Now that the stack is ready, here's a diff to take the first victim,
trunk(4), out of ether_input().

If you glanced over previous versions of this diff, the differences
are mostly in sys/net/trunklacp.c and include some printf(9) fixes
in bonus.

Ok?

Index: net/if_ethersubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.195
diff -u -p -r1.195 if_ethersubr.c
--- net/if_ethersubr.c  4 May 2015 10:24:08 -0000       1.195
+++ net/if_ethersubr.c  5 May 2015 12:10:25 -0000
@@ -463,9 +463,6 @@ ether_input(struct mbuf *m, void *hdr)
        int llcfound = 0;
        struct llc *l;
        struct arpcom *ac;
-#if NTRUNK > 0
-       int i = 0;
-#endif
 #if NPPPOE > 0
        struct ether_header *eh_tmp;
 #endif
@@ -480,21 +477,6 @@ ether_input(struct mbuf *m, void *hdr)
                m_adj(m, ETHER_HDR_LEN);
        }
 
-#if NTRUNK > 0
-       /* Handle input from a trunk port */
-       while (ifp->if_type == IFT_IEEE8023ADLAG) {
-               if (++i > TRUNK_MAX_STACKING) {
-                       m_freem(m);
-                       return (1);
-               }
-               if (trunk_input(ifp, eh, m) != 0)
-                       return (1);
-
-               /* Has been set to the trunk interface */
-               ifp = m->m_pkthdr.rcvif;
-       }
-#endif
-
        if ((ifp->if_flags & IFF_UP) == 0) {
                m_freem(m);
                return (1);
@@ -518,17 +500,9 @@ ether_input(struct mbuf *m, void *hdr)
                else
                        m->m_flags |= M_MCAST;
                ifp->if_imcasts++;
-#if NTRUNK > 0
-               if (ifp != ifp0)
-                       ifp0->if_imcasts++;
-#endif
        }
 
        ifp->if_ibytes += m->m_pkthdr.len + sizeof(*eh);
-#if NTRUNK > 0
-       if (ifp != ifp0)
-               ifp0->if_ibytes += m->m_pkthdr.len + sizeof(*eh);
-#endif
 
        etype = ntohs(eh->ether_type);
 
Index: net/if_trunk.c
===================================================================
RCS file: /cvs/src/sys/net/if_trunk.c,v
retrieving revision 1.95
diff -u -p -r1.95 if_trunk.c
--- net/if_trunk.c      14 Mar 2015 03:38:51 -0000      1.95
+++ net/if_trunk.c      5 May 2015 13:09:53 -0000
@@ -94,14 +94,14 @@ int  trunk_rr_detach(struct trunk_softc 
 void    trunk_rr_port_destroy(struct trunk_port *);
 int     trunk_rr_start(struct trunk_softc *, struct mbuf *);
 int     trunk_rr_input(struct trunk_softc *, struct trunk_port *,
-           struct ether_header *, struct mbuf *);
+           struct mbuf *);
 
 /* Active failover */
 int     trunk_fail_attach(struct trunk_softc *);
 int     trunk_fail_detach(struct trunk_softc *);
 int     trunk_fail_start(struct trunk_softc *, struct mbuf *);
 int     trunk_fail_input(struct trunk_softc *, struct trunk_port *,
-           struct ether_header *, struct mbuf *);
+           struct mbuf *);
 
 /* Loadbalancing */
 int     trunk_lb_attach(struct trunk_softc *);
@@ -110,7 +110,7 @@ int  trunk_lb_port_create(struct trunk_p
 void    trunk_lb_port_destroy(struct trunk_port *);
 int     trunk_lb_start(struct trunk_softc *, struct mbuf *);
 int     trunk_lb_input(struct trunk_softc *, struct trunk_port *,
-           struct ether_header *, struct mbuf *);
+           struct mbuf *);
 int     trunk_lb_porttable(struct trunk_softc *, struct trunk_port *);
 
 /* Broadcast mode */
