ip: unconditionally set cork gso_size
authorWillem de Bruijn <willemb@google.com>
Fri, 6 Jul 2018 14:12:59 +0000 (10:12 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Jul 2018 01:58:49 +0000 (10:58 +0900)
Now that ipc(6)->gso_size is correctly initialized in all callers of
ip(6)_setup_cork, it is safe to unconditionally pass it to the cork.

Link: http://lkml.kernel.org/r/20180619164752.143249-1-willemdebruijn.kernel@gmail.com
Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_output.c
net/ipv6/ip6_output.c

index e14c774cc092457483a945770668984f6236e2f6..e2b6bd478afb5ea50b8182b32f87cc454a0c540e 100644 (file)
@@ -1146,8 +1146,7 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork,
        cork->fragsize = ip_sk_use_pmtu(sk) ?
                         dst_mtu(&rt->dst) : rt->dst.dev->mtu;
 
-       cork->gso_size = sk->sk_type == SOCK_DGRAM &&
-                        sk->sk_protocol == IPPROTO_UDP ? ipc->gso_size : 0;
+       cork->gso_size = ipc->gso_size;
        cork->dst = &rt->dst;
        cork->length = 0;
        cork->ttl = ipc->ttl;
index ff4b28a600abbda93559ad7f9438e941fdeebe6b..8047fd41ba887fdb01607908c57034fdc8a5553d 100644 (file)
@@ -1219,8 +1219,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork,
        if (mtu < IPV6_MIN_MTU)
                return -EINVAL;
        cork->base.fragsize = mtu;
-       cork->base.gso_size = sk->sk_type == SOCK_DGRAM &&
-                             sk->sk_protocol == IPPROTO_UDP ? ipc6->gso_size : 0;
+       cork->base.gso_size = ipc6->gso_size;
        cork->base.tx_flags = 0;
        sock_tx_timestamp(sk, ipc6->sockc.tsflags, &cork->base.tx_flags);