-
Notifications
You must be signed in to change notification settings - Fork 5.3k
filter chain match: support source CIDRs and ports #7064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
43744eb
filter chain match: support source CIDRs and ports
mattklein123 5c29732
Merge remote-tracking branch 'origin/master' into source_ip_match
mattklein123 f8af6d7
comments
mattklein123 3b0c106
Merge remote-tracking branch 'origin/master' into source_ip_match
mattklein123 f8af833
IPv6 test
mattklein123 f57bba3
Merge remote-tracking branch 'origin/master' into source_ip_match
mattklein123 73cdf30
comment
mattklein123 2460514
Merge remote-tracking branch 'origin/master' into source_ip_match
mattklein123 e4a6b29
Merge remote-tracking branch 'origin/master' into source_ip_match
mattklein123 764d800
comment
mattklein123 aea58fe
Merge remote-tracking branch 'origin/master' into source_ip_match
mattklein123 1c8a379
comments
mattklein123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you comment on the rationale behind the ordering here? Is it arbitrary? Is there a practical reason to select source IP/port as the LSBs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked to @PiotrSikora about this offline. Effectively, it's arbitrary, and since we are adding new ones it seems best to add them at the end? IMO this needs to be configurable but that's out of scope for this change. @PiotrSikora any additional thoughts here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really arbitrary. The order is trying to more and more precisely describe destination (what service are you connecting to) with source selectors added at the end for the "split horizon".
This order allows filter chains to effectively act as virtual servers with fancy selectors (transport protocols, application protocols, etc.), while still being able to configure "split horizon" on a per virtual server basis for those that need it.
If source selectors had priority, then "split horizon" would be at the top of the decision tree, requiring all virtual servers to be configured for each source.
The only thing that I'm not 100% sure about is the order between source IPs and ports... Thinking about this now, perhaps it should be reversed (source port with higher priority) to allow matching connections from port X from any IP, but I honestly cannot think of a "real" use case for source port matching anyway.
There is an open issue for making the order configurable (#3411), but in the year+ that this order has been in place, I don't recall anyone complaining that the existing order doesn't work for their use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I don't have a strong opinion on the order of IP vs. port. Perhaps ship and iterate? I'm fine either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation @PiotrSikora. I wonder if we should capture this somewhere, it's useful design rationale.