summaryrefslogtreecommitdiff
path: root/staticd/static_nb_config.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-30 22:51:46 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-02-02 00:25:15 +0200
commitd205208f57855a219e9c72b8a24976af3eb34bcd (patch)
tree8c9197af322ce362db4de0f1985d0b50619692f6 /staticd/static_nb_config.c
parent9d8fd14b56a7c0a35d761c323084083b957ecb86 (diff)
Revert "staticd: Accept full blackhole typed keywords for ip_route_cmd"
This reverts commit 76b2bc97e73874d882d5cf021972cfca84656cef. This change is wrong for several reasons: - it is backwards incompatible - previously it was always possible to create blackhole/reject routes using shortened versions of the words and it suddenly became impossible if there's an interface in the system with the same name - it uses operational data for validation which is prohibited - it doesn't really solve the problem with inability to create routes using interface names like `bla` or `rej`
Diffstat (limited to 'staticd/static_nb_config.c')
-rw-r--r--staticd/static_nb_config.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/staticd/static_nb_config.c b/staticd/static_nb_config.c
index 2fee908d5d..78378371b0 100644
--- a/staticd/static_nb_config.c
+++ b/staticd/static_nb_config.c
@@ -136,8 +136,7 @@ static bool static_nexthop_create(struct nb_cb_create_args *args)
switch (args->event) {
case NB_EV_VALIDATE:
ifname = yang_dnode_get_string(args->dnode, "interface");
- nh_type = yang_dnode_get_enum(args->dnode, "nh-type");
- if (ifname != NULL && nh_type != STATIC_BLACKHOLE) {
+ if (ifname != NULL) {
if (strcasecmp(ifname, "Null0") == 0
|| strcasecmp(ifname, "reject") == 0
|| strcasecmp(ifname, "blackhole") == 0) {
@@ -465,33 +464,10 @@ static int static_nexthop_bh_type_modify(struct nb_cb_modify_args *args)
{
struct static_nexthop *nh;
enum static_nh_type nh_type;
- const char *nh_ifname;
- const char *nh_vrf;
switch (args->event) {
case NB_EV_VALIDATE:
nh_type = yang_dnode_get_enum(args->dnode, "../nh-type");
- nh_ifname = yang_dnode_get_string(args->dnode, "../interface");
- nh_vrf = yang_dnode_get_string(args->dnode, "../vrf");
- if (nh_ifname && nh_vrf) {
- struct vrf *vrf = vrf_lookup_by_name(nh_vrf);
-
- if (!vrf) {
- snprintf(args->errmsg, args->errmsg_len,
- "nexthop vrf %s not found", nh_vrf);
- return NB_ERR_VALIDATION;
- }
-
- struct interface *ifp = if_lookup_by_name(nh_ifname,
- vrf->vrf_id);
-
- if (ifp && (!strmatch(nh_ifname, "blackhole") ||
- !strmatch(nh_ifname, "reject"))) {
- snprintf(args->errmsg, args->errmsg_len,
- "nexthop interface name must be (reject, blackhole)");
- return NB_ERR_VALIDATION;
- }
- }
if (nh_type != STATIC_BLACKHOLE) {
snprintf(args->errmsg, args->errmsg_len,
"nexthop type is not the blackhole type");