FreeBSD Bugzilla – Attachment 187326 Details for
Bug 217606
Bridge stops working after some days
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Diff of if_bridge.c for 11.0 and 11.1
if_bridge-11.x.diff (text/plain), 5.96 KB, created by
punkt.de Hosting Team
on 2017-10-20 13:53:05 UTC
(
hide
)
Description:
Diff of if_bridge.c for 11.0 and 11.1
Filename:
MIME Type:
Creator:
punkt.de Hosting Team
Created:
2017-10-20 13:53:05 UTC
Size:
5.96 KB
patch
obsolete
>*** if_bridge-11.0.c 2017-10-20 15:44:06.000000000 +0200 >--- if_bridge-11.1.c 2017-10-20 15:43:30.000000000 +0200 >*************** >*** 166,172 **** > /* > * List of capabilities to possibly mask on the member interface. > */ >! #define BRIDGE_IFCAPS_MASK (IFCAP_TOE|IFCAP_TSO|IFCAP_TXCSUM) > > /* > * List of capabilities to strip >--- 166,173 ---- > /* > * List of capabilities to possibly mask on the member interface. > */ >! #define BRIDGE_IFCAPS_MASK (IFCAP_TOE|IFCAP_TSO|IFCAP_TXCSUM|\ >! IFCAP_TXCSUM_IPV6) > > /* > * List of capabilities to strip >*************** >*** 332,338 **** > #ifdef INET6 > static int bridge_ip6_checkbasic(struct mbuf **mp); > #endif /* INET6 */ >! static int bridge_fragment(struct ifnet *, struct mbuf *, > struct ether_header *, int, struct llc *); > static void bridge_linkstate(struct ifnet *ifp); > static void bridge_linkcheck(struct bridge_softc *sc); >--- 333,339 ---- > #ifdef INET6 > static int bridge_ip6_checkbasic(struct mbuf **mp); > #endif /* INET6 */ >! static int bridge_fragment(struct ifnet *, struct mbuf **mp, > struct ether_header *, int, struct llc *); > static void bridge_linkstate(struct ifnet *ifp); > static void bridge_linkcheck(struct bridge_softc *sc); >*************** >*** 908,921 **** >--- 909,926 ---- > mask &= bif->bif_savedcaps; > } > >+ BRIDGE_XLOCK(sc); > LIST_FOREACH(bif, &sc->sc_iflist, bif_next) { > enabled = bif->bif_ifp->if_capenable; > enabled &= ~BRIDGE_IFCAPS_STRIP; > /* strip off mask bits and enable them again if allowed */ > enabled &= ~BRIDGE_IFCAPS_MASK; > enabled |= mask; >+ BRIDGE_UNLOCK(sc); > bridge_set_ifcap(sc, bif, enabled); >+ BRIDGE_LOCK(sc); > } >+ BRIDGE_XDROP(sc); > > } > >*************** >*** 926,931 **** >--- 931,938 ---- > struct ifreq ifr; > int error; > >+ BRIDGE_UNLOCK_ASSERT(sc); >+ > bzero(&ifr, sizeof(ifr)); > ifr.ifr_reqcap = set; > >*************** >*** 1916,1921 **** >--- 1923,1929 ---- > m->m_flags &= ~M_VLANTAG; > } > >+ M_ASSERTPKTHDR(m); /* We shouldn't transmit mbuf without pkthdr */ > if ((err = dst_ifp->if_transmit(dst_ifp, m))) { > m_freem(m0); > if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); >*************** >*** 3233,3242 **** > break; > > /* check if we need to fragment the packet */ > if (V_pfil_member && ifp != NULL && dir == PFIL_OUT) { > i = (*mp)->m_pkthdr.len; > if (i > ifp->if_mtu) { >! error = bridge_fragment(ifp, *mp, &eh2, snap, > &llc1); > return (error); > } >--- 3241,3252 ---- > break; > > /* check if we need to fragment the packet */ >+ /* bridge_fragment generates a mbuf chain of packets */ >+ /* that already include eth headers */ > if (V_pfil_member && ifp != NULL && dir == PFIL_OUT) { > i = (*mp)->m_pkthdr.len; > if (i > ifp->if_mtu) { >! error = bridge_fragment(ifp, mp, &eh2, snap, > &llc1); > return (error); > } >*************** >*** 3475,3530 **** > /* > * bridge_fragment: > * >! * Return a fragmented mbuf chain. > */ > static int >! bridge_fragment(struct ifnet *ifp, struct mbuf *m, struct ether_header *eh, > int snap, struct llc *llc) > { >! struct mbuf *m0; > struct ip *ip; > int error = -1; > > if (m->m_len < sizeof(struct ip) && > (m = m_pullup(m, sizeof(struct ip))) == NULL) >! goto out; > ip = mtod(m, struct ip *); > > m->m_pkthdr.csum_flags |= CSUM_IP; > error = ip_fragment(ip, &m, ifp->if_mtu, ifp->if_hwassist); > if (error) >! goto out; > >! /* walk the chain and re-add the Ethernet header */ >! for (m0 = m; m0; m0 = m0->m_nextpkt) { >! if (error == 0) { >! if (snap) { >! M_PREPEND(m0, sizeof(struct llc), M_NOWAIT); >! if (m0 == NULL) { >! error = ENOBUFS; >! continue; >! } >! bcopy(llc, mtod(m0, caddr_t), >! sizeof(struct llc)); >! } >! M_PREPEND(m0, ETHER_HDR_LEN, M_NOWAIT); >! if (m0 == NULL) { > error = ENOBUFS; >! continue; > } >! bcopy(eh, mtod(m0, caddr_t), ETHER_HDR_LEN); >! } else >! m_freem(m); >! } > >! if (error == 0) >! KMOD_IPSTAT_INC(ips_fragmented); > > return (error); > >! out: >! if (m != NULL) >! m_freem(m); > return (error); > } > >--- 3485,3561 ---- > /* > * bridge_fragment: > * >! * Fragment mbuf chain in multiple packets and prepend ethernet header. > */ > static int >! bridge_fragment(struct ifnet *ifp, struct mbuf **mp, struct ether_header *eh, > int snap, struct llc *llc) > { >! struct mbuf *m = *mp, *nextpkt = NULL, *mprev = NULL, *mcur = NULL; > struct ip *ip; > int error = -1; > > if (m->m_len < sizeof(struct ip) && > (m = m_pullup(m, sizeof(struct ip))) == NULL) >! goto dropit; > ip = mtod(m, struct ip *); > > m->m_pkthdr.csum_flags |= CSUM_IP; > error = ip_fragment(ip, &m, ifp->if_mtu, ifp->if_hwassist); > if (error) >! goto dropit; > >! /* >! * Walk the chain and re-add the Ethernet header for >! * each mbuf packet. >! */ >! for (mcur = m; mcur; mcur = mcur->m_nextpkt) { >! nextpkt = mcur->m_nextpkt; >! mcur->m_nextpkt = NULL; >! if (snap) { >! M_PREPEND(mcur, sizeof(struct llc), M_NOWAIT); >! if (mcur == NULL) { > error = ENOBUFS; >! if (mprev != NULL) >! mprev->m_nextpkt = nextpkt; >! goto dropit; > } >! bcopy(llc, mtod(mcur, caddr_t),sizeof(struct llc)); >! } > >! M_PREPEND(mcur, ETHER_HDR_LEN, M_NOWAIT); >! if (mcur == NULL) { >! error = ENOBUFS; >! if (mprev != NULL) >! mprev->m_nextpkt = nextpkt; >! goto dropit; >! } >! bcopy(eh, mtod(mcur, caddr_t), ETHER_HDR_LEN); > >+ /* >+ * The previous two M_PREPEND could have inserted one or two >+ * mbufs in front so we have to update the previous packet's >+ * m_nextpkt. >+ */ >+ mcur->m_nextpkt = nextpkt; >+ if (mprev != NULL) >+ mprev->m_nextpkt = mcur; >+ else { >+ /* The first mbuf in the original chain needs to be >+ * updated. */ >+ *mp = mcur; >+ } >+ mprev = mcur; >+ } >+ >+ KMOD_IPSTAT_INC(ips_fragmented); > return (error); > >! dropit: >! for (mcur = *mp; mcur; mcur = m) { /* droping the full packet chain */ >! m = mcur->m_nextpkt; >! m_freem(mcur); >! } > return (error); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 217606
:
185916
|
186372
|
187001
| 187326