Hi,
the diff is needed - I was running into it quite recently when I was
trying some QinQ/svlan configurations on trunk.
Comments below, otherwise OK
reyk
On Fri, May 10, 2013 at 02:11:28PM +0100, Stuart Henderson wrote:
> Index: if_trunk.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_trunk.c,v
> retrieving revision 1.81
> diff -u -p -r1.81 if_trunk.c
> --- if_trunk.c 2 Apr 2013 08:54:37 -0000 1.81
> +++ if_trunk.c 10 May 2013 13:09:49 -0000
> @@ -313,6 +313,20 @@ trunk_port_create(struct trunk_softc *tr
> if (ifp->if_type != IFT_ETHER)
> return (EPROTONOSUPPORT);
>
> + /* Take MTU from the first member port */
I agree, using the MTU from the first port is the right way, at least
it matches trunk intended behaviour.
> + 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) {
Just a style comment - I don't like wrapping the else if on a new line ;)
But the check is correct.
> + 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);
>
> @@ -508,6 +522,10 @@ trunk_port_ioctl(struct ifnet *ifp, u_lo
> }
>
> trunk_port2req(tp, rp);
> + break;
> + case SIOCSIFMTU:
> + /* Do not allow the MTU to be changed once joined */
> + error = EINVAL;
> break;
> default:
> error = ENOTTY;
>