diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-06-27 16:33:49 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-06-27 16:33:49 +0000 |
commit | b856c5340b684cc544b7a074840b4a03af6af033 (patch) | |
tree | 18b6b1437b6475e168568da33fbb7a82da2e2777 /sys/netinet/tcp_input.c | |
parent | 9516394ee28d7f96d466feee1b96506e8714100e (diff) |
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.c | 16 |
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) |