From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Khawar Shehzad <shehzad.khawar@gmail.com>
Cc: "netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: Programmatically adding Map element into the map/set using libnftnl
Date: Wed, 30 Nov 2016 22:27:25 +0100 [thread overview]
Message-ID: <20161130212725.GA2576@salvia> (raw)
In-Reply-To: <20161130201434.GA24593@salvia>
On Wed, Nov 30, 2016 at 09:14:34PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Nov 30, 2016 at 07:46:05PM +0000, Khawar Shehzad wrote:
> > Thanks. I want to add an element to existing ipv6 map programmatically
> > in C using libnftnl. From the above example commit, the code specifies
> > how to add a map (which I assessed by working on the
> > nft-set-elem-add.c example previously, thanks for the datatypes.c hint
> > too). I tried
> >
> > nftnl_set_elem_set(e, NFTNL_SET_ELEM_KEY, "fe80::2", 16);
> > nftnl_set_elem_set(e, NFTNL_SET_ELEM_DATA, "fe80::3", 16);
> >
> > AND
> >
> > nftnl_set_elem_set(e, NFTNL_SET_ELEM_KEY, &(sa1.sin6_addr),
> > sizeof(sa1.sin6_addr));
> > nftnl_set_elem_set(e, NFTNL_SET_ELEM_DATA, &(sa2.sin6_addr),
> > sizeof(sa2.sin6_addr));
> >
> > but both didn't work. It showed same error i.e. "error: Invalid argument".
>
> Oh, those examples are broken. Batch header and trailing are missing,
> I'm going to fix this.
Just fixed examples to add set element:
http://git.netfilter.org/libnftnl/commit/?id=6a32dbd4cd56c8fede6044a447469fbd0e35c10a
http://git.netfilter.org/libnftnl/commit/?id=cc1b5986f5379c17c97ff9fb7064aceddf0b87ed
next prev parent reply other threads:[~2016-11-30 21:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-30 19:16 Programmatically adding Map element into the map/set using libnftnl Khawar Shehzad
2016-11-30 19:34 ` Pablo Neira Ayuso
2016-11-30 19:46 ` Khawar Shehzad
2016-11-30 20:14 ` Pablo Neira Ayuso
2016-11-30 21:27 ` Pablo Neira Ayuso [this message]
2016-11-30 22:17 ` Khawar Shehzad
2016-11-30 22:28 ` Khawar Shehzad
2016-11-30 22:32 ` Pablo Neira Ayuso
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=20161130212725.GA2576@salvia \
--to=pablo@netfilter.org \
--cc=netfilter@vger.kernel.org \
--cc=shehzad.khawar@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