Page MenuHomeFreeBSD

pf: Standardize rtableid
ClosedPublic

Authored by vegeta_tuxpowered.net on May 8 2023, 8:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 25, 4:44 PM
Unknown Object (File)
Tue, Jun 23, 3:00 AM
Unknown Object (File)
Sun, Jun 21, 10:54 PM
Unknown Object (File)
Fri, Jun 19, 9:43 PM
Unknown Object (File)
Tue, Jun 16, 6:32 PM
Unknown Object (File)
May 13 2026, 9:41 PM
Unknown Object (File)
May 13 2026, 9:32 PM
Unknown Object (File)
May 12 2026, 4:32 PM

Details

Summary

Prepare for rtableid being included in struct pfsync_state where it will be int32_t. Make variables which will be set to and from it the same width.

Sponsored by: InnoGames GmbH

Diff Detail

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

Event Timeline

The new kernel code uses uint32_t as the table id, I’m curious why do you want to have rtableid signef.

The new kernel code uses uint32_t as the table id, I’m curious why do you want to have rtableid signef.

The rtableid variable is signed in pf. You can see it being assigned value of -1 for the default rule in pf_ioctl.c and for each rule by pfctl unless a specific value is set. Then in pf_test_rule() and a few other places M_SETFIB(); is called only if the value is >= 0. That makes 0 a valid value which can be set and -1 the default meaning don't set rtableid.

The new kernel code uses uint32_t as the table id, I’m curious why do you want to have rtableid signef.

The rtableid variable is signed in pf. You can see it being assigned value of -1 for the default rule in pf_ioctl.c and for each rule by pfctl unless a specific value is set. Then in pf_test_rule() and a few other places M_SETFIB(); is called only if the value is >= 0. That makes 0 a valid value which can be set and -1 the default meaning don't set rtableid.

Ack, thank you gor clarification!

This revision was not accepted when it landed; it landed in state Needs Review.May 17 2023, 4:02 PM
Closed by commit rG8c23afdb574e: pf: Standardize rtableid (authored by vegeta_tuxpowered.net, committed by kp). · Explain Why
This revision was automatically updated to reflect the committed changes.