-.\" $OpenBSD: ip.4,v 1.36 2015/09/10 17:55:21 schwarze Exp $
+.\" $OpenBSD: ip.4,v 1.37 2015/10/20 20:22:42 benno Exp $
.\" $NetBSD: ip.4,v 1.3 1994/11/30 16:22:19 jtc Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\"
.\" @(#)ip.4 8.2 (Berkeley) 11/30/93
.\"
-.Dd $Mdocdate: September 10 2015 $
+.Dd $Mdocdate: October 20 2015 $
.Dt IP 4
.Os
.Sh NAME
.Tn IP
header for
.Dv SOCK_STREAM
-and
+,
.Dv SOCK_DGRAM
+and
+.Dv SOCK_RAW
sockets.
For example,
.Bd -literal -offset indent
setsockopt(s, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl));
.Ed
.Pp
+.Dv IP_IPDEFTTL
+can be used to retrieve the system wide default ttl.
+.Pp
If the
.Dv IP_RECVDSTADDR
option is enabled on a
-/* $OpenBSD: in.h,v 1.114 2015/04/14 12:22:15 mikeb Exp $ */
+/* $OpenBSD: in.h,v 1.115 2015/10/20 20:22:42 benno Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
#define IP_PIPEX 34 /* bool; using PIPEX */
#define IP_RECVRTABLE 35 /* bool; receive rdomain w/dgram */
#define IP_IPSECFLOWINFO 36 /* bool; IPsec flow info for dgram */
+#define IP_IPDEFTTL 37 /* int; IP TTL system default */
#define IP_RTABLE 0x1021 /* int; routing table, see SO_RTABLE */
#define IP_DIVERTFL 0x1022 /* int; divert direction flag opt */
-/* $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 $ */
/*
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) {
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: