udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
Subsystems (4)
PATCH 1/1 udp6: respect IPV6_DONTFRAG sockopt in case there are pending frames
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.
--- net/ipv6/udp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/ipv6/udp.c +2 -3
@@ -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,
Signature · 1 line
1.8.3.1
Quoted 33 lines · Jiri Pirko
if
up->pending!= 0 dontfrag is left with default value -1. That causes that application that do:
sendto len>mtu flagMSG_MORE
sendto len>mtu flag 0
will receive EMSGSIZE errno as the result of the second sendto.This patch fixes it by respecting
IPV6_DONTFRAGsocket option.introduced by:
commit4b340ae20d0e2366792abe70f46629e576adaf5e"IPv6: CompleteIPV6_DONTFRAGsupport"Please push to stable as well.
Signed-off-by Jiri Pirko <[email protected]>--- net/ipv6/udp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)net/ipv6/udp.c +0
-3@@ -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:
net/ipv6/udp.c back_from_confirm: · line 1250
Quoted 8 lines
net/ipv6/udp.c +2
-0@@ -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.
Hannes Frederic Sowa
Acked-byQuoted 1 line · Hannes Frederic Sowa
Hmm, I wonder if we need the same change in
ipv6/raw.c.
Nope, ipv6/raw.c is fine.
Quoted 1 line
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.
net/ipv6/ip6_output.c +8 -1
@@ -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:
Thanks,
Hannes
Hi David!
Quoted 1 line · Hannes Frederic Sowa
(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
David Miller
maintainerFrom: Hannes Frederic Sowa <[email protected]>
Date: Wed, 2 Oct 2013 00:03:54 +0200
Quoted 7 lines
Hi David!
Quoted 1 line · Hannes Frederic Sowa
(for patchwork correspondence)
Quoted 7 lines
I still think this patch is perfectly fine but it opens up a hole in the
ip6_append_datalogic 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.
Quoted 15 lines · Wed, Oct 02, 2013 at 10:00:28PM CEST, [email protected] wrote:
From: Hannes Frederic Sowa <[email protected]>
Date: Wed, 2 Oct 2013 00:03:54 +0200Quoted 12 lines
Hi David!
Quoted 1 line · Hannes Frederic Sowa
(for patchwork correspondence)
I still think this patch is perfectly fine but it opens up a hole in the
ip6_append_datalogic 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".
Quoted 4 lines
Quoted 2 lines
So, for the time being, I would like to withdraw my Acked-by until this is sorted out.
Jiri please repost the
IPV6_DONTFRAGpatch once things are sorted, thanks.
allright