linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] udp: disallow UFO for sockets with SO_NO_CHECK option
@ 2016-01-11  6:50 Michal Kubecek
  2016-01-11 12:19 ` Hannes Frederic Sowa
  2016-01-11 22:42 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Kubecek @ 2016-01-11  6:50 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, linux-kernel, Hannes Frederic Sowa, Nelson, Shannon,
	Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
	Patrick McHardy

Commit acf8dd0a9d0b ("udp: only allow UFO for packets from SOCK_DGRAM
sockets") disallows UFO for packets sent from raw sockets. We need to do
the same also for SOCK_DGRAM sockets with SO_NO_CHECK options, even if
for a bit different reason: while such socket would override the
CHECKSUM_PARTIAL set by ip_ufo_append_data(), gso_size is still set and
bad offloading flags warning is triggered in __skb_gso_segment().

In the IPv6 case, SO_NO_CHECK option is ignored but we need to disallow
UFO for packets sent by sockets with UDP_NO_CHECK6_TX option.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Tested-by: Shannon Nelson <shannon.nelson@intel.com>
---
 net/ipv4/ip_output.c  | 2 +-
 net/ipv6/ip6_output.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 4233cbe47052..36ac9f3a6451 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -921,7 +921,7 @@ static int __ip_append_data(struct sock *sk,
 	if (((length > mtu) || (skb && skb_is_gso(skb))) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
 	    (rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
-	    (sk->sk_type == SOCK_DGRAM)) {
+	    (sk->sk_type == SOCK_DGRAM) && !sk->sk_no_check_tx) {
 		err = ip_ufo_append_data(sk, queue, getfrag, from, length,
 					 hh_len, fragheaderlen, transhdrlen,
 					 maxfraglen, flags);
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index e6a7bd15b9b7..6473889f1736 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -1353,7 +1353,7 @@ emsgsize:
 	     (skb && skb_is_gso(skb))) &&
 	    (sk->sk_protocol == IPPROTO_UDP) &&
 	    (rt->dst.dev->features & NETIF_F_UFO) &&
-	    (sk->sk_type == SOCK_DGRAM)) {
+	    (sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk)) {
 		err = ip6_ufo_append_data(sk, queue, getfrag, from, length,
 					  hh_len, fragheaderlen,
 					  transhdrlen, mtu, flags, fl6);
-- 
2.7.0

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

* Re: [PATCH net] udp: disallow UFO for sockets with SO_NO_CHECK option
  2016-01-11  6:50 [PATCH net] udp: disallow UFO for sockets with SO_NO_CHECK option Michal Kubecek
@ 2016-01-11 12:19 ` Hannes Frederic Sowa
  2016-01-11 22:42 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2016-01-11 12:19 UTC (permalink / raw)
  To: Michal Kubecek, David S. Miller
  Cc: netdev, linux-kernel, Nelson, Shannon, Alexey Kuznetsov,
	James Morris, Hideaki YOSHIFUJI, Patrick McHardy

On 11.01.2016 07:50, Michal Kubecek wrote:
> Commit acf8dd0a9d0b ("udp: only allow UFO for packets from SOCK_DGRAM
> sockets") disallows UFO for packets sent from raw sockets. We need to do
> the same also for SOCK_DGRAM sockets with SO_NO_CHECK options, even if
> for a bit different reason: while such socket would override the
> CHECKSUM_PARTIAL set by ip_ufo_append_data(), gso_size is still set and
> bad offloading flags warning is triggered in __skb_gso_segment().
>
> In the IPv6 case, SO_NO_CHECK option is ignored but we need to disallow
> UFO for packets sent by sockets with UDP_NO_CHECK6_TX option.
>
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> Tested-by: Shannon Nelson <shannon.nelson@intel.com>

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

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

* Re: [PATCH net] udp: disallow UFO for sockets with SO_NO_CHECK option
  2016-01-11  6:50 [PATCH net] udp: disallow UFO for sockets with SO_NO_CHECK option Michal Kubecek
  2016-01-11 12:19 ` Hannes Frederic Sowa
@ 2016-01-11 22:42 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-01-11 22:42 UTC (permalink / raw)
  To: mkubecek
  Cc: netdev, linux-kernel, hannes, shannon.nelson, kuznet, jmorris,
	yoshfuji, kaber

From: Michal Kubecek <mkubecek@suse.cz>
Date: Mon, 11 Jan 2016 07:50:30 +0100 (CET)

> Commit acf8dd0a9d0b ("udp: only allow UFO for packets from SOCK_DGRAM
> sockets") disallows UFO for packets sent from raw sockets. We need to do
> the same also for SOCK_DGRAM sockets with SO_NO_CHECK options, even if
> for a bit different reason: while such socket would override the
> CHECKSUM_PARTIAL set by ip_ufo_append_data(), gso_size is still set and
> bad offloading flags warning is triggered in __skb_gso_segment().
> 
> In the IPv6 case, SO_NO_CHECK option is ignored but we need to disallow
> UFO for packets sent by sockets with UDP_NO_CHECK6_TX option.
> 
> Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
> Tested-by: Shannon Nelson <shannon.nelson@intel.com>

Applied and queued up for -stable, thanks Michal.

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

end of thread, other threads:[~2016-01-11 22:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11  6:50 [PATCH net] udp: disallow UFO for sockets with SO_NO_CHECK option Michal Kubecek
2016-01-11 12:19 ` Hannes Frederic Sowa
2016-01-11 22:42 ` David Miller

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