From: "Serguei Bezverkhi (sbezverk)" <sbezverk@cisco.com>
To: Laura Garcia <nevola@gmail.com>
Cc: "netfilter-devel@vger.kernel.org" <netfilter-devel@vger.kernel.org>
Subject: Re: nftables and set with interval
Date: Thu, 8 Aug 2019 16:08:13 +0000 [thread overview]
Message-ID: <0C41EF82-F2D0-4F20-BC97-6EBF48817694@cisco.com> (raw)
In-Reply-To: <CAF90-WhmQ3s2dhVSqHX0woC6eVXBNja3Qnm6Ma0HhHLozU3zSg@mail.gmail.com>
I have made a little progress, so now I build this from the code, but I do not think it totally right, because only 10.16.0.0/16 and 192.16.0.0/16 should show up, these three elements
0.0.0.0-10.15.255.255, 10.17.0.0-192.15.255.255, 192.17.0.0-255.255.255.255 are supposed to be excluded.
sudo nft list table ipv4table
table ip ipv4table {
set 246ae426f810 {
type ipv4_addr
flags constant,interval
elements = { 0.0.0.0-10.15.255.255, 10.16.0.0/16,
10.17.0.0-192.15.255.255, 192.16.0.0/16,
192.17.0.0-255.255.255.255 }
}
chain ipv4chain-1 {
type filter hook input priority filter; policy accept;
ip daddr @246ae426f810 return comment "pU"
}
}
In set with intervals, what attributes or how to indicate Exclusion SetElement?
Thank you
Serguei
On 2019-08-08, 9:19 AM, "Laura Garcia" <nevola@gmail.com> wrote:
On Thu, Aug 8, 2019 at 1:56 PM Serguei Bezverkhi (sbezverk)
<sbezverk@cisco.com> wrote:
>
> Hello,
>
> I am developing golang nftables libraryI am debugging nftables set with elements defining intervals. I compare what gets generated by nfl command and strace of my code.
>
> Based on the output of this command:
>
> sudo nft --debug all add rule ipv4table ipv4chain-1 ip daddr { 192.16.0.0/16, 10.16.0.0/16 } return
>
> It seems nft sets up NFTNL_SET_KEY_TYPE (0x4) as 0x2 and I cannot find anywhere what it means.
> {{nla_len=8, nla_type=0x4}, "\x00\x00\x00\x02"},
>
> When I decode strace generated for my code, it always gets set to x01
> {{nla_len=8, nla_type=0x4}, "\x00\x00\x00\x01"},
>
Hi, are you interacting directly with netlink?
Did you consider using the higher level library libnftables instead?
Cheers.
prev parent reply other threads:[~2019-08-08 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-08 11:47 nftables and set with interval Serguei Bezverkhi (sbezverk)
2019-08-08 13:18 ` Laura Garcia
2019-08-08 13:32 ` Serguei Bezverkhi (sbezverk)
2019-08-08 16:08 ` Serguei Bezverkhi (sbezverk) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0C41EF82-F2D0-4F20-BC97-6EBF48817694@cisco.com \
--to=sbezverk@cisco.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=nevola@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).