Page MenuHomeFreeBSD

Fix IPv6 flow label match in ipfw
ClosedPublic

Authored by lytboris_gmail.com on May 7 2026, 4:23 PM.
Tags
None
Referenced Files
F166106106: D56869.id177369.diff
Tue, Aug 11, 6:47 PM
Unknown Object (File)
Mon, Aug 10, 8:01 AM
Unknown Object (File)
Sun, Aug 9, 7:53 PM
Unknown Object (File)
Sun, Aug 9, 3:56 PM
Unknown Object (File)
Sun, Aug 9, 5:51 AM
Unknown Object (File)
Sat, Aug 8, 5:57 PM
Unknown Object (File)
Sat, Aug 8, 10:47 AM
Unknown Object (File)
Sat, Aug 8, 5:07 AM

Details

Summary

Address a number of IPv6 flow label bugs scattered across different parts of ipfw:

  • kernel module: IPV6_FLOWLABEL_MASK is not being applied before comparison in flow6id_match() so flow-id opcode never matches a flow label alone (one need to take protocol version and traffic class into account)
  • kernel module: off-by-one bug leading to out-of-bounds read
  • sbin/ipfw: flow-id opcode allows just ip6 as a proto while ipv6-icmp, tcp, udp should be fine too.
Test Plan

ipv6-flow-id.sh test is provided

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

pouria added subscribers: ziaee, pouria.

I'm not an expert on IPFW. But the code, and logic LGTM.

tests/sys/netpfil/ipfw/ipv6-flow-id.sh
2–28

Please use new format.
recently, @ziaee updated the preferred format:
https://docs.freebsd.org/en/articles/license-guide/

Even that - at the first line is no longer required.

43

Could be nice to use ifconfig -j instead. Of course, I understand this pattern is repeated across the ipfw tests.

tests/sys/netpfil/ipfw/lookup.sh
59 ↗(On Diff #177369)

This is not really related to this change.
I suggest to separate it into another commit/review.

144 ↗(On Diff #177369)

This is not really related to this change.
I suggest to separate it into another commit/review.

This revision is now accepted and ready to land.May 7 2026, 7:22 PM
This revision now requires review to proceed.May 8 2026, 5:43 AM
This revision was not accepted when it landed; it landed in state Needs Review.May 12 2026, 7:49 AM
This revision was automatically updated to reflect the committed changes.