From: Phil Sutter <phil@nwl.cc>
To: netfilter-devel@vger.kernel.org
Subject: nft: I broke interactive mode with iface changes
Date: Wed, 8 Nov 2017 11:15:45 +0100 [thread overview]
Message-ID: <20171108101545.GV32305@orbyte.nwl.cc> (raw)
Hi,
When preparing my patch 94a945ffa81b7 ("libnftables: Get rid of explicit
cache flushes"), I missed that 'nft -i' was explicitly dropping the
interface cache after every command, so now it won't recognize interface
changes anymore. Sadly, there is no lightweight method available to
detect an outdated interface cache like we have with ruleset cache, so I
played around a bit with alternatives.
First thing to mention, using the iface cache is considerably faster
than calling if_nametoindex/if_indextoname each time.
OTOH, I'm not sure having interface indexes in rules is a good idea to
begin with: A seemingly obvious rule like e.g. 'oif br0 accept' all of a
sudden stops working if br0 is recreated (typically by restarting
libvirt or whatever manages it). This becomes obvious when inspecting
the rule set (said rule won't print the interface name anymore but just
the ifindex value), but it's something users have to be aware of first.
So given that oifname/iifname expressions should be recommended over
plain oif/iif ones for general-purpose applications, I wonder how
important that interface cache really is and whether there is a relevant
drawback when dropping it.
Getting back to the original issue, I see the following alternatives:
* Drop interface cache altogether.
* Make nft_run_cmd_from_*() drop the interface cache before parsing
commands.
* Reintroduce a 'drop_cache()' API function for cli.c to call it.
Obviously, I prefer the first one, but would appreciate others' opinions
before sending patches.
Thanks, Phil
next reply other threads:[~2017-11-08 10:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 10:15 Phil Sutter [this message]
2017-11-08 23:47 ` nft: I broke interactive mode with iface changes Pablo Neira Ayuso
2017-11-09 12:24 ` [nft PATCH] libnftables: Flush iface cache after command execution Phil Sutter
2017-11-13 12:36 ` 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=20171108101545.GV32305@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=netfilter-devel@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;
as well as URLs for NNTP newsgroup(s).