PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/iptables-module/README.compile

https://github.com/mobilipia/IPTV-Analyzer
Unknown | 170 lines | 99 code | 71 blank | 0 comment | 0 complexity | 0eb5bf1368a96f4dcb589a8d9a804510 MD5 | raw file
Possible License(s): GPL-3.0
  1. = Howto Compile =
  2. This is a quick howto, on getting the iptables module compiled.
  3. Including howto install an newer/compatible iptables version.
  4. I'm using GNU tool 'stow' to handle my out-of-distro installed
  5. software. To follow these compile instructions, you should have stow
  6. installed on your machine.
  7. == Iptables dependency ==
  8. This iptables module requires minimum iptables 1.4.3.
  9. == Developement tree ==
  10. Get the development git development tree here:
  11. (FIXME: Move this to the new domain iptv-analyzer.org)
  12. git clone git://people.netfilter.org/hawk/iptv-analyzer.git
  13. === Compiling the userspace iptables module ===
  14. The default make command tries to compile both the iptables userspace
  15. library and kernel module. If you only want to compile the iptables
  16. userspace library call:
  17. make lib
  18. Every iptables extension/module is based upon a dynamically loadable
  19. library file (suffix .so). These libraries/modules are installed in
  20. e.g. /usr/local/libexec/xtables/ and are loaded by iptables when
  21. needed.
  22. Thus, the makefile trick is "simply" to create an iptables dynamically
  23. loadable library "out-of-tree".
  24. All the details can be found in the excellent document titled:
  25. "Writing Netfilter modules" by Jan Engelhardt:
  26. http://jengelh.medozas.de/documents/Netfilter_Modules.pdf
  27. === Trick: Fake stow install ===
  28. TODO: Currently the Makefile does not contain an install target for
  29. the userspace iptables library. Below is the manual procedure.
  30. Make a fake stow software package for the development version of the
  31. source.
  32. Create directory:
  33. mkdir /usr/local/stow/mpeg2ts_development_fake/
  34. And create the directories libexec/xtables/ within.
  35. mkdir -p /usr/local/stow/mpeg2ts_development_fake/libexec/xtables/
  36. cd /usr/local/stow/mpeg2ts_development_fake/libexec/xtables/
  37. Create a symlink from this directory to your development edition of
  38. the file 'libxt_mpeg2ts.so'
  39. ln -s ~/git/iptv-analyzer/iptables-module/libxt_mpeg2ts.so .
  40. Activate the stow software package 'mpeg2ts_development_fake'.
  41. cd /usr/local/stow
  42. stow mpeg2ts_development_fake
  43. == Compiling the kernel module ==
  44. No patching of the Linux kernel is required, but the kernel source is
  45. required. The module takes advantage of the kernel build/make system.
  46. Minimum kernel version required is 2.6.28 (due to some RCU changes).
  47. If you only want to compile the kernel module call:
  48. make modules
  49. The Makefile tries to detect the kernel source via the symlink in:
  50. /lib/modules/2.6.xx/build
  51. The kernel version is extracted by calling 'uname -r' in the makefile.
  52. But its also possibly to compile against another kernel than the
  53. current running version, by calling:
  54. make KERNEL_DIR=~/git/kernel/davem/net-next-2.6/
  55. If you have a fresh kernel source you might need to call:
  56. make oldconfig
  57. make prepare
  58. make modules_prepare
  59. TODO/Issue?: Is it possible to link against a fresh source? As the
  60. module needs to know the C "extern" adresses.
  61. === Loading the kernel module manually ===
  62. Its possibly to load the kernel module via insmod, without installing
  63. the module into /lib/modules/2.6.xx/ (see below howto perform the
  64. install).
  65. * But be warned that the systems does not automatically load
  66. dependencies.
  67. First of all you need to make sure that the iptables module have been
  68. loaded (e.g x_tables, ip_tables, iptable_mangle, iptable_filter etc.).
  69. The easiest way to get these modules loaded is simple to invoke the
  70. 'iptables -L' command line tool.
  71. The kernel module compile, actually produced two kernel modules:
  72. * xt_mpeg2ts.ko
  73. * compat_xtables.ko
  74. If you kernel version <= 2.6.34, then you also need to load the kernel
  75. module "compat_xtables.ko"
  76. insmod ./compat_xtables.ko
  77. Next, you need to load the real kernel module:
  78. insmod ./xt_mpeg2ts.ko
  79. If the loading failed with (e.g. "Unknown symbol in module") use
  80. 'dmesg' to see the real error message.
  81. === Reloading kernel module ===
  82. When making modifications to the kernel module remember to manually
  83. rmmod and insmod the kernel module again.
  84. rmmod xt_mpeg2ts
  85. insmod ./xt_mpeg2ts.ko
  86. === Installing the kernel module ===
  87. When the kernel module has been compiled successfully, its possibly to
  88. install the kernel module, as root, via:
  89. make modules_install
  90. This will install the kernel module into /lib/modules/2.6.xx/extra/
  91. (via a call to the kernel build system, this might call depmod for
  92. you).
  93. After the install you should call (as root):
  94. depmod -a
  95. If its another kernel than the running kernel you need to add the
  96. kernel-version as an argument to depmod
  97. A small test to see if the kernel module got installed and depmod
  98. correctly call:
  99. modinfo -k $KERNEL_VER xt_mpeg2ts