ipv4: ip_forward: perform skb->pkt_type check at the beginning
Subsystems (3)
PATCH v2 1/1 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 <[email protected]>
---
v1 -> v2: Fixed identation
--- net/ipv4/ip_forward.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/ipv4/ip_forward.c +4 -3
@@ -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);/*
Signature · 1 line
1.8.0.2
David Miller
maintainerFrom: Denis Kirjanov <[email protected]>
Date: Thu, 13 Feb 2014 08:58:56 +0400
Quoted 6 lines
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 <[email protected]>
Looks good, applied, thanks.