diff options
| -rw-r--r-- | bgpd/ChangeLog | 12 | ||||
| -rw-r--r-- | bgpd/bgp_attr.c | 4 | ||||
| -rw-r--r-- | bgpd/bgp_fsm.c | 29 | ||||
| -rw-r--r-- | bgpd/bgp_nexthop.c | 16 | ||||
| -rw-r--r-- | bgpd/bgp_packet.c | 10 | ||||
| -rw-r--r-- | bgpd/bgp_snmp.c | 5 | ||||
| -rw-r--r-- | bgpd/bgp_vty.c | 2 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 12 | ||||
| -rw-r--r-- | bgpd/bgpd.h | 1 | 
9 files changed, 60 insertions, 31 deletions
diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 6bee4def..269c5524 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,3 +1,15 @@ +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 diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 8ffcfdd0..cad9168d 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1084,6 +1084,10 @@ bgp_attr_unknown (struct peer *peer, struct attr *attr, u_char flag,    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); 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); diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index c368eba5..76c1c2a1 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -507,6 +507,14 @@ bgp_scan (afi_t afi, safi_t safi)      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. */ @@ -516,7 +524,7 @@ bgp_scan_timer (struct thread *t)    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); @@ -1022,7 +1030,6 @@ bgp_import_check (struct prefix *p, u_int32_t *igpmetric, struct in_addr *igpnex  int  bgp_import (struct thread *t)  { -  struct bgp_master *bm;    struct bgp *bgp;    struct bgp_node *rn;    struct bgp_static *bgp_static; @@ -1036,9 +1043,8 @@ bgp_import (struct thread *t)    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)      { diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 5640e2b7..04e5bd30 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -1527,6 +1527,16 @@ bgp_update_receive (struct peer *peer, bgp_size_t size)  	  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 */ diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c index 6ffadf9c..228060a0 100644 --- a/bgpd/bgp_snmp.c +++ b/bgpd/bgp_snmp.c @@ -870,11 +870,6 @@ bgpTrapBackwardTransition (struct peer *peer)  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);  } diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 5968f68c..b94e66b0 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2770,7 +2770,7 @@ peer_port_vty (struct vty *vty, const char *ip_str, int afi,    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>", diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index bd2f998f..cb760d90 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -1780,15 +1780,6 @@ bgp_create (as_t *as, const char *name)    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 () @@ -4870,14 +4861,11 @@ bgp_init ()  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) diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 4137baf2..42c3ceaa 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -764,7 +764,6 @@ void bgp_reset (void);  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 *);  | 
