Hi! vlan(4) and svlan(4) users should test this diff.
It annoys me for some time that vlan(4) does not allow to change its vlan id or parent interface at runtime. The current code returns EBUSY and always forces you to destroy and re-create the interface. The attached diff changes this behaviour. This did not work before (second call would return EBUSY): # ifconfig vlan1 vlandev em0 # ifconfig vlan1 vlan 2 The diff will also allow to switch the options without loosing any configured state on the interface: # ifconfig vlan1 vlandev em0 192.168.1.1/24 # ifconfig vlan1 vlandev em1 comments? feedback? reyk Index: if_vlan.c =================================================================== RCS file: /cvs/src/sys/net/if_vlan.c,v retrieving revision 1.85 diff -u -p -r1.85 if_vlan.c --- if_vlan.c 2 Jul 2010 02:40:16 -0000 1.85 +++ if_vlan.c 29 Dec 2010 16:39:45 -0000 @@ -365,8 +365,9 @@ vlan_config(struct ifvlan *ifv, struct i return EPROTONOSUPPORT; if (ifv->ifv_p == p && ifv->ifv_tag == tag) /* noop */ return (0); - if (ifv->ifv_p) - return EBUSY; + + /* Reset the interface */ + vlan_unconfig(&ifv->ifv_if); ifv->ifv_p = p;