diff options
author | ae <ae@FreeBSD.org> | 2012-12-27 20:59:22 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2012-12-27 20:59:22 +0000 |
commit | 60647185741ca17e243ad7fcabde595eb8ae00e9 (patch) | |
tree | 1db5ce151bf0dc99b6ce987adad865caa9c38cd8 /sys/net | |
parent | 9708a96be58af22cd8b296b5394cd23b5c7764a7 (diff) | |
download | FreeBSD-src-60647185741ca17e243ad7fcabde595eb8ae00e9.zip FreeBSD-src-60647185741ca17e243ad7fcabde595eb8ae00e9.tar.gz |
Add net.link.stf.permit_rfc1918 sysctl variable. It can be used to allow
the use of private IPv4 addresses with stf(4).
MFC after: 2 weeks
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_stf.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index c7ea06c..de76724 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -127,6 +127,10 @@ static int stf_route_cache = 1; SYSCTL_INT(_net_link_stf, OID_AUTO, route_cache, CTLFLAG_RW, &stf_route_cache, 0, "Caching of IPv4 routes for 6to4 Output"); +static int stf_permit_rfc1918 = 0; +SYSCTL_INT(_net_link_stf, OID_AUTO, permit_rfc1918, CTLFLAG_RW, + &stf_permit_rfc1918, 0, "Permit the use of private IPv4 addresses"); + #define STFUNIT 0 #define IN6_IS_ADDR_6TO4(x) (ntohs((x)->s6_addr16[0]) == 0x2002) @@ -581,9 +585,10 @@ isrfc1918addr(in) * returns 1 if private address range: * 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 */ - if ((ntohl(in->s_addr) & 0xff000000) >> 24 == 10 || + if (stf_permit_rfc1918 == 0 && ( + (ntohl(in->s_addr) & 0xff000000) >> 24 == 10 || (ntohl(in->s_addr) & 0xfff00000) >> 16 == 172 * 256 + 16 || - (ntohl(in->s_addr) & 0xffff0000) >> 16 == 192 * 256 + 168) + (ntohl(in->s_addr) & 0xffff0000) >> 16 == 192 * 256 + 168)) return 1; return 0; |