Skip to content
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

Is there an equivalent method to nft get element ? #131

Open
sbs2001 opened this issue Oct 19, 2021 · 1 comment
Open

Is there an equivalent method to nft get element ? #131

sbs2001 opened this issue Oct 19, 2021 · 1 comment
Labels
question Further information is requested

Comments

@sbs2001
Copy link

sbs2001 commented Oct 19, 2021

Consider there are some elements in a nft set (some are CIDR ranges). By doing

 nft get element x y { 1.1.1.1 }
 table ip x {
         set m {
                 type ipv4_addr
                 flags interval
                 elements = { 1.1.1.0/24 }
         }
}

we can query whether a single IP is contained within set. This resolves the CIDRs in the set too. Is there a way to mimic this functionality by using this library ?

Background Info https://marc.info/?l=netfilter&m=163360852605801&w=2

@stapelberg
Copy link
Collaborator

You can obtain the sets using this nftables package, but I think converting a set element to an IP address range (see https://pkg.go.dev/net#ParseCIDR) is not currently implemented.

cc @sbezverk to make sure I’m not missing anything

@stapelberg stapelberg added the question Further information is requested label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants