svn commit: r245258 - in stable/9: share/man/man4 sys/net

Andrey V. Elsukov ae at FreeBSD.org
Thu Jan 10 17:06:25 UTC 2013


Author: ae
Date: Thu Jan 10 17:06:24 2013
New Revision: 245258
URL: http://svnweb.freebsd.org/changeset/base/245258

Log:
  MFC r244750:
    Add net.link.stf.permit_rfc1918 sysctl variable. It can be used to allow
    the use of private IPv4 addresses with stf(4).
  
  MFC r244752:
    Add an ability to set net.link.stf.permit_rfc1918 from the loader.

Modified:
  stable/9/share/man/man4/stf.4
  stable/9/sys/net/if_stf.c
Directory Properties:
  stable/9/share/man/man4/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/dev/puc/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/share/man/man4/stf.4
==============================================================================
--- stable/9/share/man/man4/stf.4	Thu Jan 10 16:50:27 2013	(r245257)
+++ stable/9/share/man/man4/stf.4	Thu Jan 10 17:06:24 2013	(r245258)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 23, 2011
+.Dd December 28, 2012
 .Dt STF 4
 .Os
 .Sh NAME
@@ -180,6 +180,22 @@ Note, however, there are other security 
 If you wish to use the configuration,
 you must not advertise your 6to4 address to others.
 .\"
+.Sh SYSCTL VARIABLES
+The following
+.Xr sysctl 8
+variables can be used to control the behavior of the
+.Nm stf .
+The default value is shown next to each variable.
+.Bl -tag -width indent
+.It Va net.link.stf.permit_rfc1918 : No 0
+The RFC3056 requires the use of globally unique 32-bit IPv4
+addresses. This sysctl variable controls the behaviour of this
+requirement. When it set to not 0, 
+.Nm stf 
+allows the use of private IPv4 addresses described in the RFC1918.
+This may be useful for an Intranet environment or when some mechanisms
+of network address translation (NAT) are used.
+.El
 .Sh EXAMPLES
 Note that
 .Li 8504:0506

Modified: stable/9/sys/net/if_stf.c
==============================================================================
--- stable/9/sys/net/if_stf.c	Thu Jan 10 16:50:27 2013	(r245257)
+++ stable/9/sys/net/if_stf.c	Thu Jan 10 17:06:24 2013	(r245258)
@@ -127,6 +127,11 @@ 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;
+TUNABLE_INT("net.link.stf.permit_rfc1918", &stf_permit_rfc1918);
+SYSCTL_INT(_net_link_stf, OID_AUTO, permit_rfc1918, CTLFLAG_RW | CTLFLAG_TUN,
+    &stf_permit_rfc1918, 0, "Permit the use of private IPv4 addresses");
+
 #define STFNAME		"stf"
 #define STFUNIT		0
 
@@ -580,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;


More information about the svn-src-stable-9 mailing list