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. */
+ uint16_t ccm_vlan; /* Vlan tag of CCM PDUs. */
uint8_t maid[CCM_MAID_LEN]; /* The MAID of this CFM. */
struct timer tx_timer; /* Send CCM when expired. */
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
static struct hmap all_cfms = HMAP_INITIALIZER(&all_cfms);
-static void cfm_unixctl_show(struct unixctl_conn *, const char *args,
- void *aux);
+static unixctl_cb_func cfm_unixctl_show;
static const uint8_t *
cfm_ccm_addr(const struct cfm *cfm)
void
cfm_init(void)
{
- unixctl_command_register("cfm/show", "[interface]", cfm_unixctl_show,
+ unixctl_command_register("cfm/show", "[interface]", 0, 1, cfm_unixctl_show,
NULL);
}
struct ccm *ccm;
timer_set_duration(&cfm->tx_timer, cfm->ccm_interval_ms);
- ccm = eth_compose(packet, cfm_ccm_addr(cfm), eth_src, ETH_TYPE_CFM,
- sizeof *ccm);
+ eth_compose(packet, cfm_ccm_addr(cfm), eth_src, ETH_TYPE_CFM, sizeof *ccm);
+
+ if (cfm->ccm_vlan) {
+ eth_push_vlan(packet, htons(cfm->ccm_vlan));
+ }
+
+ ccm = packet->l3;
ccm->mdlevel_version = 0;
ccm->opcode = CCM_OPCODE;
ccm->tlv_offset = 70;
interval = ms_to_ccm_interval(s->interval);
interval_ms = ccm_interval_to_ms(interval);
+ cfm->ccm_vlan = s->ccm_vlan & VLAN_VID_MASK;
if (cfm->extended && interval_ms != s->interval) {
interval = 0;
interval_ms = MIN(s->interval, UINT16_MAX);
}
static void
-cfm_unixctl_show(struct unixctl_conn *conn,
- const char *args, void *aux OVS_UNUSED)
+cfm_unixctl_show(struct unixctl_conn *conn, int argc, const char *argv[],
+ void *aux OVS_UNUSED)
{
struct ds ds = DS_EMPTY_INITIALIZER;
const struct cfm *cfm;
- if (strlen(args)) {
- cfm = cfm_find(args);
+ if (argc > 1) {
+ cfm = cfm_find(argv[1]);
if (!cfm) {
unixctl_command_reply(conn, 501, "no such CFM object");
return;