From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: Programmatically adding Map element into the map/set using libnftnl Date: Wed, 30 Nov 2016 21:14:34 +0100 Message-ID: <20161130201434.GA24593@salvia> References: <20161130193453.GA12643@salvia> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: Sender: netfilter-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Khawar Shehzad Cc: "netfilter@vger.kernel.org" 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.