netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: raw: assign delivered after receive success
@ 2017-06-19 12:37 yuan linyu
  2017-06-19 14:55 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: yuan linyu @ 2017-06-19 12:37 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, yuan linyu

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-19 14:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-19 12:37 [PATCH net-next] net: raw: assign delivered after receive success yuan linyu
2017-06-19 14:55 ` 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).