Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds two enhancements:
RDR list and RDR clear for persistent rules file
rdr.conf
.The major rationale behind this was, that the
rdr clear
does not clear therdr.conf
and only clears the applied pf rules. I didn't want to change the current default behavior (it may be useful in some cases).RDR ip and dev commands. It allows changing the globally configured ext_if device and defining specific host target ip address. Even this change extends the rdr.conf format it is consistent with the current format and no migration is needed.
Now a following format of
rdr.conf
is allowed:It allows bigger flexibility of redirection and fix some issues.
For example when the system is a gateway and the ext_if is the device being a gateway, the former redirection (from any to any) cause a redirect of all the packets heading to that port on this device even if the destination ip was different.
Another possible example of use case is having a two outgoing interfaces (in all my cases an ethernet port and a wireguard tunnel) with a possibility to selectively redirect from.
Then there are two extra commits. One is for the overall rdr.sh cleanup (deduplication, consistent formating, and generalization). And the last commit is update to the rdr documentation, which was not updated for a while.