summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_top.c
diff options
context:
space:
mode:
authoranlan_cs <anlan_cs@tom.com>2022-01-11 04:21:05 -0500
committeranlan_cs <anlan_cs@tom.com>2022-01-11 04:21:05 -0500
commitd6b901ac78f164a5239c7694076968456bd163d4 (patch)
tree0fbaa60bae41c0c4bc9529784bf5ee12b1dfd7fd /ospf6d/ospf6_top.c
parentc274b697ee856a67cd225d5ae05195063a991047 (diff)
ospf6d: give error information for commands with non-exist vrfs
Currently the ospf6d's commands with non-exist vrfs can't give the error informations to users. This commit adds a macro "OSPF6_CMD_CHECK_VRF" to give error information if with non-exist vrfs. As usual, skip the checking process in the case of json. So one command can call this macro to do the checking process in its end. At that time it need know json style or not, so add "json" parameter for several related functions. BTW, suppress the build warning of the macro `OSPF6_FIND_VRF_ARGS`: "Macros starting with if should be enclosed by a do - while loop to avoid possible if/else logic defects." Signed-off-by: anlan_cs <anlan_cs@tom.com>
Diffstat (limited to 'ospf6d/ospf6_top.c')
-rw-r--r--ospf6d/ospf6_top.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 6bff52fc56..5fcfc7e701 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -1536,6 +1536,8 @@ DEFUN(show_ipv6_ospf6, show_ipv6_ospf6_cmd,
if (uj)
json_object_free(json);
+ OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6);
+
return CMD_SUCCESS;
}
@@ -1574,6 +1576,8 @@ DEFUN(show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd,
}
}
+ OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6);
+
return CMD_SUCCESS;
}
@@ -1607,6 +1611,8 @@ DEFUN(show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd,
}
}
+ OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6);
+
return CMD_SUCCESS;
}
@@ -1641,6 +1647,8 @@ DEFUN(show_ipv6_ospf6_route_match_detail,
}
}
+ OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6);
+
return CMD_SUCCESS;
}
@@ -1676,6 +1684,8 @@ DEFUN(show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd,
}
}
+ OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6);
+
return CMD_SUCCESS;
}
@@ -2091,6 +2101,8 @@ DEFPY (show_ipv6_ospf6_external_aggregator,
vty_json(vty, json);
}
+ OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6);
+
return CMD_SUCCESS;
}