Fix vlan creation for the older ifconfig(8) binaries.

Reported by:	allanjude
MFC after:	immediately
This commit is contained in:
Alexander V. Chernikov 2021-04-11 17:47:03 +01:00
parent 993d2d4bca
commit afbb64f1d8

View File

@ -1015,6 +1015,10 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params)
vid = vlr.vlr_tag; vid = vlr.vlr_tag;
proto = vlr.vlr_proto; proto = vlr.vlr_proto;
#ifdef COMPAT_FREEBSD12
if (proto == 0)
proto = ETHERTYPE_VLAN;
#endif
p = ifunit_ref(vlr.vlr_parent); p = ifunit_ref(vlr.vlr_parent);
if (p == NULL) if (p == NULL)
return (ENXIO); return (ENXIO);
@ -1947,6 +1951,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
error = ENOENT; error = ENOENT;
break; break;
} }
#ifdef COMPAT_FREEBSD12
if (vlr.vlr_proto == 0)
vlr.vlr_proto = ETHERTYPE_VLAN;
#endif
oldmtu = ifp->if_mtu; oldmtu = ifp->if_mtu;
error = vlan_config(ifv, p, vlr.vlr_tag, vlr.vlr_proto); error = vlan_config(ifv, p, vlr.vlr_tag, vlr.vlr_proto);
if_rele(p); if_rele(p);