Page MenuHomeFreeBSD

net*: use inlined m_pullup()
Needs ReviewPublic

Authored by glebius on Mon, Oct 12, 11:26 PM.
Tags
None
Referenced Files
F176047068: D60689.id189685.diff
Thu, Oct 15, 3:08 PM
F176046238: D60689.id189951.diff
Thu, Oct 15, 2:59 PM
F176039224: D60689.diff
Thu, Oct 15, 1:25 PM
F176037075: D60689.diff
Thu, Oct 15, 12:55 PM
Unknown Object (File)
Wed, Oct 14, 10:12 AM
Unknown Object (File)
Wed, Oct 14, 2:07 AM
Unknown Object (File)
Tue, Oct 13, 7:00 PM
Unknown Object (File)
Tue, Oct 13, 2:37 PM

Details

Reviewers
pouria
gallatin
zlei
Group Reviewers
network
transport
Summary

Leverage the fact that m_pullup() in an inline function in mbuf.h and let
compiler to do all optimizations.

Mostly mechanical changes, but in few cases surrounding lines are brought
to style(9). In netinet6, a few input functions changed to set the
input/output struct mbuf ** pointer to NULL at a single place.

Looks like pfsync(4) got a bug fixed, where a result from a successful
m_pullup() was not stored.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 78234
Build 75117: arc lint + arc unit

Event Timeline

I've reviewed the code under sys/net/

I also reviewed the code under sys/netinet6.

sys/netinet6/icmp6.c
453

Nice catch!

sys/netinet6/route6.c
65–67

Yup, it was not defined at all. fgrep -r ip6aux sys/

Generally looks good to me. Well I'd recommend fixing existing bugs prior to committing this change.

sys/net/if_bridge.c
4137

This shall never happen if the mbuf is correctly constructed.

sys/net/if_geneve.c
3099

if_geneve has not been yet MFCed to stable branches. I'd recommend to commit this part separately. That will reduce conflicts if someone would like to MFC this.

sys/netgraph/ng_pppoe.c
1457
m->m_len >= 2 && (m = m_pullup(m, 2))

The above logic appears wrong to me. I would expect to pullup only when m->m_len < 2 . CC @glebius to confirm.

sys/netinet/tcp_subr.c
597

I'd keep this untouched, to reduce diff.

sys/netinet6/route6.c
69–71

I personally like this,

- 	if ((m = m_pullup(m, off + sizeof(*rh))) == NULL) {
+ 	if ((m = *mp = m_pullup(*mp, off + sizeof(*rh))) == NULL) {

That will clearly show the intention.

sys/netpfil/pf/if_pfsync.c
982

Yes it looks like a bug. CC @kp to confirm. If that is true then we shall fix it firstly.

1085

Ditto.

  • Rebase over fixed bug in pfsync and over caddr_t cleanup D60738
glebius added inline comments.
sys/netgraph/ng_pppoe.c
1457

Yes, looks like another bug accidentally fixed.

zlei added a subscriber: eugen_grosbein.net.

Looks good to me.

sys/netgraph/ng_pppoe.c
1457

V_ng_pppoe_lcp_pcp is 0 by default. I think that is why this code is not widely tested and no bugs reported.

This code was introduced via 28903f396af4b . Also CC the author @eugen_grosbein.net . If that is indeed a bug, I think it should be fixed separately and MFCed to stable branches.