Bug 191252

Summary: [rc.conf] [vlan] [carp] broken alias syntax on vlan interfaces
Product: Base System Reporter: Daniel Duerr <dd>
Component: confAssignee: freebsd-rc (Nobody) <rc>
Status: Closed FIXED    
Severity: Affects Some People CC: agifford, dd, hrs
Priority: ---    
Version: 10.0-STABLE   
Hardware: Any   
OS: Any   

Description Daniel Duerr 2014-06-21 18:30:23 UTC
Just upgraded my 9-STABLE pf+carp gateway machines to 10-STABLE, very happy with the improvements in pf and carp!  I followed the updated instructions in the handbook (https://www.freebsd.org/doc/handbook/carp.html) to migrate my /etc/rc.conf settings to match the new syntax required for carp.  Everything works fine for normal interfaces, but the alias syntax breaks when used with vlan interfaces.

Here's an example config that doesn't work:

ifconfig_em0="up media 1000baseTX mediaopt full-duplex"
vlans_em0="1 2"
ifconfig_em0_1="inet 1.1.1.1/24"
ifconfig_em0_1_alias0="inet vhid 1 advskew 100 pass foo alias 1.1.1.254/32"
ifconfig_em0_2="inet 2.2.2.2/24"
ifconfig_em0_2_alias0="inet vhid 2 advskew 100 pass foo alias 2.2.2.254/32"

As a workaround, I've created a custom startup script to set these up and everything works fine.  Just would like to be able to do it via the standard rc.conf mechanism.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2014-06-26 01:26:28 UTC
Over to maintainers.
Comment 2 agifford 2014-07-24 00:10:43 UTC
I can confirm this same problem with 9.3-RELEASE after upgrading from 9.2.

...
ifconfig_em0="up"                  ## works
vlan_em0="13 202"                  ## works
ifconfig_em0_13="inet 10.0.0.5/24" ## works
ifconfig_em0_13_aliases="inet 10.0.0.6/32 inet 10.0.0.12/32" ## FAILS miserable
...

Alternatively, old-style:
...
ifconfig_em0_13_alias0="inet 10.0.0.6/32"  ## FAILS
ifconfig_em0_13_alias1="inet 10.0.0.12/32" ## FAILS
..

My WORK-AROUND for this BUG in the rc scripts was to resort to this:
ifconfig_em0="up"
vlan_em0="em0vlan13 em0vlan202"
create_args_em0vlan13="vlan 13"
create_args_em0vlan202="vlan 202"
ifconfig_em0vlan13="inet 10.0.0.5/24"
ifconfig_em0vlan13_aliases="inet 10.0.0.6/32 inet 10.0.0.12/32" ## WORKS

So I'm betting it's that pesky dot-translated-to-underscore somewhere in the rc network script functions is biting the em0.13 interface syntax when it gets translated into em0_13 for the purposes of alias variables.

Sincerely,
Aaron Gifford
Comment 3 Hiroki Sato freebsd_committer freebsd_triage 2014-11-03 01:22:41 UTC
This is a bug in 9.3-R and prior.  /etc/network.subr in stable/9 and stable/10 has already been fixed.  For 9.3-R, replacing network.subr with ones in a stable branch is a workaround.