diff mbox

[ovs-dev] ofproto-dpif-xlate: Allow sending BFD messages even when RSTP port is not forwarding

Message ID CAGH6phEfUU25DcKPGXYnAHqZuF98sxVnH9ougsfeMX4We7menQ@mail.gmail.com
State Accepted
Headers show

Commit Message

Mika Väisänen Feb. 20, 2017, 12:27 p.m. UTC
Interworking of BFD and RSTP does not work, as currently BFD messages are
dropped if RSTP port is not in forwarding mode. To correct this problem,
an extra check is added to allow BFD messages to be sent even when
rstp_forward_state is false.

Note: This patch is made against branch-2.5.

Signed-off-by: Mika Vaisanen <mika.vaisanen@gmail.com>

---
ofproto/ofproto-dpif-xlate.c |  6 ++++--
tests/bfd.at                 | 30 ++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 2 deletions(-)

+BFD_CHECK([p2], [true], [false], [none], [up], [No Diagnostic], [none],
[up], [No Diagnostic])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
diff mbox

Patch

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 9537131..c5bbc98 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -2949,8 +2949,10 @@  compose_output_action__(struct xlate_ctx *ctx,
ofp_port_t ofp_port,
                 }
                 return;
             }
-        } else if (!xport_stp_forward_state(xport) ||
-                   !xport_rstp_forward_state(xport)) {
+        } else if ((!xport_stp_forward_state(xport) ||
+                   !xport_rstp_forward_state(xport)) &&
+                   /* BFD messages can be sent when RSTP port is not
forwarding */
+                   !(xport->bfd && bfd_should_process_flow(xport->bfd,
flow, wc))) {
             if (ctx->xbridge->stp != NULL) {
                 xlate_report(ctx, "STP not in forwarding state, "
                         "skipping output");
diff --git a/tests/bfd.at b/tests/bfd.at
index 925af77..307e9ee 100644
--- a/tests/bfd.at
+++ b/tests/bfd.at
@@ -794,3 +794,33 @@  BFD_VSCTL_LIST_IFACE([p1], ["s/^.*flap_count=\(.*\),
forwarding.*$/\1/p"], ["1"]

OVS_VSWITCHD_STOP
AT_CLEANUP
+
+AT_SETUP([bfd - check that BFD works together with RSTP])
+# Create br0 with interfaces p1
+#    and br1 with interfaces p2
+# with p1 and p2 connected via unix domain socket
+OVS_VSWITCHD_START(
+  [set bridge br0 rstp_enable=true -- \
+   add-br br1 -- \
+   set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
+   set bridge br1 datapath-type=dummy -- \
+   set bridge br1 rstp_enable=true -- \
+])
+
+AT_CHECK([ovs-vsctl add-port br0 p1 -- \
+   set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock
bfd:enable=true -- \
+])
+
+AT_CHECK([ovs-vsctl add-port br1 p2 -- \
+   set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock
bfd:enable=true -- \
+])
+
+ovs-appctl time/stop
+ovs-appctl time/warp 4100 100
+
+# Forwarding should be true
+BFD_CHECK([p1], [true], [false], [none], [up], [No Diagnostic], [none],
[up], [No Diagnostic])