Skip to content

fix: make masquerade to ports take effect, with its flags - #373

Open
bored-engineer wants to merge 1 commit into
google:mainfrom
bored-engineer:masq-ports-flags
Open

bored-engineer wants to merge 1 commit into
google:mainfrom
bored-engineer:masq-ports-flags

Conversation

@bored-engineer

Copy link
Copy Markdown

Masq with ToPorts wrote the port registers but never set NF_NAT_RANGE_PROTO_SPECIFIED, which the kernel's masq expression needs to apply them (nft sets it too), so the range was ignored. It also only wrote NFTA_MASQ_FLAGS when ToPorts was false, so Random, FullyRandom and Persistent were dropped as soon as a range was set.

Always write the flags that apply, and set PROTO_SPECIFIED with ToPorts. Masq without ToPorts is unchanged.

Masq with ToPorts wrote the port registers but never set
NF_NAT_RANGE_PROTO_SPECIFIED, which the kernel's masq expression needs
to apply them (nft sets it too), so the range was ignored. It also only
wrote NFTA_MASQ_FLAGS when ToPorts was false, so Random, FullyRandom and
Persistent were dropped as soon as a range was set.

Always write the flags that apply, and set PROTO_SPECIFIED with ToPorts.
Masq without ToPorts is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant