bgpd: add qobj registrations

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2016-12-07 12:25:24 +01:00
parent 04cb240868
commit 19df7279f7
2 changed files with 25 additions and 0 deletions

View File

@ -78,6 +78,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "bgpd/bgp_bfd.h" #include "bgpd/bgp_bfd.h"
#include "bgpd/bgp_memory.h" #include "bgpd/bgp_memory.h"
DEFINE_QOBJ_TYPE(bgp_master)
DEFINE_QOBJ_TYPE(bgp)
DEFINE_QOBJ_TYPE(peer)
/* BGP process wide configuration. */ /* BGP process wide configuration. */
static struct bgp_master bgp_master; static struct bgp_master bgp_master;
@ -1018,6 +1022,8 @@ peer_free (struct peer *peer)
{ {
assert (peer->status == Deleted); assert (peer->status == Deleted);
QOBJ_UNREG (peer);
/* this /ought/ to have been done already through bgp_stop earlier, /* this /ought/ to have been done already through bgp_stop earlier,
* but just to be sure.. * but just to be sure..
*/ */
@ -1201,6 +1207,7 @@ peer_new (struct bgp *bgp)
sp = getservbyname ("bgp", "tcp"); sp = getservbyname ("bgp", "tcp");
peer->port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port); peer->port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
QOBJ_REG (peer, peer);
return 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->wpkt_quanta = BGP_WRITE_PACKET_MAX;
bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME; bgp->coalesce_time = BGP_DEFAULT_SUBGROUP_COALESCE_TIME;
QOBJ_REG (bgp, bgp);
update_bgp_group_init(bgp); update_bgp_group_init(bgp);
return bgp; return bgp;
} }
@ -3233,6 +3242,8 @@ bgp_free (struct bgp *bgp)
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
QOBJ_UNREG (bgp);
list_delete (bgp->group); list_delete (bgp->group);
list_delete (bgp->peer); list_delete (bgp->peer);
@ -7481,6 +7492,8 @@ bgp_master_init (void)
/* Enable multiple instances by default. */ /* Enable multiple instances by default. */
bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE); 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 *node, *nnode;
struct listnode *mnode, *mnnode; struct listnode *mnode, *mnnode;
QOBJ_UNREG (bm);
/* Close the listener sockets first as this prevents peers from attempting /* Close the listener sockets first as this prevents peers from attempting
* to reconnect on receiving the peer unconfig message. In the presence * 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 * of a large number of peers this will ensure that no peer is left with

View File

@ -21,6 +21,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGPD_H #ifndef _QUAGGA_BGPD_H
#define _QUAGGA_BGPD_H #define _QUAGGA_BGPD_H
#include "qobj.h"
#include "lib/json.h" #include "lib/json.h"
#include "vrf.h" #include "vrf.h"
@ -120,7 +121,10 @@ struct bgp_master
struct thread *t_rmap_update; /* Handle route map updates */ struct thread *t_rmap_update; /* Handle route map updates */
u_int32_t rmap_update_timer; /* Route map update timer */ u_int32_t rmap_update_timer; /* Route map update timer */
#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */ #define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
QOBJ_FIELDS
}; };
DECLARE_QOBJ_TYPE(bgp_master)
/* BGP route-map structure. */ /* BGP route-map structure. */
struct bgp_rmap struct bgp_rmap
@ -356,7 +360,10 @@ struct bgp
struct rfapi_cfg *rfapi_cfg; struct rfapi_cfg *rfapi_cfg;
struct rfapi *rfapi; struct rfapi *rfapi;
#endif #endif
QOBJ_FIELDS
}; };
DECLARE_QOBJ_TYPE(bgp)
#define BGP_ROUTE_ADV_HOLD(bgp) (bgp->main_peers_update_hold) #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 */ /* hostname and domainname advertised by host */
char *hostname; char *hostname;
char *domainname; char *domainname;
QOBJ_FIELDS
}; };
DECLARE_QOBJ_TYPE(peer)
/* Check if suppress start/restart of sessions to peer. */ /* Check if suppress start/restart of sessions to peer. */
#define BGP_PEER_START_SUPPRESSED(P) \ #define BGP_PEER_START_SUPPRESSED(P) \