All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timo Teras <timo.teras@iki.fi>
To: netdev@vger.kernel.org
Subject: probe netlink app in NUD_PROBE
Date: Sat, 22 Feb 2014 10:44:19 +0200	[thread overview]
Message-ID: <20140222104419.6b4daa44@vostro> (raw)

When a stale or delayed neigh entry is being re-validated the entry
goes to NUD_PROBE state. At the moment only unicast probes are sent.
This is basically because neigh_max_probes() limits the probe amount so.

Now, opennhrp intentionally configures UCAST_PROBES and MCAST_PROBES to
zero and APP_PROBES to something meaningful. The idea is that opennhrp
replaces arp completely with NHRP implemented in userland.

Due to this it seems there is a very small time window, when the
NUD_PROBE times out and the neighbour entry gets invalidated, and
packets get lost.

To remedy this, I would like to have these NUD_PROBE validations sent
via netlink too.

First choice is to change to just use both unicast and application
probes:

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index b9e9e0d..36d3f8c 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -836,10 +836,10 @@ out:
 static __inline__ int neigh_max_probes(struct neighbour *n)
 {
 	struct neigh_parms *p = n->parms;
-	return (n->nud_state & NUD_PROBE) ?
-		NEIGH_VAR(p, UCAST_PROBES) :
-		NEIGH_VAR(p, UCAST_PROBES) + NEIGH_VAR(p, APP_PROBES) +
-		NEIGH_VAR(p, MCAST_PROBES);
+	int max_probes = NEIGH_VAR(p, UCAST_PROBES) + NEIGH_VAR(p, APP_PROBES);
+	if (!(n->nud_state & NUD_PROBE))
+		max_probes += NEIGH_VAR(p, MCAST_PROBES);
+	return max_probes;
 }
 
 static void neigh_invalidate(struct neighbour *neigh)

On default configuration there is no behaviour change, as APP_PROBES
defaults zero. I'm not sure if other ARPD programs than opennhrp are
currently commonly used.

If that feels risky, alternative would be:

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index b9e9e0d..8bb320b 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -836,9 +836,11 @@ out:
 static __inline__ int neigh_max_probes(struct neighbour *n)
 {
 	struct neigh_parms *p = n->parms;
-	return (n->nud_state & NUD_PROBE) ?
-		NEIGH_VAR(p, UCAST_PROBES) :
-		NEIGH_VAR(p, UCAST_PROBES) + NEIGH_VAR(p, APP_PROBES) +
+
+	if (n->nud_state & NUD_PROBE)
+		return NEIGH_VAR(p, UCAST_PROBES) ? : NEIGH_VAR(p, APP_PROBES);
+
+	return NEIGH_VAR(p, UCAST_PROBES) + NEIGH_VAR(p, APP_PROBES) + 
 		NEIGH_VAR(p, MCAST_PROBES);
 }
 
In which the netlink would be used only if unicast probes are turned
off.

Any preference which to send formatted formally?

- Timo

             reply	other threads:[~2014-02-22  8:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-22  8:44 Timo Teras [this message]
2014-02-25 23:18 ` probe netlink app in NUD_PROBE David Miller
2014-02-26  6:28   ` Timo Teras
2014-02-26  9:43   ` [PATCH net-next] neigh: probe application via netlink " Timo Teräs
2014-02-26 20:47     ` David Miller

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=20140222104419.6b4daa44@vostro \
    --to=timo.teras@iki.fi \
    --cc=netdev@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.