ifpps: Remove unnecessary memset()
[netsniff-ng.git] / INSTALL
blob1d1d70f203c1027ce8bbb6704ce9ab9c812466c5
1 Currently only operating systems running on Linux kernels with the option
2 CONFIG_PACKET_MMAP enabled. This feature can be found even back to the days of
3 2.4 kernels. Most operating systems ship pre-compiled kernels that have this
4 config option enabled and even the latest kernel versions got rid of this
5 option and have this functionality already built-in. However, we recommend a
6 kernel >= 2.6.31, because the TX_RING is officially integrated since then. In
7 any case, if you have the possibility, consider getting the latest kernel from
8 Linus' Git repository, tweak and compile it, and run this one!
10 A note for distribution package maintainers can be found at the end of the file.
12 What additional tools next to your build-chain are required?
14  - ccache, pkg-config, gpg (optional)
15  - flex, bison (bpfc, trafgen)
17 What libraries are required?
19  - libncurses (ifpps, flowtop)
20  - libGeoIP >=1.4.8 (astraceroute, flowtop, netsniff-ng)
21  - libz (astraceroute, flowtop, netsniff-ng)
22  - libnacl (curvetun)
23  - libnetfilter-conntrack (flowtop)
24  - libpcap (netsniff-ng [for tcpdump-like filters], mausezahn)
25  - liburcu (flowtop)
26  - libnl3 (netsniff-ng, trafgen)
27  - libcli (mausezahn)
28  - libnet (mausezahn)
30 What additional tools are recommended after the build?
32  - cpp (trafgen)
33  - ntpd (curvetun)
34  - setcap (all)
36 It is common, that these libraries are shipped as distribution packages
37 for an easy installation. We try to keep this as minimal as possible.
39 One-liner installation for *all* dependencies on Debian:
41   $ sudo apt-get install ccache flex bison libnl-3-dev \
42   libnl-genl-3-dev libgeoip-dev libnetfilter-conntrack-dev \
43   libncurses5-dev liburcu-dev libnacl-dev libpcap-dev \
44   zlib1g-dev libcli-dev libnet1-dev
46 One-liner installation for *all* dependencies on Fedora:
48   $ sudo yum install ccache flex bison ccache libnl3-devel \
49   GeoIP-devel libnetfilter_conntrack-devel ncurses-devel \
50   userspace-rcu-devel nacl-devel libpcap-devel zlib-devel \
51   libcli-devel libnet-devel
53 After downloading the netsniff-ng toolkit, you should change to the
54 repository root directory:
56   $ cd netsniff-ng/
58 The installation (deinstallation) process is fairly simple:
60   $ ./configure
61   $ make
62   # make install
64   (# make uninstall)
66 In order to remove all build files from the source tree:
68   $ make clean
70 To bring the source tree into a pristine state, there are two options.
71 The first one will remove all build and build config file, the latter
72 will also remove any manually added files:
74   $ make distclean
75   ($ make mrproper)
77 You can also build/install/uninstall only a particular tool, e.g.:
79   $ make trafgen
80   # make trafgen_install
82   (# make trafgen_uninstall)
84 If you want to build all tools, but {curvetun,mausezahn} (i.e. because you
85 don't need the tunneling software and the NaCl build process lasts quite long):
87   $ make allbutcurvetun               (allbutmausezahn)
88   # make install_allbutcurvetun       (install_allbutmausezahn)
90   (# make uninstall)
92 In order to build curvetun, libnacl must be built first. A helper script
93 called nacl_build.sh is there to facilitate this process. If you want to
94 build NaCl in the directory ~/nacl, the script should be called this way:
96   $ cd curvetun
97   $ ./nacl_build.sh ~/nacl
99 There's also an abbreviation for this by simply typing:
101   $ make nacl
103 This gives an initial output such as "Building NaCl for arch amd64 on host
104 fuuubar (grab a coffee, this takes a while) ...". If the automatically
105 detected architecture (such as amd64) is not the one you intend to compile
106 for, then edit the (cc="gcc") variable within the nacl_build.sh script to
107 your cross compiler. Yes, we know, the build system of NaCl is a bit of a
108 pain, so you might check for a pre-built package from your distribution in
109 case you are not cross compiling.
111 If NaCl already has been built on the target, it is quicker to use
112 nacl_path.sh this way:
114   $ cd curvetun
115   $ ./nacl_path.sh ~/nacl/build/include/x86 ~/nacl/build/lib/x86
117 When done, netsniff-ng's build infrastructure will read those evironment
118 variables in order to get the needed paths to NaCl.
120 If you're unsure with any make targets, check out: make help
122 In order to run the toolkit as a normal user, set the following privilege
123 separation after the build/installation:
125   $ sudo setcap cap_net_raw,cap_ipc_lock,cap_sys_admin,cap_net_admin=eip {toolname}
127 For cross-compiling netsniff-ng, the process is faily simple. Assuming you
128 want to build netsniff-ng for the Microblaze architecture, update the PATH
129 variable first, e.g.:
131   $ export PATH=<cc-tools-path>/microblazeel-unknown-linux-gnu/bin:$PATH
133 And then, build the toolkit like this:
135   $ make CROSS_COMPILE=microblazeel-unknown-linux-gnu- \
136          CROSS_LD_LIBRARY_PATH=<cc-lib-search-path>
138 Note that some adaptations might be necessary regarding the CFLAGS, since not
139 all might be supported by a different architecture. Probably the most simple
140 way would be to run make CFLAGS="-O2 -Wall".
142 For power users we have a set of zsh auto completion files, have a look at all
143 file with ending *.zsh. There's also a BPF vim syntax highlighting file in the
144 tree called bpf.vim.
146 For doing a debug build of the toolkit with less optimizations and non-stripped
147 symbols, do:
149   $ make DEBUG=1
151 For debugging the build system, full commands are shown if every make target is
152 executed with:
154   $ make Q=
156 Concerning packaging the toolkit for a Linux distribution, by default,
157 netsniff-ng has some architecture-specific tuning options enabled that don't
158 belong into a package binary of a distribution. Hence, you might want to adapt
159 some build-related things before starting to package the toolkit. All
160 necessary things (e.g., CFLAGS,WFLAGS) can be found in Makefile. Hence,
161 you need to adapt it there. You can then build and install the toolkit into
162 a prefixed path like:
164   $ make PREFIX=<path-prefix-for-package>
165   $ make PREFIX=<path-prefix-for-package> install
167 Thanks for maintaining netsniff-ng in your distribution. Further questions
168 will be answered on the public mailing list.