mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
Stop tinkering with the parent's VLAN_MTU capability.
Now it is user-controlled through ifconfig(8). The former ``automagic'' way of operation created more trouble than good. First, VLAN_MTU consumers other than vlan(4) had appeared, e.g., ng_vlan(4). Second, there was no way to disable VLAN_MTU manually if it were causing trouble, e.g., data corruption. Dropping the ``automagic'' should be completely invisible to the user since a) all the drivers supporting VLAN_MTU have it enabled by default, and in the first place b) there is only one driver that can really toggle VLAN_MTU in the hardware under its control (it's fxp(4), to which I added VLAN_MTU controls to illustrate the principle.)
This commit is contained in:
parent
e82866fea6
commit
d6fcfb7ae1
1 changed files with 7 additions and 27 deletions
|
|
@ -650,27 +650,18 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p)
|
|||
ifv->ifv_mintu = ETHERMIN;
|
||||
ifv->ifv_flags = 0;
|
||||
|
||||
/*
|
||||
* The active VLAN counter on the parent is used
|
||||
* at various places to see if there is a vlan(4)
|
||||
* attached to this physical interface.
|
||||
*/
|
||||
p->if_nvlans++;
|
||||
|
||||
/*
|
||||
* If the parent supports the VLAN_MTU capability,
|
||||
* i.e. can Tx/Rx larger than ETHER_MAX_LEN frames,
|
||||
* use it.
|
||||
* First of all, enable Tx/Rx of such extended frames on the
|
||||
* parent if it's disabled and we're the first to attach.
|
||||
*/
|
||||
p->if_nvlans++;
|
||||
if (p->if_nvlans == 1 &&
|
||||
(p->if_capabilities & IFCAP_VLAN_MTU) &&
|
||||
(p->if_capenable & IFCAP_VLAN_MTU) == 0) {
|
||||
struct ifreq ifr;
|
||||
int error;
|
||||
|
||||
ifr.ifr_reqcap = p->if_capenable | IFCAP_VLAN_MTU;
|
||||
error = (*p->if_ioctl)(p, SIOCSIFCAP, (caddr_t) &ifr);
|
||||
if (error) {
|
||||
p->if_nvlans--;
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
if (p->if_capenable & IFCAP_VLAN_MTU) {
|
||||
/*
|
||||
* No need to fudge the MTU since the parent can
|
||||
|
|
@ -777,17 +768,6 @@ vlan_unconfig(struct ifnet *ifp)
|
|||
}
|
||||
|
||||
p->if_nvlans--;
|
||||
if (p->if_nvlans == 0) {
|
||||
struct ifreq ifr;
|
||||
|
||||
/*
|
||||
* Try to disable Tx/Rx of VLAN-sized frames.
|
||||
* This may have no effect for some interfaces,
|
||||
* but only the parent driver knows that.
|
||||
*/
|
||||
ifr.ifr_reqcap = p->if_capenable & ~IFCAP_VLAN_MTU;
|
||||
(*p->if_ioctl)(p, SIOCSIFCAP, (caddr_t) &ifr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Disconnect from parent. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue