Bug 157200 - [network.subr] [patch] stf(4) can not communicate between other 6to4 prefix holder
Summary: [network.subr] [patch] stf(4) can not communicate between other 6to4 prefix h...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-20 07:20 UTC by kensaku.masuda
Modified: 2017-12-31 22:32 UTC (History)
0 users

See Also:


Attachments
file.diff (1.99 KB, patch)
2011-05-20 07:20 UTC, kensaku.masuda
no flags Details | Diff
stf-related.diff (1.82 KB, patch)
2011-05-30 07:27 UTC, kensaku.masuda
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kensaku.masuda 2011-05-20 07:20:09 UTC
	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.

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)
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.
Comment 1 kensaku.masuda 2011-05-26 09:02:59 UTC
    I have checked about original KAME's code. And stf_output() in if_stf.c 
are like this.

        if (IN6_IS_ADDR_6TO4(&ip6->ip6_dst)) {
            ptr = GET_V4(sc, &ip6->ip6_dst);
        }
        if (IN6_IS_ADDR_6TO4(&dst6->sin6_addr)) {
            ptr = GET_V4(sc, &dst6->sin6_addr);
        }

This codes are not changed before three years.
And freebsd's is

        if (IN6_IS_ADDR_6TO4(&ip6->ip6_dst))
            ptr = GET_V4(&ip6->ip6_dst);
        else if (IN6_IS_ADDR_6TO4(&dst6->sin6_addr))
            ptr = GET_V4(&dst6->sin6_addr);
        else {

Unnecessary "else" seems to be included, I think this difference is mistake 
at back-porting from KAME.
Is it correct ?
Comment 2 kensaku.masuda 2011-05-30 07:27:42 UTC
    I had created a new fixes based on KAME. And this fixes seems to be
perfect.
Please commit.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2011-06-01 06:09:45 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Actually this primarily affects sys/net/if_stf.c, with the conf files 
merely being an adjunct.  Thus, reclassify and assign it, as submitter 
requested.
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:51 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped