]> git.puffer.fish Git - mirror/frr.git/commitdiff
* zebra_rib.c, rib.h: Add distance and metric arguments to the
authorhasso <hasso>
Sat, 27 Aug 2005 06:05:47 +0000 (06:05 +0000)
committerhasso <hasso>
Sat, 27 Aug 2005 06:05:47 +0000 (06:05 +0000)
  rib_add_ipv6() function so that IPv6 routes in RIB can have correct
  metric. No IPv6 routing daemon uses distance yet though.
* zserv.c, connected.c, kernel_socket.c, rt_netlink.c,
  rtread_proc.c,zserv.c: Pass metric and distance info to the
  rib_add_ipv6().

Forwardport from stable branch.

zebra/ChangeLog
zebra/connected.c
zebra/kernel_socket.c
zebra/rib.h
zebra/rt_netlink.c
zebra/rtread_proc.c
zebra/zebra_rib.c
zebra/zserv.c

index 3e9629f53c6b99bee74eea198e26e7d9af2ef418..61b8b41ab393ed81d494ea823bbd2fc9bde399be 100644 (file)
@@ -1,3 +1,12 @@
+2005-08-27 Hasso Tepper <hasso at quagga.net>
+
+       * zebra_rib.c, rib.h: Add distance and metric arguments to the
+         rib_add_ipv6() function so that IPv6 routes in RIB can have correct
+         metric. No IPv6 routing daemon uses distance yet though.
+       * zserv.c, connected.c, kernel_socket.c, rt_netlink.c,
+         rtread_proc.c,zserv.c: Pass metric and distance info to the
+         rib_add_ipv6().
+
 2005-07-29 Paul Jakma <paul.jakma@sun.com>
 
        * interface.c: (if_delete_update) should always be available, not
index 46d2aab9271d0a1329a48279401d05aa300c0511..6826908884935a430c49317f6fcfbfbec9a21011 100644 (file)
@@ -308,7 +308,7 @@ connected_up_ipv6 (struct interface *ifp, struct connected *ifc)
     return;
 #endif
 
-  rib_add_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0);
+  rib_add_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, 0, 0);
 
   rib_update ();
 }
index b2985c9d91efd4280660b255c7d6cc6227f48ee0..fe7411eed1e3269fda3c5fe7cca954ffccb1be77 100644 (file)
@@ -654,7 +654,7 @@ rtm_read (struct rt_msghdr *rtm)
 
       if (rtm->rtm_type == RTM_GET || rtm->rtm_type == RTM_ADD)
        rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, zebra_flags,
-                     &p, &gate.sin6.sin6_addr, ifindex, 0);
+                     &p, &gate.sin6.sin6_addr, ifindex, 0, 0, 0);
       else
        rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, zebra_flags,
                         &p, &gate.sin6.sin6_addr, ifindex, 0);
index dbd2a6b15a48832949cef63b3caee1ad957ec50d..12ed8b7c573f3f898c1f5083a1f78991f57735dc 100644 (file)
@@ -244,7 +244,8 @@ static_delete_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname,
 #ifdef HAVE_IPV6
 extern int
 rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
-             struct in6_addr *gate, unsigned int ifindex, u_int32_t vrf_id);
+             struct in6_addr *gate, unsigned int ifindex, u_int32_t vrf_id,
+             u_int32_t metric, u_char distance);
 
 extern int
 rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p,
index 3f22a6cc03e33ac7dda439becf2940fdcf08096e..62d166b29dd993ab14cd49e8608812bf4ec97eb8 100644 (file)
@@ -793,7 +793,8 @@ netlink_routing_table (struct sockaddr_nl *snl, struct nlmsghdr *h)
       memcpy (&p.prefix, dest, 16);
       p.prefixlen = rtm->rtm_dst_len;
 
-      rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, flags, &p, gate, index, table);
+      rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, flags, &p, gate, index, table,
+                   metric, 0);
     }
 #endif /* HAVE_IPV6 */
 
@@ -943,7 +944,7 @@ netlink_route_change (struct sockaddr_nl *snl, struct nlmsghdr *h)
         }
 
       if (h->nlmsg_type == RTM_NEWROUTE)
-        rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, 0);
+        rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, 0, 0, 0);
       else
         rib_delete_ipv6 (ZEBRA_ROUTE_KERNEL, 0, &p, gate, index, 0);
     }
index ab3891a315f940163b54094670e8d5cfb18dcd68..93ec238fffd012eaa17cac16f33e2b8abe38cb9e 100644 (file)
@@ -156,7 +156,8 @@ proc_ipv6_route_read ()
       str2in6_addr (gate, &gateway);
       p.prefixlen = dest_plen;
 
-      rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, zebra_flags, &p, &gateway, 0, 0);
+      rib_add_ipv6 (ZEBRA_ROUTE_KERNEL, zebra_flags, &p, &gateway, 0, 0,
+                   metric, 0);
     }
 
   fclose (fp);
index da6a3a8eadb0e9d727bb5b8d503c3f6d3b96ba39..6d947c85ab46e58f875547283dc5743253f7931a 100644 (file)
@@ -1748,7 +1748,8 @@ rib_bogus_ipv6 (int type, struct prefix_ipv6 *p,
 
 int
 rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
-             struct in6_addr *gate, unsigned int ifindex, u_int32_t vrf_id)
+             struct in6_addr *gate, unsigned int ifindex, u_int32_t vrf_id,
+             u_int32_t metric, u_char distance)
 {
   struct rib *rib;
   struct rib *same = NULL;
@@ -1756,9 +1757,6 @@ rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
   struct route_node *rn;
   struct nexthop *nexthop;
 
-  int distance;
-  u_int32_t metric = 0;
-
   /* Lookup table.  */
   table = vrf_table (AFI_IP6, SAFI_UNICAST, 0);
   if (! table)
@@ -1768,7 +1766,8 @@ rib_add_ipv6 (int type, int flags, struct prefix_ipv6 *p,
   apply_mask_ipv6 (p);
 
   /* Set default distance by route type. */
-  distance = route_info[type].distance;
+  if (!distance)
+    distance = route_info[type].distance;
   
   if (type == ZEBRA_ROUTE_BGP && CHECK_FLAG (flags, ZEBRA_FLAG_IBGP))
     distance = 200;
index eb126feb1538f448ad8ab5dfe9085b53e49c9309..872ddb85ee3f54540db968d263871d4019fecf1c 100644 (file)
@@ -999,9 +999,11 @@ zread_ipv6_add (struct zserv *client, u_short length)
     api.metric = 0;
     
   if (IN6_IS_ADDR_UNSPECIFIED (&nexthop))
-    rib_add_ipv6 (api.type, api.flags, &p, NULL, ifindex, 0);
+    rib_add_ipv6 (api.type, api.flags, &p, NULL, ifindex, 0, api.metric,
+                 api.distance);
   else
-    rib_add_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, 0);
+    rib_add_ipv6 (api.type, api.flags, &p, &nexthop, ifindex, 0, api.metric,
+                 api.distance);
   return 0;
 }