Bug 24130

Summary: rc.network6 assumes single ipv6 interface is always the first interface
Product: Base System Reporter: Leo Bicknell <bicknell>
Component: confAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-RELEASE   
Hardware: Any   
OS: Any   

Description Leo Bicknell 2001-01-07 20:10:01 UTC
	IPv6 end hosts are only allowed to autoconfigure a single interface,
as autoconfiguring multiple interfaces may result in network reachability issues.
This is correctly documented in /etc/rc.network6.  However, the code in 
/etc/rc.network6 assumes that an autoconfiguring host _has only one NIC_, which
is not a correct assumption.

	In my enviornment, the IPv6 network is separate from the IPv4 network.
As such the machine has two NIC's, one for IPv4 _only_, and one for IPv6 _only_.
The IPv6 NIC is the second NIC in the box (fxp1).  This does not violate the
rule of having a single NIC for IPv6 autoconfiguration, but is not an allowed
configuration by the current /etc/rc.network6 script.

Fix: 

A simple hack would be to change set `ifconfig -l` to be 
set $ipv6_network_interfaces, allowing the second line to get the first
specified interface, if more than one were specified.  I believe more
elaborte checking might be in order though, to allow lo0 to be configured
as well, and to produce better warning / error messages.
How-To-Repeat: 
	Configure a box with two nics (the examples below assume fxp0 and fxp1).
Try the following /etc/rc.conf config lines:


network_interfaces="fxp0 lo0"
ifconfig_fxp0="inet 209.249.106.101 netmask 255.255.255.240"
defaultrouter="209.249.106.97"
ipv6_enable="YES"
ipv6_network_interfaces="fxp1"

	Due to the following code in /etc/rc.network6:

                        #
                        # manual configurations - in case ip6_gateway_enable=NO
                        # you can configure only single interface,
                        # as specification assumes that
                        # autoconfigured host has single interface only.
                        #
                        set `ifconfig -l`
                        ipv6_network_interfaces="$1"

	The code will override the ipv6_network_interfaces="fxp1" with 
ipv6_network_interfaces="fxp0" (the first interface in the box) in these
lines.

	Note, it is unclear if ipv6_network_interfaces="fxp1" should really
be ipv6_network_interfaces="fxp1 lo0", which makes more sense.  The code does
not seem to allow for this possibility either.
Comment 1 dwmalone 2001-01-07 23:00:02 UTC
On Sun, Jan 07, 2001 at 03:09:10PM -0500, bicknell@ufp.org wrote:

> ipv6_network_interfaces="fxp1"
> 
> 	Due to the following code in /etc/rc.network6:
> 
>                         #
>                         # manual configurations - in case ip6_gateway_enable=NO
>                         # you can configure only single interface,
>                         # as specification assumes that
>                         # autoconfigured host has single interface only.
>                         #
>                         set `ifconfig -l`
>                         ipv6_network_interfaces="$1"
> 
> 	The code will override the ipv6_network_interfaces="fxp1" with 
> ipv6_network_interfaces="fxp0" (the first interface in the box) in these
> lines.

The code quote above is only run if you have ipv6_network_interfaces
set to auto. Since you are setting this variable to fxp1 it should
not be run. Maybe you are seeing some other configuration problem?

	David.
Comment 2 dwmalone 2001-01-07 23:08:21 UTC
On Sun, Jan 07, 2001 at 03:09:10PM -0500, bicknell@ufp.org wrote:

[Sorry if you get this twice - I think my first reply got eaten.]

> ipv6_network_interfaces="fxp1"
> 
> 	Due to the following code in /etc/rc.network6:
> 
>                         #
>                         # manual configurations - in case ip6_gateway_enable=NO
>                         # you can configure only single interface,
>                         # as specification assumes that
>                         # autoconfigured host has single interface only.
>                         #
>                         set `ifconfig -l`
>                         ipv6_network_interfaces="$1"
> 
> 	The code will override the ipv6_network_interfaces="fxp1" with 
> ipv6_network_interfaces="fxp0" (the first interface in the box) in these
> lines.

Note - the code you quote is only run if ipv6_network_interfaces
is set to auto. If you are setting ipv6_network_interfaces to fxp1
then you shouldn't have any other interfaces configured (though
you might want to add lo0 to the list for the sake of completeness).

	David.
Comment 3 Leo Bicknell 2001-01-07 23:25:31 UTC
On Sun, Jan 07, 2001 at 11:00:02PM +0000, David Malone wrote:
> The code quote above is only run if you have ipv6_network_interfaces
> set to auto. Since you are setting this variable to fxp1 it should
> not be run. Maybe you are seeing some other configuration problem?

	You're right, I didn't pay close enough attention.

	I'm working on troubleshooting now to find the exact cause
of the problem, but notice something interesting already.  If I set
ipv6_enable="NO", fxp0 still gets an ipv6 link local address.  I 
then removed /etc/rc.network6 (actually, made it a one line empty
script) and tried again (with ipv6_enable="NO"), and I still get a 
link local address on fxp0 (not on fxp1 though).  

	Is this intended?

-- 
Leo Bicknell - bicknell@ufp.org
Systems Engineer - Internetworking Engineer - CCIE 3440
Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org
Comment 4 dwmalone freebsd_committer freebsd_triage 2001-01-10 10:34:32 UTC
State Changed
From-To: open->closed

Submitter is going to send in some PRs to supersede this one.