From f8d9cc53659d29a0c047f3718b02efaf6d1cce3b Mon Sep 17 00:00:00 2001
From: Ethan Jackson <ethan@nicira.com>
Date: Wed, 13 Jul 2011 11:50:10 -0700
Subject: [PATCH] bond: Drop packets on backup slaves.

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.
---
 vswitchd/bridge.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index d44f4803b..928d03ce3 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3016,6 +3016,21 @@ is_admissible(struct bridge *br, const struct flow *flow, bool have_packet,
         }
     }
 
+    /* Drop all packets which arrive on backup slaves.  This is similar to how
+     * Linux bonding handles active-backup bonds. */
+    if (in_port->bond_mode == BM_AB) {
+
+        *tags |= in_port->active_iface;
+        if (in_port->active_iface != in_iface->port_ifidx) {
+            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+
+            VLOG_WARN_RL(&rl, "active-backup bond received packet on backup"
+                         " interface (%s) destined for " ETH_ADDR_FMT,
+                         in_iface->name, ETH_ADDR_ARGS(flow->dl_dst));
+            return false ;
+        }
+    }
+
     return true;
 }
 
-- 
2.47.0