]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: cleanup useless checks
authorIgor Ryzhov <iryzhov@nfware.com>
Wed, 15 Sep 2021 16:21:47 +0000 (19:21 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 15 Sep 2021 16:21:47 +0000 (19:21 +0300)
om6->ospf6 is always initialized at the start of the execution.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
ospf6d/ospf6_area.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_neighbor.c
ospf6d/ospf6_route.c
ospf6d/ospf6_top.c
ospf6d/ospf6d.c
ospf6d/ospf6d.h

index 71d32b409c260b26bbdda5420a810b6c6f4dc689..7423a1a9e90da57d4dd18d44b39acf4e61f831c4 100644 (file)
@@ -780,10 +780,6 @@ void ospf6_area_plist_update(struct prefix_list *plist, int add)
        const char *name = prefix_list_name(plist);
        struct ospf6 *ospf6 = NULL;
 
-
-       if (!om6->ospf6)
-               return;
-
        for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) {
                for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, n, oa)) {
                        if (PREFIX_NAME_IN(oa)
@@ -988,7 +984,6 @@ DEFUN(show_ipv6_ospf6_spf_tree, show_ipv6_ospf6_spf_tree_cmd,
        int idx_vrf = 0;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
 
        for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
@@ -1048,7 +1043,6 @@ DEFUN(show_ipv6_ospf6_area_spf_tree, show_ipv6_ospf6_area_spf_tree_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_ipv4 += 2;
@@ -1132,7 +1126,6 @@ DEFUN(show_ipv6_ospf6_simulate_spf_tree_root,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_ipv4 += 2;
@@ -1340,8 +1333,6 @@ void ospf6_area_interface_delete(struct ospf6_interface *oi)
        struct listnode *node, *nnode;
        struct ospf6 *ospf6;
 
-       if (!om6->ospf6)
-               return;
        for (ALL_LIST_ELEMENTS(om6->ospf6, node, nnode, ospf6)) {
                for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa))
                        if (listnode_lookup(oa->if_list, oi))
index 90c9fdf23a270748e373a8eef5110b929218b28a..ff651d674b0d3219e1d947e4a64fbf7278280a6c 100644 (file)
@@ -2522,7 +2522,6 @@ DEFUN(show_ipv6_ospf6_redistribute, show_ipv6_ospf6_redistribute_cmd,
        json_object *json_array_routes = NULL;
        json_object *json_array_redistribute = NULL;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
 
        if (uj) {
index b427a0c9bde3ed34cb966487df1e4560e445f407..b63a3c02db3aa92f829b77f9a5294c81034bc5a5 100644 (file)
@@ -1330,7 +1330,6 @@ DEFUN(show_ipv6_ospf6_interface, show_ipv6_ospf6_interface_ifname_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_ifname += 2;
@@ -1547,7 +1546,6 @@ DEFUN(show_ipv6_ospf6_interface_traffic, show_ipv6_ospf6_interface_traffic_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
 
        for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
@@ -1590,7 +1588,6 @@ DEFUN(show_ipv6_ospf6_interface_ifname_prefix,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_ifname += 2;
@@ -1651,7 +1648,6 @@ DEFUN(show_ipv6_ospf6_interface_prefix, show_ipv6_ospf6_interface_prefix_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_prefix += 2;
index 4ea615f32b7f5923bb84ba44bfe5a7dbb3b6b18a..05ef40be4773fd12275f0cbee41b9b37d1487980 100644 (file)
@@ -1081,7 +1081,6 @@ DEFUN(show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd,
        bool detail = false;
        bool drchoice = false;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
 
        if (argv_find(argv, argc, "detail", &idx_type))
@@ -1156,7 +1155,6 @@ DEFUN(show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_ipv4 += 2;
index 5f630828e7b58d7265f237a3b8fd98e394852612..8bfd3b7124df197a74ad8b49ae78d38bbf04df95 100644 (file)
@@ -1120,11 +1120,6 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route,
        json_object *json_array_next_hops = NULL;
        json_object *json_next_hop;
 
-       if (om6->ospf6 == NULL) {
-               vty_out(vty, "OSPFv3 is not running\n");
-               return;
-       }
-
        monotime(&now);
        timersub(&now, &route->changed, &res);
        timerstring(&res, duration, sizeof(duration));
@@ -1208,11 +1203,6 @@ void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route,
        json_object *json_array_next_hops = NULL;
        json_object *json_next_hop;
 
-       if (om6->ospf6 == NULL) {
-               vty_out(vty, "OSPFv3 is not running\n");
-               return;
-       }
-
        monotime(&now);
 
        /* destination */
index 6ff3789a804ac00bf126250c1f8734cb5f6c403b..d07d36c3191c4fdde04f3b0245d3f129c9697b95 100644 (file)
@@ -1519,7 +1519,6 @@ DEFUN(show_ipv6_ospf6, show_ipv6_ospf6_cmd,
        bool uj = use_json(argc, argv);
        json_object *json = NULL;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
 
        for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
@@ -1560,7 +1559,6 @@ DEFUN(show_ipv6_ospf6_route, show_ipv6_ospf6_route_cmd,
        int idx_arg_start = 4;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_arg_start += 2;
@@ -1594,7 +1592,6 @@ DEFUN(show_ipv6_ospf6_route_match, show_ipv6_ospf6_route_match_cmd,
        int idx_start_arg = 4;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_start_arg += 2;
@@ -1629,7 +1626,6 @@ DEFUN(show_ipv6_ospf6_route_match_detail,
        int idx_start_arg = 4;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_start_arg += 2;
@@ -1665,7 +1661,6 @@ DEFUN(show_ipv6_ospf6_route_type_detail, show_ipv6_ospf6_route_type_detail_cmd,
        int idx_start_arg = 4;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_start_arg += 2;
@@ -2078,7 +2073,6 @@ DEFPY (show_ipv6_ospf6_external_aggregator,
        if (uj)
                json = json_object_new_object();
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
 
        for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) {
index 0e8185cfeb81415a9ee48be13b03407e57f68ba7..e85f4c1b61caafaf47e438ff4e09bad8560f3683 100644 (file)
@@ -413,7 +413,6 @@ DEFUN(show_ipv6_ospf6_database, show_ipv6_ospf6_database_cmd,
        int idx_vrf = 0;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_level += 2;
@@ -460,7 +459,6 @@ DEFUN(show_ipv6_ospf6_database_type, show_ipv6_ospf6_database_type_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -505,7 +503,6 @@ DEFUN(show_ipv6_ospf6_database_id, show_ipv6_ospf6_database_id_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (argv[idx_ipv4]->type == IPV4_TKN)
                inet_pton(AF_INET, argv[idx_ipv4]->arg, &id);
@@ -548,7 +545,6 @@ DEFUN(show_ipv6_ospf6_database_router, show_ipv6_ospf6_database_router_cmd,
        int idx_vrf = 0;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_ipv4 += 2;
@@ -619,7 +615,6 @@ DEFUN_HIDDEN(
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_ipv4 += 2;
@@ -672,7 +667,6 @@ DEFUN(show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -731,7 +725,6 @@ DEFUN(show_ipv6_ospf6_database_type_router,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -782,7 +775,6 @@ DEFUN(show_ipv6_ospf6_database_id_router,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_ls_id += 2;
@@ -833,7 +825,6 @@ DEFUN(show_ipv6_ospf6_database_adv_router_linkstate_id,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_adv_rtr += 2;
@@ -891,7 +882,6 @@ DEFUN(show_ipv6_ospf6_database_type_id_router,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -960,7 +950,6 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -1008,7 +997,6 @@ DEFUN(show_ipv6_ospf6_database_self_originated,
        uint32_t adv_router = 0;
        bool uj = use_json(argc, argv);
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_level += 2;
@@ -1063,7 +1051,6 @@ DEFUN(show_ipv6_ospf6_database_type_self_originated,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -1123,7 +1110,6 @@ DEFUN(show_ipv6_ospf6_database_type_self_originated_linkstate_id,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -1185,7 +1171,6 @@ DEFUN(show_ipv6_ospf6_database_type_id_self_originated,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_lsa += 2;
@@ -1268,7 +1253,6 @@ DEFUN(show_ipv6_ospf6_border_routers, show_ipv6_ospf6_border_routers_cmd,
        int idx_vrf = 0;
        int idx_argc = 5;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0) {
                idx_argc += 2;
@@ -1308,7 +1292,6 @@ DEFUN(show_ipv6_ospf6_linkstate, show_ipv6_ospf6_linkstate_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_ipv4 += 2;
@@ -1348,8 +1331,6 @@ DEFUN(show_ipv6_ospf6_linkstate_detail, show_ipv6_ospf6_linkstate_detail_cmd,
        bool all_vrf = false;
        int idx_vrf = 0;
 
-
-       OSPF6_CMD_CHECK_RUNNING();
        OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf);
        if (idx_vrf > 0)
                idx_detail += 2;
index d5170be7cc8a6d28817386ac4c19bd325a767021..041a9b1df98cf82624320a997a954352eb2b3019 100644 (file)
@@ -93,12 +93,6 @@ extern struct thread_master *master;
 #define OSPF6_ROUTER_ID_STR "Specify Router-ID\n"
 #define OSPF6_LS_ID_STR     "Specify Link State ID\n"
 
-#define OSPF6_CMD_CHECK_RUNNING()                                              \
-       if (om6->ospf6 == NULL) {                                              \
-               vty_out(vty, "OSPFv3 is not running\n");                       \
-               return CMD_SUCCESS;                                            \
-       }
-
 #define IS_OSPF6_ASBR(O) ((O)->flag & OSPF6_FLAG_ASBR)
 #define OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf)            \
        if (argv_find(argv, argc, "vrf", &idx_vrf)) {                          \