summaryrefslogtreecommitdiff
path: root/include/net/udp.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2019-06-10 20:52:53 +0300
committerMark Brown <broonie@kernel.org>2019-06-10 20:52:53 +0300
commit4343f61103cdb8ccd6f3d5dd7168f1176a1cee37 (patch)
tree3db0a2e099cf7feb0c2d60d2a4bf1bf10d5253db /include/net/udp.h
parentaef9752274f4045b0dab577e113da63c96832f77 (diff)
parentd1fdb6d8f6a4109a4263176c84b899076a5f8008 (diff)
downloadlinux-4343f61103cdb8ccd6f3d5dd7168f1176a1cee37.tar.xz
Merge tag 'v5.2-rc4' into spi-5.3
Linux 5.2-rc4
Diffstat (limited to 'include/net/udp.h')
-rw-r--r--include/net/udp.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/net/udp.h b/include/net/udp.h
index d8ce937bc395..79d141d2103b 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
@@ -13,11 +14,6 @@
* Fixes:
* Alan Cox : Turned on udp checksums. I don't want to
* chase 'memory corruption' bugs that aren't!
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
*/
#ifndef _UDP_H
#define _UDP_H
@@ -471,12 +467,19 @@ void udpv6_encap_enable(void);
static inline struct sk_buff *udp_rcv_segment(struct sock *sk,
struct sk_buff *skb, bool ipv4)
{
+ netdev_features_t features = NETIF_F_SG;
struct sk_buff *segs;
+ /* Avoid csum recalculation by skb_segment unless userspace explicitly
+ * asks for the final checksum values
+ */
+ if (!inet_get_convert_csum(sk))
+ features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+
/* the GSO CB lays after the UDP one, no need to save and restore any
* CB fragment
*/
- segs = __skb_gso_segment(skb, NETIF_F_SG, false);
+ segs = __skb_gso_segment(skb, features, false);
if (unlikely(IS_ERR_OR_NULL(segs))) {
int segs_nr = skb_shinfo(skb)->gso_segs;