bond: Drop packets on backup slaves.
authorEthan Jackson <ethan@nicira.com>
Mon, 27 Jun 2011 20:18:19 +0000 (13:18 -0700)
committerEthan Jackson <ethan@nicira.com>
Mon, 27 Jun 2011 21:03:21 +0000 (14:03 -0700)
Currently, OVS accepts incoming traffic on all slaves participating
in a bond.  In Linux active-backup bonding, all traffic which comes
in on backup slaves is dropped.  This patch causes OVS to do the
same.

Bug #6125.

lib/bond.c

index 913a307..d8e0966 100644 (file)
@@ -573,6 +573,22 @@ bond_check_admissibility(struct bond *bond, const void *slave_,
         }
     }
 
+    /* Drop all packets which arrive on backup slaves.  This is similar to how
+     * Linux bonding handles active-backup bonds. */
+    if (bond->balance == BM_AB) {
+        struct bond_slave *slave = bond_slave_lookup(bond, slave_);
+
+        *tags |= bond_get_active_slave_tag(bond);
+        if (bond->active_slave != slave) {
+            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+
+            VLOG_WARN_RL(&rl, "active-backup bond received packet on backup"
+                         " slave (%s) destined for " ETH_ADDR_FMT,
+                         slave->name, ETH_ADDR_ARGS(eth_dst));
+            return BV_DROP;
+        }
+    }
+
     /* Drop all packets for which we have learned a different input port,
      * because we probably sent the packet on one slave and got it back on the
      * other.  Gratuitous ARP packets are an exception to this rule: the host