]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_vty.c
*: clean up cmd_node initializers
[mirror_frr.git] / ospfd / ospf_vty.c
index 1542ef88fb9ad3eeedb8e7dadfc1d360af78151a..c2b08cab772ea9a1d4fa1b8fd3b3effeb5ad0c20 100644 (file)
@@ -54,8 +54,8 @@
 #include "ospfd/ospf_bfd.h"
 
 FRR_CFG_DEFAULT_BOOL(OSPF_LOG_ADJACENCY_CHANGES,
-       { .val_long = true, .match_profile = "datacenter", },
-       { .val_long = false },
+       { .val_bool = true, .match_profile = "datacenter", },
+       { .val_bool = false },
 )
 
 static const char *const ospf_network_type_str[] = {
@@ -93,7 +93,7 @@ static int str2metric(const char *str, int *metric)
                return 0;
 
        *metric = strtol(str, NULL, 10);
-       if (*metric < 0 && *metric > 16777214) {
+       if (*metric < 0 || *metric > 16777214) {
                /* vty_out (vty, "OSPF metric value is invalid\n"); */
                return 0;
        }
@@ -619,8 +619,7 @@ DEFUN (ospf_network_area,
                if (IS_DEBUG_OSPF_EVENT)
                        zlog_debug(
                                "%s ospf vrf %s num of %u ip osp area x config",
-                               __PRETTY_FUNCTION__,
-                               ospf->name ? ospf->name : "NIL",
+                               __func__, ospf->name ? ospf->name : "NIL",
                                ospf->if_ospf_cli_count);
                return CMD_WARNING_CONFIG_FAILED;
        }
@@ -3551,7 +3550,7 @@ static void show_ip_ospf_interface_sub(struct vty *vty, struct ospf *ospf,
                }
 
                /* Show DR information. */
-               if (DR(oi).s_addr == 0) {
+               if (DR(oi).s_addr == INADDR_ANY) {
                        if (!use_json)
                                vty_out(vty,
                                        "  No backup designated router on this network\n");
@@ -4199,7 +4198,7 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty,
                                }
 
                                if (nbr->state == NSM_Attempt
-                                   && nbr->router_id.s_addr == 0)
+                                   && nbr->router_id.s_addr == INADDR_ANY)
                                        strlcpy(neigh_str, "neighbor",
                                                sizeof(neigh_str));
                                else
@@ -4258,7 +4257,7 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty,
                                ospf_nbr_state_message(nbr, msgbuf, 16);
 
                                if (nbr->state == NSM_Attempt
-                                   && nbr->router_id.s_addr == 0)
+                                   && nbr->router_id.s_addr == INADDR_ANY)
                                        vty_out(vty, "%-15s %3d %-15s ", "-",
                                                nbr->priority, msgbuf);
                                else
@@ -4908,7 +4907,8 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
                        json_neigh_array = NULL;
                }
 
-               if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
+               if (nbr->state == NSM_Attempt
+                   && nbr->router_id.s_addr == INADDR_ANY)
                        strlcpy(neigh_str, "noNbrId", sizeof(neigh_str));
                else
                        strlcpy(neigh_str, inet_ntoa(nbr->router_id),
@@ -4926,7 +4926,8 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
 
        } else {
                /* Show neighbor ID. */
-               if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
+               if (nbr->state == NSM_Attempt
+                   && nbr->router_id.s_addr == INADDR_ANY)
                        vty_out(vty, " Neighbor %s,", "-");
                else
                        vty_out(vty, " Neighbor %s,",
@@ -10555,7 +10556,11 @@ void ospf_vty_show_init(void)
 
 
 /* ospfd's interface node. */
-static struct cmd_node interface_node = {INTERFACE_NODE, "%s(config-if)# ", 1};
+static struct cmd_node interface_node = {
+       .node = INTERFACE_NODE,
+       .prompt = "%s(config-if)# ",
+       .vtysh = 1,
+};
 
 /* Initialization of OSPF interface. */
 static void ospf_vty_if_init(void)
@@ -10667,7 +10672,11 @@ static void ospf_vty_zebra_init(void)
 #endif /* 0 */
 }
 
-static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# ", 1};
+static struct cmd_node ospf_node = {
+       .node = OSPF_NODE,
+       .prompt = "%s(config-router)# ",
+       .vtysh = 1,
+};
 
 static void ospf_interface_clear(struct interface *ifp)
 {