svn commit: r350974 - head/sys/netinet

Andrey V. Elsukov ae at FreeBSD.org
Tue Aug 13 12:47:54 UTC 2019


Author: ae
Date: Tue Aug 13 12:47:53 2019
New Revision: 350974
URL: https://svnweb.freebsd.org/changeset/base/350974

Log:
  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
  MFC after:	1 week

Modified:
  head/sys/netinet/tcp_input.c

Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c	Tue Aug 13 12:41:15 2019	(r350973)
+++ head/sys/netinet/tcp_input.c	Tue Aug 13 12:47:53 2019	(r350974)
@@ -554,6 +554,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;
@@ -676,6 +677,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);
@@ -684,6 +686,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;
 		}


More information about the svn-src-head mailing list