summaryrefslogtreecommitdiff
path: root/staticd/static_vty.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_vty.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_vty.c')
-rw-r--r--staticd/static_vty.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/staticd/static_vty.c b/staticd/static_vty.c
index 05f23f54d1..a18028ed08 100644
--- a/staticd/static_vty.c
+++ b/staticd/static_vty.c
@@ -60,8 +60,6 @@ struct static_route_args {
bool bfd_multi_hop;
const char *bfd_source;
const char *bfd_profile;
-
- const char *input;
};
static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
@@ -153,20 +151,9 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
else
buf_gate_str = "";
- if (args->gateway == NULL && args->interface_name == NULL) {
+ if (args->gateway == NULL && args->interface_name == NULL)
type = STATIC_BLACKHOLE;
- /* If this is blackhole/reject flagged route, then
- * specify interface_name with the value of what was really
- * entered.
- * interface_name will be validated later in NB functions
- * to check if we don't create blackhole/reject routes that
- * match the real interface names.
- * E.g.: `ip route 10.0.0.1/32 bla` will create a blackhole
- * route despite the real interface named `bla` exists.
- */
- if (args->input)
- args->interface_name = args->input;
- } else if (args->gateway && args->interface_name) {
+ else if (args->gateway && args->interface_name) {
if (args->afi == AFI_IP)
type = STATIC_IPV4_GATEWAY_IFNAME;
else
@@ -553,8 +540,6 @@ DEFPY_YANG(ip_route_blackhole,
"Table to configure\n"
"The table number to configure\n")
{
- int idx_flag = 0;
-
struct static_route_args args = {
.delete = !!no,
.afi = AFI_IP,
@@ -569,9 +554,6 @@ DEFPY_YANG(ip_route_blackhole,
.vrf = vrf,
};
- if (flag && argv_find(argv, argc, flag, &idx_flag))
- args.input = argv[idx_flag]->arg;
-
return static_route_nb_run(vty, &args);
}
@@ -600,8 +582,6 @@ DEFPY_YANG(ip_route_blackhole_vrf,
"Table to configure\n"
"The table number to configure\n")
{
- int idx_flag = 0;
-
struct static_route_args args = {
.delete = !!no,
.afi = AFI_IP,
@@ -623,9 +603,6 @@ DEFPY_YANG(ip_route_blackhole_vrf,
*/
assert(args.prefix);
- if (flag && argv_find(argv, argc, flag, &idx_flag))
- args.input = argv[idx_flag]->arg;
-
return static_route_nb_run(vty, &args);
}
@@ -916,8 +893,6 @@ DEFPY_YANG(ipv6_route_blackhole,
"Table to configure\n"
"The table number to configure\n")
{
- int idx_flag = 0;
-
struct static_route_args args = {
.delete = !!no,
.afi = AFI_IP6,
@@ -932,9 +907,6 @@ DEFPY_YANG(ipv6_route_blackhole,
.vrf = vrf,
};
- if (flag && argv_find(argv, argc, flag, &idx_flag))
- args.input = argv[idx_flag]->arg;
-
return static_route_nb_run(vty, &args);
}
@@ -963,8 +935,6 @@ DEFPY_YANG(ipv6_route_blackhole_vrf,
"Table to configure\n"
"The table number to configure\n")
{
- int idx_flag = 0;
-
struct static_route_args args = {
.delete = !!no,
.afi = AFI_IP6,
@@ -986,9 +956,6 @@ DEFPY_YANG(ipv6_route_blackhole_vrf,
*/
assert(args.prefix);
- if (flag && argv_find(argv, argc, flag, &idx_flag))
- args.input = argv[idx_flag]->arg;
-
return static_route_nb_run(vty, &args);
}