@@ -118,14 +118,14 @@ int        trunk_bcast_attach(struct trunk_sof
 int     trunk_bcast_detach(struct trunk_softc *);
 int     trunk_bcast_start(struct trunk_softc *, struct mbuf *);
 int     trunk_bcast_input(struct trunk_softc *, struct trunk_port *,
-           struct ether_header *, struct mbuf *);
+           struct mbuf *);
 
 /* 802.3ad LACP */
 int     trunk_lacp_attach(struct trunk_softc *);
 int     trunk_lacp_detach(struct trunk_softc *);
 int     trunk_lacp_start(struct trunk_softc *, struct mbuf *);
 int     trunk_lacp_input(struct trunk_softc *, struct trunk_port *,
-           struct ether_header *, struct mbuf *);
+           struct mbuf *);
 
 /* Trunk protocol table */
 static const struct {
@@ -288,6 +288,7 @@ trunk_port_create(struct trunk_softc *tr
 {
        struct trunk_softc *tr_ptr;
        struct trunk_port *tp;
+       struct ifih *trunk_ifih;
        int error = 0;
 
        /* Limit the maximal number of trunk ports */
@@ -326,12 +327,19 @@ trunk_port_create(struct trunk_softc *tr
            M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
                return (ENOMEM);
 
+       trunk_ifih = malloc(sizeof(*trunk_ifih), M_DEVBUF, M_NOWAIT);
+       if (trunk_ifih == NULL) {
+               free(tp, M_DEVBUF, 0);
+               return (ENOMEM);
+       }
+
        /* Check if port is a stacked trunk */
        SLIST_FOREACH(tr_ptr, &trunk_list, tr_entries) {
                if (ifp == &tr_ptr->tr_ac.ac_if) {
                        tp->tp_flags |= TRUNK_PORT_STACK;
                        if (trunk_port_checkstacking(tr_ptr) >=
                            TRUNK_MAX_STACKING) {
+                               free(trunk_ifih, M_DEVBUF, sizeof(*trunk_ifih));
                                free(tp, M_DEVBUF, 0);
                                return (E2BIG);
                        }
@@ -341,6 +349,11 @@ trunk_port_create(struct trunk_softc *tr
        /* Change the interface type */
        tp->tp_iftype = ifp->if_type;
        ifp->if_type = IFT_IEEE8023ADLAG;
+
+       /* Change input handler of the physical interface. */
+       trunk_ifih->ifih_input = trunk_input;
+       SLIST_INSERT_HEAD(&ifp->if_inputs, trunk_ifih, ifih_next);
+
        ifp->if_tp = (caddr_t)tp;
        tp->tp_ioctl = ifp->if_ioctl;
        ifp->if_ioctl = trunk_port_ioctl;
@@ -411,6 +424,7 @@ trunk_port_destroy(struct trunk_port *tp
 {
        struct trunk_softc *tr = (struct trunk_softc *)tp->tp_trunk;
        struct trunk_port *tp_ptr;
+       struct ifih *trunk_ifih;
        struct ifnet *ifp = tp->tp_if;
 
        if (tr->tr_port_destroy != NULL)
@@ -425,8 +439,15 @@ trunk_port_destroy(struct trunk_port *tp
 
        ifpromisc(ifp, 0);
 
-       /* Restore interface */
+       /* Restore interface type. */
        ifp->if_type = tp->tp_iftype;
+
+       /* Restore previous input handler. */
+       trunk_ifih = SLIST_FIRST(&ifp->if_inputs);
+       SLIST_REMOVE_HEAD(&ifp->if_inputs, ifih_next);
+       KASSERT(trunk_ifih->ifih_input == trunk_input);
+       free(trunk_ifih, M_DEVBUF, sizeof(*trunk_ifih));
+
        ifp->if_watchdog = tp->tp_watchdog;
        ifp->if_ioctl = tp->tp_ioctl;
        ifp->if_tp = NULL;
@@ -1073,12 +1094,24 @@ trunk_watchdog(struct ifnet *ifp)
 }
 
 int
-trunk_input(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m)
+trunk_input(struct mbuf *m, void *hdr)
 {
+       struct ifnet *ifp;
        struct trunk_softc *tr;
        struct trunk_port *tp;
        struct ifnet *trifp = NULL;
-       int error = 0;
+       struct ether_header *eh = hdr;
+       int error;
+
+       ifp = m->m_pkthdr.rcvif;
+
+       if (eh == NULL)
+               eh = mtod(m, struct ether_header *);
+
+       if (ETHER_IS_MULTICAST(eh->ether_dhost))
+               ifp->if_imcasts++;
+
+       ifp->if_ibytes += m->m_pkthdr.len;
 
        /* Should be checked by the caller */
        if (ifp->if_type != IFT_IEEE8023ADLAG) {
@@ -1098,19 +1131,24 @@ trunk_input(struct ifnet *ifp, struct et
 
 #if NBPFILTER > 0
        if (trifp->if_bpf && tr->tr_proto != TRUNK_PROTO_FAILOVER)
-               bpf_mtap_hdr(trifp->if_bpf, (char *)eh, ETHER_HDR_LEN, m,
-                   BPF_DIRECTION_IN, NULL);
+               bpf_mtap_ether(trifp->if_bpf, m, BPF_DIRECTION_IN);
 #endif
 
-       error = (*tr->tr_input)(tr, tp, eh, m);
-       if (error != 0)
-               return (error);
+       if ((*tr->tr_input)(tr, tp, m)) {
+               /*
+                * We stop here if the packet has been consumed
+                * by the protocol routine.
+                */
+               m_freem(m);
+               return (1);
+       }
 
        trifp->if_ipackets++;
+       m->m_pkthdr.rcvif = trifp;
        return (0);
 
  bad:
-       if (error > 0 && trifp != NULL)
+       if (trifp != NULL)
                trifp->if_ierrors++;
        m_freem(m);
        return (error);
@@ -1290,14 +1328,9 @@ trunk_rr_start(struct trunk_softc *tr, s
 }
 
 int
-trunk_rr_input(struct trunk_softc *tr, struct trunk_port *tp,
-    struct ether_header *eh, struct mbuf *m)
+trunk_rr_input(struct trunk_softc *tr, struct trunk_port *tp, struct mbuf *m)
 {
-       struct ifnet *ifp = &tr->tr_ac.ac_if;
-
        /* Just pass in the packet to our trunk device */
-       m->m_pkthdr.rcvif = ifp;
-
        return (0);
 }
 
@@ -1344,8 +1377,7 @@ trunk_fail_start(struct trunk_softc *tr,
 }
 
 int
-trunk_fail_input(struct trunk_softc *tr, struct trunk_port *tp,
-    struct ether_header *eh, struct mbuf *m)
+trunk_fail_input(struct trunk_softc *tr, struct trunk_port *tp, struct mbuf *m)
 {
        struct ifnet *ifp = &tr->tr_ac.ac_if;
        struct trunk_port *tmp_tp;
@@ -1362,17 +1394,13 @@ trunk_fail_input(struct trunk_softc *tr,
                if ((tmp_tp == NULL || tmp_tp == tp))
                        accept = 1;
        }
-       if (!accept) {
-               m_freem(m);
+       if (!accept)
                return (-1);
-       }
 #if NBPFILTER > 0
        if (ifp->if_bpf)
-               bpf_mtap_hdr(ifp->if_bpf, (char *)eh, ETHER_HDR_LEN, m,
-                   BPF_DIRECTION_IN, NULL);
+               bpf_mtap_ether(ifp->if_bpf, m, BPF_DIRECTION_IN);
 #endif
 
-       m->m_pkthdr.rcvif = ifp;
        return (0);
 }
 
@@ -1476,14 +1504,9 @@ trunk_lb_start(struct trunk_softc *tr, s
 }
 
 int
-trunk_lb_input(struct trunk_softc *tr, struct trunk_port *tp,
-    struct ether_header *eh, struct mbuf *m)
+trunk_lb_input(struct trunk_softc *tr, struct trunk_port *tp, struct mbuf *m)
 {
-       struct ifnet *ifp = &tr->tr_ac.ac_if;
-
        /* Just pass in the packet to our trunk device */
-       m->m_pkthdr.rcvif = ifp;
-
        return (0);
 }
 
@@ -1559,12 +1582,8 @@ trunk_bcast_start(struct trunk_softc *tr
 }
 
 int
-trunk_bcast_input(struct trunk_softc *tr, struct trunk_port *tp,
-    struct ether_header *eh, struct mbuf *m)
+trunk_bcast_input(struct trunk_softc *tr, struct trunk_port *tp, struct mbuf 
*m)
 {
-       struct ifnet *ifp = &tr->tr_ac.ac_if;
-
-       m->m_pkthdr.rcvif = ifp;
        return (0);
 }
 
@@ -1630,15 +1649,7 @@ trunk_lacp_start(struct trunk_softc *tr,
 }
 
 int
-trunk_lacp_input(struct trunk_softc *tr, struct trunk_port *tp,
-    struct ether_header *eh, struct mbuf *m)
+trunk_lacp_input(struct trunk_softc *tr, struct trunk_port *tp, struct mbuf *m)
 {
-       struct ifnet *ifp = &tr->tr_ac.ac_if;
-
-       m = lacp_input(tp, eh, m);
-       if (m == NULL)
-               return (-1);
-
-       m->m_pkthdr.rcvif = ifp;
-       return (0);
+       return (lacp_input(tp, m));
 }
Index: net/if_trunk.h
===================================================================
RCS file: /cvs/src/sys/net/if_trunk.h,v
retrieving revision 1.19
diff -u -p -r1.19 if_trunk.h
--- net/if_trunk.h      4 Dec 2014 00:01:53 -0000       1.19
+++ net/if_trunk.h      5 May 2015 12:10:25 -0000
@@ -194,7 +194,7 @@ struct trunk_softc {
        int     (*tr_start)(struct trunk_softc *, struct mbuf *);
        int     (*tr_watchdog)(struct trunk_softc *);
        int     (*tr_input)(struct trunk_softc *, struct trunk_port *,
-                   struct ether_header *, struct mbuf *);
+                   struct mbuf *);
        int     (*tr_port_create)(struct trunk_port *);
        void    (*tr_port_destroy)(struct trunk_port *);
        void    (*tr_linkstate)(struct trunk_port *);
@@ -219,8 +219,7 @@ struct trunk_lb {
        struct trunk_port       *lb_ports[TRUNK_MAX_PORTS];
 };
 
-int            trunk_input(struct ifnet *, struct ether_header *,
-                   struct mbuf *);
+int            trunk_input(struct mbuf *, void *);
 int            trunk_enqueue(struct ifnet *, struct mbuf *);
 u_int32_t      trunk_hashmbuf(struct mbuf *, SIPHASH_KEY *);
 #endif /* _KERNEL */
Index: net/trunklacp.c
===================================================================
RCS file: /cvs/src/sys/net/trunklacp.c,v
retrieving revision 1.19
diff -u -p -r1.19 trunklacp.c
--- net/trunklacp.c     14 Mar 2015 03:38:51 -0000      1.19
+++ net/trunklacp.c     5 May 2015 13:48:20 -0000
@@ -122,10 +122,8 @@ void               lacp_aggregator_delref(struct lacp
 
 /* receive machine */
 
-int            lacp_pdu_input(struct lacp_port *,
-                   struct ether_header *, struct mbuf *);
-int            lacp_marker_input(struct lacp_port *,
-                   struct ether_header *, struct mbuf *);
+int            lacp_pdu_input(struct lacp_port *, struct mbuf *);
+int            lacp_marker_input(struct lacp_port *, struct mbuf *);
 void           lacp_sm_rx(struct lacp_port *, const struct lacpdu *);
 void           lacp_sm_rx_timer(struct lacp_port *);
 void           lacp_sm_rx_set_expired(struct lacp_port *);
@@ -219,29 +217,30 @@ const lacp_timer_func_t lacp_timer_funcs
        [LACP_TIMER_WAIT_WHILE] = lacp_sm_mux_timer,
 };
 
-struct mbuf *
-lacp_input(struct trunk_port *tp, struct ether_header *eh, struct mbuf *m)
+int
+lacp_input(struct trunk_port *tp, struct mbuf *m)
 {
        struct lacp_port *lp = LACP_PORT(tp);
        struct lacp_softc *lsc = lp->lp_lsc;
        struct lacp_aggregator *la = lp->lp_aggregator;
+       struct ether_header *eh;
        u_int8_t subtype;
 
+       eh = mtod(m, struct ether_header *);
+
        if (ntohs(eh->ether_type) == ETHERTYPE_SLOW) {
-               if (m->m_pkthdr.len < sizeof(subtype)) {
-                       m_freem(m);
-                       return (NULL);
-               }
-               subtype = *mtod(m, u_int8_t *);
+               if (m->m_pkthdr.len < (sizeof(*eh) + sizeof(subtype)))
+                       return (-1);
 
+               m_copydata(m, sizeof(*eh), sizeof(subtype), &subtype);
                switch (subtype) {
                case SLOWPROTOCOLS_SUBTYPE_LACP:
-                       lacp_pdu_input(lp, eh, m);
-                       return (NULL);
+                       lacp_pdu_input(lp, m);
+                       return (1);
 
                case SLOWPROTOCOLS_SUBTYPE_MARKER:
-                       lacp_marker_input(lp, eh, m);
-                       return (NULL);
+                       lacp_marker_input(lp, m);
+                       return (1);
                }
        }
 
@@ -251,20 +250,18 @@ lacp_input(struct trunk_port *tp, struct
         */
        /* This port is joined to the active aggregator */
        if ((lp->lp_state & LACP_STATE_COLLECTING) == 0 ||
-           la == NULL || la != lsc->lsc_active_aggregator) {
-               m_freem(m);
-               return (NULL);
-       }
+           la == NULL || la != lsc->lsc_active_aggregator)
+               return (-1);
 
        /* Not a subtype we are interested in */
-       return (m);
+       return (0);
 }
 
 /*
  * lacp_pdu_input: process lacpdu
  */
 int
-lacp_pdu_input(struct lacp_port *lp, struct ether_header *eh, struct mbuf *m)
+lacp_pdu_input(struct lacp_port *lp, struct mbuf *m)
 {
        struct lacpdu *du;
        int error = 0;
@@ -280,7 +277,7 @@ lacp_pdu_input(struct lacp_port *lp, str
        }
        du = mtod(m, struct lacpdu *);
 
-       if (memcmp(&eh->ether_dhost,
+       if (memcmp(&du->ldu_eh.ether_dhost,
            &ethermulticastaddr_slowprotocols, ETHER_ADDR_LEN))
                goto bad;
 
@@ -308,11 +305,9 @@ lacp_pdu_input(struct lacp_port *lp, str
 
        lacp_sm_rx(lp, du);
 
-       m_freem(m);
        return (error);
 
 bad:
-       m_freem(m);
        return (EINVAL);
 }
 
@@ -346,28 +341,23 @@ lacp_xmit_lacpdu(struct lacp_port *lp)
 {
        struct trunk_port *tp = lp->lp_trunk;
        struct mbuf *m;
-       struct ether_header *eh;
        struct lacpdu *du;
        int error, s;
 
        m = m_gethdr(M_DONTWAIT, MT_DATA);
        if (m == NULL)
                return (ENOMEM);
-       m->m_len = m->m_pkthdr.len = sizeof(*eh) + sizeof(*du);
+       m->m_len = m->m_pkthdr.len = sizeof(*du);
        m->m_pkthdr.pf.prio = LACP_IFQ_PRIO;
 
-       eh = mtod(m, struct ether_header *);
-       memcpy(&eh->ether_dhost, ethermulticastaddr_slowprotocols,
-           ETHER_ADDR_LEN);
-       memcpy(&eh->ether_shost, tp->tp_lladdr, ETHER_ADDR_LEN);
-       eh->ether_type = htons(ETHERTYPE_SLOW);
-
-       m->m_data += sizeof(*eh);
        du = mtod(m, struct lacpdu *);
-       m->m_data -= sizeof(*eh);
-
        memset(du, 0, sizeof(*du));
 
+       memcpy(&du->ldu_eh.ether_dhost, ethermulticastaddr_slowprotocols,
+           ETHER_ADDR_LEN);
+       memcpy(&du->ldu_eh.ether_shost, tp->tp_lladdr, ETHER_ADDR_LEN);
+       du->ldu_eh.ether_type = htons(ETHERTYPE_SLOW);
+
        du->ldu_sph.sph_subtype = SLOWPROTOCOLS_SUBTYPE_LACP;
        du->ldu_sph.sph_version = 1;
 
@@ -404,28 +394,23 @@ lacp_xmit_marker(struct lacp_port *lp)
 {
        struct trunk_port *tp = lp->lp_trunk;
        struct mbuf *m;
-       struct ether_header *eh;
        struct markerdu *mdu;
        int error, s;
 
        m = m_gethdr(M_DONTWAIT, MT_DATA);
        if (m == NULL)
                return (ENOMEM);
-       m->m_len = m->m_pkthdr.len = sizeof(*eh) + sizeof(*mdu);
+       m->m_len = m->m_pkthdr.len = sizeof(*mdu);
        m->m_pkthdr.pf.prio = LACP_IFQ_PRIO;
 
-       eh = mtod(m, struct ether_header *);
-       memcpy(&eh->ether_dhost, ethermulticastaddr_slowprotocols,
-           ETHER_ADDR_LEN);
-       memcpy(&eh->ether_shost, tp->tp_lladdr, ETHER_ADDR_LEN);
-       eh->ether_type = htons(ETHERTYPE_SLOW);
-
-       m->m_data += sizeof(*eh);
        mdu = mtod(m, struct markerdu *);
-       m->m_data -= sizeof(*eh);
-
        memset(mdu, 0, sizeof(*mdu));
 
+       memcpy(&mdu->mdu_eh.ether_dhost, ethermulticastaddr_slowprotocols,
+           ETHER_ADDR_LEN);
+       memcpy(&mdu->mdu_eh.ether_shost, tp->tp_lladdr, ETHER_ADDR_LEN);
+       mdu->mdu_eh.ether_type = htons(ETHERTYPE_SLOW);
+
        mdu->mdu_sph.sph_subtype = SLOWPROTOCOLS_SUBTYPE_MARKER;
        mdu->mdu_sph.sph_version = 1;
 
@@ -434,8 +419,9 @@ lacp_xmit_marker(struct lacp_port *lp)
        TLV_SET(&mdu->mdu_tlv, MARKER_TYPE_INFO, sizeof(mdu->mdu_info));
        mdu->mdu_info = lp->lp_marker;
 
-       LACP_DPRINTF((lp, "marker transmit, port=%u, sys=%6D, id=%u\n",
-           ntohs(mdu->mdu_info.mi_rq_port), mdu->mdu_info.mi_rq_system, ":",
+       LACP_DPRINTF((lp, "marker transmit, port=%u, sys=%s, id=%u\n",
+           ntohs(mdu->mdu_info.mi_rq_port),
+           ether_sprintf(mdu->mdu_info.mi_rq_system),
            ntohl(mdu->mdu_info.mi_rq_xid)));
 
        m->m_flags |= M_MCAST;
@@ -1626,7 +1612,7 @@ lacp_run_timers(struct lacp_port *lp)
 }
 
 int
-lacp_marker_input(struct lacp_port *lp, struct ether_header *eh, struct mbuf 
*m)
+lacp_marker_input(struct lacp_port *lp, struct mbuf *m)
 {
        struct lacp_softc *lsc = lp->lp_lsc;
        struct trunk_port *tp = lp->lp_trunk;
@@ -1649,7 +1635,7 @@ lacp_marker_input(struct lacp_port *lp, 
 
        mdu = mtod(m, struct markerdu *);
 
-       if (memcmp(&eh->ether_dhost,
+       if (memcmp(&mdu->mdu_eh.ether_dhost,
            &ethermulticastaddr_slowprotocols, ETHER_ADDR_LEN))
                goto bad;
 
@@ -1663,9 +1649,9 @@ lacp_marker_input(struct lacp_port *lp, 
                        goto bad;
 
                mdu->mdu_tlv.tlv_type = MARKER_TYPE_RESPONSE;
-               memcpy(&eh->ether_dhost,
+               memcpy(&mdu->mdu_eh.ether_dhost,
                    &ethermulticastaddr_slowprotocols, ETHER_ADDR_LEN);
-               memcpy(&eh->ether_shost,
+               memcpy(&mdu->mdu_eh.ether_shost,
                    tp->tp_lladdr, ETHER_ADDR_LEN);
                error = trunk_enqueue(lp->lp_ifp, m);
                break;
@@ -1675,9 +1661,10 @@ lacp_marker_input(struct lacp_port *lp, 
                    marker_response_tlv_template, 1))
                        goto bad;
 
-               LACP_DPRINTF((lp, "marker response, port=%u, sys=%6D, id=%u\n",
-                   ntohs(mdu->mdu_info.mi_rq_port), mdu->mdu_info.mi_rq_system,
-                   ":", ntohl(mdu->mdu_info.mi_rq_xid)));
+               LACP_DPRINTF((lp, "marker response, port=%u, sys=%s, id=%u\n",
+                   ntohs(mdu->mdu_info.mi_rq_port),
+                   ether_sprintf(mdu->mdu_info.mi_rq_system),
+                   ntohl(mdu->mdu_info.mi_rq_xid)));
 
                /* Verify that it is the last marker we sent out */
                if (memcmp(&mdu->mdu_info, &lp->lp_marker,
@@ -1701,7 +1688,6 @@ lacp_marker_input(struct lacp_port *lp, 
                                lsc->lsc_suppress_distributing = 0;
                        }
                }
-               m_freem(m);
                break;
 
        default:
@@ -1712,7 +1698,6 @@ lacp_marker_input(struct lacp_port *lp, 
 
 bad:
        LACP_DPRINTF((lp, "bad marker frame\n"));
-       m_freem(m);
        return (EINVAL);
 }
 
Index: net/trunklacp.h
===================================================================
RCS file: /cvs/src/sys/net/trunklacp.h,v
retrieving revision 1.8
diff -u -p -r1.8 trunklacp.h
--- net/trunklacp.h     4 Dec 2014 00:01:53 -0000       1.8
+++ net/trunklacp.h     5 May 2015 13:00:49 -0000
@@ -87,6 +87,7 @@ struct lacp_collectorinfo {
 } __packed;
 
 struct lacpdu {
+       struct ether_header     ldu_eh;
        struct slowprothdr      ldu_sph;
 
        struct tlvhdr           ldu_tlv_actor;
@@ -153,6 +154,7 @@ struct lacp_markerinfo {
        "\010EXPIRED"
 
 struct markerdu {
+       struct ether_header     mdu_eh;
        struct slowprothdr      mdu_sph;
 
        struct tlvhdr           mdu_tlv;
@@ -260,8 +262,7 @@ struct lacp_softc {
 #define LACP_UNLOCK(_lsc)              mtx_unlock(&(_lsc)->lsc_mtx)
 #define LACP_LOCK_ASSERT(_lsc)         mtx_assert(&(_lsc)->lsc_mtx, MA_OWNED)
 
-struct mbuf    *lacp_input(struct trunk_port *,
-                   struct ether_header *, struct mbuf *);
+int            lacp_input(struct trunk_port *, struct mbuf *);
 struct trunk_port *lacp_select_tx_port(struct trunk_softc *, struct mbuf *);
 int            lacp_attach(struct trunk_softc *);
 int            lacp_detach(struct trunk_softc *);

Reply via email to