diff options
author | 2015-10-20 20:22:42 +0000 | |
---|---|---|
committer | 2015-10-20 20:22:42 +0000 | |
commit | cdd79de48c88bd7c662bcd79e6b54b0243bd1253 (patch) | |
tree | c74bbafac5a022843661e77d6029d2b6009d7963 /sys/netinet/ip_output.c | |
parent | Fix write to other user's tty. The device has to be opened with (diff) | |
download | wireguard-openbsd-cdd79de48c88bd7c662bcd79e6b54b0243bd1253.tar.xz wireguard-openbsd-cdd79de48c88bd7c662bcd79e6b54b0243bd1253.zip |
add a new getsockopt option IP_IPDEFTTL to retrieve the default ttl.
this can be used as an alternative to sysctl net.inet.ip.ttl, in
programs that use pledge().
ok reyk@, "Like this" deraadt@
Diffstat (limited to 'sys/netinet/ip_output.c')
-rw-r--r-- | sys/netinet/ip_output.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 8d575b7904d..5e9147a1014 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_output.c,v 1.302 2015/10/19 12:10:05 mpi Exp $ */ +/* $OpenBSD: ip_output.c,v 1.303 2015/10/20 20:22:42 benno Exp $ */ /* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */ /* @@ -1088,6 +1088,7 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, case IP_RECVDSTPORT: case IP_RECVRTABLE: case IP_IPSECFLOWINFO: + case IP_IPDEFTTL: *mp = m = m_get(M_WAIT, MT_SOOPTS); m->m_len = sizeof(int); switch (optname) { @@ -1104,6 +1105,10 @@ ip_ctloutput(int op, struct socket *so, int level, int optname, optval = inp->inp_ip_minttl; break; + case IP_IPDEFTTL: + optval = ip_defttl; + break; + #define OPTBIT(bit) (inp->inp_flags & bit ? 1 : 0) case IP_RECVOPTS: |