/* Same logic as for connected_up_ipv4(): push the changes into the
* head. */
rib_delete(AFI_IP, SAFI_UNICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0,
- &p, NULL, NULL, ifp->ifindex, 0);
+ &p, NULL, NULL, ifp->ifindex, 0, 0);
rib_delete(AFI_IP, SAFI_MULTICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0,
- 0, &p, NULL, NULL, ifp->ifindex, 0);
+ 0, &p, NULL, NULL, ifp->ifindex, 0, 0);
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
return;
rib_delete(AFI_IP6, SAFI_UNICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0,
- 0, &p, NULL, NULL, ifp->ifindex, 0);
+ 0, &p, NULL, NULL, ifp->ifindex, 0, 0);
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
if (rtm->rtm_type == RTM_CHANGE)
rib_delete(AFI_IP, SAFI_UNICAST, VRF_DEFAULT,
ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
- NULL, 0, 0);
+ NULL, 0, 0, 0);
union g_addr ggate = {.ipv4 = gate.sin.sin_addr};
if (rtm->rtm_type == RTM_GET || rtm->rtm_type == RTM_ADD
else
rib_delete(AFI_IP, SAFI_UNICAST, VRF_DEFAULT,
ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
- &ggate, 0, 0);
+ &ggate, 0, 0, 0);
}
if (dest.sa.sa_family == AF_INET6) {
/* One day we might have a debug section here like one in the
if (rtm->rtm_type == RTM_CHANGE)
rib_delete(AFI_IP6, SAFI_UNICAST, VRF_DEFAULT,
ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
- NULL, 0, 0);
+ NULL, 0, 0, 0);
union g_addr ggate = {.ipv6 = gate.sin6.sin6_addr};
if (rtm->rtm_type == RTM_GET || rtm->rtm_type == RTM_ADD
else
rib_delete(AFI_IP6, SAFI_UNICAST, VRF_DEFAULT,
ZEBRA_ROUTE_KERNEL, 0, zebra_flags, &p, NULL,
- &ggate, ifindex, 0);
+ &ggate, ifindex, 0, 0);
}
}
rib_delete(AFI_IP, SAFI_UNICAST, re->vrf_id, ZEBRA_ROUTE_TABLE,
re->table, re->flags, &p, NULL, NULL, 0,
- zebrad.rtm_table_default);
+ zebrad.rtm_table_default, re->metric);
}
/* DD: Add IPv6 code */
u_short instance, int flags, struct prefix *p,
struct prefix_ipv6 *src_p, union g_addr *gate,
union g_addr *src, ifindex_t ifindex, u_int32_t table_id,
- u_int32_t, u_int32_t, u_char);
+ u_int32_t metric, u_int32_t mtu, u_char distance);
extern int rib_add_multipath(afi_t afi, safi_t safi, struct prefix *,
struct prefix_ipv6 *src_p, struct route_entry *);
extern void rib_delete(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, union g_addr *gate,
- ifindex_t ifindex, u_int32_t table_id);
+ ifindex_t ifindex, u_int32_t table_id,
+ u_int32_t metric);
extern struct route_entry *rib_match(afi_t afi, safi_t safi, vrf_id_t,
union g_addr *,
if (tb[RTA_GATEWAY])
gate = RTA_DATA(tb[RTA_GATEWAY]);
- if (h->nlmsg_type == RTM_NEWROUTE) {
- if (tb[RTA_PRIORITY])
- metric = *(int *)RTA_DATA(tb[RTA_PRIORITY]);
+ if (tb[RTA_PRIORITY])
+ metric = *(int *)RTA_DATA(tb[RTA_PRIORITY]);
- if (tb[RTA_METRICS]) {
- struct rtattr *mxrta[RTAX_MAX + 1];
+ if (tb[RTA_METRICS]) {
+ struct rtattr *mxrta[RTAX_MAX + 1];
- memset(mxrta, 0, sizeof mxrta);
- netlink_parse_rtattr(mxrta, RTAX_MAX,
- RTA_DATA(tb[RTA_METRICS]),
- RTA_PAYLOAD(tb[RTA_METRICS]));
+ memset(mxrta, 0, sizeof mxrta);
+ netlink_parse_rtattr(mxrta, RTAX_MAX,
+ RTA_DATA(tb[RTA_METRICS]),
+ RTA_PAYLOAD(tb[RTA_METRICS]));
- if (mxrta[RTAX_MTU])
- mtu = *(u_int32_t *)RTA_DATA(mxrta[RTAX_MTU]);
- }
+ if (mxrta[RTAX_MTU])
+ mtu = *(u_int32_t *)RTA_DATA(mxrta[RTAX_MTU]);
}
if (rtm->rtm_family == AF_INET) {
if (!tb[RTA_MULTIPATH])
rib_delete(afi, SAFI_UNICAST, vrf_id,
ZEBRA_ROUTE_KERNEL, 0, flags, &p, NULL, gate,
- index, table);
+ index, table, metric);
else {
struct rtnexthop *rtnh =
(struct rtnexthop *)RTA_DATA(tb[RTA_MULTIPATH]);
rib_delete(afi, SAFI_UNICAST, vrf_id,
ZEBRA_ROUTE_KERNEL, 0, flags,
&p, NULL, gate, index,
- table);
+ table, metric);
len -= NLMSG_ALIGN(rtnh->rtnh_len);
rtnh = RTNH_NEXT(rtnh);
void rib_delete(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, union g_addr *gate,
- ifindex_t ifindex, u_int32_t table_id)
+ ifindex_t ifindex, u_int32_t table_id,
+ u_int32_t metric)
{
struct route_table *table;
struct route_node *rn;
continue;
if (re->instance != instance)
continue;
+ if (re->type == ZEBRA_ROUTE_KERNEL &&
+ re->metric != metric)
+ continue;
if (re->type == ZEBRA_ROUTE_CONNECT && (nexthop = re->nexthop)
&& nexthop->type == NEXTHOP_TYPE_IFINDEX) {
if (nexthop->ifindex != ifindex)
continue;
if (re->instance != instance)
continue;
+ if (re->type == ZEBRA_ROUTE_KERNEL &&
+ re->metric != metric)
+ continue;
if (!RIB_SYSTEM_ROUTE(re)) {
same = re;
break;
table_id = zvrf->table_id;
rib_delete(AFI_IP, api.safi, zvrf_id(zvrf), api.type, api.instance,
- api.flags, &p, NULL, nexthop_p, ifindex, table_id);
+ api.flags, &p, NULL, nexthop_p, ifindex, table_id,
+ api.metric);
client->v4_route_del_cnt++;
return 0;
}
if (IN6_IS_ADDR_UNSPECIFIED(&nexthop))
rib_delete(AFI_IP6, api.safi, zvrf_id(zvrf), api.type,
api.instance, api.flags, &p, src_pp, NULL, ifindex,
- client->rtm_table);
+ client->rtm_table, api.metric);
else
rib_delete(AFI_IP6, api.safi, zvrf_id(zvrf), api.type,
api.instance, api.flags, &p, src_pp, pnexthop,
- ifindex, client->rtm_table);
+ ifindex, client->rtm_table, api.metric);
client->v6_route_del_cnt++;
return 0;