From patchwork Thu Nov 21 00:40:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salam Noureddine X-Patchwork-Id: 292904 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 9E6B92C0109 for ; Thu, 21 Nov 2013 11:40:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754528Ab3KUAky (ORCPT ); Wed, 20 Nov 2013 19:40:54 -0500 Received: from mail-vb0-f53.google.com ([209.85.212.53]:52009 "EHLO mail-vb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753982Ab3KUAkx (ORCPT ); Wed, 20 Nov 2013 19:40:53 -0500 Received: by mail-vb0-f53.google.com with SMTP id g10so3287087vbg.12 for ; Wed, 20 Nov 2013 16:40:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=GnVfJLxj69i2+54Fo9P5sOeGARU3fgAdtMhvJHZogHI=; b=acMmSdmmxbBdm/PqKNNHdB+HgGvxEyhhC3hv/8YB7Rl8nWs83lOnVRNzS4aehEm1xg zG9gBfLPS8ZtLiC2bu8yBH/O1pURQLByBJIt54z+Y5Pa5Cu4wq7HSvmiDJXCoUczGTnW etwWQKDP5ypt00RXO+qh36Xz//vY+Icpu9t3GPCodduljFYOpoB4l4vxNDelA9xfPnVz QXjyJQoMATL4yc5MygqPYmLU/Akr2iWue9lw+/gdEtk7TgyjTjKzQmkbgrCMvkVga2ZP XaEvSqGd4TYH55uFiLU1SKfkA32raopPJJkbWo51j4/EDx60yRmxoE7nJk8lwme+Hkha Vf/w== X-Gm-Message-State: ALoCoQkgtUHP2aQpETJNgb59DentXBixvRIvHEye2qqNp5/gSNtnM71CX6edlDOL2LDJXp3GcfGE MIME-Version: 1.0 X-Received: by 10.52.98.194 with SMTP id ek2mr2463533vdb.11.1384994453009; Wed, 20 Nov 2013 16:40:53 -0800 (PST) Received: by 10.58.28.231 with HTTP; Wed, 20 Nov 2013 16:40:52 -0800 (PST) Date: Wed, 20 Nov 2013 16:40:52 -0800 Message-ID: Subject: Issue with gratuitous arps when new addr is different from cached addr From: Salam Noureddine To: "David S. Miller" , Daniel Borkmann , Willem de Bruijn , Phil Sutter , Eric Dumazet , netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, It seems to me that neigh_update is not handling correctly the case when the new address is different from the cached one and NEIGH_UPDATE_F_OVERRIDE is not set. When we receive a gratuitous arp request we check jiffies against the neigh->updated + locktime in arp_process. If we're passed that time then the flag is set. In neigh_update, we set neigh->updated before checking for the case where we have a new address and the override flag is not set. This means, that we "extend the life of the old address". By setting locktime to 2 sec and sending an arp with a new address every 1 sec, I was able to perpetuate the old entry for as long as I wanted. To fix this, we can just move setting neigh->updated to after the check for new address and override flag not present, If that seems like a an acceptable solution, I would post a patch shortly. Thanks, Salam --- 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 --- linux-3.4.orig/net/core/neighbour.c +++ linux-3.4/net/core/neighbour.c @@ -1206,10 +1206,6 @@ int neigh_update(struct neighbour *neigh lladdr = neigh->ha; } - if (new & NUD_CONNECTED) - neigh->confirmed = jiffies; - neigh->updated = jiffies; - /* If entry was valid and address is not changed, do not change entry state, if new one is STALE. */ @@ -1233,6 +1229,10 @@ int neigh_update(struct neighbour *neigh } } + if (new & NUD_CONNECTED) + neigh->confirmed = jiffies; + neigh->updated = jiffies; + if (new != old) { neigh_del_timer(neigh); if (new & NUD_IN_TIMER)