+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
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 ();
}
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);
#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,
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 */
}
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);
}
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);
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;
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)
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;
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;
}