* [PATCH net-next v4 0/2] fix tunnel statistics handling
@ 2015-10-09 9:27 Andreas Schultz
2015-10-09 9:27 ` [PATCH net-next v4 1/2] fix return of iptunnel_xmit Andreas Schultz
2015-10-09 9:27 ` [PATCH net-next v4 2/2] tipc: remove invalid ip_rt_put Andreas Schultz
0 siblings, 2 replies; 5+ messages in thread
From: Andreas Schultz @ 2015-10-09 9:27 UTC (permalink / raw)
To: netdev; +Cc: Pravin B Shelar, David S. Miller
These are the two changes I send earlier, rebased to net-next to avoid
a merge conflict. The statistics bug they fix has been noted before, so
I can wait a bit longer in net-next.
This first patch changes to the return of iptunnel_xmit to return the
real err value when err < 0. Before the return value would always be >= 0.
The second patch fixes the error handling of iptunnel_xmit in tipc.
Andreas Schultz (2):
fix return of iptunnel_xmit
tipc: remove invalid ip_rt_put
net/ipv4/ip_tunnel_core.c | 9 ++++++---
net/tipc/udp_media.c | 4 ----
2 files changed, 6 insertions(+), 7 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v4 1/2] fix return of iptunnel_xmit
2015-10-09 9:27 [PATCH net-next v4 0/2] fix tunnel statistics handling Andreas Schultz
@ 2015-10-09 9:27 ` Andreas Schultz
2015-10-09 13:05 ` Sergei Shtylyov
2015-10-09 18:11 ` Debabrata Banerjee
2015-10-09 9:27 ` [PATCH net-next v4 2/2] tipc: remove invalid ip_rt_put Andreas Schultz
1 sibling, 2 replies; 5+ messages in thread
From: Andreas Schultz @ 2015-10-09 9:27 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>
Acked-by: Jiri Benc <jbenc@redhat.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
---
Change in v2:
- remove unused variable pkt_len
Change in v3:
- reworked based on comment from Jiri Benc
Change in v4:
- rebased to net-next to avoid merge conflicts
- added Acked-By from Jiri Benc and Pravin B Shelar
---
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 6cb9009..453d569 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,
__ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1);
err = ip_local_out(net, 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
* [PATCH net-next v4 2/2] tipc: remove invalid ip_rt_put
2015-10-09 9:27 [PATCH net-next v4 0/2] fix tunnel statistics handling Andreas Schultz
2015-10-09 9:27 ` [PATCH net-next v4 1/2] fix return of iptunnel_xmit Andreas Schultz
@ 2015-10-09 9:27 ` Andreas Schultz
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Schultz @ 2015-10-09 9:27 UTC (permalink / raw)
To: netdev; +Cc: Pravin B Shelar, David S. Miller
udp_tunnel_xmit_skb() will free the skb and release the rt->dst
reference in the error case. There is no need (and it would actully
trigger a warning) when we did.
This problem was not visible before, as udp_tunnel_xmit_skb() would
never return a value < 0
Signed-off-by: Andreas Schultz <aschultz@tpip.net>
Acked-by: Jiri Benc <jbenc@redhat.com>
---
net/tipc/udp_media.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
index c170d31..de8e110 100644
--- a/net/tipc/udp_media.c
+++ b/net/tipc/udp_media.c
@@ -181,10 +181,6 @@ static int tipc_udp_send_msg(struct net *net, struct sk_buff *skb,
dst->ipv4.s_addr, 0, ttl, 0,
src->udp_port, dst->udp_port,
false, true);
- if (err < 0) {
- ip_rt_put(rt);
- goto tx_error;
- }
#if IS_ENABLED(CONFIG_IPV6)
} else {
struct dst_entry *ndst;
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4 1/2] fix return of iptunnel_xmit
2015-10-09 9:27 ` [PATCH net-next v4 1/2] fix return of iptunnel_xmit Andreas Schultz
@ 2015-10-09 13:05 ` Sergei Shtylyov
2015-10-09 18:11 ` Debabrata Banerjee
1 sibling, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2015-10-09 13:05 UTC (permalink / raw)
To: Andreas Schultz, netdev; +Cc: Pravin B Shelar, David S. Miller
Hello.
On 10/9/2015 12:27 PM, Andreas Schultz wrote:
> 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
Didn't checkpatch.pl compalin about improper commit citing?
> negative return case was lost.
> This bug was introduced when the ip_tunnel_core code was refactored.
> Fixes: 0e6fbc5b6c6218987c93b8c7ca60cf786062899d
See Documentation/SubmittingPatches for the proper format of this tag.
> Signed-off-by: Andreas Schultz <aschultz@tpip.net>
> Acked-by: Jiri Benc <jbenc@redhat.com>
> Acked-by: Pravin B Shelar <pshelar@nicira.com>
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4 1/2] fix return of iptunnel_xmit
2015-10-09 9:27 ` [PATCH net-next v4 1/2] fix return of iptunnel_xmit Andreas Schultz
2015-10-09 13:05 ` Sergei Shtylyov
@ 2015-10-09 18:11 ` Debabrata Banerjee
1 sibling, 0 replies; 5+ messages in thread
From: Debabrata Banerjee @ 2015-10-09 18:11 UTC (permalink / raw)
To: Andreas Schultz, Joshua Hunt; +Cc: netdev, Pravin B Shelar, David S. Miller
Andreas, I think we need to use the net_xmit defines so the errors are
masked properly, how about:
- if (unlikely(net_xmit_eval(err)))
- pkt_len = 0;
- return pkt_len;
+ if (likely(net_xmit_eval(err) == 0))
+ return pkt_len;
+ else
+ return net_xmit_errno(err);
+
+ return 0;
On Fri, Oct 9, 2015 at 5:27 AM, Andreas Schultz <aschultz@tpip.net> wrote:
> 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>
> Acked-by: Jiri Benc <jbenc@redhat.com>
> Acked-by: Pravin B Shelar <pshelar@nicira.com>
> ---
> Change in v2:
> - remove unused variable pkt_len
>
> Change in v3:
> - reworked based on comment from Jiri Benc
>
> Change in v4:
> - rebased to net-next to avoid merge conflicts
> - added Acked-By from Jiri Benc and Pravin B Shelar
>
> ---
> 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 6cb9009..453d569 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,
> __ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1);
>
> err = ip_local_out(net, 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-10-09 18:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 9:27 [PATCH net-next v4 0/2] fix tunnel statistics handling Andreas Schultz
2015-10-09 9:27 ` [PATCH net-next v4 1/2] fix return of iptunnel_xmit Andreas Schultz
2015-10-09 13:05 ` Sergei Shtylyov
2015-10-09 18:11 ` Debabrata Banerjee
2015-10-09 9:27 ` [PATCH net-next v4 2/2] tipc: remove invalid ip_rt_put Andreas Schultz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.