Page MenuHomeFreeBSD

ip6_output: improve extension header handling
ClosedPublic

Authored by bz on Feb 18 2020, 12:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 17, 8:03 AM
Unknown Object (File)
Tue, Dec 17, 8:00 AM
Unknown Object (File)
Tue, Dec 17, 7:59 AM
Unknown Object (File)
Tue, Dec 17, 7:56 AM
Unknown Object (File)
Wed, Dec 11, 5:25 PM
Unknown Object (File)
Mon, Dec 9, 1:03 AM
Unknown Object (File)
Nov 22 2024, 2:20 PM
Unknown Object (File)
Nov 22 2024, 1:14 PM
Subscribers

Details

Summary

Move IPv6 source address checks from after extension header heandling
to the top of the function. If we do not pass these checks there is
no reason to do a lot of work upfront.

Fold extension header preparations and length calculations together into
a single branch and macro rather than doing them sequentially.
Likewise move extension header concatination into a single branch block
only doing it if we recorded any extension header length length.

Sponsored by: Netflix (partially, originally)
MFC after: 1 week

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 29497
Build 27367: arc lint + arc unit

Event Timeline

LGTM.
It looks like the next step could potentially be isolation the whole if (opt){} and all its consequences into a separate function, filling in exthdr?

This revision is now accepted and ready to land.Feb 18 2020, 12:43 PM
sys/netinet6/ip6_output.c
158–159

You should remove the "and," or move it.

170

There should be parens around mp.

493

Why is this removed? After the ip6_splithdr() call, ip6 is left pointing at a stale copy of the header, no?

Correct changes based on the comments from @markj and make hdrsplit
a bool as it is used as such.

This revision now requires review to proceed.Feb 19 2020, 5:48 PM
bz marked 3 inline comments as done.Feb 19 2020, 5:50 PM
bz added inline comments.
sys/netinet6/ip6_output.c
493

Good catch. Was extracted from another patch where the code has changed more. I put it into each branch after a successful ip6_splithdr() call. The ip6_insert_jumboopt() further down does not seem to need it to my reading.

This revision is now accepted and ready to land.Feb 19 2020, 5:58 PM
This revision was automatically updated to reflect the committed changes.
bz marked an inline comment as done.