Date: Tue, 29 Dec 2009 13:54:26 -0500 From: John Baldwin <jhb@freebsd.org> To: Brooks Davis <brooks@freebsd.org> Cc: net@freebsd.org Subject: Add support for vlans to rc.d startup scripts Message-ID: <200912291354.26708.jhb@freebsd.org>
next in thread | raw e-mail | index | archive | help
This patch takes the work done for VAP devices for wireless and extends it to support adding VLAN interfaces to network devices more easily. A list of vlan interfaces is specified via 'vlans_<foo>'. If the vlan name is just a number, then that number is taken to be a tag and a '<foo>.<tag>' vlan interface device is created. Otherwise, a 'create_args_<vlan>' variable must be defined that includes the 'vlan <tag>' in order for the vlan to be successfully created. If one had the following lines in rc.conf for example: vlans_foo="101 bar vlan100" create_args_bar="vlan 102" create_args_vlan100="vlan 104" Then this would result in the following vlan devices being created during boot: foo.101: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=3<RXCSUM,TXCSUM> ether 00:24:81:40:e3:ef media: Ethernet autoselect vlan: 101 parent interface: foo bar: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=3<RXCSUM,TXCSUM> ether 00:24:81:40:e3:ef media: Ethernet autoselect vlan: 102 parent interface: foo vlan100: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=3<RXCSUM,TXCSUM> ether 00:24:81:40:e3:ef media: Ethernet autoselect vlan: 104 parent interface: foo If one uses 'sh /etc/rc.d/netif start foo' then the vlan devices will be created, and if one does 'sh /etc/rc.d/netif stop foo' then the vlan devices will be destroyed. One downside is that similar to the wlan interfaces, the ifconfig output for these devices is not displayed as part of the normal boot messages. Doing so would require some way for ifn_start and ifn_stop to communicate their list of child interfaces along with create/fail status for each back to the main loop in /etc/rc.d/netif. The patch is at http://www.FreeBSD.org/~jhb/patches/vlans_head.patch and is included below. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912291354.26708.jhb>