netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
@ 2013-09-30 13:50 Jiri Pirko
  2013-09-30 17:56 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Pirko @ 2013-09-30 13:50 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuznet, jmorris, hannes, kaber, yoshfuji

if up->pending != 0 dontfrag is left with default value -1. That
causes that application that do:
sendto len>mtu flag MSG_MORE
sendto len>mtu flag 0
will receive EMSGSIZE errno as the result of the second sendto.

This patch fixes it by respecting IPV6_DONTFRAG socket option.

introduced by:
commit 4b340ae20d0e2366792abe70f46629e576adaf5e "IPv6: Complete IPV6_DONTFRAG support"

Please push to stable as well.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 net/ipv6/udp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 72b7eaa..1878609 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1225,9 +1225,6 @@ do_udp_sendmsg:
 	if (tclass < 0)
 		tclass = np->tclass;
 
-	if (dontfrag < 0)
-		dontfrag = np->dontfrag;
-
 	if (msg->msg_flags&MSG_CONFIRM)
 		goto do_confirm;
 back_from_confirm:
@@ -1246,6 +1243,8 @@ back_from_confirm:
 	up->pending = AF_INET6;
 
 do_append_data:
+	if (dontfrag < 0)
+		dontfrag = np->dontfrag;
 	up->len += ulen;
 	getfrag  =  is_udplite ?  udplite_getfrag : ip_generic_getfrag;
 	err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen,
-- 
1.8.3.1

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

