]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Replacing BGP temporary linpools by the common temporary linpool
authorMaria Matejka <mq@ucw.cz>
Wed, 2 Mar 2022 10:22:32 +0000 (11:22 +0100)
committerMaria Matejka <mq@ucw.cz>
Wed, 2 Mar 2022 11:13:49 +0000 (12:13 +0100)
proto/bgp/attrs.c
proto/bgp/bgp.c
proto/bgp/bgp.h
proto/bgp/packets.c

index 1f927cbd9c7e8e4279110c34292ee1ecc078862c..6c1ae176dbd7519fdd548273e230d3b6f95b357d 100644 (file)
@@ -1854,7 +1854,7 @@ bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old)
 
   if (new)
   {
-    struct ea_list *attrs = bgp_update_attrs(p, c, new, new->attrs->eattrs, bgp_linpool2);
+    struct ea_list *attrs = bgp_update_attrs(p, c, new, new->attrs->eattrs, tmp_linpool);
 
     /* Error during attribute processing */
     if (!attrs)
@@ -1863,8 +1863,6 @@ bgp_rt_notify(struct proto *P, struct channel *C, net *n, rte *new, rte *old)
     /* If attributes are invalid, we fail back to withdraw */
     buck = attrs ? bgp_get_bucket(c, attrs) : bgp_get_withdraw_bucket(c);
     path = new->attrs->src->global_id;
-
-    lp_flush(bgp_linpool2);
   }
   else
   {
index 619a816b468a03e131d7e3e0adb2a62268f8b7fa..b5a31ab723030d65fc3b62f850bd60028ae335dd 100644 (file)
 #include "bgp.h"
 
 
-struct linpool *bgp_linpool;           /* Global temporary pool */
-struct linpool *bgp_linpool2;          /* Global temporary pool for bgp_rt_notify() */
-static list bgp_sockets;               /* Global list of listening sockets */
+static list STATIC_LIST_INIT(bgp_sockets);             /* Global list of listening sockets */
 
 
 static void bgp_connect(struct bgp_proto *p);
@@ -161,10 +159,6 @@ bgp_open(struct bgp_proto *p)
   uint flags = p->cf->free_bind ? SKF_FREEBIND : 0;
   uint flag_mask = SKF_FREEBIND;
 
-  /* FIXME: Add some global init? */
-  if (!bgp_linpool)
-    init_list(&bgp_sockets);
-
   /* We assume that cf->iface is defined iff cf->local_ip is link-local */
 
   WALK_LIST(bs, bgp_sockets)
@@ -204,12 +198,6 @@ bgp_open(struct bgp_proto *p)
 
   add_tail(&bgp_sockets, &bs->n);
 
-  if (!bgp_linpool)
-  {
-    bgp_linpool  = lp_new_default(proto_pool);
-    bgp_linpool2 = lp_new_default(proto_pool);
-  }
-
   return 0;
 
 err:
@@ -238,15 +226,6 @@ bgp_close(struct bgp_proto *p)
   rfree(bs->sk);
   rem_node(&bs->n);
   mb_free(bs);
-
-  if (!EMPTY_LIST(bgp_sockets))
-    return;
-
-  rfree(bgp_linpool);
-  bgp_linpool = NULL;
-
-  rfree(bgp_linpool2);
-  bgp_linpool2 = NULL;
 }
 
 static inline int
index 4969c0b9c0d508ca281ac5e23f95a69079e66cb2..f2c1186936713006a4963cf667340892f542b426 100644 (file)
@@ -20,7 +20,6 @@
 #include "lib/hash.h"
 #include "lib/socket.h"
 
-struct linpool;
 struct eattr;
 
 
@@ -495,9 +494,6 @@ bgp_parse_error(struct bgp_parse_state *s, uint subcode)
   longjmp(s->err_jmpbuf, 1);
 }
 
-extern struct linpool *bgp_linpool;
-extern struct linpool *bgp_linpool2;
-
 
 void bgp_start_timer(timer *t, uint value);
 void bgp_check_config(struct bgp_config *c);
index f13625e2850333f8b40024a6f15415253144b7de..875808fb34dec67f19b3152f6609682d43977264 100644 (file)
@@ -2335,7 +2335,7 @@ again: ;
   struct bgp_write_state s = {
     .proto = p,
     .channel = c,
-    .pool = bgp_linpool,
+    .pool = tmp_linpool,
     .mp_reach = (c->afi != BGP_AF_IPV4) || c->ext_next_hop,
     .as4_session = p->as4_session,
     .add_path = c->add_path_tx,
@@ -2518,7 +2518,7 @@ bgp_rx_update(struct bgp_conn *conn, byte *pkt, uint len)
   /* Initialize parse state */
   struct bgp_parse_state s = {
     .proto = p,
-    .pool = bgp_linpool,
+    .pool = tmp_linpool,
     .as4_session = p->as4_session,
   };