cfm: No longer allow configuration of ma_name and md_name.
authorEthan Jackson <ethan@nicira.com>
Thu, 12 May 2011 23:08:52 +0000 (16:08 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 20 May 2011 22:53:29 +0000 (15:53 -0700)
These settings added complexity to the database and CFM module
interface with negligible benefit.  This patch removes them in such
a way that they can easily be re-added in the (unlikely) event that
we need them in the future.

lib/cfm.c
lib/cfm.h
ofproto/ofproto-dpif.c
vswitchd/bridge.c
vswitchd/vswitch.ovsschema
vswitchd/vswitch.xml

index ff416a3..e0a5121 100644 (file)
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -17,6 +17,7 @@
 #include <config.h>
 #include "cfm.h"
 
+#include <assert.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
@@ -44,6 +45,7 @@ struct cfm_internal {
     uint32_t seq;          /* The sequence number of our last CCM. */
     uint8_t ccm_interval;  /* The CCM transmission interval. */
     int ccm_interval_ms;   /* 'ccm_interval' in milliseconds. */
+    uint8_t maid[CCM_MAID_LEN]; /* The MAID of this CFM. */
 
     struct timer tx_timer;    /* Send CCM when expired. */
     struct timer fault_timer; /* Check for faults when expired. */
@@ -55,6 +57,31 @@ static struct list all_cfms = LIST_INITIALIZER(&all_cfms);
 static void cfm_unixctl_show(struct unixctl_conn *, const char *args,
                              void *aux);
 
+static void
+cfm_generate_maid(struct cfm_internal *cfmi)
+{
+    const char *ovs_md_name = "ovs_md";
+    const char *ovs_ma_name = "ovs_ma";
+    uint8_t *ma_p;
+    size_t md_len, ma_len;
+
+    memset(cfmi->maid, 0, CCM_MAID_LEN);
+
+    md_len = strlen(ovs_md_name);
+    ma_len = strlen(ovs_ma_name);
+
+    assert(md_len && ma_len && md_len + ma_len + 4 <= CCM_MAID_LEN);
+
+    cfmi->maid[0] = 4;                           /* MD name string format. */
+    cfmi->maid[1] = md_len;                      /* MD name size. */
+    memcpy(&cfmi->maid[2], ovs_md_name, md_len); /* MD name. */
+
+    ma_p = cfmi->maid + 2 + md_len;
+    ma_p[0] = 2;                           /* MA name string format. */
+    ma_p[1] = ma_len;                      /* MA name size. */
+    memcpy(&ma_p[2], ovs_ma_name, ma_len); /* MA name. */
+}
+
 static int
 ccm_interval_to_ms(uint8_t interval)
 {
@@ -154,6 +181,7 @@ cfm_create(void)
     cfm  = &cfmi->cfm;
 
     hmap_init(&cfm->remote_mps);
+    cfm_generate_maid(cfmi);
     list_push_back(&all_cfms, &cfmi->list_node);
     return cfm;
 }
@@ -233,7 +261,7 @@ cfm_compose_ccm(struct cfm *cfm, struct ccm *ccm)
     ccm->seq = htonl(++cfmi->seq);
     ccm->mpid = htons(cfmi->cfm.mpid);
     ccm->flags = cfmi->ccm_interval;
-    memcpy(ccm->maid, cfmi->cfm.maid, sizeof ccm->maid);
+    memcpy(ccm->maid, cfmi->maid, sizeof ccm->maid);
 }
 
 void
@@ -317,43 +345,6 @@ cfm_get_remote_mp(const struct cfm *cfm, uint16_t mpid)
     return lookup_remote_mp(&cfm->remote_mps, mpid);
 }
 
-/* Generates 'maid' from 'md_name' and 'ma_name'.  A NULL parameter indicates
- * the default should be used. Returns false if unsuccessful. */
-bool
-cfm_generate_maid(const char *md_name, const char *ma_name,
-                  uint8_t maid[CCM_MAID_LEN])
-{
-    uint8_t *ma_p;
-    size_t md_len, ma_len;
-
-    if (!md_name) {
-        md_name = "ovs";
-    }
-
-    if (!ma_name) {
-        ma_name = "ovs";
-    }
-
-    memset(maid, 0, CCM_MAID_LEN);
-
-    md_len = strlen(md_name);
-    ma_len = strlen(ma_name);
-
-    if (!md_len || !ma_len || md_len + ma_len + 4 > CCM_MAID_LEN) {
-        return false;
-    }
-
-    maid[0] = 4;                       /* MD name string format. */
-    maid[1] = md_len;                  /* MD name size. */
-    memcpy(&maid[2], md_name, md_len); /* MD name. */
-
-    ma_p    = maid + 2 + md_len;
-    ma_p[0] = 2;                       /* MA name string format. */
-    ma_p[1] = ma_len;                  /* MA name size. */
-    memcpy(&ma_p[2], ma_name, ma_len); /* MA name. */
-    return true;
-}
-
 /* Returns true if the CFM library should process packets from 'flow'. */
 bool
 cfm_should_process_flow(const struct flow *flow)
@@ -398,7 +389,7 @@ cfm_process_heartbeat(struct cfm *cfm, const struct ofpbuf *p)
      * them judiciously, especially when CFM is used to check slave status of
      * bonds. Furthermore, faults can be maliciously triggered by crafting
      * invalid CCMs. */
