]> git.puffer.fish Git - mirror/frr.git/commitdiff
* bgp_nexthop.c: Improve debug.
authorhasso <hasso>
Tue, 1 Feb 2005 20:13:16 +0000 (20:13 +0000)
committerhasso <hasso>
Tue, 1 Feb 2005 20:13:16 +0000 (20:13 +0000)
        * 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]

bgpd/ChangeLog
bgpd/bgp_attr.c
bgpd/bgp_fsm.c
bgpd/bgp_nexthop.c
bgpd/bgp_packet.c
bgpd/bgp_snmp.c
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.h

index 6bee4def95e61970da8d711f951cacaffcfd5ca6..269c55249c09be4823a190985805d19aa35387b7 100644 (file)
@@ -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
index 8ffcfdd08cc502636068c95993b1e63b3866ad5b..cad9168d7106bc472cff2a7336a918bc638f3b56 100644 (file)
@@ -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);
index 891958621f6e474ff7c4a58f3794b01eb1aa8ead..7327db0c17b8dce6f112c6bf74161d71cc146f1f 100644 (file)
@@ -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);
index c368eba503bd30a18fec46554415b8a4e7c0c541..76c1c2a13d42aa950af9dff88d8ee0ba0521efa9 100644 (file)
@@ -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)
     {
index 5640e2b7b02e03162c0aebfd925ee6e4b0e3eb5c..04e5bd30bc1edaf18854342922defdb05d6ea109 100644 (file)
@@ -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 */
index 6ffadf9cd696bda8ea7d39cf60d618a17803ef59..228060a0f3b5eb2d00756ca81e1028dfd4829e2c 100644 (file)
@@ -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);
 }
index 5968f68c616f32b87ad3572b8e8e0d1cd5da6240..b94e66b008fed2907558f1af6dcbcc5e33ed533e 100644 (file)
@@ -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>",
index bd2f998fca0b1949698710ac84e30ff30c3195e0..cb760d9095c7bd6327c706c0b9b4356b4a1b3c9e 100644 (file)
@@ -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)
index 4137baf2e24cb30fb4d0995ac541a9fa84c65035..42c3ceaa5aacedd4d6c0aae2b4bd9fec350011fe 100644 (file)
@@ -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 *);