Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Implement IPSet.Invert and IPSet.Intersect. #126

Merged
merged 1 commit into from
Jan 29, 2021

Conversation

danderson
Copy link
Member

Fixes #123.

Signed-off-by: David Anderson [email protected]

I set the merge-base to #124 so it shows only the new functionality.

@danderson danderson requested a review from bradfitz January 27, 2021 08:03
Copy link
Member

@mdlayher mdlayher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

ipset.go Outdated Show resolved Hide resolved
@danderson danderson force-pushed the danderson/set-intersection branch from d03d0ad to 487778c Compare January 27, 2021 20:55
ipset.go Outdated Show resolved Hide resolved
ipset.go Outdated Show resolved Hide resolved
s.out = s.in
s.in = []IPRange{
IPPrefix{IP: IPv4(0, 0, 0, 0), Bits: 0}.Range(),
IPPrefix{IP: IPv6Unspecified(), Bits: 0}.Range(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we iterate through the s.in, discover all IPv6 zones contained therein, and add those here? Should we have IPv6 at all if s.in only contains IPv4?

Either way, we should document what universe we're taking the complement in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm. IPSet doesn't really deal with zones at all right now (e.g. compaction will smush together IPs across zones), so I think I'm going to turn this into a bug to figure out what to do, and we can fix all of IPSet at once. Until then, leaving as-is.

@danderson danderson force-pushed the danderson/set-intersection branch from 487778c to e9210e4 Compare January 29, 2021 00:55
@danderson danderson force-pushed the danderson/set-intersection branch from e9210e4 to 525d3c7 Compare January 29, 2021 00:56
Base automatically changed from danderson/bug-demo to main January 29, 2021 01:02
@danderson danderson force-pushed the danderson/set-intersection branch from 525d3c7 to 4e1358f Compare January 29, 2021 01:15
@danderson danderson merged commit dc71c98 into main Jan 29, 2021
@danderson danderson deleted the danderson/set-intersection branch January 29, 2021 01:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IPSet needs more set operations
3 participants