-    if (memcmp(ccm->maid, cfm->maid, sizeof ccm->maid)) {
+    if (memcmp(ccm->maid, cfmi->maid, sizeof ccm->maid)) {
         VLOG_WARN_RL(&rl, "Received unexpected remote MAID from MAC "
                      ETH_ADDR_FMT, ETH_ADDR_ARGS(eth->eth_src));
     } else {
index c83a7cc..60e234e 100644 (file)
--- a/lib/cfm.h
+++ b/lib/cfm.h
@@ -53,7 +53,6 @@ BUILD_ASSERT_DECL(CCM_LEN == sizeof(struct ccm));
 struct cfm {
     /* Configuration Variables. */
     uint16_t mpid;              /* The MPID of this CFM. */
-    uint8_t maid[CCM_MAID_LEN]; /* The MAID of this CFM. */
     int interval;               /* The requested transmission interval. */
     const char *name;           /* Name of this CFM object. */
 
@@ -92,9 +91,6 @@ void cfm_update_remote_mps(struct cfm *, const uint16_t *mpid, size_t n_mpids);
 
 const struct remote_mp *cfm_get_remote_mp(const struct cfm *, uint16_t mpid);
 
-bool cfm_generate_maid(const char *md_name, const char *ma_name,
-                       uint8_t maid[CCM_MAID_LEN]);
-
 bool cfm_should_process_flow(const struct flow *);
 
 void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
index 5807c56..7702221 100644 (file)
@@ -751,7 +751,6 @@ set_cfm(struct ofport *ofport_, const struct cfm *cfm,
         ofport->cfm->mpid = cfm->mpid;
         ofport->cfm->interval = cfm->interval;
         ofport->cfm->name = cfm->name;
-        memcpy(ofport->cfm->maid, cfm->maid, CCM_MAID_LEN);
 
         cfm_update_remote_mps(ofport->cfm, remote_mps, n_remote_mps);
 
index aba0b94..c7b0262 100644 (file)
@@ -2505,7 +2505,6 @@ iface_configure_cfm(struct iface *iface)
     struct cfm cfm;
     uint16_t *remote_mps;
     struct ovsrec_monitor *mon;
-    uint8_t maid[CCM_MAID_LEN];
 
     mon = iface->cfg->monitor;
 
@@ -2514,17 +2513,10 @@ iface_configure_cfm(struct iface *iface)
         return;
     }
 
-    if (!cfm_generate_maid(mon->md_name, mon->ma_name, maid)) {
-        VLOG_WARN("interface %s: Failed to generate MAID.", iface->name);
-        return;
-    }
-
     cfm.mpid     = mon->mpid;
     cfm.interval = mon->interval ? *mon->interval : 1000;
     cfm.name = iface->name;
 
-    memcpy(cfm.maid, maid, sizeof cfm.maid);
-
     remote_mps = xzalloc(mon->n_remote_mps * sizeof *remote_mps);
     for(i = 0; i < mon->n_remote_mps; i++) {
         remote_mps[i] = mon->remote_mps[i]->mpid;
index 96be69f..0622512 100644 (file)
@@ -1,6 +1,6 @@
 {"name": "Open_vSwitch",
- "version": "3.4.2",
- "cksum": "976911089 15276",
+ "version": "3.5.0",
+ "cksum": "1684955806 14964",
  "tables": {
    "Open_vSwitch": {
      "columns": {
        "mpid": {
          "type" : {
            "key": { "type": "integer", "minInteger": 1, "maxInteger": 8191}}},
-       "md_name": {
-         "type" : {
-           "key": { "type": "string", "minLength": 1, "maxLength": 43},
-           "min": 0,
-           "max": 1}},
-       "ma_name": {
-         "type" : {
-           "key": { "type": "string", "minLength": 1, "maxLength": 43},
-           "min": 0,
-           "max": 1}},
        "interval": {
          "type": {
            "key": { "type": "integer", "minInteger": 100},
index a16c486..f9a82cc 100644 (file)
     <group title="Monitor Configuration">
       <column name="mpid">
         A Maintenance Point ID (MPID) uniquely identifies each endpoint within
-        a Maintenance Association (see <ref column="ma_name"/>).  The MPID is
-        used to identify this <ref table="Monitor"/> to other endpoints in the
-        MA.
+        a Maintenance Association.  The MPID is used to identify this
+        <ref table="Monitor"/> to other endpoints in the MA.
       </column>
 
       <column name="remote_mps">
         signaled.
       </column>
 
-      <column name="ma_name">
-        A Maintenance Association (MA) name pairs with a Maintenance Domain
-        (MD) name to uniquely identify a MA.  A MA is a group of endpoints who
-        have complete and exclusive interconnectivity. Defaults to
-        <code>ovs</code> if unset.
-      </column>
-
-      <column name="md_name">
-        A Maintenance Domain name pairs with a Maintenance Association name to
-        uniquely identify a MA. Defaults to <code>ovs</code> if unset.
-      </column>
-
       <column name="interval">
         The transmission interval of CCMs in milliseconds.  Three missed CCMs
         indicate a connectivity fault.  Defaults to 1000ms.