From patchwork Sat Feb 22 08:44:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 323132 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D06232C00C9 for ; Sat, 22 Feb 2014 19:43:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751600AbaBVInd (ORCPT ); Sat, 22 Feb 2014 03:43:33 -0500 Received: from mail-la0-f43.google.com ([209.85.215.43]:52720 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784AbaBVInc (ORCPT ); Sat, 22 Feb 2014 03:43:32 -0500 Received: by mail-la0-f43.google.com with SMTP id pv20so3270456lab.2 for ; Sat, 22 Feb 2014 00:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:mime-version:content-type :content-transfer-encoding; bh=K0TLqtTufw8/ePhV4PAabrWFftVJYc3TRAAnAhxMBi0=; b=XrrZDC16EJ2ZXIpyJf88qIaEG0AtvTEdw1nECGldRSRIJKh84XEaZaZTB+ApldeNzR SDDe2eQAxq5kHrxhGn81uJ+HbsNcCOC2EzUL6cSqI1oinEzFfo72ax/5pvBQhRBirqlk auOf3+ajpYuYVZyYRI5MVjevFh1ha/wBSuH0hEjdvgQa2+FB8d8W5pHi8XNPcRz8xAoy e2dnjCWehIyrHOk6gIwe4ycu1q+W7iIQ6m5b4OBp9ZhKlxdGrFG433mBcpxFyZuwOtBb pUoXGSXEr5/bFoVQJL+Tv7s57lNxOJT3c+aFCel/BIHiK+9k9c+5JtEeuJT8705GSm1T yOBA== X-Received: by 10.152.121.65 with SMTP id li1mr6421231lab.76.1393058610808; Sat, 22 Feb 2014 00:43:30 -0800 (PST) Received: from vostro ([83.145.235.194]) by mx.google.com with ESMTPSA id jt7sm5758221lbc.15.2014.02.22.00.43.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Feb 2014 00:43:30 -0800 (PST) Date: Sat, 22 Feb 2014 10:44:19 +0200 From: Timo Teras To: netdev@vger.kernel.org Subject: probe netlink app in NUD_PROBE Message-ID: <20140222104419.6b4daa44@vostro> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.20; i486-alpine-linux-uclibc) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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: In which the netlink would be used only if unicast probes are turned off. Any preference which to send formatted formally? - Timo --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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); }