Commit 06ece326 authored by Maria Matejka's avatar Maria Matejka
Browse files

Replacing BGP temporary linpools by the common temporary linpool

parent d814a8cb
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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
  {
+1 −22
Original line number Diff line number Diff line
@@ -126,9 +126,7 @@
#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
+0 −4
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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,
  };