On some specific cases, the user may wish not to export its memory
type and group. The user can then declare and initialises this
memory type, provided that he ensures also the initialisation. The
goal of that commit is initialising in quagga the static mtypes.

Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com>
---
 bgpd/bgp_nexthop.c          | 4 ++++
 isisd/isis_memory.c         | 3 ++-
 ospf6d/ospf6_interface.c    | 2 ++
 ospfclient/ospf_apiclient.c | 5 +++++
 ospfd/ospf_opaque.c         | 9 +++++++++
 ospfd/ospf_te.c             | 9 +++++++++
 tests/heavy-wq.c            | 3 +++
 tests/test-memory.c         | 2 ++
 vtysh/vtysh_config.c        | 4 ++++
 9 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 04ee6a0b720b..bc35614342bf 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -52,6 +52,8 @@ static struct bgp_table *cache1_table[AFI_MAX];
 /* Route table for connected route. */
 static struct bgp_table *bgp_connected_table[AFI_MAX];
 
+DEFINE_MTYPE_STATIC(BGPD, BGP_NEXTHOP, "BGP nexthop")
+
 char *
 bnc_str (struct bgp_nexthop_cache *bnc, char *buf, int size)
 {
@@ -510,6 +512,8 @@ DEFUN (show_ip_bgp_nexthop_detail,
 void
 bgp_scan_init (void)
 {
+  INIT_MTYPE(BGP_NEXTHOP);
+
   cache1_table[AFI_IP] = bgp_table_init (AFI_IP, SAFI_UNICAST);
   bgp_nexthop_cache_table[AFI_IP] = cache1_table[AFI_IP];
 
diff --git a/isisd/isis_memory.c b/isisd/isis_memory.c
index 5b8950c34e56..e1ec42e22dc4 100644
--- a/isisd/isis_memory.c
+++ b/isisd/isis_memory.c
@@ -45,7 +45,7 @@ DEFINE_MTYPE(ISISD, ISIS_DICT,          "ISIS dictionary")
 DEFINE_MTYPE(ISISD, ISIS_DICT_NODE,     "ISIS dictionary node")
 DEFINE_MTYPE(ISISD, ISIS_MPLS_TE,       "ISIS MPLS Traffic Engineering")
 DEFINE_MTYPE(ISISD, ISIS_EXT_ROUTE,     "ISIS redistributed route")
-DEFINE_MTYPE(ISISD, ISIS_EXT_INFO,      "ISIS redistributed route info")
+DEFINE_MTYPE(ISISD, ISIS_EXT_INFO,      "ISIS Ext Info")
 
 void isis_memory_init(void)
 {
@@ -68,6 +68,7 @@ void isis_memory_init(void)
   INIT_MTYPE(ISIS_NEXTHOP6);
   INIT_MTYPE(ISIS_DICT);
   INIT_MTYPE(ISIS_DICT_NODE);
+  INIT_MTYPE(ISIS_MPLS_TE);
   INIT_MTYPE(ISIS_EXT_ROUTE);
   INIT_MTYPE(ISIS_EXT_INFO);
 }
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 5c2a9298ddb6..15ebdca20028 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -1876,6 +1876,8 @@ static struct cmd_node interface_node =
 void
 ospf6_interface_init (void)
 {
+  INIT_MTYPE(CFG_PLIST_NAME);
+
   /* Install interface node. */
   install_node (&interface_node, config_write_ospf6_interface);
 
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c
index 453e05ce2ebb..c77322a7dcf5 100644
--- a/ospfclient/ospf_apiclient.c
+++ b/ospfclient/ospf_apiclient.c
@@ -54,6 +54,9 @@ DEFINE_MTYPE_STATIC(OSPFD, OSPF_APICLIENT,  "OSPF-API client")
 /* Backlog for listen */
 #define BACKLOG 5
 
+DEFINE_MGROUP(OSPFCLIENT, "ospfclient")
+DEFINE_MTYPE_STATIC(OSPFCLIENT, OSPF_APICLIENT, "OSPF API client")
+
 /* -----------------------------------------------------------
  * Forward declarations
  * -----------------------------------------------------------
@@ -99,6 +102,8 @@ ospf_apiclient_connect (char *host, int syncport)
   int ret;
   int on = 1;
 
+  INIT_MTYPE(OSPF_APICLIENT);
+
   /* There are two connections between the client and the server.
      First the client opens a connection for synchronous requests/replies 
      to the server. The server will accept this connection and
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index 00a77dca83c6..b6785d3cef7c 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -70,6 +70,7 @@ void ospf_apiserver_term (void);
 int ospf_apiserver_enable;
 #endif /* SUPPORT_OSPF_API */
 
+static void ospf_opaque_memory_init ();
 static void ospf_opaque_register_vty (void);
 static void ospf_opaque_funclist_init (void);
 static void ospf_opaque_funclist_term (void);
@@ -78,9 +79,17 @@ static void free_opaque_info_per_id (void *val);
 static int ospf_opaque_lsa_install_hook (struct ospf_lsa *lsa);
 static int ospf_opaque_lsa_delete_hook (struct ospf_lsa *lsa);
 
+static void ospf_opaque_memory_init(void)
+{
+  INIT_MTYPE(OSPF_OPAQUE_FUNCTAB);
+  INIT_MTYPE(OPAQUE_INFO_PER_TYPE);
+  INIT_MTYPE(OPAQUE_INFO_PER_ID);
+}
+
 void
 ospf_opaque_init (void)
 {
+  ospf_opaque_memory_init ();
   ospf_opaque_register_vty ();
   ospf_opaque_funclist_init ();
 
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index b5058f8a0269..17f72bdee6aa 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -77,10 +77,12 @@ enum oifstate
   OI_ANY, OI_DOWN, OI_UP
 };
 
+
 /*------------------------------------------------------------------------*
  * Followings are initialize/terminate functions for MPLS-TE handling.
  *------------------------------------------------------------------------*/
 
+static void ospf_mpls_te_memory_init(void);
 static int ospf_mpls_te_new_if (struct interface *ifp);
 static int ospf_mpls_te_del_if (struct interface *ifp);
 static void ospf_mpls_te_ism_change (struct ospf_interface *oi,
@@ -95,11 +97,18 @@ static struct ospf_lsa *ospf_mpls_te_lsa_refresh (struct 
ospf_lsa *lsa);
 static void del_mpls_te_link (void *val);
 static void ospf_mpls_te_register_vty (void);
 
+static void ospf_mpls_te_memory_init(void)
+{
+  INIT_MTYPE(OSPF_MPLS_TE_LINKPARAMS);
+}
+
 int
 ospf_mpls_te_init (void)
 {
   int rc;
 
+  ospf_mpls_te_memory_init();
+
   rc = ospf_register_opaque_functab (
                 OSPF_OPAQUE_AREA_LSA,
                 OPAQUE_TYPE_TRAFFIC_ENGINEERING_LSA,
diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c
index 2d15dc37bdeb..fc836150da7c 100644
--- a/tests/heavy-wq.c
+++ b/tests/heavy-wq.c
@@ -179,6 +179,9 @@ heavy_wq_init ()
 void
 test_init()
 {
+  INIT_MTYPE(WQ_NODE);
+  INIT_MTYPE(WQ_NODE_STR);
+
   install_element (VIEW_NODE, &clear_foo_cmd);
   heavy_wq_init();
 }
diff --git a/tests/test-memory.c b/tests/test-memory.c
index 6849b9dcebef..da623f885a70 100644
--- a/tests/test-memory.c
+++ b/tests/test-memory.c
@@ -51,6 +51,8 @@ main(int argc, char **argv)
   void *a[10];
   int i;
 
+  INIT_MTYPE(TEST);
+
   printf ("malloc x, malloc x, free, malloc x, free free\n\n");
   /* simple case, test cache */
   for (i = 0; i < TIMES; i++)
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index f6c73bd9b321..fa81ba5cf8fc 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -437,6 +437,10 @@ vtysh_config_write ()
 void
 vtysh_config_init ()
 {
+  INIT_MGROUP(MVTYSH);
+  INIT_MTYPE(VTYSH_CONFIG);
+  INIT_MTYPE(VTYSH_CONFIG_LINE);
+
   config_top = list_new ();
   config_top->del = (void (*) (void *))line_del;
   configvec = vector_init (1);
-- 
2.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to