]> git.puffer.fish Git - mirror/frr.git/commitdiff
staticd: fix nexthops without interface
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 31 Jan 2024 12:10:09 +0000 (14:10 +0200)
committerIgor Ryzhov <iryzhov@nfware.com>
Thu, 1 Feb 2024 22:25:15 +0000 (00:25 +0200)
When interface is not set in "ip route" command, CLI passes "(null)" as
an interface name instead of an empty string. The actual code in turn
uses "nh->ifname[0] != 0" to check if the interface name was set. Fix
the problem by changing the "(null)" string into an empty string when
populating the nexthop structure.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
staticd/static_nb_config.c

index 78378371b0a1f8bd822006dea94a0bb1f25f1bf9..d7605cb34775ffb7a3a66fb90492a86ce9e8e7a7 100644 (file)
@@ -176,6 +176,9 @@ static bool static_nexthop_create(struct nb_cb_create_args *args)
                nh_vrf = yang_dnode_get_string(args->dnode, "vrf");
                pn = nb_running_get_entry(args->dnode, NULL, true);
 
+               if (strmatch(ifname, "(null)"))
+                       ifname = "";
+
                if (!static_add_nexthop_validate(nh_vrf, nh_type, &ipaddr))
                        flog_warn(
                                EC_LIB_NB_CB_CONFIG_VALIDATE,