* Re: [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
  2013-09-30 13:50 [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames Jiri Pirko
@ 2013-09-30 17:56 ` Hannes Frederic Sowa
  2013-09-30 21:21   ` Hannes Frederic Sowa
  0 siblings, 1 reply; 6+ messages in thread
From: Hannes Frederic Sowa @ 2013-09-30 17:56 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, kuznet, jmorris, kaber, yoshfuji

On Mon, Sep 30, 2013 at 03:50:38PM +0200, Jiri Pirko wrote:
> if up->pending != 0 dontfrag is left with default value -1. That
> causes that application that do:
> sendto len>mtu flag MSG_MORE
> sendto len>mtu flag 0
> will receive EMSGSIZE errno as the result of the second sendto.
> 
> This patch fixes it by respecting IPV6_DONTFRAG socket option.
> 
> introduced by:
> commit 4b340ae20d0e2366792abe70f46629e576adaf5e "IPv6: Complete IPV6_DONTFRAG support"
> 
> Please push to stable as well.
> 
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
> ---
>  net/ipv6/udp.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index 72b7eaa..1878609 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -1225,9 +1225,6 @@ do_udp_sendmsg:
>  	if (tclass < 0)
>  		tclass = np->tclass;
>  
> -	if (dontfrag < 0)
> -		dontfrag = np->dontfrag;
> -
>  	if (msg->msg_flags&MSG_CONFIRM)
>  		goto do_confirm;
>  back_from_confirm:
> @@ -1246,6 +1243,8 @@ back_from_confirm:
>  	up->pending = AF_INET6;
>  
>  do_append_data:
> +	if (dontfrag < 0)
> +		dontfrag = np->dontfrag;
>  	up->len += ulen;
>  	getfrag  =  is_udplite ?  udplite_getfrag : ip_generic_getfrag;
>  	err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen,

Hmm, I wonder if we need the same change in ipv6/raw.c.

Looks good at first sight, but I need to do some more tests.

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

* Re: [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
  2013-09-30 17:56 ` Hannes Frederic Sowa
@ 2013-09-30 21:21   ` Hannes Frederic Sowa
  2013-10-01 22:03     ` Hannes Frederic Sowa
  0 siblings, 1 reply; 6+ messages in thread
From: Hannes Frederic Sowa @ 2013-09-30 21:21 UTC (permalink / raw)
  To: Jiri Pirko, netdev, davem, kuznet, jmorris, kaber, yoshfuji

On Mon, Sep 30, 2013 at 07:56:40PM +0200, Hannes Frederic Sowa wrote:
> Hmm, I wonder if we need the same change in ipv6/raw.c.

Nope, ipv6/raw.c is fine.

> Looks good at first sight, but I need to do some more tests.

Strange, loopback traffic is not bound by the frag_size. This fixes it but
should not be necessary. Don't know the reason, yet.

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index a54c45c..9dd136e 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -124,7 +124,14 @@ static int ip6_finish_output2(struct sk_buff *skb)
 
 static int ip6_finish_output(struct sk_buff *skb)
 {
-	if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) ||
+	int mtu;
+	struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL;
+
+	mtu = ip6_skb_dst_mtu(skb);
+	if (np && np->frag_size && np->frag_size < mtu)
+		mtu = np->frag_size;
+
+	if ((skb->len > mtu && !skb_is_gso(skb)) ||
 	    dst_allfrag(skb_dst(skb)))
 		return ip6_fragment(skb, ip6_finish_output2);
 	else


Regarding your patch, this is fine by me:

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Thanks,

  Hannes

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

* Re: [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
  2013-09-30 21:21   ` Hannes Frederic Sowa
@ 2013-10-01 22:03     ` Hannes Frederic Sowa
  2013-10-02 20:00       ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Hannes Frederic Sowa @ 2013-10-01 22:03 UTC (permalink / raw)
  To: Jiri Pirko, netdev, davem, kuznet, jmorris, kaber, yoshfuji

Hi David!

On Mon, Sep 30, 2013 at 11:21:55PM +0200, Hannes Frederic Sowa wrote:
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

(for patchwork correspondence)

I still think this patch is perfectly fine but it opens up a hole in the
ip6_append_data logic where it is possible to crash the kernel. Jiri and me
will look after it in the thread " ipv6: udp packets following an UFO enqueued
packet need also be handled by UFO".

So, for the time being, I would like to withdraw my Acked-by until this is
sorted out.

Thanks,

  Hannes

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

* Re: [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
  2013-10-01 22:03     ` Hannes Frederic Sowa
@ 2013-10-02 20:00       ` David Miller
  2013-10-02 20:45         ` Jiri Pirko
  0 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2013-10-02 20:00 UTC (permalink / raw)
  To: hannes; +Cc: jiri, netdev, kuznet, jmorris, kaber, yoshfuji

From: Hannes Frederic Sowa <hannes@stressinduktion.org>
Date: Wed, 2 Oct 2013 00:03:54 +0200

> Hi David!
> 
> On Mon, Sep 30, 2013 at 11:21:55PM +0200, Hannes Frederic Sowa wrote:
>> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> 
> (for patchwork correspondence)
> 
> I still think this patch is perfectly fine but it opens up a hole in the
> ip6_append_data logic where it is possible to crash the kernel. Jiri and me
> will look after it in the thread " ipv6: udp packets following an UFO enqueued
> packet need also be handled by UFO".
> 
> So, for the time being, I would like to withdraw my Acked-by until this is
> sorted out.

Jiri please repost the IPV6_DONTFRAG patch once things are sorted, thanks.

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

* Re: [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
  2013-10-02 20:00       ` David Miller
@ 2013-10-02 20:45         ` Jiri Pirko
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Pirko @ 2013-10-02 20:45 UTC (permalink / raw)
  To: David Miller; +Cc: hannes, netdev, kuznet, jmorris, kaber, yoshfuji

Wed, Oct 02, 2013 at 10:00:28PM CEST, davem@davemloft.net wrote:
>From: Hannes Frederic Sowa <hannes@stressinduktion.org>
>Date: Wed, 2 Oct 2013 00:03:54 +0200
>
>> Hi David!
>> 
>> On Mon, Sep 30, 2013 at 11:21:55PM +0200, Hannes Frederic Sowa wrote:
>>> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
>> 
>> (for patchwork correspondence)
>> 
>> I still think this patch is perfectly fine but it opens up a hole in the
>> ip6_append_data logic where it is possible to crash the kernel. Jiri and me
>> will look after it in the thread " ipv6: udp packets following an UFO enqueued
>> packet need also be handled by UFO".
>> 
>> So, for the time being, I would like to withdraw my Acked-by until this is
>> sorted out.
>
>Jiri please repost the IPV6_DONTFRAG patch once things are sorted, thanks.

allright

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

end of thread, other threads:[~2013-10-02 20:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 13:50 [patch net] udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames Jiri Pirko
2013-09-30 17:56 ` Hannes Frederic Sowa
2013-09-30 21:21   ` Hannes Frederic Sowa
2013-10-01 22:03     ` Hannes Frederic Sowa
2013-10-02 20:00       ` David Miller
2013-10-02 20:45         ` Jiri Pirko

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