diff options
author | Neale Ranns <nranns@cisco.com> | 2018-04-06 09:18:11 -0700 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-04-12 06:53:38 -0400 |
commit | 756cd9441752fc8f84104c9ee19099506ba89f85 (patch) | |
tree | da9afcf137e7cb540713d39a3c5df2b0fdd8ead2 /src | |
parent | 58c711a196d9b178bfe6190964a7df92145cf949 (diff) |
Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify'
Change-Id: I994649761fe2e66e12ae0e49a84fb1d0a966ddfb
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src')
51 files changed, 215 insertions, 180 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c index 7d3a8527eac..d95e798eb75 100644 --- a/src/plugins/acl/acl.c +++ b/src/plugins/acl/acl.c @@ -1347,7 +1347,6 @@ acl_interface_set_inout_acl_list (acl_main_t * am, u32 sw_if_index, lc_index = acl_plugin_get_lookup_context_index (am->interface_acl_user_id, sw_if_index, is_input); - ASSERT (lc_index >= 0); (*pinout_lc_index_by_sw_if_index)[sw_if_index] = lc_index; } acl_plugin_set_acl_vec_for_context (lc_index, vec_acl_list_index); diff --git a/src/plugins/ioam/analyse/ip6/node.c b/src/plugins/ioam/analyse/ip6/node.c index 6db6355e9f0..902fb9b09ce 100644 --- a/src/plugins/ioam/analyse/ip6/node.c +++ b/src/plugins/ioam/analyse/ip6/node.c @@ -424,7 +424,7 @@ ip6_ioam_analyse_register_hbh_handler (u8 option, { ip6_ioam_analyser_main_t *am = &ioam_analyser_main; - ASSERT (option < ARRAY_LEN (am->analyse_hbh_handler)); + ASSERT ((u32) option < ARRAY_LEN (am->analyse_hbh_handler)); /* Already registered */ if (am->analyse_hbh_handler[option]) @@ -440,7 +440,7 @@ ip6_ioam_analyse_unregister_hbh_handler (u8 option) { ip6_ioam_analyser_main_t *am = &ioam_analyser_main; - ASSERT (option < ARRAY_LEN (am->analyse_hbh_handler)); + ASSERT ((u32) option < ARRAY_LEN (am->analyse_hbh_handler)); /* Not registered */ if (!am->analyse_hbh_handler[option]) diff --git a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c index f3d03b674cc..e758b522ba0 100644 --- a/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c +++ b/src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c @@ -89,7 +89,7 @@ vxlan_gpe_ioam_add_register_option (u8 option, { vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main; - ASSERT (option < ARRAY_LEN (hm->add_options)); + ASSERT ((u32) option < ARRAY_LEN (hm->add_options)); /* Already registered */ if (hm->add_options[option]) @@ -106,7 +106,7 @@ vxlan_gpe_add_unregister_option (u8 option) { vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main; - ASSERT (option < ARRAY_LEN (hm->add_options)); + ASSERT ((u32) option < ARRAY_LEN (hm->add_options)); /* Not registered */ if (!hm->add_options[option]) @@ -128,7 +128,7 @@ vxlan_gpe_ioam_register_option (u8 option, { vxlan_gpe_ioam_main_t *im = &vxlan_gpe_ioam_main; - ASSERT (option < ARRAY_LEN (im->options)); + ASSERT ((u32) option < ARRAY_LEN (im->options)); /* Already registered */ if (im->options[option]) @@ -145,7 +145,7 @@ vxlan_gpe_ioam_unregister_option (u8 option) { vxlan_gpe_ioam_main_t *hm = &vxlan_gpe_ioam_main; - ASSERT (option < ARRAY_LEN (hm->options)); + ASSERT ((u32) option < ARRAY_LEN (hm->options)); /* Not registered */ if (!hm->options[option]) diff --git a/src/plugins/lb/lb.c b/src/plugins/lb/lb.c index 06953a45aaa..090d190e08b 100644 --- a/src/plugins/lb/lb.c +++ b/src/plugins/lb/lb.c @@ -625,7 +625,7 @@ static void lb_vip_add_adjacency(lb_main_t *lbm, lb_vip_t *vip) proto = DPO_PROTO_IP6; } - if(lb_vip_is_gre4(vip)) + if (lb_vip_is_gre4(vip)) dpo_type = lbm->dpo_gre4_type; else if (lb_vip_is_gre6(vip)) dpo_type = lbm->dpo_gre6_type; @@ -813,7 +813,7 @@ lb_as_stack (lb_as_t *as) lb_vip_t *vip = &lbm->vips[as->vip_index]; dpo_type_t dpo_type = 0; - if(lb_vip_is_gre4(vip)) + if (lb_vip_is_gre4(vip)) dpo_type = lbm->dpo_gre4_type; else if (lb_vip_is_gre6(vip)) dpo_type = lbm->dpo_gre6_type; diff --git a/src/plugins/lb/lb.h b/src/plugins/lb/lb.h index 8db0394075c..61d17d713a5 100644 --- a/src/plugins/lb/lb.h +++ b/src/plugins/lb/lb.h @@ -235,7 +235,7 @@ typedef struct { || (vip)->type == LB_VIP_TYPE_IP4_GRE4) #define lb_vip_is_gre6(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE6 \ || (vip)->type == LB_VIP_TYPE_IP4_GRE6) -#define lb_vip_is_l3dsr(vip) ((vip)->type == LB_VIP_TYPE_IP4_L3DSR) +#define lb_vip_is_l3dsr(vip) (vip)->type == LB_VIP_TYPE_IP4_L3DSR #define lb_encap_is_ip4(vip) ((vip)->type == LB_VIP_TYPE_IP6_GRE4 \ || (vip)->type == LB_VIP_TYPE_IP4_GRE4 \ diff --git a/src/vcl/sock_test_client.c b/src/vcl/sock_test_client.c index 3559c68562f..1ed4b89a3b1 100644 --- a/src/vcl/sock_test_client.c +++ b/src/vcl/sock_test_client.c @@ -794,16 +794,20 @@ parse_input () sock_test_socket_t *ctrl = &scm->ctrl_socket; sock_test_t rv = SOCK_TEST_TYPE_NONE; - if (!strcmp (SOCK_TEST_TOKEN_EXIT, ctrl->txbuf)) + if (!strncmp (SOCK_TEST_TOKEN_EXIT, ctrl->txbuf, + strlen (SOCK_TEST_TOKEN_EXIT))) rv = SOCK_TEST_TYPE_EXIT; - else if (!strcmp (SOCK_TEST_TOKEN_HELP, ctrl->txbuf)) + else if (!strncmp (SOCK_TEST_TOKEN_HELP, ctrl->txbuf, + strlen (SOCK_TEST_TOKEN_HELP))) dump_help (); - else if (!strcmp (SOCK_TEST_TOKEN_SHOW_CFG, ctrl->txbuf)) + else if (!strncmp (SOCK_TEST_TOKEN_SHOW_CFG, ctrl->txbuf, + strlen (SOCK_TEST_TOKEN_SHOW_CFG))) scm->dump_cfg = 1; - else if (!strcmp (SOCK_TEST_TOKEN_VERBOSE, ctrl->txbuf)) + else if (!strncmp (SOCK_TEST_TOKEN_VERBOSE, ctrl->txbuf, + strlen (SOCK_TEST_TOKEN_VERBOSE))) cfg_verbose_toggle (); else if (!strncmp (SOCK_TEST_TOKEN_TXBUF_SIZE, ctrl->txbuf, diff --git a/src/vlib/unix/util.c b/src/vlib/unix/util.c index 5472751e079..03aef364357 100644 --- a/src/vlib/unix/util.c +++ b/src/vlib/unix/util.c @@ -73,7 +73,8 @@ foreach_directory_file (char *dir_name, if (scan_dirs) { if (e->d_type == DT_DIR - && (!strcmp (e->d_name, ".") || !strcmp (e->d_name, ".."))) + && (!strncmp (e->d_name, ".", 1) || + !strncmp (e->d_name, "..", 2))) continue; } else diff --git a/src/vnet/bier/bier_test.c b/src/vnet/bier/bier_test.c index 204dafc3f0b..d4d1692643c 100644 --- a/src/vnet/bier/bier_test.c +++ b/src/vnet/bier/bier_test.c @@ -174,9 +174,9 @@ bier_test_validate_entry (index_t bei, res = 0; bier_entry_contribute_forwarding(bei, &dpo); - BIER_TEST_I((DPO_LOAD_BALANCE == dpo.dpoi_type), - "Entry links to %U", - format_dpo_type, dpo.dpoi_type); + res = BIER_TEST_I((DPO_LOAD_BALANCE == dpo.dpoi_type), + "Entry links to %U", + format_dpo_type, dpo.dpoi_type); if (!res) { diff --git a/src/vnet/dpo/interface_rx_dpo.c b/src/vnet/dpo/interface_rx_dpo.c index b4680f18f2a..4a6832ade9e 100644 --- a/src/vnet/dpo/interface_rx_dpo.c +++ b/src/vnet/dpo/interface_rx_dpo.c @@ -244,7 +244,7 @@ interface_rx_dpo_inline (vlib_main_t * vm, from = vlib_frame_vector_args (from_frame); n_left_from = from_frame->n_vectors; - next_index = node->cached_next_index; + next_index = INTERFACE_RX_DPO_INPUT; while (n_left_from > 0) { @@ -305,11 +305,6 @@ interface_rx_dpo_inline (vlib_main_t * vm, tr1 = vlib_add_trace (vm, node, b1, sizeof (*tr1)); tr1->sw_if_index = ido1->ido_sw_if_index; } - - vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, - n_left_to_next, bi0, bi1, - INTERFACE_RX_DPO_INPUT, - INTERFACE_RX_DPO_INPUT); } while (n_left_from > 0 && n_left_to_next > 0) @@ -349,10 +344,6 @@ interface_rx_dpo_inline (vlib_main_t * vm, tr = vlib_add_trace (vm, node, b0, sizeof (*tr)); tr->sw_if_index = ido0->ido_sw_if_index; } - - vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, - n_left_to_next, bi0, - INTERFACE_RX_DPO_INPUT); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); } diff --git a/src/vnet/ethernet/init.c b/src/vnet/ethernet/init.c index 2d20adc9610..a4689593ad7 100644 --- a/src/vnet/ethernet/init.c +++ b/src/vnet/ethernet/init.c @@ -115,7 +115,6 @@ VLIB_INIT_FUNCTION (ethernet_init); ethernet_main_t * ethernet_get_main (vlib_main_t * vm) { - vlib_call_init_function (vm, ethernet_init); return ðernet_main; } diff --git a/src/vnet/fib/fib_test.c b/src/vnet/fib/fib_test.c index 56e885ccdaf..e46f670269a 100644 --- a/src/vnet/fib/fib_test.c +++ b/src/vnet/fib/fib_test.c @@ -526,11 +526,11 @@ fib_test_validate_lb_v (const load_balance_t *lb, } break; case FT_LB_ADJ: - FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) || - (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)), - "bucket %d stacks on %U", - bucket, - format_dpo_type, dpo->dpoi_type); + res = FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) || + (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)), + "bucket %d stacks on %U", + bucket, + format_dpo_type, dpo->dpoi_type); FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index), "bucket %d stacks on adj %d", bucket, @@ -540,7 +540,7 @@ fib_test_validate_lb_v (const load_balance_t *lb, { const mpls_disp_dpo_t *mdd; - FIB_TEST_I((DPO_MPLS_DISPOSITION_PIPE == dpo->dpoi_type), + res = FIB_TEST_I((DPO_MPLS_DISPOSITION_PIPE == dpo->dpoi_type), "bucket %d stacks on %U", bucket, format_dpo_type, dpo->dpoi_type); @@ -549,11 +549,11 @@ fib_test_validate_lb_v (const load_balance_t *lb, dpo = &mdd->mdd_dpo; - FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) || - (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)), - "bucket %d stacks on %U", - bucket, - format_dpo_type, dpo->dpoi_type); + res = FIB_TEST_I(((DPO_ADJACENCY == dpo->dpoi_type) || + (DPO_ADJACENCY_INCOMPLETE == dpo->dpoi_type)), + "bucket %d stacks on %U", + bucket, + format_dpo_type, dpo->dpoi_type); FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index), "bucket %d stacks on adj %d", bucket, @@ -561,30 +561,30 @@ fib_test_validate_lb_v (const load_balance_t *lb, break; } case FT_LB_INTF: - FIB_TEST_I((DPO_INTERFACE_RX == dpo->dpoi_type), - "bucket %d stacks on %U", - bucket, - format_dpo_type, dpo->dpoi_type); + res = FIB_TEST_I((DPO_INTERFACE_RX == dpo->dpoi_type), + "bucket %d stacks on %U", + bucket, + format_dpo_type, dpo->dpoi_type); FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index), "bucket %d stacks on adj %d", bucket, exp->adj.adj); break; case FT_LB_L2: - FIB_TEST_I((DPO_DVR == dpo->dpoi_type), - "bucket %d stacks on %U", - bucket, - format_dpo_type, dpo->dpoi_type); + res = FIB_TEST_I((DPO_DVR == dpo->dpoi_type), + "bucket %d stacks on %U", + bucket, + format_dpo_type, dpo->dpoi_type); FIB_TEST_LB((exp->adj.adj == dpo->dpoi_index), "bucket %d stacks on adj %d", bucket, exp->adj.adj); break; case FT_LB_O_LB: - FIB_TEST_I((DPO_LOAD_BALANCE == dpo->dpoi_type), - "bucket %d stacks on %U", - bucket, - format_dpo_type, dpo->dpoi_type); + res = FIB_TEST_I((DPO_LOAD_BALANCE == dpo->dpoi_type), + "bucket %d stacks on %U", + bucket, + format_dpo_type, dpo->dpoi_type); FIB_TEST_LB((exp->lb.lb == dpo->dpoi_index), "bucket %d stacks on lb %d not %d", bucket, diff --git a/src/vnet/gre/gre.c b/src/vnet/gre/gre.c index 2918f3541fd..0b8d2cc8df7 100644 --- a/src/vnet/gre/gre.c +++ b/src/vnet/gre/gre.c @@ -320,13 +320,10 @@ gre_update_adj (vnet_main_t * vnm, u32 sw_if_index, adj_index_t ai) typedef enum { - GRE_ENCAP_NEXT_DROP, GRE_ENCAP_NEXT_L2_MIDCHAIN, GRE_ENCAP_N_NEXT, } gre_encap_next_t; -#define NEXT_IDX (GRE_ENCAP_NEXT_L2_MIDCHAIN) - /** * @brief TX function. Only called for L2 payload including TEB or ERSPAN. * L3 traffic uses the adj-midchains. @@ -353,7 +350,7 @@ gre_interface_tx (vlib_main_t * vm, n_left_from = frame->n_vectors; /* Speculatively send the first buffer to the last disposition we used */ - next_index = node->cached_next_index; + next_index = GRE_ENCAP_NEXT_L2_MIDCHAIN; while (n_left_from > 0) { @@ -447,10 +444,6 @@ gre_interface_tx (vlib_main_t * vm, tr1->dst = gt1->tunnel_dst.fp_addr; tr1->length = vlib_buffer_length_in_chain (vm, b1); } - - vlib_validate_buffer_enqueue_x2 (vm, node, next_index, - to_next, n_left_to_next, - bi0, bi1, NEXT_IDX, NEXT_IDX); } while (n_left_from > 0 && n_left_to_next > 0) @@ -497,10 +490,6 @@ gre_interface_tx (vlib_main_t * vm, tr->dst = gt0->tunnel_dst.fp_addr; tr->length = vlib_buffer_length_in_chain (vm, b0); } - - vlib_validate_buffer_enqueue_x1 (vm, node, next_index, - to_next, n_left_to_next, - bi0, NEXT_IDX); } vlib_put_next_frame (vm, node, next_index, n_left_to_next); @@ -530,7 +519,6 @@ VLIB_REGISTER_NODE (gre_encap_node) = .error_strings = gre_error_strings, .n_next_nodes = GRE_ENCAP_N_NEXT, .next_nodes = { - [GRE_ENCAP_NEXT_DROP] = "error-drop", [GRE_ENCAP_NEXT_L2_MIDCHAIN] = "adj-l2-midchain", }, }; @@ -644,14 +632,6 @@ gre_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (gre_init); -gre_main_t * -gre_get_main (vlib_main_t * vm) -{ - vlib_call_init_function (vm, gre_init); - return &gre_main; -} - - /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vnet/hdlc/hdlc.c b/src/vnet/hdlc/hdlc.c index e072bd46c95..5f7609d24a6 100644 --- a/src/vnet/hdlc/hdlc.c +++ b/src/vnet/hdlc/hdlc.c @@ -243,14 +243,6 @@ hdlc_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (hdlc_init); -hdlc_main_t * -hdlc_get_main (vlib_main_t * vm) -{ - vlib_call_init_function (vm, hdlc_init); - return &hdlc_main; -} - - /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vnet/ip/ip4_mtrie.c b/src/vnet/ip/ip4_mtrie.c index 5981a3c9e20..5aa9b926483 100644 --- a/src/vnet/ip/ip4_mtrie.c +++ b/src/vnet/ip/ip4_mtrie.c @@ -755,8 +755,8 @@ format_ip4_fib_mtrie_ply (u8 * s, va_list * va) { if (ip4_fib_mtrie_leaf_is_non_empty (p, i)) { - FORMAT_PLY (s, p, i, base_address, - p->dst_address_bits_base + 8, indent); + s = FORMAT_PLY (s, p, i, base_address, + p->dst_address_bits_base + 8, indent); } } @@ -791,7 +791,7 @@ format_ip4_fib_mtrie (u8 * s, va_list * va) if (p->dst_address_bits_of_leaves[slot] > 0) { - FORMAT_PLY (s, p, slot, base_address, 16, 2); + s = FORMAT_PLY (s, p, slot, base_address, 16, 2); } } } diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index 88b21d59019..588cd0675a4 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -2699,7 +2699,7 @@ ip6_hbh_register_option (u8 option, ip6_main_t *im = &ip6_main; ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main; - ASSERT (option < ARRAY_LEN (hm->options)); + ASSERT ((u32) option < ARRAY_LEN (hm->options)); /* Already registered */ if (hm->options[option]) @@ -2720,7 +2720,7 @@ ip6_hbh_unregister_option (u8 option) ip6_main_t *im = &ip6_main; ip6_hop_by_hop_main_t *hm = &ip6_hop_by_hop_main; - ASSERT (option < ARRAY_LEN (hm->options)); + ASSERT ((u32) option < ARRAY_LEN (hm->options)); /* Not registered */ if (!hm->options[option]) diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c index 90a4d21d3a6..355aba627fb 100644 --- a/src/vnet/ip/ip6_hop_by_hop.c +++ b/src/vnet/ip/ip6_hop_by_hop.c @@ -103,7 +103,7 @@ ip6_hbh_add_register_option (u8 option, { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->add_options)); + ASSERT ((u32) option < ARRAY_LEN (hm->add_options)); /* Already registered */ if (hm->add_options[option]) @@ -120,7 +120,7 @@ ip6_hbh_add_unregister_option (u8 option) { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->add_options)); + ASSERT ((u32) option < ARRAY_LEN (hm->add_options)); /* Not registered */ if (!hm->add_options[option]) @@ -138,7 +138,7 @@ ip6_hbh_config_handler_register (u8 option, { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->config_handler)); + ASSERT ((u32) option < ARRAY_LEN (hm->config_handler)); /* Already registered */ if (hm->config_handler[option]) @@ -154,7 +154,7 @@ ip6_hbh_config_handler_unregister (u8 option) { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->config_handler)); + ASSERT ((u32) option < ARRAY_LEN (hm->config_handler)); /* Not registered */ if (!hm->config_handler[option]) @@ -171,7 +171,7 @@ ip6_hbh_flow_handler_register (u8 option, { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->flow_handler)); + ASSERT ((u32) option < ARRAY_LEN (hm->flow_handler)); /* Already registered */ if (hm->flow_handler[option]) @@ -187,7 +187,7 @@ ip6_hbh_flow_handler_unregister (u8 option) { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->flow_handler)); + ASSERT ((u32) option < ARRAY_LEN (hm->flow_handler)); /* Not registered */ if (!hm->flow_handler[option]) @@ -484,7 +484,7 @@ ip6_hbh_pop_register_option (u8 option, { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->pop_options)); + ASSERT ((u32) option < ARRAY_LEN (hm->pop_options)); /* Already registered */ if (hm->pop_options[option]) @@ -500,7 +500,7 @@ ip6_hbh_pop_unregister_option (u8 option) { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; - ASSERT (option < ARRAY_LEN (hm->pop_options)); + ASSERT ((u32) option < ARRAY_LEN (hm->pop_options)); /* Not registered */ if (!hm->pop_options[option]) diff --git a/src/vnet/ipip/sixrd.c b/src/vnet/ipip/sixrd.c index 08fd604709a..cfdd0f87e3a 100644 --- a/src/vnet/ipip/sixrd.c +++ b/src/vnet/ipip/sixrd.c @@ -501,7 +501,7 @@ sixrd_init (vlib_main_t * vm) clib_error_t *error = 0; /* Make sure the IPIP tunnel subsystem is initialised */ - vlib_call_init_function (vm, ipip_init); + error = vlib_call_init_function (vm, ipip_init); sixrd_adj_delegate_type = adj_delegate_register_new_type (&sixrd_adj_delegate_vft); diff --git a/src/vnet/ipsec-gre/ipsec_gre.c b/src/vnet/ipsec-gre/ipsec_gre.c index a0b065ac283..a699a2b5fd8 100644 --- a/src/vnet/ipsec-gre/ipsec_gre.c +++ b/src/vnet/ipsec-gre/ipsec_gre.c @@ -391,13 +391,6 @@ ipsec_gre_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (ipsec_gre_init); -ipsec_gre_main_t * -ipsec_gre_get_main (vlib_main_t * vm) -{ - vlib_call_init_function (vm, ipsec_gre_init); - return &ipsec_gre_main; -} - /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vnet/ppp/ppp.c b/src/vnet/ppp/ppp.c index e1b5fc742b4..2b3b3b23b5f 100644 --- a/src/vnet/ppp/ppp.c +++ b/src/vnet/ppp/ppp.c @@ -244,14 +244,6 @@ ppp_init (vlib_main_t * vm) VLIB_INIT_FUNCTION (ppp_init); -ppp_main_t * -ppp_get_main (vlib_main_t * vm) -{ - vlib_call_init_function (vm, ppp_init); - return &ppp_main; -} - - /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vpp-api/vom/acl_binding.hpp b/src/vpp-api/vom/acl_binding.hpp index 6e994e4d2a5..89db0eea219 100644 --- a/src/vpp-api/vom/acl_binding.hpp +++ b/src/vpp-api/vom/acl_binding.hpp @@ -26,6 +26,7 @@ #include "vom/object_base.hpp" #include "vom/om.hpp" #include "vom/singular_db.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { namespace ACL { @@ -123,7 +124,7 @@ private: /** * Show the object in the Singular DB */ - void show(std::ostream& os) { m_db.dump(os); } + void show(std::ostream& os) { db_dump(m_db, os); } /** * Get the sortable Id of the listener diff --git a/src/vpp-api/vom/acl_ethertype.cpp b/src/vpp-api/vom/acl_ethertype.cpp index 530a0aee604..9092517194e 100644 --- a/src/vpp-api/vom/acl_ethertype.cpp +++ b/src/vpp-api/vom/acl_ethertype.cpp @@ -15,6 +15,7 @@ #include "vom/acl_ethertype.hpp" #include "vom/acl_ethertype_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { namespace ACL { @@ -122,7 +123,7 @@ acl_ethertype::find(const key_t& key) void acl_ethertype::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -237,7 +238,7 @@ acl_ethertype::event_handler::order() const void acl_ethertype::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } }; }; diff --git a/src/vpp-api/vom/acl_list.cpp b/src/vpp-api/vom/acl_list.cpp index 5b03f5db021..651eb87a4a9 100644 --- a/src/vpp-api/vom/acl_list.cpp +++ b/src/vpp-api/vom/acl_list.cpp @@ -16,6 +16,7 @@ #include "vom/acl_list.hpp" #include "vom/acl_list_cmds.hpp" #include "vom/logger.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { namespace ACL { @@ -70,6 +71,13 @@ l2_list::event_handler::handle_populate(const client_db::key_t& key) } template <> +void +l2_list::event_handler::show(std::ostream& os) +{ + db_dump(m_db, os); +} + +template <> l3_list::event_handler::event_handler() { OM::register_listener(this); @@ -130,6 +138,13 @@ l3_list::event_handler::handle_populate(const client_db::key_t& key) template <> void +l3_list::event_handler::show(std::ostream& os) +{ + db_dump(m_db, os); +} + +template <> +void l3_list::update(const l3_list& obj) { /* diff --git a/src/vpp-api/vom/acl_list.hpp b/src/vpp-api/vom/acl_list.hpp index bd84ce1ea43..eff5e1c5a52 100644 --- a/src/vpp-api/vom/acl_list.hpp +++ b/src/vpp-api/vom/acl_list.hpp @@ -192,7 +192,7 @@ private: /** * Show the object in the Singular DB */ - void show(std::ostream& os) { m_db.dump(os); } + void show(std::ostream& os); /** * Get the sortable Id of the listener diff --git a/src/vpp-api/vom/arp_proxy_binding.cpp b/src/vpp-api/vom/arp_proxy_binding.cpp index 7053390b7c7..73d3d844f53 100644 --- a/src/vpp-api/vom/arp_proxy_binding.cpp +++ b/src/vpp-api/vom/arp_proxy_binding.cpp @@ -15,6 +15,7 @@ #include "vom/arp_proxy_binding.hpp" #include "vom/arp_proxy_binding_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { @@ -61,7 +62,7 @@ arp_proxy_binding::sweep() void arp_proxy_binding::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -134,7 +135,7 @@ arp_proxy_binding::event_handler::order() const void arp_proxy_binding::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } /* diff --git a/src/vpp-api/vom/arp_proxy_config.cpp b/src/vpp-api/vom/arp_proxy_config.cpp index c72b5f2e8b0..3973eba55f9 100644 --- a/src/vpp-api/vom/arp_proxy_config.cpp +++ b/src/vpp-api/vom/arp_proxy_config.cpp @@ -15,6 +15,7 @@ #include "vom/arp_proxy_config.hpp" #include "vom/arp_proxy_config_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { singular_db<arp_proxy_config::key_t, arp_proxy_config> arp_proxy_config::m_db; @@ -57,7 +58,7 @@ arp_proxy_config::sweep() void arp_proxy_config::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -126,7 +127,7 @@ arp_proxy_config::event_handler::order() const void arp_proxy_config::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& diff --git a/src/vpp-api/vom/bond_group_binding.cpp b/src/vpp-api/vom/bond_group_binding.cpp index 6958eb386ba..60721dd4265 100644 --- a/src/vpp-api/vom/bond_group_binding.cpp +++ b/src/vpp-api/vom/bond_group_binding.cpp @@ -15,6 +15,7 @@ #include "vom/bond_group_binding.hpp" #include "vom/bond_group_binding_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { @@ -73,7 +74,7 @@ bond_group_binding::sweep() void bond_group_binding::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -166,7 +167,7 @@ bond_group_binding::event_handler::order() const void bond_group_binding::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } /* diff --git a/src/vpp-api/vom/bridge_domain.cpp b/src/vpp-api/vom/bridge_domain.cpp index 17144a67ca9..be520f5ee45 100644 --- a/src/vpp-api/vom/bridge_domain.cpp +++ b/src/vpp-api/vom/bridge_domain.cpp @@ -17,6 +17,7 @@ #include "vom/bridge_domain_cmds.hpp" #include "vom/interface.hpp" #include "vom/l2_binding.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { @@ -137,7 +138,7 @@ bridge_domain::singular() const void bridge_domain::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -199,7 +200,7 @@ bridge_domain::event_handler::order() const void bridge_domain::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/bridge_domain_arp_entry.cpp b/src/vpp-api/vom/bridge_domain_arp_entry.cpp index a3bfcddf00e..a203a76744e 100644 --- a/src/vpp-api/vom/bridge_domain_arp_entry.cpp +++ b/src/vpp-api/vom/bridge_domain_arp_entry.cpp @@ -15,6 +15,7 @@ #include "vom/bridge_domain_arp_entry.hpp" #include "vom/bridge_domain_arp_entry_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { @@ -141,7 +142,7 @@ bridge_domain_arp_entry::singular() const void bridge_domain_arp_entry::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } bridge_domain_arp_entry::event_handler::event_handler() @@ -172,7 +173,7 @@ bridge_domain_arp_entry::event_handler::order() const void bridge_domain_arp_entry::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& diff --git a/src/vpp-api/vom/bridge_domain_entry.cpp b/src/vpp-api/vom/bridge_domain_entry.cpp index 9ac5ceae87c..241de953771 100644 --- a/src/vpp-api/vom/bridge_domain_entry.cpp +++ b/src/vpp-api/vom/bridge_domain_entry.cpp @@ -15,6 +15,7 @@ #include "vom/bridge_domain_entry.hpp" #include "vom/bridge_domain_entry_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { singular_db<bridge_domain_entry::key_t, bridge_domain_entry> @@ -138,7 +139,7 @@ bridge_domain_entry::singular() const void bridge_domain_entry::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } bridge_domain_entry::event_handler::event_handler() @@ -202,7 +203,7 @@ bridge_domain_entry::event_handler::order() const void bridge_domain_entry::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& diff --git a/src/vpp-api/vom/dhcp_config.cpp b/src/vpp-api/vom/dhcp_config.cpp index 8071fb15c57..7d97fa15d6e 100644 --- a/src/vpp-api/vom/dhcp_config.cpp +++ b/src/vpp-api/vom/dhcp_config.cpp @@ -15,6 +15,7 @@ #include "vom/dhcp_config.hpp" #include "vom/dhcp_config_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -90,7 +91,7 @@ dhcp_config::sweep() void dhcp_config::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -180,7 +181,7 @@ dhcp_config::event_handler::order() const void dhcp_config::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/dhcp_config_cmds.cpp b/src/vpp-api/vom/dhcp_config_cmds.cpp index 9e803be7b8d..76ce58b6b92 100644 --- a/src/vpp-api/vom/dhcp_config_cmds.cpp +++ b/src/vpp-api/vom/dhcp_config_cmds.cpp @@ -49,6 +49,7 @@ bind_cmd::issue(connection& con) payload.is_add = 1; payload.pid = getpid(); payload.want_dhcp_event = 1; + payload.set_broadcast_flag = m_set_broadcast_flag; memset(payload.hostname, 0, sizeof(payload.hostname)); memcpy(payload.hostname, m_hostname.c_str(), diff --git a/src/vpp-api/vom/gbp_contract.cpp b/src/vpp-api/vom/gbp_contract.cpp index d648fb3aeaa..8b27269249c 100644 --- a/src/vpp-api/vom/gbp_contract.cpp +++ b/src/vpp-api/vom/gbp_contract.cpp @@ -15,6 +15,7 @@ #include "vom/gbp_contract.hpp" #include "vom/gbp_contract_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { @@ -122,7 +123,7 @@ gbp_contract::singular() const void gbp_contract::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } gbp_contract::event_handler::event_handler() @@ -171,7 +172,7 @@ gbp_contract::event_handler::order() const void gbp_contract::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& diff --git a/src/vpp-api/vom/gbp_endpoint.cpp b/src/vpp-api/vom/gbp_endpoint.cpp index 429183bd210..cd5d7e11ad6 100644 --- a/src/vpp-api/vom/gbp_endpoint.cpp +++ b/src/vpp-api/vom/gbp_endpoint.cpp @@ -15,6 +15,7 @@ #include "vom/gbp_endpoint.hpp" #include "vom/gbp_endpoint_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { @@ -122,7 +123,7 @@ gbp_endpoint::singular() const void gbp_endpoint::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } gbp_endpoint::event_handler::event_handler() @@ -174,7 +175,7 @@ gbp_endpoint::event_handler::order() const void gbp_endpoint::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } // namespace VOM diff --git a/src/vpp-api/vom/gbp_endpoint.hpp b/src/vpp-api/vom/gbp_endpoint.hpp index 9118cb80eb1..6ece4fa5431 100644 --- a/src/vpp-api/vom/gbp_endpoint.hpp +++ b/src/vpp-api/vom/gbp_endpoint.hpp @@ -16,6 +16,8 @@ #ifndef __VOM_GBP_ENDPOINT_H__ #define __VOM_GBP_ENDPOINT_H__ +#include <ostream> + #include "vom/interface.hpp" #include "vom/singular_db.hpp" #include "vom/types.hpp" diff --git a/src/vpp-api/vom/interface.cpp b/src/vpp-api/vom/interface.cpp index 262d9eaf7b6..e9b7a1a1f9b 100644 --- a/src/vpp-api/vom/interface.cpp +++ b/src/vpp-api/vom/interface.cpp @@ -22,6 +22,7 @@ #include "vom/l3_binding_cmds.hpp" #include "vom/logger.hpp" #include "vom/prefix.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -148,13 +149,13 @@ interface::l2_address() const interface::const_iterator_t interface::cbegin() { - return m_db.cbegin(); + return m_db.begin(); } interface::const_iterator_t interface::cend() { - return m_db.cend(); + return m_db.end(); } void @@ -485,7 +486,7 @@ interface::remove(const HW::item<handle_t>& item) void interface::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -626,7 +627,7 @@ interface::event_handler::order() const void interface::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } // namespace VOM diff --git a/src/vpp-api/vom/interface_span.cpp b/src/vpp-api/vom/interface_span.cpp index 9243f2dd755..283ea1ece54 100644 --- a/src/vpp-api/vom/interface_span.cpp +++ b/src/vpp-api/vom/interface_span.cpp @@ -15,6 +15,7 @@ #include "vom/interface_span.hpp" #include "vom/interface_span_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -63,7 +64,7 @@ interface_span::sweep() void interface_span::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -170,7 +171,7 @@ interface_span::event_handler::order() const void interface_span::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } const interface_span::state_t interface_span::state_t::DISABLED(0, "disable"); diff --git a/src/vpp-api/vom/ip_unnumbered.cpp b/src/vpp-api/vom/ip_unnumbered.cpp index ef693e9f140..caeeb419993 100644 --- a/src/vpp-api/vom/ip_unnumbered.cpp +++ b/src/vpp-api/vom/ip_unnumbered.cpp @@ -15,6 +15,7 @@ #include "vom/ip_unnumbered.hpp" #include "vom/ip_unnumbered_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -58,7 +59,7 @@ ip_unnumbered::sweep() void ip_unnumbered::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -128,7 +129,7 @@ ip_unnumbered::event_handler::order() const void ip_unnumbered::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/l2_binding.cpp b/src/vpp-api/vom/l2_binding.cpp index 749557ce3cd..4118f74065a 100644 --- a/src/vpp-api/vom/l2_binding.cpp +++ b/src/vpp-api/vom/l2_binding.cpp @@ -15,6 +15,7 @@ #include "vom/l2_binding.hpp" #include "vom/l2_binding_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -195,7 +196,7 @@ l2_binding::singular() const void l2_binding::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } l2_binding::event_handler::event_handler() @@ -227,7 +228,7 @@ l2_binding::event_handler::order() const void l2_binding::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/l2_emulation.cpp b/src/vpp-api/vom/l2_emulation.cpp index 4eedd95e1fc..7bc7ed657d4 100644 --- a/src/vpp-api/vom/l2_emulation.cpp +++ b/src/vpp-api/vom/l2_emulation.cpp @@ -15,6 +15,7 @@ #include "vom/l2_emulation.hpp" #include "vom/l2_emulation_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -122,7 +123,7 @@ l2_emulation::singular() const void l2_emulation::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } l2_emulation::event_handler::event_handler() @@ -154,7 +155,7 @@ l2_emulation::event_handler::order() const void l2_emulation::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/l3_binding.cpp b/src/vpp-api/vom/l3_binding.cpp index 6ff824483ea..13bc1ffd575 100644 --- a/src/vpp-api/vom/l3_binding.cpp +++ b/src/vpp-api/vom/l3_binding.cpp @@ -15,6 +15,7 @@ #include "vom/l3_binding.hpp" #include "vom/l3_binding_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { singular_db<l3_binding::key_t, l3_binding> l3_binding::m_db; @@ -92,13 +93,13 @@ l3_binding::itf() const l3_binding::const_iterator_t l3_binding::cbegin() { - return m_db.cbegin(); + return m_db.begin(); } l3_binding::const_iterator_t l3_binding::cend() { - return m_db.cend(); + return m_db.end(); } std::string @@ -146,7 +147,7 @@ l3_binding::singular() const void l3_binding::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& @@ -167,9 +168,9 @@ l3_binding::find(const interface& i) */ std::deque<std::shared_ptr<l3_binding>> l3s; - auto it = m_db.cbegin(); + auto it = m_db.begin(); - while (it != m_db.cend()) { + while (it != m_db.end()) { /* * The key in the DB is a pair of the interface's name and prefix. * If the keys match, save the L3-config @@ -215,7 +216,7 @@ l3_binding::event_handler::order() const void l3_binding::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/lldp_binding.cpp b/src/vpp-api/vom/lldp_binding.cpp index a1d3d9f57ba..69b30c2ce94 100644 --- a/src/vpp-api/vom/lldp_binding.cpp +++ b/src/vpp-api/vom/lldp_binding.cpp @@ -15,6 +15,7 @@ #include "vom/lldp_binding.hpp" #include "vom/lldp_binding_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -70,7 +71,7 @@ lldp_binding::sweep() void lldp_binding::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -149,7 +150,7 @@ lldp_binding::event_handler::order() const void lldp_binding::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/lldp_global.cpp b/src/vpp-api/vom/lldp_global.cpp index 7e701dc4c52..6bae7993651 100644 --- a/src/vpp-api/vom/lldp_global.cpp +++ b/src/vpp-api/vom/lldp_global.cpp @@ -15,6 +15,7 @@ #include "vom/lldp_global.hpp" #include "vom/lldp_global_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { /** @@ -70,7 +71,7 @@ lldp_global::sweep() void lldp_global::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -148,7 +149,7 @@ lldp_global::event_handler::order() const void lldp_global::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/nat_binding.cpp b/src/vpp-api/vom/nat_binding.cpp index a3f71117eef..eca3f9041f0 100644 --- a/src/vpp-api/vom/nat_binding.cpp +++ b/src/vpp-api/vom/nat_binding.cpp @@ -16,6 +16,7 @@ #include "vom/nat_binding.hpp" #include "vom/cmd.hpp" #include "vom/nat_binding_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { singular_db<const nat_binding::key_t, nat_binding> nat_binding::m_db; @@ -157,7 +158,7 @@ nat_binding::singular() const void nat_binding::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& @@ -224,7 +225,7 @@ nat_binding::event_handler::order() const void nat_binding::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/nat_static.cpp b/src/vpp-api/vom/nat_static.cpp index b507a5191d4..3185b56e228 100644 --- a/src/vpp-api/vom/nat_static.cpp +++ b/src/vpp-api/vom/nat_static.cpp @@ -15,6 +15,7 @@ #include "vom/nat_static.hpp" #include "vom/nat_static_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { singular_db<nat_static::key_t, nat_static> nat_static::m_db; @@ -136,7 +137,7 @@ nat_static::singular() const void nat_static::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } nat_static::event_handler::event_handler() @@ -190,7 +191,7 @@ nat_static::event_handler::order() const void nat_static::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/neighbour.cpp b/src/vpp-api/vom/neighbour.cpp index 9b53cb2a6bb..44e2760a1ec 100644 --- a/src/vpp-api/vom/neighbour.cpp +++ b/src/vpp-api/vom/neighbour.cpp @@ -15,6 +15,7 @@ #include "vom/neighbour.hpp" #include "vom/neighbour_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { singular_db<neighbour::key_t, neighbour> neighbour::m_db; @@ -120,7 +121,7 @@ neighbour::singular() const void neighbour::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& @@ -203,7 +204,7 @@ neighbour::event_handler::order() const void neighbour::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } } diff --git a/src/vpp-api/vom/route.cpp b/src/vpp-api/vom/route.cpp index fa6e5d43b37..247afa008a7 100644 --- a/src/vpp-api/vom/route.cpp +++ b/src/vpp-api/vom/route.cpp @@ -15,7 +15,7 @@ #include "vom/route.hpp" #include "vom/route_cmds.hpp" -#include "vom/singular_db.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { namespace route { @@ -367,7 +367,7 @@ ip_route::singular() const void ip_route::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } ip_route::event_handler::event_handler() @@ -514,7 +514,7 @@ ip_route::event_handler::order() const void ip_route::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } std::ostream& diff --git a/src/vpp-api/vom/route_domain.cpp b/src/vpp-api/vom/route_domain.cpp index 626a9cd29a9..b97faf6ae49 100644 --- a/src/vpp-api/vom/route_domain.cpp +++ b/src/vpp-api/vom/route_domain.cpp @@ -16,6 +16,7 @@ #include "vom/route_domain.hpp" #include "vom/cmd.hpp" #include "vom/route_domain_cmds.hpp" +#include "vom/singular_db_funcs.hpp" namespace VOM { @@ -152,7 +153,7 @@ route_domain::singular() const void route_domain::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void @@ -181,7 +182,7 @@ route_domain::event_handler::order() const void route_domain::event_handler::show(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } }; // namespace VOPM diff --git a/src/vpp-api/vom/singular_db.hpp b/src/vpp-api/vom/singular_db.hpp index 07ea2cb4acf..afca9a3509e 100644 --- a/src/vpp-api/vom/singular_db.hpp +++ b/src/vpp-api/vom/singular_db.hpp @@ -16,6 +16,7 @@ #ifndef __VOM_INST_DB_H__ #define __VOM_INST_DB_H__ +#include <map> #include <memory> #include <ostream> @@ -46,12 +47,12 @@ public: /** * Get iterator to the beginning of the DB */ - const_iterator cbegin() { return m_map.cbegin(); } + const_iterator begin() const { return m_map.cbegin(); } /** * Get iterator to the beginning of the DB */ - const_iterator cend() { return m_map.cend(); } + const_iterator end() const { return m_map.cend(); } /** * Find or add the object to the store. @@ -119,17 +120,6 @@ public: void add(const KEY& key, std::shared_ptr<OBJ> sp) { m_map[key] = sp; } /** - * Print each of the object in the DB into the stream provided - */ - void dump(std::ostream& os) - { - for (auto entry : m_map) { - os << "key: " << entry.first << std::endl; - os << " " << entry.second.lock()->to_string() << std::endl; - } - } - - /** * Populate VPP from current state, on VPP restart */ void replay() diff --git a/src/vpp-api/vom/singular_db_funcs.hpp b/src/vpp-api/vom/singular_db_funcs.hpp new file mode 100644 index 00000000000..dddc6e4c229 --- /dev/null +++ b/src/vpp-api/vom/singular_db_funcs.hpp @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017 Cisco and/or its affiliates. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __VOM_INST_DB_FUNCS_H__ +#define __VOM_INST_DB_FUNCS_H__ + +#include <ostream> + +#include "singular_db.hpp" + +/** + * A set of helper function to iterate over objects in the DB. + * These functions are delcared not as DB member functions so that + * the template instatiation of the DB does not require the definitions + * of the functions used to be declared. + */ +namespace VOM { +/** + * Print each of the objects in the DB into the stream provided + */ +template <typename DB> +void +db_dump(const DB& db, std::ostream& os) +{ + for (const auto entry : db) { + os << "key: " << entry.first << std::endl; + os << " " << entry.second.lock()->to_string() << std::endl; + } +} +}; + +/* + * fd.io coding-style-patch-verification: ON + * + * Local Variables: + * eval: (c-set-style "mozilla") + * End: + */ + +#endif diff --git a/src/vpp-api/vom/vxlan_tunnel.cpp b/src/vpp-api/vom/vxlan_tunnel.cpp index f6f3cf586e1..3d5ed64c5e0 100644 --- a/src/vpp-api/vom/vxlan_tunnel.cpp +++ b/src/vpp-api/vom/vxlan_tunnel.cpp @@ -15,6 +15,7 @@ #include "vom/vxlan_tunnel.hpp" #include "vom/logger.hpp" +#include "vom/singular_db_funcs.hpp" #include "vom/vxlan_tunnel_cmds.hpp" namespace VOM { @@ -197,7 +198,7 @@ vxlan_tunnel::singular_i() const void vxlan_tunnel::dump(std::ostream& os) { - m_db.dump(os); + db_dump(m_db, os); } void diff --git a/src/vpp/app/vppctl.c b/src/vpp/app/vppctl.c index 66fe00ab341..b7582c07c1c 100644 --- a/src/vpp/app/vppctl.c +++ b/src/vpp/app/vppctl.c @@ -157,7 +157,7 @@ main (int argc, char *argv[]) argc--; argv++; - if (argc > 1 && strcmp (argv[0], "-s") == 0) + if (argc > 1 && strncmp (argv[0], "-s", 2) == 0) { s->config = argv[1]; argc -= 2; |