From: Shmulik Ladkani <shmulik@nsof.io>
To: David Miller <davem@davemloft.net>, dsa@cumulusnetworks.com
Cc: netdev@vger.kernel.org, mateusz.bajorski@nokia.com,
tgraf@suug.ch, shmulik.ladkani@gmail.com, eyal.birger@gmail.com
Subject: Re: [PATCH net] net: fib_rules: Fix fib_rules_ops->compare implementations to support exact match
Date: Wed, 4 Oct 2017 08:34:34 +0300 [thread overview]
Message-ID: <20171004083434.36ca9272@pixies> (raw)
In-Reply-To: <20171003.145418.677435703318514230.davem@davemloft.net>
Hi David,
On Tue, 03 Oct 2017 14:54:18 -0700 (PDT) David Miller <davem@davemloft.net> wrote:
> I don't see any inconsistency. When you insert using NLM_F_EXCL the
> insertion fails if any existing rule matches or overlaps in any way
> with the keys in the new rule.
Please note that current situation is as follows:
A: Generic (non /0), followed by specific that overlaps, ALLOWED
# ip ru add from 0.0.0.0/1 iif eth2 pref 33 table 33
# ip ru add from 10.0.0.0/8 iif eth2 pref 33 table 33
A Reversed: Specific, followed by generic (non /0) that overlaps, ALLOWED
# ip ru add from 10.0.0.0/8 iif eth2 pref 33 table 33
# ip ru add from 0.0.0.0/1 iif eth2 pref 33 table 33
B: 0.0.0.0/0, followed by specific that overlaps, ALLOWED
# ip ru add from 0.0.0.0/0 iif eth2 pref 33 table 33
# ip ru add from 10.0.0.0/8 iif eth2 pref 33 table 33
B Reversed: Specific, followed by 0.0.0.0/0, FAILS
# ip ru add from 10.0.0.0/8 iif eth2 pref 33 table 33
# ip ru add from 0.0.0.0/0 iif eth2 pref 33 table 33
(File exists)
Is there any reason why 0.0.0.0/0 should be treated differently, meaning,
insertion of 0.0.0.0/0 is order dependant (where other overlapping
rules are allowed REGARDLESS order of insertion)?
Please do note there is absolutely NO "overlapping" detection logic in
'fib4_rule_compare' whatsoever; just strict comparison of the FRA_SRC
addresses.
The only exception is if the new FRA_SRC address is 0.0.0.0/0 - which is
considered "colliding" with ANY existing rule.
The "treat /0 as a collision" existed way prior NLM_F_EXCL enforcement
was introduced, as the single usecase of ->compare() was for DELRULE
which had wildcard semantics.
Alas for NEWRULE+NLM_F_EXCL it exposes the above anomaly.
Best,
Shmulik
next prev parent reply other threads:[~2017-10-04 5:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-30 8:59 [PATCH net] net: fib_rules: Fix fib_rules_ops->compare implementations to support exact match Shmulik Ladkani
2017-10-03 21:54 ` David Miller
2017-10-04 3:58 ` Eyal Birger
2017-10-04 4:40 ` David Ahern
2017-10-04 5:34 ` Shmulik Ladkani [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-10-07 6:04 Shmulik Ladkani
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=20171004083434.36ca9272@pixies \
--to=shmulik@nsof.io \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=eyal.birger@gmail.com \
--cc=mateusz.bajorski@nokia.com \
--cc=netdev@vger.kernel.org \
--cc=shmulik.ladkani@gmail.com \
--cc=tgraf@suug.ch \
/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).