mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
if_vlan: Fix up if_type before attaching the interface
ether_ifattach() does not touch if_type, so it is not mandatory to fix
the if_type after ether_ifattach(). Without this change, the event
listeners, e.g. netlink, will see wrong interface type IFT_ETHER rather
than the correct one IFT_L2VLAN. There is also a potential race that
other threads see inconsistent interface type, i.e. initially IFT_ETHER
and eventually IFT_L2VLAN.
As a nice effect, this change eliminates the memory allocation for
if_hw_addr, as vlan(4) interfaces do not support setting or retrieving
the hardware MAC address yet [1].
[1] ddae57504b Persistently store NIC's hardware MAC address, and add a way to retrive it
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D50914
(cherry picked from commit a19b353d354d4ef808965c53253103cb6e7e6708)
This commit is contained in:
parent
3fe6446523
commit
9c2305bc96
1 changed files with 1 additions and 1 deletions
|
|
@ -1185,10 +1185,10 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len,
|
|||
ifp->if_ratelimit_query = vlan_ratelimit_query;
|
||||
#endif
|
||||
ifp->if_flags = VLAN_IFFLAGS;
|
||||
ifp->if_type = IFT_L2VLAN;
|
||||
ether_ifattach(ifp, eaddr);
|
||||
/* Now undo some of the damage... */
|
||||
ifp->if_baudrate = 0;
|
||||
ifp->if_type = IFT_L2VLAN;
|
||||
ifp->if_hdrlen = ETHER_VLAN_ENCAP_LEN;
|
||||
ifa = ifp->if_addr;
|
||||
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue