mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
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.
This commit is contained in:
69
lib/cfm.c
69
lib/cfm.c
@@ -17,6 +17,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "cfm.h"
|
#include "cfm.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -44,6 +45,7 @@ struct cfm_internal {
|
|||||||
uint32_t seq; /* The sequence number of our last CCM. */
|
uint32_t seq; /* The sequence number of our last CCM. */
|
||||||
uint8_t ccm_interval; /* The CCM transmission interval. */
|
uint8_t ccm_interval; /* The CCM transmission interval. */
|
||||||
int ccm_interval_ms; /* 'ccm_interval' in milliseconds. */
|
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 tx_timer; /* Send CCM when expired. */
|
||||||
struct timer fault_timer; /* Check for faults 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,
|
static void cfm_unixctl_show(struct unixctl_conn *, const char *args,
|
||||||
void *aux);
|
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
|
static int
|
||||||
ccm_interval_to_ms(uint8_t interval)
|
ccm_interval_to_ms(uint8_t interval)
|
||||||
{
|
{
|
||||||
@@ -154,6 +181,7 @@ cfm_create(void)
|
|||||||
cfm = &cfmi->cfm;
|
cfm = &cfmi->cfm;
|
||||||
|
|
||||||
hmap_init(&cfm->remote_mps);
|
hmap_init(&cfm->remote_mps);
|
||||||
|
cfm_generate_maid(cfmi);
|
||||||
list_push_back(&all_cfms, &cfmi->list_node);
|
list_push_back(&all_cfms, &cfmi->list_node);
|
||||||
return cfm;
|
return cfm;
|
||||||
}
|
}
|
||||||
@@ -233,7 +261,7 @@ cfm_compose_ccm(struct cfm *cfm, struct ccm *ccm)
|
|||||||
ccm->seq = htonl(++cfmi->seq);
|
ccm->seq = htonl(++cfmi->seq);
|
||||||
ccm->mpid = htons(cfmi->cfm.mpid);
|
ccm->mpid = htons(cfmi->cfm.mpid);
|
||||||
ccm->flags = cfmi->ccm_interval;
|
ccm->flags = cfmi->ccm_interval;
|
||||||
memcpy(ccm->maid, cfmi->cfm.maid, sizeof ccm->maid);
|
memcpy(ccm->maid, cfmi->maid, sizeof ccm->maid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -317,43 +345,6 @@ cfm_get_remote_mp(const struct cfm *cfm, uint16_t mpid)
|
|||||||
return lookup_remote_mp(&cfm->remote_mps, 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'. */
|
/* Returns true if the CFM library should process packets from 'flow'. */
|
||||||
bool
|
bool
|
||||||
cfm_should_process_flow(const struct flow *flow)
|
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
|
* them judiciously, especially when CFM is used to check slave status of
|
||||||
* bonds. Furthermore, faults can be maliciously triggered by crafting
|
* bonds. Furthermore, faults can be maliciously triggered by crafting
|
||||||
* invalid CCMs. */
|
* 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 "
|
VLOG_WARN_RL(&rl, "Received unexpected remote MAID from MAC "
|
||||||
ETH_ADDR_FMT, ETH_ADDR_ARGS(eth->eth_src));
|
ETH_ADDR_FMT, ETH_ADDR_ARGS(eth->eth_src));
|
||||||
} else {
|
} else {
|
||||||
|
@@ -53,7 +53,6 @@ BUILD_ASSERT_DECL(CCM_LEN == sizeof(struct ccm));
|
|||||||
struct cfm {
|
struct cfm {
|
||||||
/* Configuration Variables. */
|
/* Configuration Variables. */
|
||||||
uint16_t mpid; /* The MPID of this CFM. */
|
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. */
|
int interval; /* The requested transmission interval. */
|
||||||
const char *name; /* Name of this CFM object. */
|
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);
|
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 *);
|
bool cfm_should_process_flow(const struct flow *);
|
||||||
|
|
||||||
void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
|
void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
|
||||||
|
@@ -751,7 +751,6 @@ set_cfm(struct ofport *ofport_, const struct cfm *cfm,
|
|||||||
ofport->cfm->mpid = cfm->mpid;
|
ofport->cfm->mpid = cfm->mpid;
|
||||||
ofport->cfm->interval = cfm->interval;
|
ofport->cfm->interval = cfm->interval;
|
||||||
ofport->cfm->name = cfm->name;
|
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);
|
cfm_update_remote_mps(ofport->cfm, remote_mps, n_remote_mps);
|
||||||
|
|
||||||
|
@@ -2505,7 +2505,6 @@ iface_configure_cfm(struct iface *iface)
|
|||||||
struct cfm cfm;
|
struct cfm cfm;
|
||||||
uint16_t *remote_mps;
|
uint16_t *remote_mps;
|
||||||
struct ovsrec_monitor *mon;
|
struct ovsrec_monitor *mon;
|
||||||
uint8_t maid[CCM_MAID_LEN];
|
|
||||||
|
|
||||||
mon = iface->cfg->monitor;
|
mon = iface->cfg->monitor;
|
||||||
|
|
||||||
@@ -2514,17 +2513,10 @@ iface_configure_cfm(struct iface *iface)
|
|||||||
return;
|
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.mpid = mon->mpid;
|
||||||
cfm.interval = mon->interval ? *mon->interval : 1000;
|
cfm.interval = mon->interval ? *mon->interval : 1000;
|
||||||
cfm.name = iface->name;
|
cfm.name = iface->name;
|
||||||
|
|
||||||
memcpy(cfm.maid, maid, sizeof cfm.maid);
|
|
||||||
|
|
||||||
remote_mps = xzalloc(mon->n_remote_mps * sizeof *remote_mps);
|
remote_mps = xzalloc(mon->n_remote_mps * sizeof *remote_mps);
|
||||||
for(i = 0; i < mon->n_remote_mps; i++) {
|
for(i = 0; i < mon->n_remote_mps; i++) {
|
||||||
remote_mps[i] = mon->remote_mps[i]->mpid;
|
remote_mps[i] = mon->remote_mps[i]->mpid;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{"name": "Open_vSwitch",
|
{"name": "Open_vSwitch",
|
||||||
"version": "3.4.2",
|
"version": "3.5.0",
|
||||||
"cksum": "976911089 15276",
|
"cksum": "1684955806 14964",
|
||||||
"tables": {
|
"tables": {
|
||||||
"Open_vSwitch": {
|
"Open_vSwitch": {
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -204,16 +204,6 @@
|
|||||||
"mpid": {
|
"mpid": {
|
||||||
"type" : {
|
"type" : {
|
||||||
"key": { "type": "integer", "minInteger": 1, "maxInteger": 8191}}},
|
"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": {
|
"interval": {
|
||||||
"type": {
|
"type": {
|
||||||
"key": { "type": "integer", "minInteger": 100},
|
"key": { "type": "integer", "minInteger": 100},
|
||||||
|
@@ -1550,9 +1550,8 @@
|
|||||||
<group title="Monitor Configuration">
|
<group title="Monitor Configuration">
|
||||||
<column name="mpid">
|
<column name="mpid">
|
||||||
A Maintenance Point ID (MPID) uniquely identifies each endpoint within
|
A Maintenance Point ID (MPID) uniquely identifies each endpoint within
|
||||||
a Maintenance Association (see <ref column="ma_name"/>). The MPID is
|
a Maintenance Association. The MPID is used to identify this
|
||||||
used to identify this <ref table="Monitor"/> to other endpoints in the
|
<ref table="Monitor"/> to other endpoints in the MA.
|
||||||
MA.
|
|
||||||
</column>
|
</column>
|
||||||
|
|
||||||
<column name="remote_mps">
|
<column name="remote_mps">
|
||||||
@@ -1563,18 +1562,6 @@
|
|||||||
signaled.
|
signaled.
|
||||||
</column>
|
</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">
|
<column name="interval">
|
||||||
The transmission interval of CCMs in milliseconds. Three missed CCMs
|
The transmission interval of CCMs in milliseconds. Three missed CCMs
|
||||||
indicate a connectivity fault. Defaults to 1000ms.
|
indicate a connectivity fault. Defaults to 1000ms.
|
||||||
|
Reference in New Issue
Block a user