Skip to contentSkip to conversation

ipv6: ip6_forward: perform skb->pkt_type check at the beginning

PATCH Applied [email protected] 2 participants 2 messages Mar 11, 2014

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

PATCH v2 1/1 ipv6: ip6_forward: perform skb->pkt_type check at the beginning

From: Li RongQing <[email protected]>

Packets which have L2 address different from ours should be already filtered before entering into ip6_forward().

Perform that check at the beginning to avoid processing such packets.

---
 net/ipv6/ip6_output.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv6/ip6_output.c +3 -3
index 2bc1070..90dd551 100644
@@ -367,6 +367,9 @@ int ip6_forward(struct sk_buff *skb)
 	if (net->ipv6.devconf_all->forwarding == 0)
 		goto error;
 
+	if (skb->pkt_type != PACKET_HOST)
+		goto drop;
+
 	if (skb_warn_if_lro(skb))
 		goto drop;
 
@@ -376,9 +379,6 @@ int ip6_forward(struct sk_buff *skb)
 		goto drop;
 	}
 
-	if (skb->pkt_type != PACKET_HOST)
-		goto drop;
-
 	skb_forward_csum(skb);
 
 	/*
Signature · 1 line
1.7.10.4