From 84c5d450aaefb73b944506afe9f2fe05fa0612bf Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Thu, 12 May 2011 16:08:52 -0700 Subject: [PATCH] cfm: No longer allow configuration of ma_name and md_name. 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 | 69 +++++++++++++++++--------------------- lib/cfm.h | 4 --- ofproto/ofproto-dpif.c | 1 - vswitchd/bridge.c | 8 ----- vswitchd/vswitch.ovsschema | 14 ++------ vswitchd/vswitch.xml | 17 ++-------- 6 files changed, 34 insertions(+), 79 deletions(-) diff --git a/lib/cfm.c b/lib/cfm.c index ff416a357..e0a5121db 100644 --- a/lib/cfm.c +++ b/lib/cfm.c @@ -17,6 +17,7 @@ #include #include "cfm.h" +#include #include #include #include @@ -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 { diff --git a/lib/cfm.h b/lib/cfm.h index c83a7cce1..60e234ef8 100644 --- 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); diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 5807c5647..77022213b 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -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); diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index aba0b942e..c7b0262d6 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -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; diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema index 96be69f73..0622512c6 100644 --- a/vswitchd/vswitch.ovsschema +++ b/vswitchd/vswitch.ovsschema @@ -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": { @@ -204,16 +204,6 @@ "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}, diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index a16c486cc..f9a82ccf0 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -1550,9 +1550,8 @@ A Maintenance Point ID (MPID) uniquely identifies each endpoint within - a Maintenance Association (see ). The MPID is - used to identify this to other endpoints in the - MA. + a Maintenance Association. The MPID is used to identify this + to other endpoints in the MA. @@ -1563,18 +1562,6 @@ signaled. - - 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 - ovs if unset. - - - - A Maintenance Domain name pairs with a Maintenance Association name to - uniquely identify a MA. Defaults to ovs if unset. - - The transmission interval of CCMs in milliseconds. Three missed CCMs indicate a connectivity fault. Defaults to 1000ms. -- 2.43.0