netsniff-ng: also capture if NIC is currently down
[netsniff-ng.git] / Documentation / KnownIssues
blobeb17a3f3da300c99908059557e5a2e1ff525dfb6
1 netsniff-ng's known issues:
2 ///////////////////////////
4 Q: When I perform a traffic capture on the Ethernet interface, the PCAP file is
5    created and packets are received but without 802.1Q header. If I use
6    tshark, I get all headers but netsniff-ng removes 802.1Q headers. Is that
7    normal behavior?
8 A: Yes and no. The way how VLAN headers are handled in PF_PACKET sockets by the
9    kernel is somewhat problematic [1]. The problem in the Linux kernel is that
10    some drivers already handle VLAN, others not. Those who handle it have
11    different implementations, i.e. hardware acceleration and so on. So in some
12    cases the VLAN tag is even stripped before entering the protocol stack, in
13    some cases probably not. Bottom line is that the netdev hackers introduced
14    a "hack" in PF_PACKET so that a VLAN ID is visible in some helper data
15    structure that is accessible from the RX_RING. And then it gets really messy
16    in the user space to artificially put the VLAN header back into the right
17    place. Not mentioning about the resulting performance implications on that
18    of /all/ libpcap tools since parts of the packet need to be copied for
19    reassembly. A user reported the following, just to demonstrate this mess:
20    Some tests were made with two machines, and it seems that results depends on
21    the driver ...
23     1) AR8131
24         * ethtool -k eth0 gives "rx-vlan-offload: on"
25         -> wireshark gets the vlan header
26         -> netsniff-ng doesn't get the vlan header
28         * ethtool -K eth0 rxvlan off
29         -> wireshark gets twice the same vlan header (like QinQ even though
30            I never sent QinQ)
31         -> netsniff-ng gets the vlan header
33     2) RTL8111/8168B
34         * ethtool -k eth0 gives "rx-vlan-offload: on"
35         -> wireshark gets the vlan header
36         -> netsniff-ng doesn't get the vlan header
38         * ethtool -K eth0 rxvlan off
39         -> wireshark gets the vlan header
40         -> netsniff-ng doesn't get the vlan header
42     Even if we would agree on doing the same workaround as libpcap, we still
43     will not be able to see QinQ, for instance, due to the fact that only /one/
44     VLAN tag is stored in this kernel helper data structure. We think that
45     there should be a good consensus on the kernel space side about what gets
46     transferred to the userland.
48     [1] http://lkml.indiana.edu/hypermail/linux/kernel/0710.3/3816.html
50     Update (28.11.2012): the Linux kernel and also bpfc has built-in support
51     for hardware accelerated VLAN filtering, even though tags might not be
52     visible in the payload itself as reported here. However, the filtering
53     for VLANs works reliable if your NIC supports it. bpfc example for filtering
54     for any tags:
56         _main:
57          ld #vlanp
58          jeq #0, drop
59          ret #-1
60         drop:
61          ret #0
63    Filtering for a particular VLAN tag:
65         _main:
66          ld #vlant
67          jneq #10, drop
68          ret #-1
69         drop:
70          ret #0
72    Where 10 is VLAN ID 10 in this example. Or, more pedantic:
74         _main:
75          ld #vlanp
76          jeq #0, drop
77          ld #vlant
78          jneq #10, drop
79          ret #-1
80         drop:
81          ret #0
83 Q: When I start trafgen, my kernel crashes! What is happening?
84 A: We have fixed this ``bug'' in the Linux kernel under commit
85    7f5c3e3a80e6654cf48dfba7cf94f88c6b505467 (http://bit.ly/PcH5Nd). Either
86    update your kernel to the latest version, e.g. clone and build it from
87    git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git or don't
88    start multiple trafgen instances at once resp. start trafgen with flag -A
89    to disable temporary socket memory tuning! Although trafgen's mechanism is
90    written in a correct manner, some probably Linux internal side-effects
91    cause the tigger of the BUG macro. Why tuning? In general, if not otherwise
92    specified, the netsniff-ng suite tries to get a good performance on default.
93    For instance, this includes things like tuning the system's socket memory,
94    enabling the BPF JIT compiler, migrating the NIC's interrupt affinity and
95    so on. If you don't want netsniff-ng to do this, look at the relevant cmd
96    line options that disable them with ``--help'' and explicitly specify them
97    on the program start.