From: roy.qing.li@gmail.com
To: netdev@vger.kernel.org
Subject: [PATCH net-next] ipv6: ip6_forward: perform skb->pkt_type check at the beginning
Date: Mon, 10 Mar 2014 13:10:20 +0800 [thread overview]
Message-ID: <1394428220-9955-1-git-send-email-roy.qing.li@gmail.com> (raw)
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
next reply other threads:[~2014-03-10 5:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 5:10 roy.qing.li [this message]
2014-03-11 1:49 ` [PATCH net-next] ipv6: ip6_forward: perform skb->pkt_type check at the beginning David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394428220-9955-1-git-send-email-roy.qing.li@gmail.com \
--to=roy.qing.li@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).