]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: add qobj registrations
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 7 Dec 2016 11:25:24 +0000 (12:25 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 9 Dec 2016 16:36:25 +0000 (17:36 +0100)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgpd.c
bgpd/bgpd.h

index 6d479e1021071f668a110f2ac3f58203996f77ba..5ed630b49d9e791c360051f47d9ed2aa65251709 100644 (file)
@@ -78,6 +78,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #include "bgpd/bgp_bfd.h"
 #include "bgpd/bgp_memory.h"
 
+DEFINE_QOBJ_TYPE(bgp_master)
+DEFINE_QOBJ_TYPE(bgp)
+DEFINE_QOBJ_TYPE(peer)
+
 /* BGP process wide configuration.  */
 static struct bgp_master bgp_master;
 
@@ -1018,6 +1022,8 @@ peer_free (struct peer *peer)
 {
   assert (peer->status == Deleted);
 
+  QOBJ_UNREG (peer);
+
   /* this /ought/ to have been done already through bgp_stop earlier,
    * but just to be sure.. 
    */
@@ -1201,6 +1207,7 @@ peer_new (struct bgp *bgp)
   sp = getservbyname ("bgp", "tcp");
   peer->port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
 
+  QOBJ_REG (peer, peer);
   return peer;
 }
 
@@ -2917,6 +2924,8 @@ bgp_create (as_t *as, const char *name, enum bgp_instance_type inst_type)
   bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX;
   bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME;
 
+  QOBJ_REG (bgp, bgp);
+
   update_bgp_group_init(bgp);
   return bgp;
 }
@@ -3233,6 +3242,8 @@ bgp_free (struct bgp *bgp)
   afi_t afi;
   safi_t safi;
 
+  QOBJ_UNREG (bgp);
+
   list_delete (bgp->group);
   list_delete (bgp->peer);
 
@@ -7481,6 +7492,8 @@ bgp_master_init (void)
 
   /* Enable multiple instances by default. */
   bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
+
+  QOBJ_REG (bm, bgp_master);
 }
 
 /*
@@ -7582,6 +7595,8 @@ bgp_terminate (void)
   struct listnode *node, *nnode;
   struct listnode *mnode, *mnnode;
 
+  QOBJ_UNREG (bm);
+
   /* Close the listener sockets first as this prevents peers from attempting
    * to reconnect on receiving the peer unconfig message. In the presence
    * of a large number of peers this will ensure that no peer is left with
index 510082fdc2f182e34ccc989cfca987c26bafcd9d..86fa207b6b7f4ae694acbbe01ebb600449004c9f 100644 (file)
@@ -21,6 +21,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 #ifndef _QUAGGA_BGPD_H
 #define _QUAGGA_BGPD_H
 
+#include "qobj.h"
 #include "lib/json.h"
 #include "vrf.h"
 
@@ -120,7 +121,10 @@ struct bgp_master
   struct thread *t_rmap_update;   /* Handle route map updates */
   u_int32_t rmap_update_timer;   /* Route map update timer */
 #define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
+
+  QOBJ_FIELDS
 };
+DECLARE_QOBJ_TYPE(bgp_master)
 
 /* BGP route-map structure.  */
 struct bgp_rmap
@@ -356,7 +360,10 @@ struct bgp
   struct rfapi_cfg *rfapi_cfg;
   struct rfapi *rfapi;
 #endif
+
+  QOBJ_FIELDS
 };
+DECLARE_QOBJ_TYPE(bgp)
 
 #define BGP_ROUTE_ADV_HOLD(bgp) (bgp->main_peers_update_hold)
 
@@ -879,7 +886,10 @@ u_char last_reset_cause[BGP_MAX_PACKET_SIZE];
   /* hostname and domainname advertised by host */
   char *hostname;
   char *domainname;
+
+  QOBJ_FIELDS
 };
+DECLARE_QOBJ_TYPE(peer)
 
 /* Check if suppress start/restart of sessions to peer. */
 #define BGP_PEER_START_SUPPRESSED(P) \