Index: arch/sparc64/conf/GENERIC =================================================================== RCS file: /cvs/src/sys/arch/sparc64/conf/GENERIC,v retrieving revision 1.300 diff -u -p -r1.300 GENERIC --- arch/sparc64/conf/GENERIC 8 Jan 2016 09:48:42 -0000 1.300 +++ arch/sparc64/conf/GENERIC 9 Feb 2016 06:11:34 -0000 @@ -26,6 +26,8 @@ option WSEMUL_NO_VT100 # do not provide option WSEMUL_DUMB option WSDISPLAY_COMPAT_RAWKBD # provide raw scancodes; needed for X11 +makeoption DEBUG="-g" + config bsd swap generic # Main bus and CPU .. all systems. Index: kern/uipc_mbuf.c =================================================================== RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v retrieving revision 1.218 diff -u -p -r1.218 uipc_mbuf.c --- kern/uipc_mbuf.c 31 Jan 2016 00:18:07 -0000 1.218 +++ kern/uipc_mbuf.c 9 Feb 2016 06:11:34 -0000 @@ -1213,6 +1213,40 @@ m_dup_pkthdr(struct mbuf *to, struct mbu return (0); } +struct mbuf * +m_dup_pkt(struct mbuf *m0, unsigned int adj, int wait) +{ + struct mbuf *m; + int len; + + len = m0->m_pkthdr.len + adj; + if (len > MAXMCLBYTES) /* XXX */ + return (NULL); + + m = m_get(m0->m_type, wait); + if (m == NULL) + return (NULL); + + if (m_dup_pkthdr(m, m0, wait) != 0) + goto fail; + + if (len > MHLEN) { + MCLGETI(m, len, NULL, wait); + if (!ISSET(m->m_flags, M_EXT)) + goto fail; + } + + m->m_len = m->m_pkthdr.len = len; + m_adj(m, adj); + m_copydata(m0, 0, m0->m_pkthdr.len, mtod(m, caddr_t)); + + return (m); + +fail: + m_freem(m); + return (NULL); +} + #ifdef DDB void m_print(void *v, Index: net/bpf.c =================================================================== RCS file: /cvs/src/sys/net/bpf.c,v retrieving revision 1.133 diff -u -p -r1.133 bpf.c --- net/bpf.c 5 Feb 2016 13:17:37 -0000 1.133 +++ net/bpf.c 9 Feb 2016 06:11:34 -0000 @@ -1143,6 +1143,7 @@ bpf_tap(caddr_t arg, u_char *pkt, u_int size_t slen; struct timeval tv; int drop = 0, gottime = 0; + int s; if (bp == NULL) return (0); @@ -1168,10 +1169,12 @@ bpf_tap(caddr_t arg, u_char *pkt, u_int microtime(&tv); KERNEL_LOCK(); + s = splnet(); if (d->bd_bif != NULL) { bpf_catchpacket(d, pkt, pktlen, slen, bcopy, &tv); } + splx(s); KERNEL_UNLOCK(); if (d->bd_fildrop) @@ -1221,6 +1224,7 @@ _bpf_mtap(caddr_t arg, struct mbuf *m, u struct mbuf *m0; struct timeval tv; int gottime = 0; + int s; if (m == NULL) return; @@ -1258,10 +1262,12 @@ _bpf_mtap(caddr_t arg, struct mbuf *m, u microtime(&tv); KERNEL_LOCK(); + s = splnet(); if (d->bd_bif != NULL) { bpf_catchpacket(d, (u_char *)m, pktlen, slen, cpfn, &tv); } + splx(s); KERNEL_UNLOCK(); if (d->bd_fildrop) Index: net/if.h =================================================================== RCS file: /cvs/src/sys/net/if.h,v retrieving revision 1.175 diff -u -p -r1.175 if.h --- net/if.h 5 Dec 2015 19:04:37 -0000 1.175 +++ net/if.h 9 Feb 2016 06:11:34 -0000 @@ -378,6 +378,7 @@ struct ifreq { #define ifr_ttl ifr_ifru.ifru_metric /* tunnel TTL (overload) */ #define ifr_data ifr_ifru.ifru_data /* for use by interface */ #define ifr_index ifr_ifru.ifru_index /* interface index */ +#define ifr_refcnt ifr_ifru.ifru_index /* reference count (overload) */ }; struct ifaliasreq { Index: net/if_bridge.c =================================================================== RCS file: /cvs/src/sys/net/if_bridge.c,v retrieving revision 1.275 diff -u -p -r1.275 if_bridge.c --- net/if_bridge.c 5 Dec 2015 10:07:55 -0000 1.275 +++ net/if_bridge.c 9 Feb 2016 06:11:34 -0000 @@ -137,7 +137,6 @@ int bridge_ipsec(struct bridge_softc *, int bridge_clone_create(struct if_clone *, int); int bridge_clone_destroy(struct ifnet *ifp); int bridge_delete(struct bridge_softc *, struct bridge_iflist *); -struct mbuf *bridge_m_dup(struct mbuf *); #define ETHERADDR_IS_IP_MCAST(a) \ /* struct etheraddr *a; */ \ @@ -800,7 +799,7 @@ bridge_output(struct ifnet *ifp, struct used = 1; mc = m; } else { - mc = bridge_m_dup(m); + mc = m_dup_pkt(m, ETHER_ALIGN, M_DONTWAIT); if (mc == NULL) { sc->sc_if.if_oerrors++; continue; @@ -1090,7 +1089,7 @@ bridge_process(struct ifnet *ifp, struct (ifl->bif_state == BSTP_IFSTATE_DISCARDING)) goto reenqueue; - mc = bridge_m_dup(m); + mc = m_dup_pkt(m, ETHER_ALIGN, M_DONTWAIT); if (mc == NULL) goto reenqueue; @@ -1227,7 +1226,7 @@ bridge_broadcast(struct bridge_softc *sc mc = m; used = 1; } else { - mc = bridge_m_dup(m); + mc = m_dup_pkt(m, ETHER_ALIGN, M_DONTWAIT); if (mc == NULL) { sc->sc_if.if_oerrors++; continue; @@ -1277,7 +1276,7 @@ bridge_localbroadcast(struct bridge_soft return; } - m1 = bridge_m_dup(m); + m1 = m_dup_pkt(m, ETHER_ALIGN, M_DONTWAIT); if (m1 == NULL) { sc->sc_if.if_oerrors++; return; @@ -2017,37 +2016,4 @@ bridge_copyaddr(struct sockaddr *src, st memcpy(dst, src, src->sa_len); else dst->sa_family = AF_UNSPEC; -} - -/* - * Specialized deep copy to ensure that the payload after the Ethernet - * header is nicely aligned. - */ -struct mbuf * -bridge_m_dup(struct mbuf *m) -{ - struct mbuf *m1, *m2, *mx; - - m1 = m_copym2(m, 0, ETHER_HDR_LEN, M_DONTWAIT); - if (m1 == NULL) { - return (NULL); - } - m2 = m_copym2(m, ETHER_HDR_LEN, M_COPYALL, M_DONTWAIT); - if (m2 == NULL) { - m_freem(m1); - return (NULL); - } - - for (mx = m1; mx->m_next != NULL; mx = mx->m_next) - /*EMPTY*/; - mx->m_next = m2; - - if (m1->m_flags & M_PKTHDR) { - int len = 0; - for (mx = m1; mx != NULL; mx = mx->m_next) - len += mx->m_len; - m1->m_pkthdr.len = len; - } - - return (m1); } Index: netinet/ip_carp.c =================================================================== RCS file: /cvs/src/sys/netinet/ip_carp.c,v retrieving revision 1.286 diff -u -p -r1.286 ip_carp.c --- netinet/ip_carp.c 21 Jan 2016 11:23:48 -0000 1.286 +++ netinet/ip_carp.c 9 Feb 2016 06:11:34 -0000 @@ -210,6 +210,7 @@ int carp_input(struct ifnet *, struct mb void carp_proto_input_c(struct ifnet *, struct mbuf *, struct carp_header *, int, sa_family_t); void carp_proto_input_if(struct ifnet *, struct mbuf *, int); +int carp_input_mcast(struct carp_softc *, struct mbuf *); void carpattach(int); void carpdetach(struct carp_softc *); int carp_prepare_ad(struct mbuf *, struct carp_vhost_entry *, @@ -1429,13 +1430,15 @@ carp_input(struct ifnet *ifp0, struct mb if (!(sc->sc_if.if_flags & IFF_UP)) continue; - m0 = m_copym2(m, 0, M_COPYALL, M_DONTWAIT); + m0 = m_dup_pkt(m, max_linkhdr + ETHER_ALIGN, + M_DONTWAIT); + + /* if we cant send one we probably cant send more */ if (m0 == NULL) - continue; + break; ml_init(&ml); ml_enqueue(&ml, m0); - if_input(&sc->sc_if, &ml); } SRPL_LEAVE(&i, sc); Index: sys/mbuf.h =================================================================== RCS file: /cvs/src/sys/sys/mbuf.h,v retrieving revision 1.207 diff -u -p -r1.207 mbuf.h --- sys/mbuf.h 31 Jan 2016 00:18:07 -0000 1.207 +++ sys/mbuf.h 9 Feb 2016 06:11:34 -0000 @@ -447,6 +447,7 @@ void m_cat(struct mbuf *, struct mbuf *) struct mbuf *m_devget(char *, int, int); int m_apply(struct mbuf *, int, int, int (*)(caddr_t, caddr_t, unsigned int), caddr_t); +struct mbuf *m_dup_pkt(struct mbuf *, unsigned int, int); int m_dup_pkthdr(struct mbuf *, struct mbuf *, int); /* Packet tag routines */