Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2019 10:12:42 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r351420 - stable/11/sys/netinet
Message-ID:  <201908231012.x7NACgNC084556@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Fri Aug 23 10:12:42 2019
New Revision: 351420
URL: https://svnweb.freebsd.org/changeset/base/351420

Log:
  MFC r350974:
    Save ip_ttl value and restore it after checksum calculation.
  
    Since ipvoly is used for checksum calculation, part of original IP
    header is zeroed. This part includes ip_ttl field, that can be used
    later in IP_MINTTL socket option handling.
  
    PR:           239799

Modified:
  stable/11/sys/netinet/tcp_input.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_input.c
==============================================================================
--- stable/11/sys/netinet/tcp_input.c	Fri Aug 23 10:11:10 2019	(r351419)
+++ stable/11/sys/netinet/tcp_input.c	Fri Aug 23 10:12:42 2019	(r351420)
@@ -576,6 +576,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
 	int optlen = 0;
 #ifdef INET
 	int len;
+	uint8_t ipttl;
 #endif
 	int tlen = 0, off;
 	int drop_hdrlen;
@@ -697,6 +698,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
 			 * Checksum extended TCP header and data.
 			 */
 			len = off0 + tlen;
+			ipttl = ip->ip_ttl;
 			bzero(ipov->ih_x1, sizeof(ipov->ih_x1));
 			ipov->ih_len = htons(tlen);
 			th->th_sum = in_cksum(m, len);
@@ -705,6 +707,7 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
 			/* Reset TOS bits */
 			ip->ip_tos = iptos;
 			/* Re-initialization for later version check */
+			ip->ip_ttl = ipttl;
 			ip->ip_v = IPVERSION;
 			ip->ip_hl = off0 >> 2;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908231012.x7NACgNC084556>