diff options
author | andre <andre@FreeBSD.org> | 2005-08-22 16:13:08 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2005-08-22 16:13:08 +0000 |
commit | 573a9535a81268ee8fa937d020dad86235127d2c (patch) | |
tree | e4fae08b9c2716f53ec0fdfe0bc72046c99f26b9 /sys/netinet/udp_usrreq.c | |
parent | ef76245e903c6da9b4359edf312f385c9d1ab002 (diff) | |
download | FreeBSD-src-573a9535a81268ee8fa937d020dad86235127d2c.zip FreeBSD-src-573a9535a81268ee8fa937d020dad86235127d2c.tar.gz |
Add socketoption IP_MINTTL. May be used to set the minimum acceptable
TTL a packet must have when received on a socket. All packets with a
lower TTL are silently dropped. Works on already connected/connecting
and listening sockets for RAW/UDP/TCP.
This option is only really useful when set to 255 preventing packets
from outside the directly connected networks reaching local listeners
on sockets.
Allows userland implementation of 'The Generalized TTL Security Mechanism
(GTSM)' according to RFC3682. Examples of such use include the Cisco IOS
BGP implementation command "neighbor ttl-security".
MFC after: 2 weeks
Sponsored by: TCP/IP Optimization Fundraise 2005
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r-- | sys/netinet/udp_usrreq.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 0ffb004..6de2d7b 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -384,6 +384,9 @@ udp_input(m, off) return; } INP_LOCK(inp); + /* Check the minimum TTL for socket. */ + if (inp->inp_ip_minttl && inp->inp_ip_minttl > ip->ip_ttl) + goto badheadlocked; udp_append(inp, ip, m, iphlen + sizeof(struct udphdr), &udp_in); INP_UNLOCK(inp); INP_INFO_RUNLOCK(&udbinfo); |