kern/157200: stf(4) can not communication between other 6to4 preix holder

kensaku.masuda at gmail.com kensaku.masuda at gmail.com
Fri May 20 06:20:09 UTC 2011


>Number:         157200
>Category:       kern
>Synopsis:       stf(4) can not communication between other 6to4 preix holder
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 20 06:20:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Kensaku MASUDA
>Release:        FreeBSD 8.2-STABLE amd64
>Organization:
>Environment:
System: FreeBSD futunusi.skyfx.rdh.fujixerox.co.jp 8.2-STABLE FreeBSD 8.2-STABLE #3: Thu May 19 12:57:19 JST 2011 root at futunusi.skyfx.rdh.fujixerox.co.jp:/usr/src/sys/amd64/compile/futunusi.skyfx.rdh.fujixerox.co.jp amd64


	

>Description:
	stf(4) is work fine between native prefixes. But other 6to4 prefix holder is not.
Case of with navtive prefix, stf send a packet(protocol 41) into anycast router.
But other 6to4 prefix, stf send a packet into its V4 address directly. and other side router drop it.

>How-To-Repeat:
	1) Setup stf:
		stf_interface_ipv4addr="XXX.XXX.XXX.XXX" <- Global V4 Address
		ipv6_defaultrouter="2002:c058:6301::1"   <- 192.88.99.1 6to4 anycast router
	2) ping to native v6 machine(Ex: www.kame.net)
	3) see protocol 41 packet, you see a packet that destination is 192.88.99.1.
	4) ping to some 6to4 prefix holder(2002::YYYY:YYYY:?????.....)
	5) see protocol 41 packet, you see a packet that destination is YY.YY.YY.YY.

>Fix:

	function stf_output(mbuf, dest, ro) in if_stf.c create a outgoing packet for stf(4).
And stf_output address IPv4 address from mbuf(outgoing IPv6 packet) or dest.
I think that it use only "dest", no need to refer raw IPv6 packet. 
because, "dest" was look like computed from routing table and interface prefix length.

And problem will clear,so delete routing information about 2002::/16 or above.
(Need to setup route using anycast router)

diff -ruN src.orig/etc/defaults/rc.conf src/etc/defaults/rc.conf
--- src.orig/etc/defaults/rc.conf	2011-05-20 14:19:34.341476080 +0900
+++ src/etc/defaults/rc.conf	2011-05-20 14:18:23.927534426 +0900
@@ -494,6 +494,7 @@
 stf_interface_ipv6_ifid="0:0:0:1"	# IPv6 interface id for stf0.
 				# If you like, you can set "AUTO" for this.
 stf_interface_ipv6_slaid="0000"	# IPv6 Site Level Aggregator for stf0
+stf_interface_mode="anycast"	# Anycast router or edge router
 ipv6_faith_prefix="NO"		# Set faith prefix to enable a FAITH
 				# IPv6-to-IPv4 TCP translator.  You also need
 				# faithd(8) setup.
diff -ruN src.orig/etc/network.subr src/etc/network.subr
--- src.orig/etc/network.subr	2011-05-20 14:19:50.528201421 +0900
+++ src/etc/network.subr	2011-05-20 14:17:59.467935221 +0900
@@ -1042,6 +1042,14 @@
 		route add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject
 		route add -inet6 2002:0000:: -prefixlen 24 ::1 -reject
 		route add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject
+		case ${stf_interface_mode} in
+		[Aa][Nn][Yy][Cc][Aa][Ss][Tt])
+			;;
+		[Ee][Dd][Gg][Ee])
+			route -q del -inet6 2002:${ipv4_in_hexformat}::/${stf_prefixlen}
+			route -q del -inet6 2002::/${stf_prefixlen}
+			;;
+			esac
 		;;
 	esac
 }
diff -ruN src.orig/sys/net/if_stf.c src/sys/net/if_stf.c
--- src.orig/sys/net/if_stf.c	2011-05-20 14:20:08.610057217 +0900
+++ src/sys/net/if_stf.c	2011-05-20 14:19:12.535445653 +0900
@@ -479,11 +479,18 @@
 	/*
 	 * Pickup the right outer dst addr from the list of candidates.
 	 * ip6_dst has priority as it may be able to give us shorter IPv4 hops.
+	 *
+	 * NOTICE: dst is computed by routing tables and network prefix.
+	 * In broadcast segment, ip6->ip6_dst and dst6->sin6_addr are same.
+	 * Othersise, dst is found from routeing table.
 	 */
 	ptr = NULL;
+/*
 	if (IN6_IS_ADDR_6TO4(&ip6->ip6_dst))
 		ptr = GET_V4(&ip6->ip6_dst);
-	else if (IN6_IS_ADDR_6TO4(&dst6->sin6_addr))
+	else
+*/
+	if (IN6_IS_ADDR_6TO4(&dst6->sin6_addr))
 		ptr = GET_V4(&dst6->sin6_addr);
 	else {
 		ifa_free(&ia6->ia_ifa);
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list