From: jca Date: Fri, 1 Jul 2016 18:37:15 +0000 (+0000) Subject: Make accepted sockets inherit IP_TTL from the listening socket. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=502cfe9407e8bf16b8f49301f05c88d69c188714;p=openbsd Make accepted sockets inherit IP_TTL from the listening socket. This is consistent with the IPV6_UNICAST_HOPS behavior, and is the only way to allow applications to completely control the TTL of outgoing packets (else an application could temporariy send packets with the default TTL, until it sets again IP_TTL ; this is harmful eg for GTSM). ok bluhm@ --- diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index cb700eca3da..7807968b380 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.323 2016/06/27 20:57:41 jca Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.324 2016/07/01 18:37:15 jca Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -3702,8 +3702,11 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th, if (inp->inp_flags & INP_IPV6) { inp->inp_ipv6.ip6_hlim = oldinp->inp_ipv6.ip6_hlim; inp->inp_hops = oldinp->inp_hops; - } + } else #endif /* INET6 */ + { + inp->inp_ip.ip_ttl = oldinp->inp_ip.ip_ttl; + } #if NPF > 0 if (m && m->m_pkthdr.pf.flags & PF_TAG_DIVERTED &&