Fixes for 'make UNATTENDED=yes CC=clang CXX=clang verify' 48/11648/2
authorNeale Ranns <nranns@cisco.com>
Fri, 6 Apr 2018 16:18:11 +0000 (09:18 -0700)
committerNeale Ranns <nranns@cisco.com>
Thu, 12 Apr 2018 10:53:38 +0000 (06:53 -0400)
Change-Id: I994649761fe2e66e12ae0e49a84fb1d0a966ddfb
Signed-off-by: Neale Ranns <nranns@cisco.com>
51 files changed:
src/plugins/acl/acl.c
src/plugins/ioam/analyse/ip6/node.c
src/plugins/ioam/lib-vxlan-gpe/vxlan_gpe_ioam_trace.c
src/plugins/lb/lb.c
src/plugins/lb/lb.h
src/vcl/sock_test_client.c
src/vlib/unix/util.c
src/vnet/bier/bier_test.c
src/vnet/dpo/interface_rx_dpo.c
src/vnet/ethernet/init.c
src/vnet/fib/fib_test.c
src/vnet/gre/gre.c
src/vnet/hdlc/hdlc.c
src/vnet/ip/ip4_mtrie.c
src/vnet/ip/ip6_forward.c
src/vnet/ip/ip6_hop_by_hop.c
src/vnet/ipip/sixrd.c
src/vnet/ipsec-gre/ipsec_gre.c
src/vnet/ppp/ppp.c
src/vpp-api/vom/acl_binding.hpp
src/vpp-api/vom/acl_ethertype.cpp
src/vpp-api/vom/acl_list.cpp
src/vpp-api/vom/acl_list.hpp
src/vpp-api/vom/arp_proxy_binding.cpp
src/vpp-api/vom/arp_proxy_config.cpp
src/vpp-api/vom/bond_group_binding.cpp
src/vpp-api/vom/bridge_domain.cpp
src/vpp-api/vom/bridge_domain_arp_entry.cpp
src/vpp-api/vom/bridge_domain_entry.cpp
src/vpp-api/vom/dhcp_config.cpp
src/vpp-api/vom/dhcp_config_cmds.cpp
src/vpp-api/vom/gbp_contract.cpp
src/vpp-api/vom/gbp_endpoint.cpp
src/vpp-api/vom/gbp_endpoint.hpp
src/vpp-api/vom/interface.cpp
src/vpp-api/vom/interface_span.cpp
src/vpp-api/vom/ip_unnumbered.cpp
src/vpp-api/vom/l2_binding.cpp
src/vpp-api/vom/l2_emulation.cpp
src/vpp-api/vom/l3_binding.cpp
src/vpp-api/vom/lldp_binding.cpp
src/vpp-api/vom/lldp_global.cpp
src/vpp-api/vom/nat_binding.cpp
src/vpp-api/vom/nat_static.cpp
src/vpp-api/vom/neighbour.cpp
src/vpp-api/vom/route.cpp
src/vpp-api/vom/route_domain.cpp
src/vpp-api/vom/singular_db.hpp
src/vpp-api/vom/singular_db_funcs.hpp [new file with mode: 0644]
src/vpp-api/vom/vxlan_tunnel.cpp
src/vpp/app/vppctl.c

index 7d3a852..d95e798 100644 (file)
@@ -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);
index 6db6355..902fb9b 100644 (file)
@@ -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])
index f3d03b6..e758b52 100644 (file)
@@ -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])
index 06953a4..090d190 100644 (file)
@@ -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;
index 8db0394..61d17d7 100644 (file)
@@ -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 \
index 3559c68..1ed4b89 100644 (file)
@@ -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,
index 5472751..03aef36 100644 (file)
@@ -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
index 204dafc..d4d1692 100644 (file)
@@ -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)
     {
index b4680f1..4a6832a 100644 (file)
@@ -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);
     }
index 2d20adc..a468959 100644 (file)
@@ -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 &ethernet_main;
 }
 
index 56e885c..e46f670 100644 (file)
@@ -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,
index 2918f35..0b8d2cc 100644 (file)
@@ -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
  *
index e072bd4..5f7609d 100644 (file)
@@ -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
  *
index 5981a3c..5aa9b92 100644 (file)
@@ -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);
            }
        }
     }
index 88b21d5..588cd06 100644 (file)
@@ -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])
index 90a4d21..355aba6 100644 (file)
@@ -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])
index 08fd604..cfdd0f8 100644 (file)
@@ -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);
index a0b065a..a699a2b 100644 (file)
@@ -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
 *
index e1b5fc7..2b3b3b2 100644 (file)
@@ -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
  *
index 6e994e4..89db0ee 100644 (file)
@@ -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
index 530a0ae..9092517 100644 (file)
@@ -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);
 }
 };
 };
index 5b03f5d..651eb87 100644 (file)
@@ -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 {
@@ -69,6 +70,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()
 {
@@ -128,6 +136,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)
index bd84ce1..eff5e1c 100644 (file)
@@ -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
index 7053390..73d3d84 100644 (file)
@@ -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);
 }
 }
 /*
index c72b5f2..3973eba 100644 (file)
@@ -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&
index 6958eb3..60721dd 100644 (file)
@@ -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);
 }
 }
 /*
index 17144a6..be520f5 100644 (file)
@@ -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);
 }
 }
 
index a3bfcdd..a203a76 100644 (file)
@@ -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&
index 9ac5cea..241de95 100644 (file)
@@ -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&
index 8071fb1..7d97fa1 100644 (file)
@@ -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);
 }
 }
 
index 9e803be..76ce58b 100644 (file)
@@ -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(),
index d648fb3..8b27269 100644 (file)
@@ -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&
index 429183b..cd5d7e1 100644 (file)
@@ -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
 
index 9118cb8..6ece4fa 100644 (file)
@@ -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"
index 262d9ea..e9b7a1a 100644 (file)
@@ -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
index 9243f2d..283ea1e 100644 (file)
@@ -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");
index ef693e9..caeeb41 100644 (file)
@@ -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);
 }
 }
 
index 749557c..4118f74 100644 (file)
@@ -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);
 }
 }
 
index 4eedd95..7bc7ed6 100644 (file)
@@ -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);
 }
 }
 
index 6ff8244..13bc1ff 100644 (file)
@@ -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);
 }
 }
 
index a1d3d9f..69b30c2 100644 (file)
@@ -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);
 }
 }
 
index 7e701dc..6bae799 100644 (file)
@@ -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);
 }
 }
 
index a3f7111..eca3f90 100644 (file)
@@ -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);
 }
 }
 
index b507a51..3185b56 100644 (file)
@@ -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);
 }
 }
 
index 9b53cb2..44e2760 100644 (file)
@@ -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);
 }
 }
 
index fa6e5d4..247afa0 100644 (file)
@@ -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&
index 626a9cd..b97faf6 100644 (file)
@@ -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
index 07ea2cb..afca9a3 100644 (file)
@@ -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.
@@ -118,17 +119,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
    */
diff --git a/src/vpp-api/vom/singular_db_funcs.hpp b/src/vpp-api/vom/singular_db_funcs.hpp
new file mode 100644 (file)
index 0000000..dddc6e4
--- /dev/null
@@ -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
index f6f3cf5..3d5ed64 100644 (file)
@@ -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
index 66fe00a..b7582c0 100644 (file)
@@ -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;