configure: Add configure script used to detect NaCl
[netsniff-ng.git] / INSTALL
blob3b9b041d10d887126580fece81d8c8d9ca6e835f
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 distclean)
65   ($ make clean)
66   (or for both at once: # make mrproper)
68 You can also build only a particular tool, e.g.:
69   
70   $ make trafgen
71   # make trafgen_install
73   (# make trafgen_distclean)
74   ($ make trafgen_clean)
76 If you want to build all tools, but {curvetun,mausezahn} (i.e. because you
77 don't need the tunneling software and the NaCl build process lasts quite long):
79   $ make allbutcurvetun               (allbutmausezahn)
80   # make install_allbutcurvetun       (install_allbutmausezahn)
82   (# make mrproper)
84 In order to build curvetun, libnacl must be built first. A helper script
85 called nacl_build.sh is there to facilitate this process. If you want to
86 build NaCl in the directory ~/nacl, the script should be called this way:
88   $ cd curvetun
89   $ ./nacl_build.sh ~/nacl
91 There's also an abbreviation for this by simply typing:
93   $ make nacl
95 This gives an initial output such as "Building NaCl for arch amd64 on host
96 fuuubar (grab a coffee, this takes a while) ...". If the automatically
97 detected architecture (such as amd64) is not the one you intend to compile
98 for, then edit the (cc="gcc") variable within the nacl_build.sh script to
99 your cross compiler. Yes, we know, the build system of NaCl is a bit of a
100 pain, so you might check for a pre-built package from your distribution in
101 case you are not cross compiling.
103 If NaCl already has been built on the target, it is quicker to use
104 nacl_path.sh this way:
106   $ cd curvetun
107   $ ./nacl_path.sh ~/nacl/build/include/x86 ~/nacl/build/lib/x86
109 When done, netsniff-ng's build infrastructure will read those evironment
110 variables in order to get the needed paths to NaCl.
112 If you're unsure with any make targets, check out: make help
114 In order to run the toolkit as a normal user, set the following privilege
115 separation after the build/installation:
117   $ sudo setcap cap_net_raw,cap_ipc_lock,cap_sys_admin,cap_net_admin=eip {toolname}
119 For cross-compiling netsniff-ng, the process is faily simple. Assuming you
120 want to build netsniff-ng for the Microblaze architecture, update the PATH
121 variable first, e.g.:
123   $ export PATH=<cc-tools-path>/microblazeel-unknown-linux-gnu/bin:$PATH
125 And then, build the toolkit like this:
127   $ make CROSS_COMPILE=microblazeel-unknown-linux-gnu- \
128          CROSS_LD_LIBRARY_PATH=<cc-lib-search-path>
130 Note that some adaptations might be necessary regarding the CFLAGS, since not
131 all might be supported by a different architecture. Probably the most simple
132 way would be to run make CFLAGS="-O2 -Wall".
134 For power users we have a set of zsh auto completion files, have a look at all
135 file with ending *.zsh. There's also a BPF vim syntax highlighting file in the
136 tree called bpf.vim.
138 For doing a debug build of the toolkit with less optimizations and non-stripped
139 symbols, do:
141   $ make DEBUG=1
143 For debugging the build system, full commands are shown if every make target is
144 executed with:
146   $ make Q=
148 Concerning packaging the toolkit for a Linux distribution, by default,
149 netsniff-ng has some architecture-specific tuning options enabled that don't
150 belong into a package binary of a distribution. Hence, you might want to adapt
151 some build-related things before starting to package the toolkit. All
152 necessary things (e.g., CFLAGS,WFLAGS) can be found in Makefile. Hence,
153 you need to adapt it there. You can then build and install the toolkit into
154 a prefixed path like:
156   $ make PREFIX=<path-prefix-for-package>
157   $ make PREFIX=<path-prefix-for-package> install
159 Thanks for maintaining netsniff-ng in your distribution. Further questions
160 will be answered on the public mainling list.