* [PATCH net-next] ipv6: ip6_forward: perform skb->pkt_type check at the beginning
@ 2014-03-10 5:10 roy.qing.li
2014-03-11 1:49 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2014-03-10 5:10 UTC (permalink / raw)
To: netdev
From: Li RongQing <roy.qing.li@gmail.com>
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.
And use unlikely to optimise.
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
net/ipv6/ip6_output.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 2bc1070..90dd551 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -367,6 +367,9 @@ int ip6_forward(struct sk_buff *skb)
if (net->ipv6.devconf_all->forwarding == 0)
goto error;
+ if (unlikely(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);
/*
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] ipv6: ip6_forward: perform skb->pkt_type check at the beginning
2014-03-10 5:10 [PATCH net-next] ipv6: ip6_forward: perform skb->pkt_type check at the beginning roy.qing.li
@ 2014-03-11 1:49 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-03-11 1:49 UTC (permalink / raw)
To: roy.qing.li; +Cc: netdev
From: roy.qing.li@gmail.com
Date: Mon, 10 Mar 2014 13:10:20 +0800
> From: Li RongQing <roy.qing.li@gmail.com>
>
> 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.
> And use unlikely to optimise.
>
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Based upon Eric's feedback for your ipv4 patch, please remove
the unlikely() for this ipv6 one.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-11 1:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10 5:10 [PATCH net-next] ipv6: ip6_forward: perform skb->pkt_type check at the beginning roy.qing.li
2014-03-11 1:49 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).