diff options
author | hasso <hasso> | 2005-08-27 06:05:47 +0000 |
---|---|---|
committer | hasso <hasso> | 2005-08-27 06:05:47 +0000 |
commit | be61c4eb59b8df1aab496176d87bb2e1763f185e (patch) | |
tree | 063e8baa7cd4a863e72d246d7c14f14842cbb604 | |
parent | b7395791a31f7b734094d032998ab632136f36f1 (diff) |
* 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().
Forwardport from stable branch.
-rw-r--r-- | zebra/ChangeLog | 9 | ||||
-rw-r--r-- | zebra/connected.c | 2 | ||||
-rw-r--r-- | zebra/kernel_socket.c | 2 | ||||
-rw-r--r-- | zebra/rib.h | 3 | ||||
-rw-r--r-- | zebra/rt_netlink.c | 5 | ||||
-rw-r--r-- | zebra/rtread_proc.c | 3 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 9 | ||||
-rw-r--r-- | zebra/zserv.c | 6 |
8 files changed, 26 insertions, 13 deletions
diff --git a/zebra/ChangeLog b/zebra/ChangeLog index 3e9629f5..61b8b41a 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -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 diff --git a/zebra/connected.c b/zebra/connected.c index 46d2aab9..68269088 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -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 (); } diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index b2985c9d..fe7411ee 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -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); diff --git a/zebra/rib.h b/zebra/rib.h index dbd2a6b1..12ed8b7c 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -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, diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 3f22a6cc..62d166b2 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -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); } diff --git a/zebra/rtread_proc.c b/zebra/rtread_proc.c index ab3891a3..93ec238f 100644 --- a/zebra/rtread_proc.c +++ b/zebra/rtread_proc.c @@ -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); diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index da6a3a8e..6d947c85 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -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; diff --git a/zebra/zserv.c b/zebra/zserv.c index eb126feb..872ddb85 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -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; } |