+2005-02-01 Akihiro Mizutani <mizutani@net-chef.net>
+
+ * 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.
+
2005-01-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* bgp_filter.c: (ip_as_path,no_ip_as_path) Use argv_concat instead
bgp_size_t total;
struct transit *transit;
+ if (BGP_DEBUG (normal, NORMAL))
+ zlog_debug ("%s Unknown attribute is received (type %d, length %d)",
+ peer->host, type, length);
+
if (BGP_DEBUG (events, EVENTS))
zlog (peer->log, LOG_DEBUG,
"Unknown attribute type %d length %d is received", type, length);
/* Need of clear of peer. */
bgp_clear_route_all (peer);
+
+ /* Reset peer synctime */
+ peer->synctime = 0;
}
/* Stop read and write threads when exists. */
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",
}
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);
/* 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. */
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);
bgp_nexthop_cache_reset (cache2_table[afi]);
else
bgp_nexthop_cache_reset (cache1_table[afi]);
+
+ if (BGP_DEBUG (events, EVENTS))
+ {
+ if (afi == AFI_IP)
+ zlog_debug ("scanning IPv4 Unicast routing tables");
+ else if (afi == AFI_IP6)
+ zlog_debug ("scanning IPv6 Unicast routing tables");
+ }
}
/* BGP scan thread. This thread check nexthop reachability. */
bgp_scan_thread =
thread_add_timer (master, bgp_scan_timer, NULL, bgp_scan_interval);
- if (BGP_DEBUG (normal, NORMAL))
+ if (BGP_DEBUG (events, EVENTS))
zlog_debug ("Performing BGP general scanning");
bgp_scan (AFI_IP, SAFI_UNICAST);
int
bgp_import (struct thread *t)
{
- struct bgp_master *bm;
struct bgp *bgp;
struct bgp_node *rn;
struct bgp_static *bgp_static;
bgp_import_thread =
thread_add_timer (master, bgp_import, NULL, bgp_import_interval);
- bm = bgp_get_master ();
- if (! bm)
- return 0;
+ if (BGP_DEBUG (events, EVENTS))
+ zlog_debug ("Import timer expired.");
LIST_LOOP (bm->bgp, bgp, nn)
{
bgp_nlri_parse (peer, &attr, &update);
}
+ if (mp_update.length
+ && mp_update.afi == AFI_IP
+ && mp_update.safi == SAFI_UNICAST)
+ bgp_nlri_parse (peer, &attr, &mp_update);
+
+ if (mp_withdraw.length
+ && mp_withdraw.afi == AFI_IP
+ && mp_withdraw.safi == SAFI_UNICAST)
+ bgp_nlri_parse (peer, NULL, &mp_withdraw);
+
if (! attribute_len && ! withdraw_len)
{
/* End-of-RIB received */
void
bgp_snmp_init ()
{
- struct bgp_master *bm;
-
- if ( !(bm = bgp_get_master ()) )
- return;
-
smux_init (bm->master);
REGISTER_MIB("mibII/bgp", bgp_variables, variable, bgp_oid);
}
return CMD_SUCCESS;
}
-/* Set specified peer's BGP version. */
+/* Set specified peer's BGP port. */
DEFUN (neighbor_port,
neighbor_port_cmd,
NEIGHBOR_CMD "port <0-65535>",
return bgp;
}
-/* Return master of BGP. */
-struct bgp_master *
-bgp_get_master ()
-{
- if (bm)
- return bm;
- return NULL;
-}
-
/* Return first entry of BGP. */
struct bgp *
bgp_get_default ()
void
bgp_terminate ()
{
- struct bgp_master *bm;
struct bgp *bgp;
struct peer *peer;
struct listnode *nn;
struct listnode *mm;
- bm = bgp_get_master ();
-
LIST_LOOP (bm->bgp, bgp, nn)
LIST_LOOP (bgp->peer, peer, mm)
if (peer->status == Established)
void bgp_zclient_reset ();
int bgp_nexthop_set (union sockunion *, union sockunion *,
struct bgp_nexthop *, struct peer *);
-struct bgp_master *bgp_get_master ();
struct bgp *bgp_get_default ();
struct bgp *bgp_lookup (as_t, const char *);
struct bgp *bgp_lookup_by_name (const char *);