diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-11-18 15:39:37 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-11-18 15:39:37 -0800 |
commit | 23d2673796e60c7fea6ba218eb084cbd59e7271b (patch) | |
tree | 52a7c1a34b90431356baaa8821b44426f6ebb6fd /pcap-linux.c | |
parent | 11031d0f71387161c282248cddc2fa0f7bf014ce (diff) |
linktype: add netlink link/dlt type
With Linux 3.11, we have the possibility to debug local netlink traffic
[1] i.e. the workflow looks like this:
Setup:
modprobe nlmon
ip link add type nlmon
ip link set nlmon0 up
Capture:
tcpdump -i nlmon0 ...
Teardown:
ip link set nlmon0 down
ip link del dev nlmon0
rmmod nlmon
For pcap interoperability, introduce a common link type for netlink
captures.
Diffstat (limited to 'pcap-linux.c')
-rw-r--r-- | pcap-linux.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/pcap-linux.c b/pcap-linux.c index e8173824..0651522f 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -2972,6 +2972,19 @@ static void map_arphrd_to_dlt(pcap_t *handle, int arptype, int cooked_ok) handle->linktype = DLT_IEEE802_15_4_NOFCS; break; +#ifndef ARPHRD_NETLINK +#define ARPHRD_NETLINK 824 +#endif + case ARPHRD_NETLINK: + handle->linktype = DLT_NETLINK; + /* + * We need to use cooked mode, so that in sll_protocol we + * pick up the netlink protocol type such as NETLINK_ROUTE, + * NETLINK_GENERIC, NETLINK_FIB_LOOKUP, etc. + */ + handle->cooked = 1; + break; + default: handle->linktype = -1; break; |