From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Mikaël Fourrier" <mikael.fourrier@laposte.net>
Cc: netfilter@vger.kernel.org
Subject: Re: Add element in set when element already present.
Date: Wed, 24 Aug 2016 16:53:38 +0200 [thread overview]
Message-ID: <20160824145338.GA8282@salvia> (raw)
In-Reply-To: <e145e82f-0b0f-50df-c9ce-d1c2446f9543@laposte.net>
Hi,
On Tue, Aug 23, 2016 at 06:51:32PM +0200, Mikaël Fourrier wrote:
> Hi,
>
> When I add an element in a set (same with maps) and the set already contains
> the element, the command fails with an error. Worse: I try to add multiple
> elements and at least one of these elements is already in the set, the
> command fails without adding any element. Why do you use this semantic? It
> would be more ergonomic if you could just add elements in a set without
> checking its content.
Just sent a patchset to address this. Two for kernel:
http://patchwork.ozlabs.org/patch/662322/
http://patchwork.ozlabs.org/patch/662323/
Four for userspace (include two tests).
http://patchwork.ozlabs.org/patch/662333/
http://patchwork.ozlabs.org/patch/662331/
http://patchwork.ozlabs.org/patch/662332/
http://patchwork.ozlabs.org/patch/662330/
# nft add set inet filter myset { type ipv4_addr\; }
# nft add element inet filter myset { 0.0.0.0 }
# nft add element inet filter myset { 0.0.0.0 }
# nft create element inet filter myset { 0.0.0.0 }
<cmdline>:1:1-45: Error: Could not process rule: File exists
create element inet filter myset { 0.0.0.0 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The 'create' command complains if the element exists, the 'add'
command returns success if it already exists.
This basically provides the same semantics that we have already in
other objects.
next prev parent reply other threads:[~2016-08-24 14:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-23 16:51 Add element in set when element already present Mikaël Fourrier
2016-08-24 14:53 ` Pablo Neira Ayuso [this message]
2016-08-24 15:25 ` Yamakaky
2016-08-26 9:09 ` Pablo Neira Ayuso
2016-08-26 17:41 ` Yamakaky
-- strict thread matches above, loose matches on Subject: below --
2016-08-23 16:53 Yamakaky
2016-08-23 17:28 ` Roger Price
2016-08-23 19:46 ` Yamakaky
[not found] ` <000001d1fd88$03ad1770$0b074650$@verizon.net>
2016-08-24 6:57 ` Yamakaky
2016-04-06 11:22 Mikaël Fourrier
2016-04-06 12:12 ` Mikaël Fourrier
2016-04-06 12:15 ` Mikaël Fourrier
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=20160824145338.GA8282@salvia \
--to=pablo@netfilter.org \
--cc=mikael.fourrier@laposte.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.