From patchwork Mon Feb 17 14:41:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Veaceslav Falico X-Patchwork-Id: 321016 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 F10282C00CD for ; Tue, 18 Feb 2014 01:46:00 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753436AbaBQOpy (ORCPT ); Mon, 17 Feb 2014 09:45:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57918 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753376AbaBQOpw (ORCPT ); Mon, 17 Feb 2014 09:45:52 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1HEjn1R002952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Feb 2014 09:45:50 -0500 Received: from darkmag.usersys.redhat.com (dhcp-27-102.brq.redhat.com [10.34.27.102]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s1HEjdWc031117; Mon, 17 Feb 2014 09:45:48 -0500 From: Veaceslav Falico To: netdev@vger.kernel.org Cc: Veaceslav Falico , Jay Vosburgh , Andy Gospodarek Subject: [PATCH v4 net-next 05/12] bonding: extend arp_validate to be able to receive unvalidated arp-only traffic Date: Mon, 17 Feb 2014 15:41:21 +0100 Message-Id: <1392648088-21336-6-git-send-email-vfalico@redhat.com> In-Reply-To: <1392648088-21336-1-git-send-email-vfalico@redhat.com> References: <1392648088-21336-1-git-send-email-vfalico@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently we can either receive any traffic as a proff of slave being up, or only *validated* arp traffic (i.e. with src/dst ip checked). Add an option to be able to specify if we want to receive non-validated arp traffic only. CC: Jay Vosburgh CC: Andy Gospodarek Signed-off-by: Veaceslav Falico --- drivers/net/bonding/bond_options.c | 13 ++++++++----- drivers/net/bonding/bonding.h | 11 +++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 6324baf..713a90e 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -47,11 +47,14 @@ static struct bond_opt_value bond_xmit_hashtype_tbl[] = { }; static struct bond_opt_value bond_arp_validate_tbl[] = { - { "none", BOND_ARP_VALIDATE_NONE, BOND_VALFLAG_DEFAULT}, - { "active", BOND_ARP_VALIDATE_ACTIVE, 0}, - { "backup", BOND_ARP_VALIDATE_BACKUP, 0}, - { "all", BOND_ARP_VALIDATE_ALL, 0}, - { NULL, -1, 0}, + { "none", BOND_ARP_VALIDATE_NONE, BOND_VALFLAG_DEFAULT}, + { "active", BOND_ARP_VALIDATE_ACTIVE, 0}, + { "backup", BOND_ARP_VALIDATE_BACKUP, 0}, + { "all", BOND_ARP_VALIDATE_ALL, 0}, + { "filter", BOND_ARP_FILTER, 0}, + { "filter_active", BOND_ARP_FILTER_ACTIVE, 0}, + { "filter_backup", BOND_ARP_FILTER_BACKUP, 0}, + { NULL, -1, 0}, }; static struct bond_opt_value bond_arp_all_targets_tbl[] = { diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 86ccfb9..ab2e651 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -342,6 +342,11 @@ static inline bool bond_is_active_slave(struct slave *slave) #define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP) #define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \ BOND_ARP_VALIDATE_BACKUP) +#define BOND_ARP_FILTER (BOND_ARP_VALIDATE_ALL + 1) +#define BOND_ARP_FILTER_ACTIVE (BOND_ARP_VALIDATE_ACTIVE | \ + BOND_ARP_FILTER) +#define BOND_ARP_FILTER_BACKUP (BOND_ARP_VALIDATE_BACKUP | \ + BOND_ARP_FILTER) static inline int slave_do_arp_validate(struct bonding *bond, struct slave *slave) @@ -349,6 +354,12 @@ static inline int slave_do_arp_validate(struct bonding *bond, return bond->params.arp_validate & (1 << bond_slave_state(slave)); } +static inline int slave_do_arp_validate_only(struct bonding *bond, + struct slave *slave) +{ + return bond->params.arp_validate & BOND_ARP_FILTER; +} + /* Get the oldest arp which we've received on this slave for bond's * arp_targets. */