summaryrefslogtreecommitdiffstats
path: root/staticd
diff options
context:
space:
mode:
authoranlan_cs <anlan_cs@tom.com>2021-07-08 11:57:37 +0200
committeranlan_cs <anlan_cs@tom.com>2021-07-10 01:42:45 +0200
commit7ea5c53477164104121550365557afac84df03bd (patch)
tree111323483d121ba2efa1e28d03bc334324184f4d /staticd
parentMerge pull request #8919 from mobash-rasool/ospfv3-fixes (diff)
downloadfrr-7ea5c53477164104121550365557afac84df03bd.tar.xz
frr-7ea5c53477164104121550365557afac84df03bd.zip
staticd: fix late initialization of blackhole type
If a static route is added to a not-yet-existing VRF, the blackhole type is not initialized. Initialization must be done before the VRF existence check. Signed-off-by: anlan_cs <anlan_cs@tom.com>
Diffstat (limited to 'staticd')
-rw-r--r--staticd/static_routes.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/staticd/static_routes.c b/staticd/static_routes.c
index cdafc4a76..58a29ad25 100644
--- a/staticd/static_routes.c
+++ b/staticd/static_routes.c
@@ -278,6 +278,9 @@ static_add_nexthop(struct route_node *rn, struct static_path *pn, safi_t safi,
nh->type = type;
nh->color = color;
+ if (nh->type == STATIC_BLACKHOLE)
+ nh->bh_type = STATIC_BLACKHOLE_NULL;
+
nh->nh_vrf_id = nh_svrf ? nh_svrf->vrf->vrf_id : VRF_UNKNOWN;
strlcpy(nh->nh_vrfname, nh_vrf, sizeof(nh->nh_vrfname));
@@ -325,6 +328,7 @@ static_add_nexthop(struct route_node *rn, struct static_path *pn, safi_t safi,
switch (nh->type) {
case STATIC_IPV4_GATEWAY:
case STATIC_IPV6_GATEWAY:
+ case STATIC_BLACKHOLE:
break;
case STATIC_IPV4_GATEWAY_IFNAME:
case STATIC_IPV6_GATEWAY_IFNAME:
@@ -337,9 +341,6 @@ static_add_nexthop(struct route_node *rn, struct static_path *pn, safi_t safi,
ifname);
break;
- case STATIC_BLACKHOLE:
- nh->bh_type = STATIC_BLACKHOLE_NULL;
- break;
case STATIC_IFNAME:
ifp = if_lookup_by_name(ifname, nh->nh_vrf_id);
if (ifp && ifp->ifindex != IFINDEX_INTERNAL) {