netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Robertson <alanr@unix.sh>
To: netdev@vger.kernel.org, "David S. Miller" <davem@gavemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Vlad Yasevich <vyasevic@redhat.com>
Cc: Alan Robertson <alanr@unix.sh>
Subject: [PATCH net] rtnetlink: ndo_dflt_fdb_del() never works
Date: Thu, 30 May 2013 16:01:55 -0600	[thread overview]
Message-ID: <1369951315-14742-1-git-send-email-alanr@unix.sh> (raw)

ndo_dflt_fdb_del is checking for a condition which is opposite that
which ndo_dflt_fdb_add enforces.  ndo_dflt_fdb_add declares an error
if (ndm->ndm_state && !(ndm->ndm_state) & NUD_PERMANENT)) - that is, if the
entry is static.  This is consistent with the failure error message.

On the other hand, ndo_dflt_del() declares an error
if (ndm_state & NUD_PERMANENT) - which is inconsistent with the add
precondition, and inconsistent with its failure message text.
As it is now, you can't delete any entry which add allows to be added -
so entry deletion always fails.

Signed-off-by: Alan Robertson <alanr@unix.sh>
---
 net/core/rtnetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a08bd2b..373a8e7 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2142,7 +2142,7 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm,
 	/* If aging addresses are supported device will need to
 	 * implement its own handler for this.
 	 */
-	if (ndm->ndm_state & NUD_PERMANENT) {
+	if (!(ndm->ndm_state & NUD_PERMANENT)) {
 		pr_info("%s: FDB only supports static addresses\n", dev->name);
 		return -EINVAL;
 	}
-- 
1.8.1.4

             reply	other threads:[~2013-05-30 22:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 22:01 Alan Robertson [this message]
2013-05-31  8:46 ` [PATCH net] rtnetlink: ndo_dflt_fdb_del() never works David Miller
2013-05-31 16:43   ` Alan Robertson
2013-05-31 17:11     ` Vlad Yasevich
2013-05-31 19:59       ` Alan Robertson
2013-05-31 23:42       ` David Miller
2013-06-03 21:40         ` Alan Robertson

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=1369951315-14742-1-git-send-email-alanr@unix.sh \
    --to=alanr@unix.sh \
    --cc=davem@gavemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=vyasevic@redhat.com \
    /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).