From: yuan linyu <cugyly@163.com>
To: netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>,
yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Subject: [PATCH net-next] net: raw: assign delivered after receive success
Date: Mon, 19 Jun 2017 20:37:38 +0800 [thread overview]
Message-ID: <1497875858-22402-1-git-send-email-cugyly@163.com> (raw)
From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
it's not reasonable to assign delivered if packet match no RAW sock
Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
net/ipv4/raw.c | 5 ++---
net/ipv6/raw.c | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index bdffad8..fa39894 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -187,15 +187,14 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash)
skb->dev->ifindex);
while (sk) {
- delivered = 1;
if ((iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) &&
ip_mc_sf_allow(sk, iph->daddr, iph->saddr,
skb->dev->ifindex)) {
struct sk_buff *clone = skb_clone(skb, GFP_ATOMIC);
/* Not releasing hash table! */
- if (clone)
- raw_rcv(sk, clone);
+ if (clone && raw_rcv(sk, clone) == NET_RX_SUCCESS)
+ delivered = 1;
}
sk = __raw_v4_lookup(net, sk_next(sk), iph->protocol,
iph->saddr, iph->daddr,
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index 60be012..de9483e 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -183,7 +183,6 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
while (sk) {
int filtered;
- delivered = true;
switch (nexthdr) {
case IPPROTO_ICMPV6:
filtered = icmpv6_filter(sk, skb);
@@ -218,7 +217,8 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
/* Not releasing hash table! */
if (clone) {
nf_reset(clone);
- rawv6_rcv(sk, clone);
+ if (rawv6_rcv(sk, clone) == NET_RX_SUCCESS)
+ delivered = true;
}
}
sk = __raw_v6_lookup(net, sk_next(sk), nexthdr, daddr, saddr,
--
2.7.4
next reply other threads:[~2017-06-19 12:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-19 12:37 yuan linyu [this message]
2017-06-19 14:55 ` [PATCH net-next] net: raw: assign delivered after receive success 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=1497875858-22402-1-git-send-email-cugyly@163.com \
--to=cugyly@163.com \
--cc=Linyu.Yuan@alcatel-sbell.com.cn \
--cc=davem@davemloft.net \
--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).