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)
Sat, Apr 27, 8:49 AM
Unknown Object (File)
Thu, Apr 25, 8:48 PM
Unknown Object (File)
Jan 26 2024, 5:38 AM
Unknown Object (File)
Jan 8 2024, 1:54 PM
Unknown Object (File)
Jan 8 2024, 1:54 PM
Unknown Object (File)
Jan 8 2024, 1:47 PM
Unknown Object (File)
Jan 8 2024, 1:39 PM
Unknown Object (File)
Dec 23 2023, 12:40 AM

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.