summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-08-13 17:34:48 +0200
committerTobias Klauser <tklauser@distanz.ch>2014-08-14 08:48:59 +0200
commit930a87b5325c1fb1ee3ad7d42213bc795be87adf (patch)
tree94f1d32ef958ecb53d02810656744e74c663847f
parent97e6f994785ce5f3f486f8eddb62df964119d121 (diff)
dissector: check for correct netlink linktype
It's supposed to be LINKTYPE_NETLINK, not AF_NETLINK as otherwise the pkt_type fixup cannot be done correctly. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--dissector.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/dissector.h b/dissector.h
index c78ea48..8cb4234 100644
--- a/dissector.h
+++ b/dissector.h
@@ -16,6 +16,7 @@
#include "ring.h"
#include "tprintf.h"
+#include "linktype.h"
#define PRINT_NORM 0
#define PRINT_LESS 1
@@ -56,6 +57,7 @@ static inline void __show_frame_hdr(uint8_t *packet, size_t len, int linktype,
char tmp[IFNAMSIZ];
union tpacket_uhdr hdr;
uint8_t pkttype = s_ll->sll_pkttype;
+ bool is_nl;
if (mode == PRINT_NONE)
return;
@@ -66,7 +68,8 @@ static inline void __show_frame_hdr(uint8_t *packet, size_t len, int linktype,
* it originally was set in the kernel. Thus, use nlmsghdr->nlmsg_pid to
* restore the type.
*/
- if (linktype == AF_NETLINK && len >= sizeof(struct nlmsghdr)) {
+ is_nl = (linktype == LINKTYPE_NETLINK && len >= sizeof(struct nlmsghdr));
+ if (is_nl && pkttype == PACKET_OUTGOING) {
struct nlmsghdr *hdr = (struct nlmsghdr *) packet;
pkttype = hdr->nlmsg_pid == 0 ? PACKET_KERNEL : PACKET_USER;
}