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)
Sun, Sep 22, 11:33 PM
Unknown Object (File)
Sun, Sep 22, 8:38 AM
Unknown Object (File)
Thu, Sep 19, 10:27 AM
Unknown Object (File)
Wed, Sep 18, 11:48 AM
Unknown Object (File)
Wed, Sep 18, 5:05 AM
Unknown Object (File)
Wed, Sep 18, 1:31 AM
Unknown Object (File)
Mon, Sep 16, 5:58 AM
Unknown Object (File)
Sun, Sep 15, 8:27 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.