summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2010-02-05 01:40:40 +0100
committerDavid Lamparter <equinox@diac24.net>2010-02-05 01:40:40 +0100
commitf06277c84f7604b380bdac491e23c848d4952d18 (patch)
tree41a46707f2780d48893140e42ca3988fc761242f /bgpd
parent447a9a8dbde95fc6ce92691491ac193f0199e2cd (diff)
parent590f04362a6dd546e868b5160a72443ce97547ca (diff)
downloadquagga-f06277c84f7604b380bdac491e23c848d4952d18.tar.bz2
quagga-f06277c84f7604b380bdac491e23c848d4952d18.tar.xz
Merge branch 'patches/smallones' into dn42
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_advertise.c4
-rw-r--r--bgpd/bgp_advertise.h32
2 files changed, 34 insertions, 2 deletions
diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c
index 87eb7ac7..4163ab96 100644
--- a/bgpd/bgp_advertise.c
+++ b/bgpd/bgp_advertise.c
@@ -263,7 +263,7 @@ bgp_adj_out_set (struct bgp_node *rn, struct peer *peer, struct prefix *p,
/* Add new advertisement to advertisement attribute list. */
bgp_advertise_add (adv->baa, adv);
- FIFO_ADD (&peer->sync[afi][safi]->update, &adv->fifo);
+ FIFO_ADD (&peer->sync[afi][safi]->update, adv);
}
void
@@ -297,7 +297,7 @@ bgp_adj_out_unset (struct bgp_node *rn, struct peer *peer, struct prefix *p,
adv->adj = adj;
/* Add to synchronization entry for withdraw announcement. */
- FIFO_ADD (&peer->sync[afi][safi]->withdraw, &adv->fifo);
+ FIFO_ADD (&peer->sync[afi][safi]->withdraw, adv);
/* Schedule packet write. */
BGP_WRITE_ON (peer->t_write, bgp_write, peer->fd);
diff --git a/bgpd/bgp_advertise.h b/bgpd/bgp_advertise.h
index 4ebde907..53427eb3 100644
--- a/bgpd/bgp_advertise.h
+++ b/bgpd/bgp_advertise.h
@@ -102,6 +102,38 @@ struct bgp_synchronize
struct bgp_advertise_fifo withdraw_low;
};
+static inline void FIFO_INIT(struct bgp_advertise_fifo *fifo)
+{
+ fifo->next = fifo->prev = (struct bgp_advertise *) fifo;
+}
+
+static inline void FIFO_ADD(struct bgp_advertise_fifo *fifo,
+ struct bgp_advertise *node)
+{
+ node->fifo.next = (struct bgp_advertise *) fifo;
+ node->fifo.prev = fifo->prev;
+ fifo->prev = fifo->prev->next = node;
+}
+
+static inline void FIFO_DEL(struct bgp_advertise *node)
+{
+ struct bgp_advertise_fifo *fifo = &node->fifo;
+
+ fifo->prev->next = fifo->next;
+ fifo->next->prev = fifo->prev;
+}
+
+static inline int FIFO_EMPTY(const struct bgp_advertise_fifo *fifo)
+{
+ return (fifo->next == (const struct bgp_advertise *) fifo);
+}
+
+static inline struct bgp_advertise *FIFO_HEAD(struct bgp_advertise_fifo *fifo)
+{
+ return FIFO_EMPTY(fifo) ? NULL : fifo->next;
+}
+
+
/* BGP adjacency linked list. */
#define BGP_INFO_ADD(N,A,TYPE) \
do { \