diff options
author | Jeffrey C. Ollie <jeff@ocjtech.us> | 2007-04-09 15:36:33 -0500 |
---|---|---|
committer | Jeffrey C. Ollie <jeff@ocjtech.us> | 2007-04-09 15:36:33 -0500 |
commit | 37e11172f8ed157340783b73d56595bb02d0a2d2 (patch) | |
tree | 65163a9cdb8ded9c55c94da92e8a6327bda9067c /bgpd/bgp_packet.c | |
parent | 8d3e3ccfd0d0cb82b253f937339d1c6189a2bf54 (diff) | |
parent | 43cd33a44e010f818633b7f144b5a0be352b41e7 (diff) | |
download | quagga-0.99.6-realms.patch.tar.bz2 quagga-0.99.6-realms.patch.tar.xz |
Merge commit 'quagga_0_99_6_release' into linux-realmsquagga-0.99.6-realms.patch
Diffstat (limited to 'bgpd/bgp_packet.c')
-rw-r--r-- | bgpd/bgp_packet.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 8b024a1c..9859e50b 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -158,14 +158,14 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) while (adv) { - if (adv->rn) - rn = adv->rn; + assert (adv->rn); + rn = adv->rn; adj = adv->adj; if (adv->binfo) binfo = adv->binfo; /* When remaining space can't include NLRI and it's length. */ - if (rn && STREAM_REMAIN (s) <= BGP_NLRI_LENGTH + PSIZE (rn->p.prefixlen)) + if (STREAM_REMAIN (s) <= BGP_NLRI_LENGTH + PSIZE (rn->p.prefixlen)) break; /* If packet is empty, set attribute. */ @@ -173,11 +173,15 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) { struct prefix_rd *prd = NULL; u_char *tag = NULL; + struct peer *from = NULL; if (rn->prn) prd = (struct prefix_rd *) &rn->prn->p; if (binfo) - tag = binfo->tag; + { + tag = binfo->tag; + from = binfo->peer; + } bgp_packet_set_marker (s, BGP_MSG_UPDATE); stream_putw (s, 0); @@ -186,7 +190,7 @@ bgp_update_packet (struct peer *peer, afi_t afi, safi_t safi) total_attr_len = bgp_packet_attribute (NULL, peer, s, adv->baa->attr, &rn->p, afi, safi, - binfo->peer, prd, tag); + from, prd, tag); stream_putw_at (s, pos, total_attr_len); } @@ -288,6 +292,7 @@ bgp_withdraw_packet (struct peer *peer, afi_t afi, safi_t safi) while ((adv = FIFO_HEAD (&peer->sync[afi][safi]->withdraw)) != NULL) { + assert (adv->rn); adj = adv->adj; rn = adv->rn; @@ -637,9 +642,7 @@ bgp_write (struct thread *thread) if (write_errno == EWOULDBLOCK || write_errno == EAGAIN) break; - BGP_EVENT_ADD (peer, BGP_Stop); - peer->status = Idle; - bgp_timer_set (peer); + BGP_EVENT_ADD (peer, TCP_fatal_error); return 0; } if (num != writenum) @@ -673,10 +676,8 @@ bgp_write (struct thread *thread) if (peer->v_start >= (60 * 2)) peer->v_start = (60 * 2); + /* Flush any existing events */ BGP_EVENT_ADD (peer, BGP_Stop); - /*bgp_stop (peer);*/ - peer->status = Idle; - bgp_timer_set (peer); return 0; case BGP_MSG_KEEPALIVE: peer->keepalive_out++; @@ -721,9 +722,7 @@ bgp_write_notify (struct peer *peer) ret = writen (peer->fd, STREAM_DATA (s), stream_get_endp (s)); if (ret <= 0) { - BGP_EVENT_ADD (peer, BGP_Stop); - peer->status = Idle; - bgp_timer_set (peer); + BGP_EVENT_ADD (peer, TCP_fatal_error); return 0; } @@ -743,10 +742,7 @@ bgp_write_notify (struct peer *peer) if (peer->v_start >= (60 * 2)) peer->v_start = (60 * 2); - /* We don't call event manager at here for avoiding other events. */ - bgp_stop (peer); - peer->status = Idle; - bgp_timer_set (peer); + BGP_EVENT_ADD (peer, BGP_Stop); return 0; } @@ -2375,14 +2371,6 @@ bgp_read (struct thread *thread) if (BGP_DEBUG (events, EVENTS)) zlog_debug ("%s [Event] Accepting BGP peer delete", peer->host); peer_delete (peer); - /* we've lost track of a reference to ACCEPT_PEER somehow. It doesnt - * _seem_ to be the 'update realpeer with accept peer' hack, yet it - * *must* be.. Very very odd, but I give up trying to - * root cause this - ACCEPT_PEER is a dirty hack, it should be fixed - * instead, which would make root-causing this a moot point.. - * A hack because of a hack, appropriate. - */ - peer_unlock (peer); /* god knows what reference... ACCEPT_PEER sucks */ } return 0; } |