mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 16:04:49 +00:00
zebra: Fix nhg ifindex setting and checking
We were only setting and checking the ifindex if the nexthop had an *_IFINDEX type. However, when nexthop active checking is done, the non-*_IFINDEX types can also obtain a nexthop with an ifindex and are thus valid too. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
This commit is contained in:
parent
e22e80010e
commit
a6e6a6d825
@ -1962,10 +1962,12 @@ static int netlink_nexthop(int cmd, struct zebra_dplane_ctx *ctx)
|
|||||||
req.nhm.nh_family = AF_INET6;
|
req.nhm.nh_family = AF_INET6;
|
||||||
|
|
||||||
switch (nh->type) {
|
switch (nh->type) {
|
||||||
|
case NEXTHOP_TYPE_IPV4:
|
||||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
||||||
addattr_l(&req.n, sizeof(req), NHA_GATEWAY,
|
addattr_l(&req.n, sizeof(req), NHA_GATEWAY,
|
||||||
&nh->gate.ipv4, IPV4_MAX_BYTELEN);
|
&nh->gate.ipv4, IPV4_MAX_BYTELEN);
|
||||||
break;
|
break;
|
||||||
|
case NEXTHOP_TYPE_IPV6:
|
||||||
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
||||||
addattr_l(&req.n, sizeof(req), NHA_GATEWAY,
|
addattr_l(&req.n, sizeof(req), NHA_GATEWAY,
|
||||||
&nh->gate.ipv6, IPV6_MAX_BYTELEN);
|
&nh->gate.ipv6, IPV6_MAX_BYTELEN);
|
||||||
@ -1978,13 +1980,13 @@ static int netlink_nexthop(int cmd, struct zebra_dplane_ctx *ctx)
|
|||||||
case NEXTHOP_TYPE_IFINDEX:
|
case NEXTHOP_TYPE_IFINDEX:
|
||||||
/* Don't need anymore info for this */
|
/* Don't need anymore info for this */
|
||||||
break;
|
break;
|
||||||
case NEXTHOP_TYPE_IPV4:
|
}
|
||||||
case NEXTHOP_TYPE_IPV6:
|
|
||||||
|
if (!nh->ifindex) {
|
||||||
flog_err(
|
flog_err(
|
||||||
EC_ZEBRA_NHG_FIB_UPDATE,
|
EC_ZEBRA_NHG_FIB_UPDATE,
|
||||||
"Context received for kernel nexthop update without an interface");
|
"Context received for kernel nexthop update without an interface");
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addattr32(&req.n, sizeof(req), NHA_OIF, nh->ifindex);
|
addattr32(&req.n, sizeof(req), NHA_OIF, nh->ifindex);
|
||||||
|
@ -312,22 +312,13 @@ static void *zebra_nhg_alloc(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add the ifp now if its not a group or recursive and has ifindex */
|
/* Add the ifp now if its not a group or recursive and has ifindex */
|
||||||
if (zebra_nhg_depends_is_empty(nhe) && nhe->nhg->nexthop) {
|
if (zebra_nhg_depends_is_empty(nhe) && nhe->nhg->nexthop
|
||||||
|
&& nhe->nhg->nexthop->ifindex) {
|
||||||
struct interface *ifp = NULL;
|
struct interface *ifp = NULL;
|
||||||
|
|
||||||
switch (nhe->nhg->nexthop->type) {
|
ifp = if_lookup_by_index(nhe->nhg->nexthop->ifindex,
|
||||||
case NEXTHOP_TYPE_IPV4_IFINDEX:
|
nhe->vrf_id);
|
||||||
case NEXTHOP_TYPE_IPV6_IFINDEX:
|
zebra_nhg_set_if(nhe, ifp);
|
||||||
case NEXTHOP_TYPE_IFINDEX:
|
|
||||||
ifp = if_lookup_by_index(nhe->nhg->nexthop->ifindex,
|
|
||||||
nhe->vrf_id);
|
|
||||||
zebra_nhg_set_if(nhe, ifp);
|
|
||||||
break;
|
|
||||||
case NEXTHOP_TYPE_BLACKHOLE:
|
|
||||||
case NEXTHOP_TYPE_IPV4:
|
|
||||||
case NEXTHOP_TYPE_IPV6:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add to id table as well */
|
/* Add to id table as well */
|
||||||
|
Loading…
Reference in New Issue
Block a user