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++; }