if (sw_if_index == ~0)
return format (s, "N/A");
- vnet_sw_interface_t *swif = vnet_get_sw_interface_safe (vnm, sw_if_index);
+ vnet_sw_interface_t *swif =
+ vnet_get_sw_interface_or_null (vnm, sw_if_index);
if (!swif)
return format (s, "Stale");
return format (s, "%U", format_vnet_sw_interface_name, vnm,
- vnet_get_sw_interface_safe (vnm, sw_if_index));
+ vnet_get_sw_interface_or_null (vnm, sw_if_index));
}
typedef struct l2fib_dump_walk_ctx_t_
l2fib_entry_result_t *l2fe_res;
} l2fib_dump_walk_ctx_t;
-static void
+static int
l2fib_dump_walk_cb (BVT (clib_bihash_kv) * kvp, void *arg)
{
l2fib_dump_walk_ctx_t *ctx = arg;
vec_add1 (ctx->l2fe_key, key);
vec_add1 (ctx->l2fe_res, result);
}
+
+ return (BIHASH_WALK_CONTINUE);
}
void
u8 now;
} l2fib_show_walk_ctx_t;
-static void
+static int
l2fib_show_walk_cb (BVT (clib_bihash_kv) * kvp, void *arg)
{
l2fib_show_walk_ctx_t *ctx = arg;
u8 *s = NULL;
if (ctx->learn && l2fib_entry_result_is_set_AGE_NOT (&result))
- return; /* skip provisioned macs */
+ return (BIHASH_WALK_CONTINUE); /* skip provisioned macs */
if (ctx->add && !l2fib_entry_result_is_set_AGE_NOT (&result))
- return; /* skip learned macs */
+ return (BIHASH_WALK_CONTINUE); /* skip learned macs */
bd_config = vec_elt_at_index (l2input_main.bd_configs,
key.fields.bd_index);
ctx->vnm, result.fields.sw_if_index);
vec_free (s);
}
+
+ return (BIHASH_WALK_CONTINUE);
}
/** Display the contents of the l2fib. */
/* set up key */
key.raw = l2fib_make_key (mac, bd_index);
+ kv.key = key.raw;
/* check if entry already exist */
if (BV (clib_bihash_search) (&fm->mac_table, &kv, &kv))
/* no aging for provisioned entry */
l2fib_entry_result_set_AGE_NOT (&result);
- kv.key = key.raw;
kv.value = result.raw;
BV (clib_bihash_add_del) (&fm->mac_table, &kv, 1 /* is_add */ );
vl_api_l2_macs_event_t *mp = 0;
vl_api_registration_t *reg = 0;
+ /* Don't scan the l2 fib if it hasn't been instantiated yet */
+ if (alloc_arena (h) == 0)
+ return 0.0;
+
if (client)
{
mp = allocate_mac_evt_buf (client, cl_idx);
key.fields.mac, 6);
mp->mac[evt_idx].action =
l2fib_entry_result_is_set_LRN_MOV (&result) ?
- MAC_EVENT_ACTION_MOVE : MAC_EVENT_ACTION_ADD;
+ (vl_api_mac_event_action_t) MAC_EVENT_ACTION_MOVE
+ : (vl_api_mac_event_action_t) MAC_EVENT_ACTION_ADD;
+ mp->mac[evt_idx].action =
+ htonl (mp->mac[evt_idx].action);
mp->mac[evt_idx].sw_if_index =
htonl (result.fields.sw_if_index);
/* clear event bits and update mac entry */
/* copy mac entry to event msg */
clib_memcpy_fast (mp->mac[evt_idx].mac_addr, key.fields.mac,
6);
- mp->mac[evt_idx].action = MAC_EVENT_ACTION_DELETE;
+ mp->mac[evt_idx].action =
+ (vl_api_mac_event_action_t) MAC_EVENT_ACTION_DELETE;
+ mp->mac[evt_idx].action = htonl (mp->mac[evt_idx].action);
mp->mac[evt_idx].sw_if_index =
htonl (result.fields.sw_if_index);
evt_idx++;