On Tue, 4 Oct 2016 17:27:12 +0200 Mike Belopuhov <[email protected]> wrote: > On Tue, Oct 04, 2016 at 01:07 +0200, Vincent Gross wrote: >> On Sat, 24 Sep 2016 10:58:10 +0200 >> Vincent Gross <[email protected]> wrote: >> >> > Hi, >> > >> [snip] >> > >> > Aside from the mbuf issue, is this Ok ? >> >> I will go back on the mbuff stuff later. >> >> Diff rebased, ok anyone ? >> >> Index: net/if_vxlan.c >> =================================================================== >> RCS file: /cvs/src/sys/net/if_vxlan.c,v >> retrieving revision 1.48 >> diff -u -p -r1.48 if_vxlan.c >> --- net/if_vxlan.c 30 Sep 2016 10:22:05 -0000 1.48 >> +++ net/if_vxlan.c 3 Oct 2016 23:12:42 -0000 >> @@ -638,7 +749,9 @@ vxlan_lookup(struct mbuf *m, struct udph >> if (m->m_pkthdr.len < skip + sizeof(struct ether_header)) >> return (EINVAL); >> >> - m_adj(m, skip); >> + m_adj(m, skip - ETHER_ALIGN); >> + m = m_pullup(m, ETHER_HDR_LEN + ETHER_ALIGN); >> + m_adj(m, ETHER_ALIGN); >> ifp = &sc->sc_ac.ac_if; >> >> #if NBRIDGE > 0 > > I think this chunk is correct. First you ensure that m->m_data > points to a contiguous and well-aligned ethernet header and then > you trim the alignment so that mtod() points directly at it.
Isn't it possible that m_pullup() may return non aligned pointer? > Possibly add a comment to that effect to spare a eyebrow-raising > moment for the next person.
