diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-07-01 18:28:59 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-07-01 18:28:59 +0000 |
commit | 1c320a42c5a249de4ddaa308eda6770770867b83 (patch) | |
tree | 8e05c213c8a4995db96cc2678c906113ba29876a /sys | |
parent | 743cf2a92c853bdefc1b38d95326862e2522d1e8 (diff) |
Allow resetting the IP_TTL and IP_MINTTL sockopts
IP_TTL can be reset by passing -1, IP_MINTTL can be reset by passing 0.
This is consistent with what Linux does and
IPV6_UNICAST_HOPS/IPV6_MINHOPCOUNT.
ok bluhm@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_output.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 36133661083..d65e81bac37 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.324 2016/06/23 09:08:56 henning Exp $ */ +/* $OpenBSD: ip_output.c,v 1.325 2016/07/01 18:28:58 jca Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -887,12 +887,14 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, case IP_TTL: if (optval > 0 && optval <= MAXTTL) inp->inp_ip.ip_ttl = optval; + else if (optval == -1) + inp->inp_ip.ip_ttl = ip_defttl; else error = EINVAL; break; case IP_MINTTL: - if (optval > 0 && optval <= MAXTTL) + if (optval >= 0 && optval <= MAXTTL) inp->inp_ip_minttl = optval; else error = EINVAL; |