Diff for /embedaddon/quagga/bgpd/bgp_mpath.c between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2012/10/09 09:22:28 version 1.1.1.3, 2016/11/02 10:09:10
Line 28 Line 28
 #include "linklist.h"  #include "linklist.h"
 #include "sockunion.h"  #include "sockunion.h"
 #include "memory.h"  #include "memory.h"
   #include "filter.h"
   
 #include "bgpd/bgpd.h"  #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"  #include "bgpd/bgp_table.h"
Line 39 Line 40
 #include "bgpd/bgp_ecommunity.h"  #include "bgpd/bgp_ecommunity.h"
 #include "bgpd/bgp_mpath.h"  #include "bgpd/bgp_mpath.h"
   
   bool
   bgp_mpath_is_configured_sort (struct bgp *bgp, bgp_peer_sort_t sort,
                                 afi_t afi, safi_t safi)
   {
     struct bgp_maxpaths_cfg *cfg = &bgp->maxpaths[afi][safi];
   
     /* XXX: BGP_DEFAULT_MAXPATHS is 1, and this test only seems to make sense
      * if if it stays 1, so not sure the DEFAULT define is that useful.
      */
     switch (sort)
       {
         case BGP_PEER_IBGP:
           return cfg->maxpaths_ibgp != BGP_DEFAULT_MAXPATHS;
         case BGP_PEER_EBGP:
           return cfg->maxpaths_ebgp != BGP_DEFAULT_MAXPATHS;
         default:
           return false;
       }
   }
   
   bool
   bgp_mpath_is_configured (struct bgp *bgp, afi_t afi, safi_t safi)
   {
     return bgp_mpath_is_configured_sort (bgp, BGP_PEER_IBGP, afi, safi)
            || bgp_mpath_is_configured_sort (bgp, BGP_PEER_EBGP, afi, safi);
   }
   
 /*  /*
  * bgp_maximum_paths_set   * bgp_maximum_paths_set
  *   *
Line 120  bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp Line 148  bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp
           compare = IPV4_ADDR_CMP (&ae1->mp_nexthop_global_in,            compare = IPV4_ADDR_CMP (&ae1->mp_nexthop_global_in,
                                    &ae2->mp_nexthop_global_in);                                     &ae2->mp_nexthop_global_in);
           break;            break;
 #ifdef HAVE_IPV6  
         case 16:          case 16:
           compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global,            compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_global,
                                    &ae2->mp_nexthop_global);                                     &ae2->mp_nexthop_global);
Line 132  bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp Line 159  bgp_info_nexthop_cmp (struct bgp_info *bi1, struct bgp
             compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_local,              compare = IPV6_ADDR_CMP (&ae1->mp_nexthop_local,
                                      &ae2->mp_nexthop_local);                                       &ae2->mp_nexthop_local);
           break;            break;
 #endif /* HAVE_IPV6 */  
         }          }
     }      }
   
Line 395  bgp_info_mpath_attr_set (struct bgp_info *binfo, struc Line 421  bgp_info_mpath_attr_set (struct bgp_info *binfo, struc
 void  void
 bgp_info_mpath_update (struct bgp_node *rn, struct bgp_info *new_best,  bgp_info_mpath_update (struct bgp_node *rn, struct bgp_info *new_best,
                        struct bgp_info *old_best, struct list *mp_list,                         struct bgp_info *old_best, struct list *mp_list,
                       struct bgp_maxpaths_cfg *mpath_cfg)                        afi_t afi, safi_t safi)
 {  {
   u_int16_t maxpaths, mpath_count, old_mpath_count;    u_int16_t maxpaths, mpath_count, old_mpath_count;
   struct listnode *mp_node, *mp_next_node;    struct listnode *mp_node, *mp_next_node;
   struct bgp_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;    struct bgp_info *cur_mpath, *new_mpath, *next_mpath, *prev_mpath;
   int mpath_changed, debug;    int mpath_changed, debug;
   char pfx_buf[INET_ADDRSTRLEN], nh_buf[2][INET_ADDRSTRLEN];    char pfx_buf[INET_ADDRSTRLEN], nh_buf[2][INET_ADDRSTRLEN];
     struct bgp_maxpaths_cfg *mpath_cfg = NULL;
   
   mpath_changed = 0;    mpath_changed = 0;
   maxpaths = BGP_DEFAULT_MAXPATHS;    maxpaths = BGP_DEFAULT_MAXPATHS;
Line 410  bgp_info_mpath_update (struct bgp_node *rn, struct bgp Line 437  bgp_info_mpath_update (struct bgp_node *rn, struct bgp
   old_mpath_count = 0;    old_mpath_count = 0;
   prev_mpath = new_best;    prev_mpath = new_best;
   mp_node = listhead (mp_list);    mp_node = listhead (mp_list);
   
   debug = BGP_DEBUG (events, EVENTS);    debug = BGP_DEBUG (events, EVENTS);
   
   if (debug)    if (debug)
Line 417  bgp_info_mpath_update (struct bgp_node *rn, struct bgp Line 445  bgp_info_mpath_update (struct bgp_node *rn, struct bgp
   
   if (new_best)    if (new_best)
     {      {
         mpath_cfg = &new_best->peer->bgp->maxpaths[afi][safi];
       mpath_count++;        mpath_count++;
       if (new_best != old_best)        if (new_best != old_best)
         bgp_info_mpath_dequeue (new_best);          bgp_info_mpath_dequeue (new_best);
      maxpaths = (peer_sort (new_best->peer) == BGP_PEER_IBGP) ?      maxpaths = (new_best->peer->sort == BGP_PEER_IBGP) ?
         mpath_cfg->maxpaths_ibgp : mpath_cfg->maxpaths_ebgp;          mpath_cfg->maxpaths_ibgp : mpath_cfg->maxpaths_ebgp;
     }      }
   
Line 715  bgp_info_mpath_aggregate_update (struct bgp_info *new_ Line 744  bgp_info_mpath_aggregate_update (struct bgp_info *new_
   
   /* Zap multipath attr nexthop so we set nexthop to self */    /* Zap multipath attr nexthop so we set nexthop to self */
   attr.nexthop.s_addr = 0;    attr.nexthop.s_addr = 0;
 #ifdef HAVE_IPV6  
   if (attr.extra)    if (attr.extra)
     memset (&attr.extra->mp_nexthop_global, 0, sizeof (struct in6_addr));      memset (&attr.extra->mp_nexthop_global, 0, sizeof (struct in6_addr));
 #endif /* HAVE_IPV6 */  
   
   /* TODO: should we set ATOMIC_AGGREGATE and AGGREGATOR? */    /* TODO: should we set ATOMIC_AGGREGATE and AGGREGATOR? */
   

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>