diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index f8af0fd3d915..03a06f09c541 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1538,8 +1538,24 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid, */ if (vid == 0 || vid == 0xFFF || (vid & ~EVL_VLID_MASK)) return (EINVAL); - if (ifv->ifv_trunk) - return (EBUSY); + if (ifv->ifv_trunk) { + trunk = ifv->ifv_trunk; + if (trunk->parent != p) + return (EBUSY); + + VLAN_XLOCK(); + + ifv->ifv_proto = proto; + + if (ifv->ifv_vid != vid) { + /* Re-hash */ + vlan_remhash(trunk, ifv); + ifv->ifv_vid = vid; + error = vlan_inshash(trunk, ifv); + } + /* Will unlock */ + goto done; + } VLAN_XLOCK(); if (p->if_vlantrunk == NULL) {