diff options
author | Denis Kirjanov <kda@linux-powerpc.org> | 2014-02-13 08:58:56 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-13 18:35:56 -0500 |
commit | d4f2fa6ad61ec1db713569a179183df4d0fc6ae7 (patch) | |
tree | beb6710f7ffb43a00ba26da9e02b3f4feab9532a /net/ipv4/ip_forward.c | |
parent | 2045ceaed4d54e6e698874d008be727ee5b2a01c (diff) | |
download | linux-stable-d4f2fa6ad61ec1db713569a179183df4d0fc6ae7.tar.gz linux-stable-d4f2fa6ad61ec1db713569a179183df4d0fc6ae7.tar.bz2 linux-stable-d4f2fa6ad61ec1db713569a179183df4d0fc6ae7.zip |
ipv4: ip_forward: perform skb->pkt_type check at the beginning
Packets which have L2 address different from ours should be
already filtered before entering into ip_forward().
Perform that check at the beginning to avoid processing such packets.
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_forward.c')
-rw-r--r-- | net/ipv4/ip_forward.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index e9f1217a8afd..d9d929042a89 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c @@ -59,6 +59,10 @@ int ip_forward(struct sk_buff *skb) struct rtable *rt; /* Route we use */ struct ip_options *opt = &(IPCB(skb)->opt); + /* that should never happen */ + if (skb->pkt_type != PACKET_HOST) + goto drop; + if (skb_warn_if_lro(skb)) goto drop; @@ -68,9 +72,6 @@ int ip_forward(struct sk_buff *skb) if (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb)) return NET_RX_SUCCESS; - if (skb->pkt_type != PACKET_HOST) - goto drop; - skb_forward_csum(skb); /* |