HomeFreeBSD

ifconfig: fix vlan/vlanproto reconfiguration

Description

ifconfig: fix vlan/vlanproto reconfiguration

The setvlantag() and setvlanproto() functions are used in two scenarios:
when we create a new vlan interface and when we update an existing
interface.
These are distinguished by the getvlan() at the end of the functions. If
this fails we assume that is because the interface doesn't exist (so
we're creating a new one). We only update the 'params' struct, and
expect the settings to be applied when we vlan_create().

However, if we're updating an existing interface we do not retrieve the
current settings, and can end up invalidating settings.

Fix this by using the settings we retrieved while checking which
scenario we're in.

Note that we do not address this for setvlandev(), because if_vlan does
not allow the vlan parent device to be changed without disassociating it
first (with ifconfig vlanX -vlandev).

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35848

Details

Provenance
kpAuthored on Jul 18 2022, 10:25 PM
Differential Revision
D35848: ifconfig: fix vlan/vlanproto reconfiguration
Parents
rG663f556b03a8: if_vlan: allow vlan and vlanproto to be changed
Branches
Unknown
Tags
Unknown