summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2011-08-30 17:37:06 -0700
committerEthan Jackson <ethan@nicira.com>2011-09-09 14:11:14 -0700
commitef9819b5f131ae3c727309a7f3758fa079679c85 (patch)
tree89af2bc6d1d8c831cddf4222192087a994cf3920
parent144216a3358fc3ddc8a8253dd85978f112cb7bbc (diff)
downloadopenvswitch-ef9819b5f131ae3c727309a7f3758fa079679c85.tar.gz
cfm: New cfm extended mode.
The new extended mode introduced in this patch will be used for features which break wire compatibility with 802.1ag compliant implementations. Bug #7014.
-rw-r--r--lib/cfm.c20
-rw-r--r--lib/cfm.h3
-rw-r--r--ofproto/ofproto-dpif.c2
-rw-r--r--vswitchd/bridge.c5
-rw-r--r--vswitchd/vswitch.xml5
5 files changed, 28 insertions, 7 deletions
diff --git a/lib/cfm.c b/lib/cfm.c
index 6494f09ce..b4f64c719 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -40,6 +40,9 @@ VLOG_DEFINE_THIS_MODULE(cfm);
/* Ethernet destination address of CCM packets. */
static const uint8_t eth_addr_ccm[6] = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x30 };
+static const uint8_t eth_addr_ccm_x[6] = {
+ 0x01, 0x23, 0x20, 0x00, 0x00, 0x30
+};
#define ETH_TYPE_CFM 0x8902
@@ -67,6 +70,7 @@ struct cfm {
struct hmap_node hmap_node; /* Node in all_cfms list. */
uint16_t mpid;
+ bool extended; /* Extended mode. */
bool fault; /* Indicates connectivity fault. */
bool unexpected_recv; /* Received an unexpected CCM. */
@@ -98,6 +102,12 @@ static struct hmap all_cfms = HMAP_INITIALIZER(&all_cfms);
static void cfm_unixctl_show(struct unixctl_conn *, const char *args,
void *aux);
+static const uint8_t *
+cfm_ccm_addr(const struct cfm *cfm)
+{
+ return cfm->extended ? eth_addr_ccm_x : eth_addr_ccm;
+}
+
static void
cfm_generate_maid(struct cfm *cfm)
{
@@ -297,8 +307,7 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet,
struct ccm *ccm;
timer_set_duration(&cfm->tx_timer, cfm->ccm_interval_ms);
-
- ccm = eth_compose(packet, eth_addr_ccm, eth_src, ETH_TYPE_CFM,
+ ccm = eth_compose(packet, cfm_ccm_addr(cfm), eth_src, ETH_TYPE_CFM,
sizeof *ccm);
ccm->mdlevel_version = 0;
ccm->opcode = CCM_OPCODE;
@@ -333,6 +342,7 @@ cfm_configure(struct cfm *cfm, const struct cfm_settings *s)
}
cfm->mpid = s->mpid;
+ cfm->extended = s->extended;
interval = ms_to_ccm_interval(s->interval);
if (interval != cfm->ccm_interval) {
@@ -346,12 +356,12 @@ cfm_configure(struct cfm *cfm, const struct cfm_settings *s)
return true;
}
-/* Returns true if the CFM library should process packets from 'flow'. */
+/* Returns true if 'cfm' should process packets from 'flow'. */
bool
-cfm_should_process_flow(const struct flow *flow)
+cfm_should_process_flow(const struct cfm *cfm, const struct flow *flow)
{
return (ntohs(flow->dl_type) == ETH_TYPE_CFM
- && eth_addr_equals(flow->dl_dst, eth_addr_ccm));
+ && eth_addr_equals(flow->dl_dst, cfm_ccm_addr(cfm)));
}
/* Updates internal statistics relevant to packet 'p'. Should be called on
diff --git a/lib/cfm.h b/lib/cfm.h
index 659077b47..0d1ddb2f0 100644
--- a/lib/cfm.h
+++ b/lib/cfm.h
@@ -27,6 +27,7 @@ struct ofpbuf;
struct cfm_settings {
uint16_t mpid; /* The MPID of this CFM. */
int interval; /* The requested transmission interval. */
+ bool extended; /* Run in extended mode. */
};
void cfm_init(void);
@@ -37,7 +38,7 @@ bool cfm_should_send_ccm(struct cfm *);
void cfm_compose_ccm(struct cfm *, struct ofpbuf *packet, uint8_t eth_src[6]);
void cfm_wait(struct cfm *);
bool cfm_configure(struct cfm *, const struct cfm_settings *);
-bool cfm_should_process_flow(const struct flow *);
+bool cfm_should_process_flow(const struct cfm *cfm, const struct flow *);
void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
bool cfm_get_fault(const struct cfm *);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index c84456bc1..9a7132141 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -1620,7 +1620,7 @@ process_special(struct ofproto_dpif *ofproto, const struct flow *flow,
return false;
}
- if (ofport->cfm && cfm_should_process_flow(flow)) {
+ if (ofport->cfm && cfm_should_process_flow(ofport->cfm, flow)) {
if (packet) {
cfm_process_heartbeat(ofport->cfm, packet);
}
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index e903a808c..44b5fbe94 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2606,6 +2606,7 @@ static void
iface_configure_cfm(struct iface *iface)
{
const struct ovsrec_interface *cfg = iface->cfg;
+ const char *extended_str;
struct cfm_settings s;
if (!cfg->n_cfm_mpid) {
@@ -2620,6 +2621,10 @@ iface_configure_cfm(struct iface *iface)
s.interval = 1000;
}
+ extended_str = get_interface_other_config(iface->cfg, "cfm_extended",
+ "false");
+ s.extended = !strcasecmp("true", extended_str);
+
ofproto_port_set_cfm(iface->port->bridge->ofproto, iface->ofp_port, &s);
}
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index b974a3d02..5151fea21 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1425,6 +1425,11 @@
<dd> The transmission interval of CFM heartbeats in milliseconds.
Three missed heartbeat receptions indicate a connectivity fault.
Defaults to 1000ms. </dd>
+ <dt><code>cfm_extended</code></dt>
+ <dd> When true, the CFM module operates in extended mode. This causes
+ it to use a nonstandard destination address to avoid conflicting
+ with compliant implementations which may be running concurrently on
+ the network. Defaults to false. </dd>
<dt><code>bond-stable-id</code></dt>
<dd> A positive integer using in <code>stable</code> bond mode to
make slave selection decisions. Allocating