diff options
author | David Lamparter <equinox@diac24.net> | 2010-02-05 01:40:40 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2010-02-05 01:40:40 +0100 |
commit | f06277c84f7604b380bdac491e23c848d4952d18 (patch) | |
tree | 41a46707f2780d48893140e42ca3988fc761242f /bgpd | |
parent | 447a9a8dbde95fc6ce92691491ac193f0199e2cd (diff) | |
parent | 590f04362a6dd546e868b5160a72443ce97547ca (diff) | |
download | quagga-f06277c84f7604b380bdac491e23c848d4952d18.tar.bz2 quagga-f06277c84f7604b380bdac491e23c848d4952d18.tar.xz |
Merge branch 'patches/smallones' into dn42
Diffstat (limited to 'bgpd')
-rw-r--r-- | bgpd/bgp_advertise.c | 4 | ||||
-rw-r--r-- | bgpd/bgp_advertise.h | 32 |
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 { \ |