Skip to contentSkip to conversation

netlink: reset network header before passing to taps

PATCH In review Daniel Borkmann 2 participants 2 messages Aug 7, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netlink: reset network header before passing to taps

netlink doesn't set any network header offset thus when the skb is being passed to tap devices via dev_queue_xmit_nit(), it emits klog false positives due to it being unset like:

...

  [  124.990397] protocol 0000 is buggy, dev nlmon0
  [  124.990411] protocol 0000 is buggy, dev nlmon0
  ...

So just reset the network header before passing to the device; for packet sockets that just means nothing will change - mac and net offset hold the same value just as before.

---
 net/netlink/af_netlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netlink/af_netlink.c +1 -1
index a324b4b..2e152e5 100644
@@ -213,7 +213,7 @@ static int __netlink_deliver_tap_skb(struct sk_buff *skb,
 		nskb->protocol = htons((u16) sk->sk_protocol);
 		nskb->pkt_type = netlink_is_kernel(sk) ?
 				 PACKET_KERNEL : PACKET_USER;
-
+		skb_reset_network_header(nskb);
 		ret = dev_queue_xmit(nskb);
 		if (unlikely(ret > 0))
 			ret = net_xmit_errno(ret);
Signature · 1 line
1.7.11.7
maintainer
#1 lore raw

From: Daniel Borkmann <[email protected]>
Date: Thu, 7 Aug 2014 22:22:47 +0200

Quoted 9 lines

netlink doesn't set any network header offset thus when the skb is being passed to tap devices via dev_queue_xmit_nit(), it emits klog false positives due to it being unset like:

...

  [  124.990397] protocol 0000 is buggy, dev nlmon0
  [  124.990411] protocol 0000 is buggy, dev nlmon0
  ...
Quoted 6 lines

So just reset the network header before passing to the device; for packet sockets that just means nothing will change - mac and net offset hold the same value just as before.

Applied and queued up for -stable.