[net-next] arp: correct return value of arp_rcv

Subsystems: networking [general], networking [ipv4/ipv6], the rest

2 messages, 2 authors, 2016-03-03 · open the first message on its own page

[net-next] arp: correct return value of arp_rcv

From: Zhang Shengju <hidden>
Date: 2016-03-01 07:23:37

Currently, arp_rcv() always return zero on a packet delivery upcall.

To make its behavior more compliant with the way this API should be
used, this patch changes this to let it return NET_RX_SUCCESS when the
packet is proper handled, and NET_RX_DROP otherwise.

Signed-off-by: Zhang Shengju <redacted>
---
 net/ipv4/arp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index c102eb5..ae235a1 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -880,7 +880,7 @@ out:
 	consume_skb(skb);
 out_free_dst:
 	dst_release(reply_dst);
-	return 0;
+	return NET_RX_SUCCESS;
 }
 
 static void parp_redo(struct sk_buff *skb)
@@ -924,11 +924,11 @@ static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
 
 consumeskb:
 	consume_skb(skb);
-	return 0;
+	return NET_RX_SUCCESS;
 freeskb:
 	kfree_skb(skb);
 out_of_mem:
-	return 0;
+	return NET_RX_DROP;
 }
 
 /*
-- 
1.8.3.1

Re: [net-next] arp: correct return value of arp_rcv

From: David Miller <davem@davemloft.net>
Date: 2016-03-03 21:30:03

From: Zhang Shengju <redacted>
Date: Tue,  1 Mar 2016 07:24:42 +0000
Currently, arp_rcv() always return zero on a packet delivery upcall.

To make its behavior more compliant with the way this API should be
used, this patch changes this to let it return NET_RX_SUCCESS when the
packet is proper handled, and NET_RX_DROP otherwise.

Signed-off-by: Zhang Shengju <redacted>
This change is bogus.
quoted hunk
@@ -880,7 +880,7 @@ out:
 	consume_skb(skb);
 out_free_dst:
 	dst_release(reply_dst);
-	return 0;
+	return NET_RX_SUCCESS;
Most of the paths to out: are dropping the request for one reason or
another.

If you want to do this right you need to split these two exit paths,
convert consume_skb() to kfree_skb() in the drop path, and then you
can return accurate NET_* codes.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help