diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-05-26 03:01:55 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-05-26 03:01:55 +0000 |
commit | d84f7db4390fc80c712737fd4c60a8c59361eef4 (patch) | |
tree | defd4ba12b0280cb2d0b26b6c46cf294a769abfb /sys/net/if_vlan.c | |
parent | 514efe9b8e6cb6d88e92f50cd5c4f62a6e435a81 (diff) |
make vlans inherit their parents hardmtu as well as mtu.
from brad@ and tested locally.
Diffstat (limited to 'sys/net/if_vlan.c')
-rw-r--r-- | sys/net/if_vlan.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 218fe2b6d5c..cc4691e3e82 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.124 2015/05/23 08:32:12 mpi Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.125 2015/05/26 03:01:54 dlg Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -394,10 +394,13 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, u_int16_t tag) ifv->ifv_p = p; ifv->ifv_if.if_baudrate = p->if_baudrate; - if (p->if_capabilities & IFCAP_VLAN_MTU) + if (p->if_capabilities & IFCAP_VLAN_MTU) { ifv->ifv_if.if_mtu = p->if_mtu; - else + ifv->ifv_if.if_hardmtu = p->if_hardmtu; + } else { ifv->ifv_if.if_mtu = p->if_mtu - EVL_ENCAPLEN; + ifv->ifv_if.if_hardmtu = p->if_hardmtu - EVL_ENCAPLEN; + } ifv->ifv_if.if_flags = p->if_flags & (IFF_UP | IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST); @@ -510,6 +513,7 @@ vlan_unconfig(struct ifnet *ifp, struct ifnet *newp) /* Disconnect from parent. */ ifv->ifv_p = NULL; ifv->ifv_if.if_mtu = ETHERMTU; + ifv->ifv_if.if_hardmtu = ETHERMTU; ifv->ifv_flags = 0; /* Clear our MAC address. */ @@ -562,7 +566,7 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct ifreq *ifr; struct ifvlan *ifv; struct vlanreq vlr; - int error = 0, p_mtu = 0, s; + int error = 0, s; ifr = (struct ifreq *)data; ifa = (struct ifaddr *)data; @@ -590,12 +594,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) case SIOCSIFMTU: if (ifv->ifv_p != NULL) { - if (ifv->ifv_p->if_capabilities & IFCAP_VLAN_MTU) - p_mtu = ifv->ifv_p->if_hardmtu; - else - p_mtu = ifv->ifv_p->if_hardmtu - EVL_ENCAPLEN; - - if (ifr->ifr_mtu > p_mtu || ifr->ifr_mtu < ETHERMIN) + if (ifr->ifr_mtu < ETHERMIN || + ifr->ifr_mtu > ifv->ifv_if.if_hardmtu) error = EINVAL; else ifp->if_mtu = ifr->ifr_mtu; |