Bug 170847 - static IPv6 addresses+vlans don't work ala rc(5)
Summary: static IPv6 addresses+vlans don't work ala rc(5)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-rc (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-22 04:00 UTC by Enji Cooper
Modified: 2024-12-14 02:40 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2012-08-22 04:00:22 UTC
Setting up static IPv6 addresses with vlan interfaces is broken on 9.0-RELEASE (the link local address is set via rc(5), but not the IPv6 static address). Example:

# cat /etc/rc.conf 
hostname="wf048.west.isilon.com"
loctet=1

: ${mtu=9000}
: ${vlan_mtu=9000}

vlans_cxgb1="223"
ifconfig_cxgb1="inet 192.168.21.$loctet/24 mtu $mtu vlanmtu $vlan_mtu $cap"
ifconfig_cxgb1_223="inet 192.168.20.$loctet/24"
case "$(uname -r)" in
9*|1[0-9]*)
        ifconfig_cxgb1_ipv6="inet6 fec0::00:d3:ad:b3:3f:0$loctet prefixlen 24"
        ifconfig_cxgb1_223_ipv6="inet6 fec0::01:d3:ad:b3:3f:0$loctet prefixlen 22
4"
        ;;
*)
        ipv6_ifconfig_cxgb1="fec0::00:d3:ad:b3:3f:0$loctet prefixlen 24"
        ipv6_ifconfig_cxgb1_223="fec0::01:d3:ad:b3:3f:0$loctet prefixlen 24"
        ipv6_enable="YES"
        ;;
esac
ifconfig_em0="DHCP"
sshd_enable="YES"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
wf048# service netif restart
ifconfig: interface cxgb1.223 does not exist
ifconfig: interface cxgb1.223 does not exist
Stopping Network: lo0 cxgb0 cxgb1 em0 em1 cxgb1.223.
lo0: flags=8048<LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 ::1 prefixlen 128 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
cxgb0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=c05bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,LRO,VLAN_HWTSO,LINKSTATE>
        ether 00:07:43:07:3f:70
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet none
        status: no carrier
cxgb1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=c05bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,LRO,VLAN_HWTSO,LINKSTATE>
        ether 00:07:43:07:3f:71
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet 10Gbase-SR <full-duplex>
        status: no carrier
em0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
        ether 00:25:90:35:59:ca
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
em1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
        ether 00:25:90:35:59:cb
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
ifconfig: interface cxgb1.223 does not exist
ifconfig: 4: bad value
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ HERE? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Starting Network: lo0 cxgb0 cxgb1 em0 em1.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 ::1 prefixlen 128 
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0xd 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
cxgb0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=c05bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,LRO,VLAN_HWTSO,LINKSTATE>
        ether 00:07:43:07:3f:70
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet none
        status: no carrier
cxgb1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=c05bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,LRO,VLAN_HWTSO,LINKSTATE>
        ether 00:07:43:07:3f:71
        inet 192.168.21.1 netmask 0xffffff00 broadcast 0.0.35.40
        inet6 fe80::207:43ff:fe07:3f71%cxgb1 prefixlen 64 scopeid 0x2 
        inet6 fec0::d3:ad:b3:3f:1 prefixlen 24 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet 10Gbase-SR <full-duplex>
        status: active
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
        ether 00:25:90:35:59:ca
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
em1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
        ether 00:25:90:35:59:cb
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: no carrier
wf048# ifconfig cxgb1.223
cxgb1.223: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:07:43:07:3f:71
        inet 192.168.20.1 netmask 0xffffff00 broadcast 192.168.20.255
        inet6 fe80::207:43ff:fe07:3f71%cxgb1.223 prefixlen 64 scopeid 0xe
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ HMMMMMM... ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet 10Gbase-SR <full-duplex>
        status: active
        vlan: 223 parent interface: cxgb1
wf048# cat /etc/rc.conf 
hostname="wf048.west.isilon.com"
loctet=1

: ${mtu=9000}
: ${vlan_mtu=9000}

vlans_cxgb1="223"
ifconfig_cxgb1="inet 192.168.21.$loctet/24 mtu $mtu vlanmtu $vlan_mtu $cap"
ifconfig_cxgb1_223="inet 192.168.20.$loctet/24"
case "$(uname -r)" in
9*|1[0-9]*)
        ifconfig_cxgb1_ipv6="inet6 fec0::00:d3:ad:b3:3f:0$loctet prefixlen 24"
        ifconfig_cxgb1_223_ipv6="inet6 fec0::01:d3:ad:b3:3f:0$loctet prefixlen 24"
        ;;
