diff options
author | 2013-05-11 11:18:27 +0000 | |
---|---|---|
committer | 2013-05-11 11:18:27 +0000 | |
commit | 084aeae21e3c9918f670ab895ad5de756730fced (patch) | |
tree | 5a118b7b1d8af669face66581bb7318bf703978c | |
parent | whitespaces (diff) | |
download | wireguard-openbsd-084aeae21e3c9918f670ab895ad5de756730fced.tar.xz wireguard-openbsd-084aeae21e3c9918f670ab895ad5de756730fced.zip |
Set trunk(4)'s MTU to that of the first trunkport. Allows trunk to work with
jumbo/baby-jumbo frames. To avoid problems with mismatches between trunkports,
any additional ports must have the same MTU as already set on the trunk(4).
Based on changes made in FreeBSD. Tested by myself and jj@, ok reyk@
-rw-r--r-- | sys/net/if_trunk.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/net/if_trunk.c b/sys/net/if_trunk.c index 82a439f2c5b..a3565678207 100644 --- a/sys/net/if_trunk.c +++ b/sys/net/if_trunk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.c,v 1.81 2013/04/02 08:54:37 mpi Exp $ */ +/* $OpenBSD: if_trunk.c,v 1.82 2013/05/11 11:18:27 sthen Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter <reyk@openbsd.org> @@ -313,6 +313,19 @@ trunk_port_create(struct trunk_softc *tr, struct ifnet *ifp) if (ifp->if_type != IFT_ETHER) return (EPROTONOSUPPORT); + /* Take MTU from the first member port */ + if (SLIST_EMPTY(&tr->tr_ports)) { + if (tr->tr_ifflags & IFF_DEBUG) + printf("%s: first port, setting trunk mtu %u\n", + tr->tr_ifname, ifp->if_mtu); + tr->tr_ac.ac_if.if_mtu = ifp->if_mtu; + tr->tr_ac.ac_if.if_hardmtu = ifp->if_mtu; + } else if (tr->tr_ac.ac_if.if_mtu != ifp->if_mtu) { + printf("%s: adding %s failed, MTU %u != %u\n", tr->tr_ifname, + ifp->if_xname, ifp->if_mtu, tr->tr_ac.ac_if.if_mtu); + return (EINVAL); + } + if ((error = ifpromisc(ifp, 1)) != 0) return (error); @@ -509,6 +522,10 @@ trunk_port_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) trunk_port2req(tp, rp); break; + case SIOCSIFMTU: + /* Do not allow the MTU to be changed once joined */ + error = EINVAL; + break; default: error = ENOTTY; goto fallback; |