Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: Kiernan George <kbg98@vt.edu>, netfilter@vger.kernel.org
Subject: Re: Creating a map programmatically using the C library libnftnl
Date: Thu, 30 Mar 2023 22:08:48 +0200	[thread overview]
Message-ID: <ZCXsUDSVRqDst1pr@salvia> (raw)
In-Reply-To: <20230330195553.GC22079@breakpoint.cc>

On Thu, Mar 30, 2023 at 09:55:53PM +0200, Florian Westphal wrote:
> Kiernan George <kbg98@vt.edu> wrote:
> > That works to create the map, but when I go to add an element through
> > the command line it fails with this error:
> > 
> > root@laptop:/tmp# nft add element netdev example test2 { 1.1.1.1 .
> > 1111 : 2.2.2.2 }
> > Error: Could not process rule: File exists 
> > add element netdev example test2 { 1.1.1.1 . 1111 : 2.2.2.2 }
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>  
> > Do you have any insight?
> 
> Worksforme.  'File exists' hints that you are adding the same element
> again.  The key has to be unique, so:
> 
> add element netdev example test2 { 1.1.1.1 . 1111 : 2.2.2.2 }
> add element netdev example test2 { 1.1.1.1 . 1111 : 2.2.2.3 } // Fails even if value is different

For the record: error reporting for slightly better with recent kernels and
nft userspace.

# nft add element x y { 1.1.1.1 : 20 }
# nft add element x y { 1.1.1.1 : 21 }
Error: Could not process rule: File exists
add element x y { 1.1.1.1 : 21 }
                  ^^^^^^^

      reply	other threads:[~2023-03-30 20:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 18:04 Creating a map programmatically using the C library libnftnl Kiernan George
2023-03-28 15:09 ` Florian Westphal
2023-03-30 15:31   ` Kiernan George
     [not found]   ` <CAOg40qhR5vXo=tkNThLTbZ3nK0MZDf=VwONarYBg4KFokYCqcg@mail.gmail.com>
2023-03-30 16:09     ` Florian Westphal
2023-03-30 17:17       ` Kiernan George
2023-03-30 19:55         ` Florian Westphal
2023-03-30 20:08           ` Pablo Neira Ayuso [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=ZCXsUDSVRqDst1pr@salvia \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=kbg98@vt.edu \
    --cc=netfilter@vger.kernel.org \
    /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