CVS commit: src/usr.bin/tftp
Module Name:src Committed By: minskim Date: Sat Sep 17 03:09:51 UTC 2011 Modified Files: src/usr.bin/tftp: main.c Log Message: Add back a line accidentally deleted in the previous commit. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/usr.bin/tftp/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/tftp/main.c diff -u src/usr.bin/tftp/main.c:1.27 src/usr.bin/tftp/main.c:1.28 --- src/usr.bin/tftp/main.c:1.27 Fri Sep 16 15:39:30 2011 +++ src/usr.bin/tftp/main.c Sat Sep 17 03:09:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.27 2011/09/16 15:39:30 joerg Exp $ */ +/* $NetBSD: main.c,v 1.28 2011/09/17 03:09:51 minskim Exp $ */ /* * Copyright (c) 1983, 1993 @@ -36,7 +36,7 @@ #if 0 static char sccsid[] = @(#)main.c 8.1 (Berkeley) 6/6/93; #else -__RCSID($NetBSD: main.c,v 1.27 2011/09/16 15:39:30 joerg Exp $); +__RCSID($NetBSD: main.c,v 1.28 2011/09/17 03:09:51 minskim Exp $); #endif #endif /* not lint */ @@ -108,6 +108,7 @@ void settimeoutopt __P((int, char **)); void status __P((int, char **)); char *tail __P((char *)); +int main __P((int, char *[])); __dead static void intr __P((int)); const struct cmd *getcmd __P((char *));
CVS commit: src/sys/dist/pf/net
Module Name:src Committed By: minskim Date: Sat Jan 23 01:17:23 UTC 2010 Modified Files: src/sys/dist/pf/net: if_pfsync.c Log Message: Fix a typo introduced by the bpf linkage change. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dist/pf/net/if_pfsync.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dist/pf/net/if_pfsync.c diff -u src/sys/dist/pf/net/if_pfsync.c:1.4 src/sys/dist/pf/net/if_pfsync.c:1.5 --- src/sys/dist/pf/net/if_pfsync.c:1.4 Tue Jan 19 22:08:00 2010 +++ src/sys/dist/pf/net/if_pfsync.c Sat Jan 23 01:17:23 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: if_pfsync.c,v 1.4 2010/01/19 22:08:00 pooka Exp $ */ +/* $NetBSD: if_pfsync.c,v 1.5 2010/01/23 01:17:23 minskim Exp $ */ /* $OpenBSD: if_pfsync.c,v 1.83 2007/06/26 14:44:12 mcbride Exp $ */ /* @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_pfsync.c,v 1.4 2010/01/19 22:08:00 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: if_pfsync.c,v 1.5 2010/01/23 01:17:23 minskim Exp $); #ifdef _KERNEL_OPT #include opt_inet.h @@ -192,7 +192,7 @@ if_alloc_sadl(ifp); bpf_ops-bpf_attach(pfsyncif-sc_if, DLT_PFSYNC, PFSYNC_HDRLEN, - pfsyncif-sc_if-if_bpf); + pfsyncif-sc_if.if_bpf); return (0); }
CVS commit: src/dist/pf/sbin/pflogd
Module Name:src Committed By: minskim Date: Fri Aug 7 16:37:12 UTC 2009 Modified Files: src/dist/pf/sbin/pflogd: pflogd.c Log Message: Correct the #ifdef test for struct ifdatareq. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/dist/pf/sbin/pflogd/pflogd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/pf/sbin/pflogd/pflogd.c diff -u src/dist/pf/sbin/pflogd/pflogd.c:1.6 src/dist/pf/sbin/pflogd/pflogd.c:1.7 --- src/dist/pf/sbin/pflogd/pflogd.c:1.6 Wed Jul 15 18:05:17 2009 +++ src/dist/pf/sbin/pflogd/pflogd.c Fri Aug 7 16:37:12 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pflogd.c,v 1.6 2009/07/15 18:05:17 christos Exp $ */ +/* $NetBSD: pflogd.c,v 1.7 2009/08/07 16:37:12 minskim Exp $ */ /* $OpenBSD: pflogd.c,v 1.45 2007/06/06 14:11:26 henning Exp $ */ /* @@ -204,7 +204,7 @@ if_exists(char *ifname) { int s; -#ifdef SIOCGZIFDATA +#ifdef SIOCGIFDATA struct ifdatareq ifr; #define ifr_name ifdr_name #else
CVS commit: src/doc
Module Name:src Committed By: minskim Date: Sun Jul 19 23:11:20 UTC 2009 Modified Files: src/doc: CHANGES Log Message: Add brief description of IP_RECVTTL and IP_MINTTL options. To generate a diff of this commit: cvs rdiff -u -r1.1256 -r1.1257 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1256 src/doc/CHANGES:1.1257 --- src/doc/CHANGES:1.1256 Fri Jul 17 22:05:38 2009 +++ src/doc/CHANGES Sun Jul 19 23:11:19 2009 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1256 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1257 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -324,5 +324,7 @@ limit values [pgoyette 20090710] libc: Add getdelim(3) and getline(3) conforming to IEEE Std 1003.1-2008 (``POSIX.1'') [roy 20090713] - ip(4): Add IP_RECVTTL option. [minskim 20090716] - ip(4): Add IP_MINTTL option. [minskim 20090717] + ip(4): Add IP_RECVTTL option to let recvmsg(2) return the TTL + of the received datagram. [minskim 20090716] + ip(4): Add IP_MINTTL option to discard packets with a TTL + lower than the option value. [minskim 20090717]
CVS commit: src
Module Name:src Committed By: minskim Date: Sun Jul 19 23:17:33 UTC 2009 Modified Files: src/share/man/man4: ip.4 src/sys/netinet: udp_usrreq.c Log Message: Enable IP_MINTTL option for SOCK_DGRAM sockets. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/share/man/man4/ip.4 cvs rdiff -u -r1.177 -r1.178 src/sys/netinet/udp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/ip.4 diff -u src/share/man/man4/ip.4:1.28 src/share/man/man4/ip.4:1.29 --- src/share/man/man4/ip.4:1.28 Sat Jul 18 06:31:54 2009 +++ src/share/man/man4/ip.4 Sun Jul 19 23:17:33 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: ip.4,v 1.28 2009/07/18 06:31:54 wiz Exp $ +.\ $NetBSD: ip.4,v 1.29 2009/07/19 23:17:33 minskim Exp $ .\ .\ Copyright (c) 1983, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\ .\ @(#)ip.4 8.2 (Berkeley) 11/30/93 .\ -.Dd July 17, 2009 +.Dd July 19, 2009 .Dt IP 4 .Os .Sh NAME @@ -190,7 +190,7 @@ The .Dv IP_MINTTL option may be used on -.Dv SOCK_STREAM +.Dv SOCK_DGRAM or SOCK_STREAM sockets to discard packets with a TTL lower than the option value. This can be used to implement the .Em Generalized TTL Security Mechanism (GTSM) Index: src/sys/netinet/udp_usrreq.c diff -u src/sys/netinet/udp_usrreq.c:1.177 src/sys/netinet/udp_usrreq.c:1.178 --- src/sys/netinet/udp_usrreq.c:1.177 Sat Apr 18 14:58:05 2009 +++ src/sys/netinet/udp_usrreq.c Sun Jul 19 23:17:33 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.177 2009/04/18 14:58:05 tsutsui Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.178 2009/07/19 23:17:33 minskim Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: udp_usrreq.c,v 1.177 2009/04/18 14:58:05 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: udp_usrreq.c,v 1.178 2009/07/19 23:17:33 minskim Exp $); #include opt_inet.h #include opt_compat_netbsd.h @@ -836,6 +836,12 @@ } #endif + /* + * Check the minimum TTL for socket. + */ + if (mtod(m, struct ip *)-ip_ttl inp-inp_ip_minttl) + goto bad; + udp4_sendup(m, off, (struct sockaddr *)src, inp-inp_socket); rcvcnt++; }
CVS commit: src/doc
Module Name:src Committed By: minskim Date: Sun Jul 19 23:29:31 UTC 2009 Modified Files: src/doc: CHANGES Log Message: - Delete trailing whitespace. - Use tabs to indent. To generate a diff of this commit: cvs rdiff -u -r1.1257 -r1.1258 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1257 src/doc/CHANGES:1.1258 --- src/doc/CHANGES:1.1257 Sun Jul 19 23:11:19 2009 +++ src/doc/CHANGES Sun Jul 19 23:29:31 2009 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1257 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1258 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -26,7 +26,7 @@ Changes from NetBSD 5.0 to NetBSD 6.0: - syslog(3): Import Martin Schuette's Summer of Code project: + syslog(3): Import Martin Schuette's Summer of Code project: Reliable TCP connections, syslog protocol API, encryption. [christos 20081031] agp(4): Add support for Intel G35. [christos 20081108] @@ -320,11 +320,11 @@ [rmind 20090628] dhcpcd(8): Import dhcpcd-5.0.5 [roy 20090704] dhcpcd(8): Import dhcpcd-5.0.6 [roy 20090708] - sysmon_envsys(8): Enhancements to allow access to driver-internal + sysmon_envsys(8): Enhancements to allow access to driver-internal limit values [pgoyette 20090710] libc: Add getdelim(3) and getline(3) conforming to IEEE Std 1003.1-2008 (``POSIX.1'') [roy 20090713] ip(4): Add IP_RECVTTL option to let recvmsg(2) return the TTL - of the received datagram. [minskim 20090716] + of the received datagram. [minskim 20090716] ip(4): Add IP_MINTTL option to discard packets with a TTL - lower than the option value. [minskim 20090717] + lower than the option value. [minskim 20090717]
CVS commit: src/sys/netinet
Module Name:src Committed By: minskim Date: Sat Jul 18 23:09:53 UTC 2009 Modified Files: src/sys/netinet: tcp_input.c Log Message: Check the minimum ttl only when pcb is available. To generate a diff of this commit: cvs rdiff -u -r1.297 -r1.298 src/sys/netinet/tcp_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet/tcp_input.c diff -u src/sys/netinet/tcp_input.c:1.297 src/sys/netinet/tcp_input.c:1.298 --- src/sys/netinet/tcp_input.c:1.297 Fri Jul 17 22:02:54 2009 +++ src/sys/netinet/tcp_input.c Sat Jul 18 23:09:53 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.297 2009/07/17 22:02:54 minskim Exp $ */ +/* $NetBSD: tcp_input.c,v 1.298 2009/07/18 23:09:53 minskim Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -145,7 +145,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.297 2009/07/17 22:02:54 minskim Exp $); +__KERNEL_RCSID(0, $NetBSD: tcp_input.c,v 1.298 2009/07/18 23:09:53 minskim Exp $); #include opt_inet.h #include opt_ipsec.h @@ -1289,10 +1289,6 @@ #endif } - /* Check the minimum TTL for socket. */ - if (ip-ip_ttl inp-inp_ip_minttl) - goto drop; - /* * If the state is CLOSED (i.e., TCB does not exist) then * all data in the incoming segment is discarded. @@ -1302,6 +1298,10 @@ tp = NULL; so = NULL; if (inp) { + /* Check the minimum TTL for socket. */ + if (ip-ip_ttl inp-inp_ip_minttl) + goto drop; + tp = intotcpcb(inp); so = inp-inp_socket; }
CVS commit: src
Module Name:src Committed By: minskim Date: Fri Jul 17 22:02:54 UTC 2009 Modified Files: src/share/man/man4: ip.4 src/sys/netinet: in.h in_pcb.h ip_output.c tcp_input.c Log Message: Add the IP_MINTTL socket option. The IP_MINTTL option may be used on SOCK_STREAM sockets to discard packets with a TTL lower than the option value. This can be used to implement the Generalized TTL Security Mechanism (GTSM) according to RFC 3682. OK'ed by chris...@. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/share/man/man4/ip.4 cvs rdiff -u -r1.84 -r1.85 src/sys/netinet/in.h cvs rdiff -u -r1.46 -r1.47 src/sys/netinet/in_pcb.h cvs rdiff -u -r1.204 -r1.205 src/sys/netinet/ip_output.c cvs rdiff -u -r1.296 -r1.297 src/sys/netinet/tcp_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/ip.4 diff -u src/share/man/man4/ip.4:1.25 src/share/man/man4/ip.4:1.26 --- src/share/man/man4/ip.4:1.25 Thu Jul 16 07:31:48 2009 +++ src/share/man/man4/ip.4 Fri Jul 17 22:02:54 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: ip.4,v 1.25 2009/07/16 07:31:48 wiz Exp $ +.\ $NetBSD: ip.4,v 1.26 2009/07/17 22:02:54 minskim Exp $ .\ .\ Copyright (c) 1983, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -186,6 +186,20 @@ cmsg_level = IPPROTO_IP cmsg_type = IP_RECVTTL .Ed +.Pp +The +.Dv IP_MINTTL +option may be used on +.Dv SOCK_STREAM +sockets to discard packets with a TTL lower than the option value. +This can be used to implement the +.Em Generalized TTL Security Mechanism (GTSM) +according to RFC 3682. +To discard all packets with a TTL lower than 255: +.Bd -literal -offset indent +int minttl = 255; +setsockopt(s, IPPROTO_IP, IP_MINTTL, minttl, sizeof(minttl)); +.Ed .Ss MULTICAST OPTIONS .Tn IP multicasting is supported only on Index: src/sys/netinet/in.h diff -u src/sys/netinet/in.h:1.84 src/sys/netinet/in.h:1.85 --- src/sys/netinet/in.h:1.84 Thu Jul 16 04:09:51 2009 +++ src/sys/netinet/in.h Fri Jul 17 22:02:54 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: in.h,v 1.84 2009/07/16 04:09:51 minskim Exp $ */ +/* $NetBSD: in.h,v 1.85 2009/07/17 22:02:54 minskim Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -283,6 +283,7 @@ #define IP_IPSEC_POLICY 22 /* struct; get/set security policy */ #endif #define IP_RECVTTL 23 /* bool; receive IP TTL w/dgram */ +#define IP_MINTTL 24 /* minimum TTL for packet or drop */ /* * Defaults and limits for options Index: src/sys/netinet/in_pcb.h diff -u src/sys/netinet/in_pcb.h:1.46 src/sys/netinet/in_pcb.h:1.47 --- src/sys/netinet/in_pcb.h:1.46 Thu Jul 16 04:09:51 2009 +++ src/sys/netinet/in_pcb.h Fri Jul 17 22:02:54 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.h,v 1.46 2009/07/16 04:09:51 minskim Exp $ */ +/* $NetBSD: in_pcb.h,v 1.47 2009/07/17 22:02:54 minskim Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,6 +91,7 @@ struct mbuf *inp_options; /* IP options */ struct ip_moptions *inp_moptions; /* IP multicast options */ int inp_errormtu; /* MTU of last xmit status = EMSGSIZE */ + uint8_t inp_ip_minttl; }; #define inp_faddr inp_ip.ip_dst Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.204 src/sys/netinet/ip_output.c:1.205 --- src/sys/netinet/ip_output.c:1.204 Thu Jul 16 04:09:51 2009 +++ src/sys/netinet/ip_output.c Fri Jul 17 22:02:54 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_output.c,v 1.204 2009/07/16 04:09:51 minskim Exp $ */ +/* $NetBSD: ip_output.c,v 1.205 2009/07/17 22:02:54 minskim Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.204 2009/07/16 04:09:51 minskim Exp $); +__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.205 2009/07/17 22:02:54 minskim Exp $); #include opt_pfil_hooks.h #include opt_inet.h @@ -1223,6 +1223,7 @@ case IP_TOS: case IP_TTL: + case IP_MINTTL: case IP_RECVOPTS: case IP_RECVRETOPTS: case IP_RECVDSTADDR: @@ -1240,6 +1241,13 @@ case IP_TTL: inp-inp_ip.ip_ttl = optval; break; + + case IP_MINTTL: +if (optval 0 optval = MAXTTL) + inp-inp_ip_minttl = optval; +else + error = EINVAL; +break; #define OPTSET(bit) \ if (optval) \ inp-inp_flags |= bit; \ @@ -1335,6 +1343,7 @@ case IP_TOS: case IP_TTL: + case IP_MINTTL: case IP_RECVOPTS: case IP_RECVRETOPTS: case IP_RECVDSTADDR: @@ -1350,6 +1359,10 @@ optval = inp-inp_ip.ip_ttl; break; + case IP_MINTTL: +optval = inp-inp_ip_minttl; +break; + case IP_ERRORMTU: optval = inp-inp_errormtu; break; Index: src/sys/netinet/tcp_input.c diff -u src/sys/netinet/tcp_input.c:1.296 src/sys/netinet/tcp_input.c:1.297 --- src/sys/netinet/tcp_input.c:1.296 Sat Jun 20 17:29:31 2009 +++ src/sys/netinet/tcp_input.c Fri Jul 17 22:02:54 2009 @@ -1,4 +1,4 @@ -/* $NetBSD:
CVS commit: src/share/man/man4
Module Name:src Committed By: minskim Date: Fri Jul 17 22:04:18 UTC 2009 Modified Files: src/share/man/man4: ip.4 Log Message: Bump date for the previous change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/share/man/man4/ip.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/ip.4 diff -u src/share/man/man4/ip.4:1.26 src/share/man/man4/ip.4:1.27 --- src/share/man/man4/ip.4:1.26 Fri Jul 17 22:02:54 2009 +++ src/share/man/man4/ip.4 Fri Jul 17 22:04:18 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: ip.4,v 1.26 2009/07/17 22:02:54 minskim Exp $ +.\ $NetBSD: ip.4,v 1.27 2009/07/17 22:04:18 minskim Exp $ .\ .\ Copyright (c) 1983, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\ .\ @(#)ip.4 8.2 (Berkeley) 11/30/93 .\ -.Dd July 16, 2009 +.Dd July 17, 2009 .Dt IP 4 .Os .Sh NAME
CVS commit: src/doc
Module Name:src Committed By: minskim Date: Fri Jul 17 22:05:38 UTC 2009 Modified Files: src/doc: CHANGES Log Message: Note ip(4) change: IP_MINTTL. To generate a diff of this commit: cvs rdiff -u -r1.1255 -r1.1256 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1255 src/doc/CHANGES:1.1256 --- src/doc/CHANGES:1.1255 Thu Jul 16 04:18:21 2009 +++ src/doc/CHANGES Fri Jul 17 22:05:38 2009 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1255 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1256 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -325,3 +325,4 @@ libc: Add getdelim(3) and getline(3) conforming to IEEE Std 1003.1-2008 (``POSIX.1'') [roy 20090713] ip(4): Add IP_RECVTTL option. [minskim 20090716] + ip(4): Add IP_MINTTL option. [minskim 20090717]
CVS commit: src
Module Name:src Committed By: minskim Date: Thu Jul 16 04:09:51 UTC 2009 Modified Files: src/share/man/man4: ip.4 src/sys/netinet: in.h in_pcb.h ip_input.c ip_output.c Log Message: Add the IP_RECVTTL option support. If the IP_RECVTTL option is enabled on a SOCK_DGRAM socket, the recvmsg(2) call will return the TTL of the received datagram. The msg_control field in the msghdr structure points to a buffer that contains a cmsghdr structure followed by the TTL value. Modeled after FreeBSD implementation. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/share/man/man4/ip.4 cvs rdiff -u -r1.83 -r1.84 src/sys/netinet/in.h cvs rdiff -u -r1.45 -r1.46 src/sys/netinet/in_pcb.h cvs rdiff -u -r1.281 -r1.282 src/sys/netinet/ip_input.c cvs rdiff -u -r1.203 -r1.204 src/sys/netinet/ip_output.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/ip.4 diff -u src/share/man/man4/ip.4:1.23 src/share/man/man4/ip.4:1.24 --- src/share/man/man4/ip.4:1.23 Tue Sep 23 14:58:05 2008 +++ src/share/man/man4/ip.4 Thu Jul 16 04:09:51 2009 @@ -1,4 +1,4 @@ -.\ $NetBSD: ip.4,v 1.23 2008/09/23 14:58:05 briggs Exp $ +.\ $NetBSD: ip.4,v 1.24 2009/07/16 04:09:51 minskim Exp $ .\ .\ Copyright (c) 1983, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\ .\ @(#)ip.4 8.2 (Berkeley) 11/30/93 .\ -.Dd September 23, 2008 +.Dd July 16, 2009 .Dt IP 4 .Os .Sh NAME @@ -165,6 +165,26 @@ cmsg_level = IPPROTO_IP cmsg_type = IP_RECVIF .Ed +.Pp +If the +.Dv IP_RECVTTL +option is enabled on a +.Dv SOCK_DGRAM +socket, the +.Xr recvmsg 2 +call will return the +.Tn TTL +of the received datagram. +The msg_control field in the msghdr structure points to a buffer +that contains a cmsghdr structure followed by the +.Tn TTL +value. +The cmsghdr fields have the following values: +.Bd -literal +cmsg_len = sizeof(uint8_t) +cmsg_level = IPPROTO_IP +cmsg_type = IP_RECVTTL +.Ed .Ss MULTICAST OPTIONS .Tn IP multicasting is supported only on Index: src/sys/netinet/in.h diff -u src/sys/netinet/in.h:1.83 src/sys/netinet/in.h:1.84 --- src/sys/netinet/in.h:1.83 Fri Jan 25 21:12:14 2008 +++ src/sys/netinet/in.h Thu Jul 16 04:09:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: in.h,v 1.83 2008/01/25 21:12:14 joerg Exp $ */ +/* $NetBSD: in.h,v 1.84 2009/07/16 04:09:51 minskim Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -282,6 +282,7 @@ #if 1 /*IPSEC*/ #define IP_IPSEC_POLICY 22 /* struct; get/set security policy */ #endif +#define IP_RECVTTL 23 /* bool; receive IP TTL w/dgram */ /* * Defaults and limits for options Index: src/sys/netinet/in_pcb.h diff -u src/sys/netinet/in_pcb.h:1.45 src/sys/netinet/in_pcb.h:1.46 --- src/sys/netinet/in_pcb.h:1.45 Sun Dec 16 18:39:57 2007 +++ src/sys/netinet/in_pcb.h Thu Jul 16 04:09:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.h,v 1.45 2007/12/16 18:39:57 elad Exp $ */ +/* $NetBSD: in_pcb.h,v 1.46 2009/07/16 04:09:51 minskim Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -108,8 +108,6 @@ /* XXX should move to an UDP control block */ #define INP_ESPINUDP 0x100 /* ESP over UDP for NAT-T */ #define INP_ESPINUDP_NON_IKE 0x200 /* ESP over UDP for NAT-T */ -#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ -INP_RECVIF) #define INP_ESPINUDP_ALL (INP_ESPINUDP|INP_ESPINUDP_NON_IKE) #define INP_NOHEADER 0x400 /* Kernel removes IP header * before feeding a packet @@ -118,6 +116,9 @@ * not supply an IP header. * Cancels INP_HDRINCL. */ +#define INP_RECVTTL 0x800 /* receive incoming IP TTL */ +#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\ +INP_RECVIF|INP_RECVTTL) #define sotoinpcb(so) ((struct inpcb *)(so)-so_pcb) Index: src/sys/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.281 src/sys/netinet/ip_input.c:1.282 --- src/sys/netinet/ip_input.c:1.281 Sat Apr 18 14:58:05 2009 +++ src/sys/netinet/ip_input.c Thu Jul 16 04:09:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.281 2009/04/18 14:58:05 tsutsui Exp $ */ +/* $NetBSD: ip_input.c,v 1.282 2009/07/16 04:09:51 minskim Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.281 2009/04/18 14:58:05 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: ip_input.c,v 1.282 2009/07/16 04:09:51 minskim Exp $); #include opt_inet.h #include opt_compat_netbsd.h @@ -2118,6 +2118,12 @@ if (*mp) mp = (*mp)-m_next; } + if (inp-inp_flags INP_RECVTTL) { + *mp = sbcreatecontrol((void *) ip-ip_ttl, + sizeof(uint8_t), IP_RECVTTL, IPPROTO_IP); + if (*mp) + mp = (*mp)-m_next; + } } /* Index: src/sys/netinet/ip_output.c diff -u src/sys/netinet/ip_output.c:1.203 src/sys/netinet/ip_output.c:1.204 --- src/sys/netinet/ip_output.c:1.203
CVS commit: src/doc
Module Name:src Committed By: minskim Date: Thu Jul 16 04:18:21 UTC 2009 Modified Files: src/doc: CHANGES Log Message: Note ip(4) changes. To generate a diff of this commit: cvs rdiff -u -r1.1254 -r1.1255 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.1254 src/doc/CHANGES:1.1255 --- src/doc/CHANGES:1.1254 Tue Jul 14 18:25:54 2009 +++ src/doc/CHANGES Thu Jul 16 04:18:21 2009 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1254 $ +# LIST OF CHANGES FROM LAST RELEASE: $Revision: 1.1255 $ # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -324,4 +324,4 @@ limit values [pgoyette 20090710] libc: Add getdelim(3) and getline(3) conforming to IEEE Std 1003.1-2008 (``POSIX.1'') [roy 20090713] - + ip(4): Add IP_RECVTTL option. [minskim 20090716]
CVS commit: src/dist/pf/sbin/pfctl
Module Name:src Committed By: minskim Date: Tue Jun 16 05:16:52 UTC 2009 Modified Files: src/dist/pf/sbin/pfctl: parse.y Log Message: Reduce diff with OpenBSD. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/dist/pf/sbin/pfctl/parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/dist/pf/sbin/pfctl/parse.y diff -u src/dist/pf/sbin/pfctl/parse.y:1.11 src/dist/pf/sbin/pfctl/parse.y:1.12 --- src/dist/pf/sbin/pfctl/parse.y:1.11 Wed Jun 18 09:06:26 2008 +++ src/dist/pf/sbin/pfctl/parse.y Tue Jun 16 05:16:52 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.y,v 1.11 2008/06/18 09:06:26 yamt Exp $ */ +/* $NetBSD: parse.y,v 1.12 2009/06/16 05:16:52 minskim Exp $ */ /* $OpenBSD: parse.y,v 1.519 2007/06/21 19:30:03 henning Exp $ */ /* @@ -26,9 +26,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This material is based upon work partially supported by NSF under - * Contract No. NSF CNS-0626584. */ %{ #include sys/types.h