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, Nov 9, 3:01 AM
Unknown Object (File)
Mon, Oct 28, 3:42 PM
Unknown Object (File)
Tue, Oct 22, 6:53 AM
Unknown Object (File)
Sep 22 2024, 11:33 PM
Unknown Object (File)
Sep 22 2024, 8:38 AM
Unknown Object (File)
Sep 19 2024, 10:27 AM
Unknown Object (File)
Sep 18 2024, 11:48 AM
Unknown Object (File)
Sep 18 2024, 5:05 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.