void bgp_advertise_attr_free(struct bgp_advertise_attr *baa)
{
+ bgp_advertise_attr_fifo_fini(&baa->fifo);
+
XFREE(MTYPE_BGP_ADVERTISE_ATTR, baa);
}
baa = bgp_advertise_attr_new();
baa->attr = ref->attr;
+
+ bgp_advertise_attr_fifo_init(&baa->fifo);
+
return baa;
}
void bgp_advertise_add(struct bgp_advertise_attr *baa,
struct bgp_advertise *adv)
{
- adv->next = baa->adv;
- if (baa->adv)
- baa->adv->prev = adv;
- baa->adv = adv;
+ bgp_advertise_attr_fifo_add_tail(&baa->fifo, adv);
}
void bgp_advertise_delete(struct bgp_advertise_attr *baa,
struct bgp_advertise *adv)
{
- if (adv->next)
- adv->next->prev = adv->prev;
- if (adv->prev)
- adv->prev->next = adv->next;
- else
- baa->adv = adv->next;
+ bgp_advertise_attr_fifo_del(&baa->fifo, adv);
}
struct bgp_advertise_attr *bgp_advertise_attr_intern(struct hash *hash,
PREDECL_DLIST(bgp_adv_fifo);
struct update_subgroup;
+struct bgp_advertise;
-/* BGP advertise attribute. */
-struct bgp_advertise_attr {
- /* Head of advertisement pointer. */
- struct bgp_advertise *adv;
+PREDECL_DLIST(bgp_advertise_attr_fifo);
- /* Reference counter. */
- unsigned long refcnt;
-
- /* Attribute pointer to be announced. */
- struct attr *attr;
-};
+struct bgp_advertise_attr;
+/* BGP advertise attribute. */
struct bgp_advertise {
/* FIFO for advertisement. */
struct bgp_adv_fifo_item fifo;
- /* Link list for same attribute advertise. */
- struct bgp_advertise *next;
- struct bgp_advertise *prev;
+ /* FIFO for this item in the bgp_advertise_attr fifo */
+ struct bgp_advertise_attr_fifo_item item;
/* Prefix information. */
struct bgp_dest *dest;
struct bgp_path_info *pathi;
};
+DECLARE_DLIST(bgp_advertise_attr_fifo, struct bgp_advertise, item);
DECLARE_DLIST(bgp_adv_fifo, struct bgp_advertise, fifo);
+/* BGP advertise attribute. */
+struct bgp_advertise_attr {
+ /* Head of advertisement pointer. */
+ struct bgp_advertise_attr_fifo_head fifo;
+
+ /* Reference counter. */
+ unsigned long refcnt;
+
+ /* Attribute pointer to be announced. */
+ struct attr *attr;
+};
+
/* BGP adjacency out. */
struct bgp_adj_out {
/* RB Tree of adjacency entries */
bgp_advertise_delete(baa, adv);
/* Fetch next advertise candidate. */
- next = baa->adv;
+ next = bgp_advertise_attr_fifo_first(&baa->fifo);
/* Unintern BGP advertise attribute. */
bgp_advertise_attr_unintern(subgrp->hash, baa);