summaryrefslogtreecommitdiff
path: root/bgpd/bgp_fsm.c
diff options
context:
space:
mode:
authorhasso <hasso>2005-02-01 20:13:16 +0000
committerhasso <hasso>2005-02-01 20:13:16 +0000
commitf418446bb767d79438e2df689c5bf9563c54b317 (patch)
treea1c7322c8b54e46a09bf2f402537277fff59c1c3 /bgpd/bgp_fsm.c
parent6a52d0d155fc8b892e30cdb5e3fbe4c2779bd4cd (diff)
* bgp_nexthop.c: Improve debug.
* bgpd.[ch], bgp_nexthop.c, bgp_snmp.c: Remove useless bgp_get_master() function. * bgp_packet.c: MP AFI_IP update and withdraw parsing. * bgp_fsm.c: Reset peer synctime in bgp_stop(). bgp_fsm_change_status() is better place to log about peer status change than bgp_event(). Log in bgp_connect_success(). * bgp_vty.c: Fix typo in comment. * bgp_attr.c: Better log about unknown attribute. [merge from GNU Zebra]
Diffstat (limited to 'bgpd/bgp_fsm.c')
-rw-r--r--bgpd/bgp_fsm.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 89195862..7327db0c 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -367,6 +367,9 @@ bgp_stop (struct peer *peer)
/* Need of clear of peer. */
bgp_clear_route_all (peer);
+
+ /* Reset peer synctime */
+ peer->synctime = 0;
}
/* Stop read and write threads when exists. */
@@ -491,6 +494,8 @@ bgp_stop_with_error (struct peer *peer)
int
bgp_connect_success (struct peer *peer)
{
+ char buf1[BUFSIZ];
+
if (peer->fd < 0)
{
zlog_err ("bgp_connect_success peer's fd is negative value %d",
@@ -499,7 +504,17 @@ bgp_connect_success (struct peer *peer)
}
BGP_READ_ON (peer->t_read, bgp_read, peer->fd);
- /* bgp_getsockname (peer); */
+ if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
+ bgp_getsockname (peer);
+
+ if (BGP_DEBUG (normal, NORMAL))
+ {
+ if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
+ zlog_debug ("%s open active, local address %s", peer->host,
+ sockunion2str (peer->su_local, buf1, SU_ADDRSTRLEN));
+ else
+ zlog_debug ("%s passive open", peer->host);
+ }
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
bgp_open_send (peer);
@@ -594,6 +609,12 @@ bgp_fsm_change_status (struct peer *peer, int status)
/* Preserve old status and change into new status. */
peer->ostatus = peer->status;
peer->status = status;
+
+ if (BGP_DEBUG (normal, NORMAL))
+ zlog_debug ("%s went from %s to %s",
+ peer->host,
+ LOOKUP (bgp_status_msg, peer->ostatus),
+ LOOKUP (bgp_status_msg, peer->status));
}
/* Keepalive send to peer. */
@@ -866,12 +887,6 @@ bgp_event (struct thread *thread)
bgp_event_str[event],
LOOKUP (bgp_status_msg, peer->status),
LOOKUP (bgp_status_msg, next));
- if (BGP_DEBUG (normal, NORMAL)
- && strcmp (LOOKUP (bgp_status_msg, peer->status), LOOKUP (bgp_status_msg, next)))
- zlog_debug ("%s went from %s to %s",
- peer->host,
- LOOKUP (bgp_status_msg, peer->status),
- LOOKUP (bgp_status_msg, next));
/* Call function. */
ret = (*(FSM [peer->status - 1][event - 1].func))(peer);