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)
Mar 16 2024, 8:46 PM
Unknown Object (File)
Mar 12 2024, 10:56 AM
Unknown Object (File)
Jan 14 2024, 8:14 PM
Unknown Object (File)
Jan 14 2024, 5:36 AM
Unknown Object (File)
Dec 23 2023, 4:07 AM
Unknown Object (File)
Dec 23 2023, 12:56 AM
Unknown Object (File)
Dec 18 2023, 2:43 AM
Unknown Object (File)
Nov 23 2023, 6:35 AM
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
Lint Not Applicable
Unit
Tests Not Applicable

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
159 ↗(On Diff #68483)

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

170 ↗(On Diff #68483)

There should be parens around mp.

493 ↗(On Diff #68483)

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 ↗(On Diff #68483)

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.