]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
bonding: extend arp_validate to be able to receive unvalidated arp-only traffic
authorVeaceslav Falico <vfalico@redhat.com>
Tue, 18 Feb 2014 06:48:40 +0000 (07:48 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Feb 2014 21:47:14 +0000 (16:47 -0500)
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 <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_options.c
drivers/net/bonding/bonding.h

index ad20c8ca11b67ffa6811df8e7290043451b48da7..5f997b9af54d52b2540bfa4c4c05b74b9a1f5601 100644 (file)
@@ -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[] = {
index 86ccfb9f71cc4dd8c843f40f5eee38b7c0c033ab..ab2e651d7bc3e114b4c6f0553d87f29580c84428 100644 (file)
@@ -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.
  */