*)
        ipv6_ifconfig_cxgb1="fec0::00:d3:ad:b3:3f:0$loctet prefixlen 24"
        ipv6_ifconfig_cxgb1_223="fec0::01:d3:ad:b3:3f:0$loctet prefixlen 24"
        ipv6_enable="YES"
        ;;
esac
ifconfig_em0="DHCP"
sshd_enable="YES"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"


Manually configuring the vlan interface with ifconfig works though, so it's an rc(5) problem, as suspected earlier:


wf048# ifconfig cxgb1.223 inet6 fec0::01:d3:ad:b3:3f:01 prefixlen 24
wf048# ifconfig cxgb1.223
cxgb1.223: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
        options=103<RXCSUM,TXCSUM,TSO4>
        ether 00:07:43:07:3f:71
        inet 192.168.20.1 netmask 0xffffff00 broadcast 192.168.20.255
        inet6 fe80::207:43ff:fe07:3f71%cxgb1.223 prefixlen 64 scopeid 0xe 
        inet6 fec0:0:1:d3:ad:b3:3f:1 prefixlen 24 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        media: Ethernet 10Gbase-SR <full-duplex>
        status: active
        vlan: 223 parent interface: cxgb1

How-To-Repeat: # cat >> /etc/rc.conf <<EOF
interface=cxgb1 # Change this.
vlan=223
vlans_${interface}="$vlan"
ifconfig_${interface}_ipv6="inet6 fec0::00:d3:ad:b3:3f:01 prefixlen 24"
ifconfig_${interface}_${vlan}_ipv6="inet6 fec0::01:d3:ad:b3:3f:01 prefixlen 24"
EOF

# service netif restart cxgb1
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-08-22 19:14:54 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 Doug Barton freebsd_committer freebsd_triage 2012-08-22 22:27:52 UTC
Responsible Changed
From-To: freebsd-rc->hrs


Assign to the person responsible for that code
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:27 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
Comment 4 Tatsuki Makino 2024-10-28 00:22:56 UTC
This will be a configuration for the 14.1-STABLE generation, but...

Since /etc/rc.conf is a configuration sh script, most sh syntax can be used.
However, it cannot use most external commands.
It's because it's read before the file system is mounted.

VLANs with 802.1Q seem to have a negative impact on link local addresses.
This is because, basically, there is only one MAC address of the parent.
The following has already happened

>        inet6 fe80::207:43ff:fe07:3f71%cxgb1 prefixlen 64 scopeid 0x2 
>        inet6 fe80::207:43ff:fe07:3f71%cxgb1.223 prefixlen 64 scopeid 0xe 

It seems that it is better to avoid this, and the configures to avoid it are as follows.

vlans_cxgb1="vlan0" # for this explain clarity, it will be vlan0
if ! : ; then
  ifconfig_vlan0="inet6 fe80::589c:fcff:fe00:1 prefixlen 64 -ifdisabled -auto_linklocal"
    # however, it does not indicate that this interface is IPv6 interface.
  ifconfig_vlan0_alias0="inet6 2001:db8::589c:fcff:fe00:1 prefixlen 64"
elif : ; then
  ifconfig_vlan0="down"
  ifconfig_vlan0_ipv6="inet6 fe80::589c:fcff:fe00:1 prefixlen 64 -auto_linklocal"
  ifconfig_vlan0_alias0="inet6 2001:db8::589c:fcff:fe00:1 prefixlen 64"
else
  ifconfig_vlan0="down"
  ifconfig_vlan0_ipv6="inet6 down -auto_linklocal"
  ifconfig_vlan0_alias0="inet6 fe80::589c:fcff:fe00:1 prefixlen 64"
  ifconfig_vlan0_alias1="inet6 2001:db8::589c:fcff:fe00:1 prefixlen 64"
fi

I've written multiple examples using conditional branching.
The common denominator is that it does not automatically add a link-local address, and that the interface is kept down until a link-local address is assigned.
And the link-local address should be the first address to be assigned.

In my environment, this seems to stabilize neighbor discovery.