]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #1237 from donaldsharp/distance_special
authorRenato Westphal <renato@openbsd.org>
Mon, 9 Oct 2017 23:11:39 +0000 (20:11 -0300)
committerGitHub <noreply@github.com>
Mon, 9 Oct 2017 23:11:39 +0000 (20:11 -0300)
zebra: Modify metric read to be admin distance and metric

1  2 
zebra/rib.h
zebra/rt_netlink.c
zebra/zebra_rib.c

diff --cc zebra/rib.h
Simple merge
Simple merge
index 5c3ec10a79fc961c7cd3bdbc1758c972d0687e84,0279c321a0b99a3d578b9d8085e398ba08f586f3..1a9bd5a58e0c50ed5a8e1cf39c52d43411381e9f
@@@ -2463,13 -2434,73 +2463,13 @@@ void rib_delete(afi_t afi, safi_t safi
  int rib_add(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, u_short instance,
            int flags, struct prefix *p, struct prefix_ipv6 *src_p,
            const struct nexthop *nh, u_int32_t table_id, u_int32_t metric,
-           u_int32_t mtu, u_char distance)
+           u_int32_t mtu, uint8_t distance)
  {
        struct route_entry *re;
 -      struct route_entry *same = NULL;
 -      struct route_table *table;
 -      struct route_node *rn;
 -      struct nexthop *rtnh;
 -
 -      assert(!src_p || afi == AFI_IP6);
 -
 -      /* Lookup table.  */
 -      table = zebra_vrf_table_with_table_id(afi, safi, vrf_id, table_id);
 -      if (!table)
 -              return 0;
 -
 -      /* Make sure mask is applied. */
 -      apply_mask(p);
 -      if (src_p)
 -              apply_mask_ipv6(src_p);
 -
 -      /* Set default distance by route type. */
 -      if (distance == 0) {
 -              distance = route_distance(type);
 -
 -              /* iBGP distance is 200. */
 -              if (type == ZEBRA_ROUTE_BGP
 -                  && CHECK_FLAG(flags, ZEBRA_FLAG_IBGP))
 -                      distance = 200;
 -      }
 -
 -      /* Lookup route node.*/
 -      rn = srcdest_rnode_get(table, p, src_p);
 -
 -      /* If same type of route are installed, treat it as a implicit
 -         withdraw. */
 -      RNODE_FOREACH_RE (rn, re) {
 -              if (CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED))
 -                      continue;
 -
 -              if (re->type != type)
 -                      continue;
 -              if (re->instance != instance)
 -                      continue;
 -              if (re->type == ZEBRA_ROUTE_KERNEL &&
 -                  re->metric != metric)
 -                      continue;
 -              if (!RIB_SYSTEM_ROUTE(re)) {
 -                      same = re;
 -                      break;
 -              }
 -              /* Duplicate system route comes in. */
 -              rtnh = re->nexthop;
 -              if (nexthop_same_no_recurse(rtnh, nh))
 -                      return 0;
 -              /*
 -               * Nexthop is different. Remove the old route unless it's
 -               * a connected route. This exception is necessary because
 -               * of IPv6 link-local routes and unnumbered interfaces on
 -               * Linux.
 -               */
 -              else if (type != ZEBRA_ROUTE_CONNECT)
 -                      same = re;
 -      }
 +      struct nexthop *nexthop;
  
 -      /* Allocate new re structure. */
 +      /* Allocate new route_entry structure. */
        re = XCALLOC(MTYPE_RE, sizeof(struct route_entry));
 -
        re->type = type;
        re->instance = instance;
        re->distance = distance;