From patchwork Tue Feb 10 13:43:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Enrique X-Patchwork-Id: 438376 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406D61400A0 for ; Wed, 11 Feb 2015 00:45:41 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 17D9B28BBD1; Tue, 10 Feb 2015 14:41:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 7608828AE03 for ; Tue, 10 Feb 2015 14:41:28 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .fon. - helo: .mail-we0-f170.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Tue, 10 Feb 2015 14:41:25 +0100 (CET) Received: by mail-we0-f170.google.com with SMTP id q59so24862862wes.1 for ; Tue, 10 Feb 2015 05:43:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7LBpddLciyqQ6wNs4lLsLPum0kX7p4svw352n7aOwc8=; b=Qyfa5MaL2kJ0wQstA04tX0r/s3ktppWYoB6cB6SWX/nm7+50R52idDhwG4XivonJ3d kMndlka1euXb6xChd3f3l8XXD87/RcDMz4DVP8okEVqevN34IgFXNG8A4XS9Em6S38Du jf3SidzKvaG7bBRAjmwvGnTvXKdrVsQe9ZnXEWbGz6bicadeuseJ+CUR7juYl0zs7hEi ce7l7ifGflkzhR0O3VBSJwzqpoEZ5dqiYTxu6v1sEiP/+FgEgBnoVrVg9MFe/J8kGbAl hh15Z/Px+GHgi5azveIRwLz48QMqCPv4iKurcY0IKUKFjN+2eY4lftbovJvEIUWq11fs zslw== X-Gm-Message-State: ALoCoQlGCCFYlNiegTewMeN5/BRIYn5ha1XEcjAjps9Bz+umYGt+PxKNuuxDg1uaa9GuERghPyYq X-Received: by 10.180.82.10 with SMTP id e10mr45447941wiy.18.1423575836153; Tue, 10 Feb 2015 05:43:56 -0800 (PST) Received: from dell-desktop.lan ([213.27.197.25]) by mx.google.com with ESMTPSA id v7sm20831857wju.22.2015.02.10.05.43.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Feb 2015 05:43:55 -0800 (PST) From: Alejandro Enrique To: Felix Fietkau Date: Tue, 10 Feb 2015 14:43:03 +0100 Message-Id: <1423575784-23320-3-git-send-email-alejandro.enrique@fon.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1423575784-23320-1-git-send-email-alejandro.enrique@fon.com> References: <1423575784-23320-1-git-send-email-alejandro.enrique@fon.com> Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH] relayd: improve host detection on interface change X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" This patch improve host detection and refresh when it moves from and interface to another by pinging for it on all managed interfaces. Previous to this patch host expiration was done by pinging for it on the last interface it was known to be. If it does not reply after a number of retries it will be expired and its entries deleted. Nevertheless, if the host has moved to another managed interface it will not be detected until there is some ARP packet sent by the host. This detection can be improved by pinging for the host on all managed interfaces instead of just the one where it is supposed to be connected, as it will reply to the ARP ping on the new interface it is connected to and a host refresh will be triggered. Signed-off-by: Alejandro Enrique --- .../patches/003-arping_on_all_interfaces.patch | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 package/network/services/relayd/patches/003-arping_on_all_interfaces.patch diff --git a/package/network/services/relayd/patches/003-arping_on_all_interfaces.patch b/package/network/services/relayd/patches/003-arping_on_all_interfaces.patch new file mode 100644 index 0000000..9321585 --- /dev/null +++ b/package/network/services/relayd/patches/003-arping_on_all_interfaces.patch @@ -0,0 +1,21 @@ +--- a/main.c ++++ b/main.c +@@ -252,6 +252,7 @@ static void send_arp_reply(struct relayd + static void host_entry_timeout(struct uloop_timeout *timeout) + { + struct relayd_host *host = container_of(timeout, struct relayd_host, timeout); ++ struct relayd_interface *rif; + + /* + * When a host is behind a managed interface, we must not expire its host +@@ -261,7 +262,9 @@ static void host_entry_timeout(struct ul + * giving up on it. + */ + if (host->rif->managed && host->cleanup_pending < host_ping_tries) { +- send_arp_request(host->rif, host->ipaddr); ++ list_for_each_entry(rif, &interfaces, list) { ++ send_arp_request(rif, host->ipaddr); ++ } + host->cleanup_pending++; + uloop_timeout_set(&host->timeout, 1000); + return;