]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ipv6: ip6_forward: perform skb->pkt_type check at the beginning
authorLi RongQing <roy.qing.li@gmail.com>
Tue, 11 Mar 2014 02:40:08 +0000 (10:40 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Mar 2014 04:37:42 +0000 (00:37 -0400)
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.

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_output.c

index 2bc10701182b77db10709e03fb9d1ffdcd727a2e..90dd551fdd3ce85b89a82832847690838213a19c 100644 (file)
@@ -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);
 
        /*