netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3 1/2] fix return of iptunnel_xmit
@ 2015-10-08 16:08 Andreas Schultz
  2015-10-08 16:08 ` [PATCH net v3 2/2] tipc: remove invalid ip_rt_put Andreas Schultz
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Andreas Schultz @ 2015-10-08 16:08 UTC (permalink / raw)
  To: netdev; +Cc: Pravin B Shelar, David S. Miller

All users of iptunnel_xmit expect the return value to be the packet
length on success (>0), negative for a tx error and zero for a tx
dropped error. In cset 0e6fbc5b6c6218987c93b8c7ca60cf786062899d the
negative return case was lost.

This bug was introduced when the ip_tunnel_core code was refactored.

Fixes: 0e6fbc5b6c6218987c93b8c7ca60cf786062899d
Signed-off-by: Andreas Schultz <aschultz@tpip.net>
---
Change in v2:
 - remove unused variable pkt_len

Change in v3:
 - reworked based on comment from Jiri Benc
---
 net/ipv4/ip_tunnel_core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 84dce6a..5cced3b 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -80,9 +80,12 @@ int iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
 			  skb_shinfo(skb)->gso_segs ?: 1);
 
 	err = ip_local_out_sk(sk, skb);
-	if (unlikely(net_xmit_eval(err)))
-		pkt_len = 0;
-	return pkt_len;
+	if (likely(net_xmit_eval(err) == 0))
+		return pkt_len;
+	if (err < 0)
+		return err;
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(iptunnel_xmit);
 
-- 
2.1.4

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

end of thread, other threads:[~2015-10-08 17:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 16:08 [PATCH net v3 1/2] fix return of iptunnel_xmit Andreas Schultz
2015-10-08 16:08 ` [PATCH net v3 2/2] tipc: remove invalid ip_rt_put Andreas Schultz
2015-10-08 16:25   ` Jiri Benc
2015-10-08 16:19 ` [PATCH net v3 1/2] fix return of iptunnel_xmit Jiri Benc
2015-10-08 17:33 ` Pravin Shelar

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).