summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_static.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_static.c')
-rw-r--r--zebra/zebra_static.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index ae3239516..6cebae997 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -81,6 +81,10 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
+ case STATIC_IPV4_GATEWAY_IFINDEX:
+ nexthop = route_entry_nexthop_ipv4_ifindex_add(
+ re, &si->addr.ipv4, NULL, si->ifindex);
+ break;
case STATIC_IFINDEX:
nexthop = route_entry_nexthop_ifindex_add(re,
si->ifindex);
@@ -152,6 +156,10 @@ void static_install_route(afi_t afi, safi_t safi, struct prefix *p,
nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
+ case STATIC_IPV4_GATEWAY_IFINDEX:
+ nexthop = route_entry_nexthop_ipv4_ifindex_add(
+ re, &si->addr.ipv4, NULL, si->ifindex);
+ break;
case STATIC_IFINDEX:
nexthop = route_entry_nexthop_ifindex_add(re,
si->ifindex);
@@ -216,6 +224,11 @@ static int static_nexthop_same(struct nexthop *nexthop, struct static_route *si)
&& si->type == STATIC_IPV4_GATEWAY
&& IPV4_ADDR_SAME(&nexthop->gate.ipv4, &si->addr.ipv4))
return 1;
+ else if (nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX
+ && si->type == STATIC_IPV4_GATEWAY_IFINDEX
+ && IPV4_ADDR_SAME(&nexthop->gate.ipv4, &si->addr.ipv4)
+ && nexthop->ifindex == si->ifindex)
+ return 1;
else if (nexthop->type == NEXTHOP_TYPE_IFINDEX
&& si->type == STATIC_IFINDEX
&& nexthop->ifindex == si->ifindex)
@@ -361,12 +374,17 @@ int static_add_route(afi_t afi, safi_t safi, u_char type, struct prefix *p,
if (!stable)
return -1;
- if (!gate && (type == STATIC_IPV4_GATEWAY || type == STATIC_IPV6_GATEWAY
- || type == STATIC_IPV6_GATEWAY_IFINDEX))
+ if (!gate
+ && (type == STATIC_IPV4_GATEWAY
+ || type == STATIC_IPV4_GATEWAY_IFINDEX
+ || type == STATIC_IPV6_GATEWAY
+ || type == STATIC_IPV6_GATEWAY_IFINDEX))
return -1;
if (!ifindex
- && (type == STATIC_IFINDEX || type == STATIC_IPV6_GATEWAY_IFINDEX))
+ && (type == STATIC_IFINDEX
+ || type == STATIC_IPV4_GATEWAY_IFINDEX
+ || type == STATIC_IPV6_GATEWAY_IFINDEX))
return -1;
/* Lookup static route prefix. */
@@ -411,11 +429,10 @@ int static_add_route(afi_t afi, safi_t safi, u_char type, struct prefix *p,
switch (type) {
case STATIC_IPV4_GATEWAY:
+ case STATIC_IPV4_GATEWAY_IFINDEX:
si->addr.ipv4 = gate->ipv4;
break;
case STATIC_IPV6_GATEWAY:
- si->addr.ipv6 = gate->ipv6;
- break;
case STATIC_IPV6_GATEWAY_IFINDEX:
si->addr.ipv6 = gate->ipv6;
break;