The CFM packets that are out of sequence or contain invalid cfm_interval were
previously not ignored. The behavior is changed with this patch to not
process those CFM frames.

Signed-off-by: Mehak Mahajan <mmaha...@nicira.com>
---
 lib/cfm.c            |   21 ++++++++++-----------
 lib/cfm.h            |    4 +++-
 vswitchd/vswitch.xml |   10 ++++++++++
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/lib/cfm.c b/lib/cfm.c
index ea39e27..473ab1b 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -577,7 +577,7 @@ cfm_process_heartbeat(struct cfm *cfm, const struct ofpbuf 
*p)
         uint64_t ccm_mpid;
         uint32_t ccm_seq;
         bool ccm_opdown;
-        bool fault = false;
+        int cfm_fault = 0;
 
         if (cfm->extended) {
             ccm_mpid = ntohll(ccm->mpid64);
@@ -589,18 +589,18 @@ cfm_process_heartbeat(struct cfm *cfm, const struct 
ofpbuf *p)
         ccm_seq = ntohl(ccm->seq);
 
         if (ccm_interval != cfm->ccm_interval) {
+            cfm_fault |= CFM_FAULT_INTERVAL;
             VLOG_WARN_RL(&rl, "%s: received a CCM with an invalid interval"
                          " (%"PRIu8") from RMP %"PRIu64, cfm->name,
                          ccm_interval, ccm_mpid);
-            fault = true;
         }
 
         if (cfm->extended && ccm_interval == 0
             && ccm_interval_ms_x != cfm->ccm_interval_ms) {
+            cfm_fault |= CFM_FAULT_INTERVAL;
             VLOG_WARN_RL(&rl, "%s: received a CCM with an invalid extended"
                          " interval (%"PRIu16"ms) from RMP %"PRIu64, cfm->name,
                          ccm_interval_ms_x, ccm_mpid);
-            fault = true;
         }
 
         rmp = lookup_remote_mp(cfm, ccm_mpid);
@@ -609,12 +609,11 @@ cfm_process_heartbeat(struct cfm *cfm, const struct 
ofpbuf *p)
                 rmp = xzalloc(sizeof *rmp);
                 hmap_insert(&cfm->remote_mps, &rmp->node, hash_mpid(ccm_mpid));
             } else {
-                cfm->recv_fault |= CFM_FAULT_OVERFLOW;
+                cfm_fault |= CFM_FAULT_OVERFLOW;
                 VLOG_WARN_RL(&rl,
                              "%s: dropped CCM with MPID %"PRIu64" from MAC "
                              ETH_ADDR_FMT, cfm->name, ccm_mpid,
                              ETH_ADDR_ARGS(eth->eth_src));
-                fault = true;
             }
         }
 
@@ -622,23 +621,23 @@ cfm_process_heartbeat(struct cfm *cfm, const struct 
ofpbuf *p)
                  " (interval %"PRIu8") (RDI %s)", cfm->name, ccm_seq,
                  ccm_mpid, ccm_interval, ccm_rdi ? "true" : "false");
 
-        if (ccm_rdi) {
-            fault = true;
-        }
         if (rmp) {
             if (rmp->seq && ccm_seq != (rmp->seq + 1)) {
+                cfm_fault |= CFM_FAULT_SEQUENCE;
                 VLOG_WARN_RL(&rl, "%s: (mpid %"PRIu64") detected sequence"
                              " numbers which indicate possible connectivity"
                              " problems (previous %"PRIu32") (current %"PRIu32
                              ")", cfm->name, ccm_mpid, rmp->seq, ccm_seq);
-                fault = true;
             }
 
             rmp->mpid = ccm_mpid;
-            rmp->recv = true;
-            if (!fault) {
+            if (!cfm_fault && !ccm_rdi) {
                 rmp->num_health_ccm++;
             }
+            if (!cfm_fault) {
+                rmp->recv = true;
+            }
+            cfm->recv_fault |= cfm_fault;
             rmp->seq = ccm_seq;
             rmp->rdi = ccm_rdi;
             rmp->opup = !ccm_opdown;
diff --git a/lib/cfm.h b/lib/cfm.h
index 2b4f888..509da2b 100644
--- a/lib/cfm.h
+++ b/lib/cfm.h
@@ -32,7 +32,9 @@ struct ofpbuf;
     CFM_FAULT_REASON(MAID, maid)           \
     CFM_FAULT_REASON(LOOPBACK, loopback)   \
     CFM_FAULT_REASON(OVERFLOW, overflow)   \
-    CFM_FAULT_REASON(OVERRIDE, override)
+    CFM_FAULT_REASON(OVERRIDE, override)   \
+    CFM_FAULT_REASON(INTERVAL, interval)   \
+    CFM_FAULT_REASON(SEQUENCE, sequence)
 
 enum cfm_fault_bit_index {
 #define CFM_FAULT_REASON(NAME, STR) CFM_FAULT_INDEX_##NAME,
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 03c8539..e734b2e 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1726,6 +1726,16 @@
         an <code>ovs-appctl</code> command.
       </column>
 
+      <column name="cfm_fault_status" key="interval">
+        Indicates a CFM fault was triggered due to the reception of a CCM
+       frame having an invalid interval.
+      </column>
+
+      <column name="cfm_fault_status" key="sequence">
+        Indicates a CFM fault was triggered because the CFM module received
+       a CCM frame with a sequence number that it was not expecting.
+      </column>
+
       <column name="cfm_health">
         <p>
           Indicates the health of the interface as a percentage of CCM frames
-- 
1.7.2.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to