summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_route.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_route.c')
-rw-r--r--bgpd/bgp_route.c71
1 files changed, 11 insertions, 60 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f8eb7f7f..db8e36d5 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -129,16 +129,11 @@ bgp_info_extra_get (struct bgp_info *ri)
static struct bgp_info *
bgp_info_new ()
{
- struct bgp_info *new;
-
- new = XMALLOC (MTYPE_BGP_ROUTE, sizeof (struct bgp_info));
- memset (new, 0, sizeof (struct bgp_info));
-
- return new;
+ return XCALLOC (MTYPE_BGP_ROUTE, sizeof (struct bgp_info));
}
/* Free bgp route information. */
-static void
+void
bgp_info_free (struct bgp_info *binfo)
{
if (binfo->attr)
@@ -151,39 +146,6 @@ bgp_info_free (struct bgp_info *binfo)
XFREE (MTYPE_BGP_ROUTE, binfo);
}
-struct bgp_info *
-bgp_info_lock (struct bgp_info *binfo)
-{
- binfo->lock++;
- return binfo;
-}
-
-struct bgp_info *
-bgp_info_unlock (struct bgp_info *binfo)
-{
- assert (binfo && binfo->lock > 0);
- binfo->lock--;
-
- if (binfo->lock == 0)
- {
-#if 0
- zlog_debug ("%s: unlocked and freeing", __func__);
- zlog_backtrace (LOG_DEBUG);
-#endif
- bgp_info_free (binfo);
- return NULL;
- }
-
-#if 0
- if (binfo->lock == 1)
- {
- zlog_debug ("%s: unlocked to 1", __func__);
- zlog_backtrace (LOG_DEBUG);
- }
-#endif
-
- return binfo;
-}
void
bgp_info_add (struct bgp_node *rn, struct bgp_info *ri)
@@ -742,9 +704,8 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p,
filter = &peer->filter[afi][safi];
bgp = peer->bgp;
-#ifdef DISABLE_BGP_ANNOUNCE
- return 0;
-#endif
+ if (DISABLE_BGP_ANNOUNCE)
+ return 0;
/* Do not send announces to RS-clients from the 'normal' bgp_table. */
if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
@@ -1095,9 +1056,8 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient,
filter = &rsclient->filter[afi][safi];
bgp = rsclient->bgp;
-#ifdef DISABLE_BGP_ANNOUNCE
- return 0;
-#endif
+ if (DISABLE_BGP_ANNOUNCE)
+ return 0;
/* Do not send back route to sender. */
if (from == rsclient)
@@ -2680,10 +2640,10 @@ bgp_clear_node_complete (struct work_queue *wq)
{
struct peer *peer = wq->spec.data;
- peer_unlock (peer); /* bgp_clear_node_complete */
-
/* Tickle FSM to start moving again */
BGP_EVENT_ADD (peer, Clearing_Completed);
+
+ peer_unlock (peer); /* bgp_clear_node_complete */
}
static void
@@ -3123,10 +3083,7 @@ bgp_nlri_sanity_check (struct peer *peer, int afi, u_char *pnt,
static struct bgp_static *
bgp_static_new ()
{
- struct bgp_static *new;
- new = XMALLOC (MTYPE_BGP_STATIC, sizeof (struct bgp_static));
- memset (new, 0, sizeof (struct bgp_static));
- return new;
+ return XCALLOC (MTYPE_BGP_STATIC, sizeof (struct bgp_static));
}
static void
@@ -4511,10 +4468,7 @@ struct bgp_aggregate
static struct bgp_aggregate *
bgp_aggregate_new ()
{
- struct bgp_aggregate *new;
- new = XMALLOC (MTYPE_BGP_AGGREGATE, sizeof (struct bgp_aggregate));
- memset (new, 0, sizeof (struct bgp_aggregate));
- return new;
+ return XCALLOC (MTYPE_BGP_AGGREGATE, sizeof (struct bgp_aggregate));
}
static void
@@ -10861,10 +10815,7 @@ struct bgp_distance
static struct bgp_distance *
bgp_distance_new ()
{
- struct bgp_distance *new;
- new = XMALLOC (MTYPE_BGP_DISTANCE, sizeof (struct bgp_distance));
- memset (new, 0, sizeof (struct bgp_distance));
- return new;
+ return XCALLOC (MTYPE_BGP_DISTANCE, sizeof (struct bgp_distance));
}
static void