struct static_route *cp;
struct static_route *update = NULL;
struct route_table *stable = svrf->stable[afi][safi];
+ struct interface *ifp;
if (!stable)
return -1;
&& IPV4_ADDR_SAME(&gate->ipv4, &si->addr.ipv4))
|| (afi == AFI_IP6
&& IPV6_ADDR_SAME(gate, &si->addr.ipv6))))
- && (!strcmp(ifname ? ifname : "", si->ifname))) {
+ && (!strcmp(ifname ? ifname : "", si->ifname))
+ && nh_svrf->vrf->vrf_id == si->nh_vrf_id) {
if ((distance == si->distance) && (tag == si->tag)
&& (table_id == si->table_id)
&& !memcmp(&si->snh_label, snh_label,
si->next = cp;
/* check whether interface exists in system & install if it does */
- if (!ifname)
+ switch (si->type) {
+ case STATIC_IPV4_GATEWAY:
+ case STATIC_IPV6_GATEWAY:
static_zebra_nht_register(rn, si, true);
- else {
- struct interface *ifp;
+ break;
+ case STATIC_IPV4_GATEWAY_IFNAME:
+ case STATIC_IPV6_GATEWAY_IFNAME:
+ ifp = if_lookup_by_name(ifname, nh_svrf->vrf->vrf_id);
+ if (ifp && ifp->ifindex != IFINDEX_INTERNAL)
+ si->ifindex = ifp->ifindex;
+ else
+ zlog_warn("Static Route using %s interface not installed because the interface does not exist in specified vrf",
+ ifname);
+ static_zebra_nht_register(rn, si, true);
+ break;
+ case STATIC_BLACKHOLE:
+ static_install_route(rn, si, safi);
+ break;
+ case STATIC_IFNAME:
ifp = if_lookup_by_name(ifname, nh_svrf->vrf->vrf_id);
if (ifp && ifp->ifindex != IFINDEX_INTERNAL) {
si->ifindex = ifp->ifindex;
} else
zlog_warn("Static Route using %s interface not installed because the interface does not exist in specified vrf",
ifname);
+
+ break;
}
return 1;
if (up) {
if (strcmp(si->ifname, ifp->name))
continue;
+ if (si->nh_vrf_id != ifp->vrf_id)
+ continue;
si->ifindex = ifp->ifindex;
} else {
if (si->ifindex != ifp->ifindex)
continue;
+ if (si->nh_vrf_id != ifp->vrf_id)
+ continue;
si->ifindex = IFINDEX_INTERNAL;
}