summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_input.c
diff options
context:
space:
mode:
authorjca <jca@openbsd.org>2016-06-27 16:33:48 +0000
committerjca <jca@openbsd.org>2016-06-27 16:33:48 +0000
commite5ff19c718a7f8106479296f9aa531519e06c0f7 (patch)
treea8406b130934aefbbbf578535e9a3edc45b4d969 /sys/netinet/tcp_input.c
parentCopy inp_hops from the listening socket to the accepted one and use (diff)
downloadwireguard-openbsd-e5ff19c718a7f8106479296f9aa531519e06c0f7.tar.xz
wireguard-openbsd-e5ff19c718a7f8106479296f9aa531519e06c0f7.zip
Implement IPV6_MINHOPCOUNT support.
Useful to implement GTSM support in daemons such as bgpd(8). Diff from 2013 revived by renato@. Input from bluhm@, ok bluhm@ deraadt@
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r--sys/netinet/tcp_input.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 688d12d412b..83f4a7e2f1b 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.321 2016/06/27 15:59:51 bluhm Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.322 2016/06/27 16:33:48 jca Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -633,8 +633,18 @@ findpcb:
KASSERT(intotcpcb(inp) == NULL || intotcpcb(inp)->t_inpcb == inp);
/* Check the minimum TTL for socket. */
- if (inp->inp_ip_minttl && inp->inp_ip_minttl > ip->ip_ttl)
- goto drop;
+ switch (af) {
+ case AF_INET:
+ if (inp->inp_ip_minttl && inp->inp_ip_minttl > ip->ip_ttl)
+ goto drop;
+#ifdef INET6
+ case AF_INET6:
+ if (inp->inp_ip6_minhlim &&
+ inp->inp_ip6_minhlim > ip6->ip6_hlim)
+ goto drop;
+ break;
+#endif
+ }
tp = intotcpcb(inp);
if (tp == NULL)