Skip to content

Commit 40ba330

Browse files
mkubecekdavem330
authored andcommitted
udp: disallow UFO for sockets with SO_NO_CHECK option
Commit acf8dd0 ("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 <[email protected]> Tested-by: Shannon Nelson <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3de0359 commit 40ba330

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

net/ipv4/ip_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ static int __ip_append_data(struct sock *sk,
921921
if (((length > mtu) || (skb && skb_is_gso(skb))) &&
922922
(sk->sk_protocol == IPPROTO_UDP) &&
923923
(rt->dst.dev->features & NETIF_F_UFO) && !rt->dst.header_len &&
924-
(sk->sk_type == SOCK_DGRAM)) {
924+
(sk->sk_type == SOCK_DGRAM) && !sk->sk_no_check_tx) {
925925
err = ip_ufo_append_data(sk, queue, getfrag, from, length,
926926
hh_len, fragheaderlen, transhdrlen,
927927
maxfraglen, flags);

net/ipv6/ip6_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ static int __ip6_append_data(struct sock *sk,
13531353
(skb && skb_is_gso(skb))) &&
13541354
(sk->sk_protocol == IPPROTO_UDP) &&
13551355
(rt->dst.dev->features & NETIF_F_UFO) &&
1356-
(sk->sk_type == SOCK_DGRAM)) {
1356+
(sk->sk_type == SOCK_DGRAM) && !udp_get_no_check6_tx(sk)) {
13571357
err = ip6_ufo_append_data(sk, queue, getfrag, from, length,
13581358
hh_len, fragheaderlen,
13591359
transhdrlen, mtu, flags, fl6);

0 commit comments

Comments
 (0)