diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/agentx.c | 2 | ||||
-rw-r--r-- | lib/command.c | 20 | ||||
-rw-r--r-- | lib/command.h | 2 | ||||
-rw-r--r-- | lib/distribute.c | 2 | ||||
-rw-r--r-- | lib/filter.c | 26 | ||||
-rw-r--r-- | lib/grammar_sandbox.c | 36 | ||||
-rw-r--r-- | lib/hash.c | 17 | ||||
-rw-r--r-- | lib/hash.h | 4 | ||||
-rw-r--r-- | lib/if.c | 8 | ||||
-rw-r--r-- | lib/if_rmap.c | 6 | ||||
-rw-r--r-- | lib/keychain.c | 14 | ||||
-rw-r--r-- | lib/module.c | 2 | ||||
-rw-r--r-- | lib/ns.c | 10 | ||||
-rw-r--r-- | lib/plist.c | 36 | ||||
-rw-r--r-- | lib/routemap.c | 34 | ||||
-rw-r--r-- | lib/smux.c | 6 | ||||
-rw-r--r-- | lib/thread.c | 6 | ||||
-rw-r--r-- | lib/vrf.c | 6 | ||||
-rw-r--r-- | lib/vty.c | 6 | ||||
-rw-r--r-- | lib/zebra.h | 2 |
20 files changed, 131 insertions, 114 deletions
diff --git a/lib/agentx.c b/lib/agentx.c index a2e737fed..30c03e6cf 100644 --- a/lib/agentx.c +++ b/lib/agentx.c @@ -197,7 +197,7 @@ DEFUN (no_agentx, { if (!agentx_enabled) return CMD_SUCCESS; vty_out (vty, "SNMP AgentX support cannot be disabled once enabled\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } void diff --git a/lib/command.c b/lib/command.c index c9fbaf47b..99e6b6e00 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1150,7 +1150,7 @@ DEFUN (config_terminal, else { vty_out (vty, "VTY configuration is locked by other VTY\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } return CMD_SUCCESS; } @@ -1720,7 +1720,7 @@ DEFUN (config_hostname, if (!isalpha((int) word->arg[0])) { vty_out (vty, "Please specify string starting with alphabet\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } return cmd_hostname_set (word->arg); @@ -1761,7 +1761,7 @@ DEFUN (config_password, { vty_out (vty, "Please specify string starting with alphanumeric\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (host.password) @@ -1810,7 +1810,7 @@ DEFUN (config_enable_password, else { vty_out (vty, "Unknown encryption type.\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } @@ -1818,7 +1818,7 @@ DEFUN (config_enable_password, { vty_out (vty, "Please specify string starting with alphanumeric\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (host.enable) @@ -2132,14 +2132,14 @@ set_log_file(struct vty *vty, const char *fname, int loglevel) if (getcwd (cwd, MAXPATHLEN) == NULL) { zlog_err ("config_log_file: Unable to alloc mem!"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if ( (p = XMALLOC (MTYPE_TMP, strlen (cwd) + strlen (fname) + 2)) == NULL) { zlog_err ("config_log_file: Unable to alloc mem!"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } sprintf (p, "%s/%s", cwd, fname); fullpath = p; @@ -2155,7 +2155,7 @@ set_log_file(struct vty *vty, const char *fname, int loglevel) if (!ret) { vty_out (vty, "can't open logfile %s\n", fname); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (host.logfile) @@ -2369,7 +2369,7 @@ cmd_banner_motd_file (const char *file) host.motdfile = XSTRDUP (MTYPE_HOST, file); } else - success = CMD_WARNING; + success = CMD_WARNING_CONFIG_FAILED; return success; } @@ -2388,7 +2388,7 @@ DEFUN (banner_motd_file, if (cmd == CMD_ERR_NO_FILE) vty_out (vty, "%s does not exist", filename); - else if (cmd == CMD_WARNING) + else if (cmd == CMD_WARNING_CONFIG_FAILED) vty_out (vty, "%s must be in %s", filename, SYSCONFDIR); return cmd; diff --git a/lib/command.h b/lib/command.h index 927c04006..4a261499d 100644 --- a/lib/command.h +++ b/lib/command.h @@ -178,6 +178,7 @@ struct cmd_node #define CMD_SUCCESS_DAEMON 10 #define CMD_ERR_NO_FILE 11 #define CMD_SUSPEND 12 +#define CMD_WARNING_CONFIG_FAILED 13 /* Argc max counts. */ #define CMD_ARGC_MAX 25 @@ -293,6 +294,7 @@ struct cmd_node */ #define CMD_CREATE_STR(s) CMD_CREATE_STR_HELPER(s) #define CMD_CREATE_STR_HELPER(s) #s +#define CMD_RANGE_STR(a,s) "(" CMD_CREATE_STR(a) "-" CMD_CREATE_STR(s) ")" /* Common descriptions. */ #define SHOW_STR "Show running system information\n" diff --git a/lib/distribute.c b/lib/distribute.c index 691b67e83..34ccfb4c7 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -350,7 +350,7 @@ DEFUN (no_distribute_list, if (! ret) { vty_out (vty, "distribute list doesn't exist\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } return CMD_SUCCESS; } diff --git a/lib/filter.c b/lib/filter.c index 9967308f6..c1e922f5b 100644 --- a/lib/filter.c +++ b/lib/filter.c @@ -577,7 +577,7 @@ vty_access_list_remark_unset (struct vty *vty, afi_t afi, const char *name) if (! access) { vty_out (vty, "%% access-list %s doesn't exist\n",name); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (access->remark) @@ -616,21 +616,21 @@ filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str, else { vty_out (vty, "%% filter type must be permit or deny\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } ret = inet_aton (addr_str, &addr); if (ret <= 0) { vty_out (vty,"%%Inconsistent address and mask\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } ret = inet_aton (addr_mask_str, &addr_mask); if (ret <= 0) { vty_out (vty,"%%Inconsistent address and mask\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (extended) @@ -639,14 +639,14 @@ filter_set_cisco (struct vty *vty, const char *name_str, const char *type_str, if (ret <= 0) { vty_out (vty,"%%Inconsistent address and mask\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } ret = inet_aton (mask_mask_str, &mask_mask); if (ret <= 0) { vty_out (vty,"%%Inconsistent address and mask\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } @@ -1259,7 +1259,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, vty_out (vty, "%% ACL name %s is invalid: length exceeds " "%d characters\n", name_str, ACL_NAMSIZ); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* Check of filter type. */ @@ -1270,7 +1270,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, else { vty_out (vty, "filter type must be [permit|deny]\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* Check string format of prefix and prefixlen. */ @@ -1280,7 +1280,7 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, if (ret <= 0) { vty_out (vty,"IP address prefix/prefixlen is malformed\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } else if (afi == AFI_IP6) @@ -1289,11 +1289,11 @@ filter_set_zebra (struct vty *vty, const char *name_str, const char *type_str, if (ret <= 0) { vty_out (vty,"IPv6 address prefix/prefixlen is malformed\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } else - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; mfilter = filter_new (); mfilter->type = type; @@ -1425,7 +1425,7 @@ DEFUN (no_access_list_all, if (access == NULL) { vty_out (vty, "%% access-list %s doesn't exist\n",argv[idx_acl]->arg); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } master = access->master; @@ -1602,7 +1602,7 @@ DEFUN (no_ipv6_access_list_all, if (access == NULL) { vty_out (vty, "%% access-list %s doesn't exist\n",argv[idx_word]->arg); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } master = access->master; diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index f6bc3e772..81c2ca5c3 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -50,6 +50,12 @@ init_cmdgraph (struct vty *, struct graph **); /** shim interface commands **/ struct graph *nodegraph = NULL, *nodegraph_free = NULL; +#define check_nodegraph() \ + do { if (!nodegraph) { \ + vty_outln(vty, "nodegraph not initialized"); \ + return CMD_WARNING; \ + } } while (0) + DEFUN (grammar_test, grammar_test_cmd, "grammar parse LINE...", @@ -57,6 +63,8 @@ DEFUN (grammar_test, "parse a command\n" "command to pass to new parser\n") { + check_nodegraph(); + int idx_command = 2; // make a string from tokenized command line char *command = argv_concat (argv, argc, idx_command); @@ -85,6 +93,8 @@ DEFUN (grammar_test_complete, "attempt to complete input on DFA\n" "command to complete\n") { + check_nodegraph(); + int idx_command = 2; char *cmdstr = argv_concat (argv, argc, idx_command); if (!cmdstr) @@ -143,6 +153,8 @@ DEFUN (grammar_test_match, "attempt to match input on DFA\n" "command to match\n") { + check_nodegraph(); + int idx_command = 2; if (argv[2]->arg[0] == '#') return CMD_SUCCESS; @@ -209,6 +221,8 @@ DEFUN (grammar_test_doc, "Test function for docstring\n" "Command end\n") { + check_nodegraph(); + // create cmd_element with docstring struct cmd_element *cmd = XCALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_element)); cmd->string = XSTRDUP (MTYPE_CMD_TOKENS, "test docstring <example|selector follow> (1-255) end VARIABLE [OPTION|set lol] . VARARG"); @@ -243,12 +257,10 @@ DEFUN (grammar_test_show, "print current accumulated DFA\n" "include docstrings\n") { - struct graph_node *stack[MAXDEPTH]; + check_nodegraph(); - if (!nodegraph) - vty_out(vty, "nodegraph uninitialized\r\n"); - else - pretty_print_graph (vty, vector_slot (nodegraph->nodes, 0), 0, argc >= 3, stack, 0); + struct graph_node *stack[MAXDEPTH]; + pretty_print_graph (vty, vector_slot (nodegraph->nodes, 0), 0, argc >= 3, stack, 0); return CMD_SUCCESS; } @@ -259,14 +271,12 @@ DEFUN (grammar_test_dot, "print current graph for dot\n" ".dot filename\n") { + check_nodegraph(); + struct graph_node *stack[MAXDEPTH]; struct graph_node *visited[MAXDEPTH*MAXDEPTH]; size_t vpos = 0; - if (!nodegraph) { - vty_out(vty, "nodegraph uninitialized\r\n"); - return CMD_SUCCESS; - } FILE *ofd = fopen(argv[2]->arg, "w"); if (!ofd) { vty_out(vty, "%s: %s\r\n", argv[2]->arg, strerror(errno)); @@ -389,7 +399,7 @@ DEFUN (grammar_findambig, if (!scan && !nodegraph) { vty_out(vty, "nodegraph uninitialized\r\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } do { @@ -432,7 +442,7 @@ DEFUN (grammar_findambig, if (scan) nodegraph = NULL; - return ambig == 0 ? CMD_SUCCESS : CMD_WARNING; + return ambig == 0 ? CMD_SUCCESS : CMD_WARNING_CONFIG_FAILED; } DEFUN (grammar_init_graph, @@ -466,7 +476,7 @@ DEFUN (grammar_access, if (!cnode) { vty_out (vty, "%% no such node\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } vty_out (vty, "node %d\n", (int)cnode->node); @@ -476,8 +486,6 @@ DEFUN (grammar_access, /* this is called in vtysh.c to set up the testing shim */ void grammar_sandbox_init(void) { - init_cmdgraph (NULL, &nodegraph); - // install all enable elements install_element (ENABLE_NODE, &grammar_test_cmd); install_element (ENABLE_NODE, &grammar_test_show_cmd); diff --git a/lib/hash.c b/lib/hash.c index 166bc7a26..47f336c1e 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -87,13 +87,8 @@ hash_alloc_intern (void *arg) } #define hash_update_ssq(hz, old, new) \ - do { \ - long double res; \ - res = powl(old, 2.0); \ - hz->stats.ssq -= (uint64_t) res;\ - res = powl(new, 2.0); \ - hz->stats.ssq += (uint64_t) res; \ - } while (0); \ + atomic_fetch_add_explicit(&hz->stats.ssq, (new + old)*(new - old),\ + memory_order_relaxed); /* Expand hash if the chain length exceeds the threshold. */ static void hash_expand (struct hash *hash) @@ -428,6 +423,13 @@ DEFUN(show_hash_stats, long double ssq; // ssq casted to long double pthread_mutex_lock (&_hashes_mtx); + if (!_hashes) + { + pthread_mutex_unlock (&_hashes_mtx); + vty_outln (vty, "No hash tables in use."); + return CMD_SUCCESS; + } + for (ALL_LIST_ELEMENTS_RO (_hashes, ln, h)) { if (!h->name) @@ -482,6 +484,5 @@ DEFUN(show_hash_stats, void hash_cmd_init () { - _hashes = list_new(); install_element (ENABLE_NODE, &show_hash_stats_cmd); } diff --git a/lib/hash.h b/lib/hash.h index 01d2b1ddc..3b2671afa 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -53,9 +53,9 @@ struct hash_backet struct hashstats { /* number of empty hash buckets */ - _Atomic int empty; + _Atomic uint_fast32_t empty; /* sum of squares of bucket length */ - _Atomic uint64_t ssq; + _Atomic uint_fast32_t ssq; }; struct hash @@ -693,7 +693,7 @@ DEFUN (interface, vty_out (vty, "%% Interface name %s is invalid: length exceeds " "%d characters\n", ifname, INTERFACE_NAMSIZ); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /*Pending: need proper vrf name based lookup/(possible creation of VRF) @@ -710,7 +710,7 @@ DEFUN (interface, if (!ifp) { vty_out (vty, "%% interface %s not in %s\n", ifname, vrfname); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } VTY_PUSH_CONTEXT (INTERFACE_NODE, ifp); @@ -740,13 +740,13 @@ DEFUN_NOSH (no_interface, if (ifp == NULL) { vty_out (vty, "%% Interface %s does not exist\n", ifname); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_ACTIVE)) { vty_out (vty, "%% Only inactive interfaces can be deleted\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if_delete(ifp); diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 49f9da524..a0c40d5af 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -229,7 +229,7 @@ DEFUN (if_rmap, else { vty_out (vty, "route-map direction must be [in|out]\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if_rmap_set (argv[idx_ifname]->arg, type, argv[idx_rmap_name]->arg); @@ -260,14 +260,14 @@ DEFUN (no_if_rmap, else { vty_out (vty, "route-map direction must be [in|out]\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } ret = if_rmap_unset (argv[idx_ifname]->arg, type, argv[idx_routemap_name]->arg); if (! ret) { vty_out (vty, "route-map doesn't exist\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } return CMD_SUCCESS; } diff --git a/lib/keychain.c b/lib/keychain.c index 9b7b0877e..f768933b7 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -272,7 +272,7 @@ DEFUN (no_key_chain, if (! keychain) { vty_out (vty, "Can't find keychain %s\n", argv[idx_word]->arg); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } keychain_delete (keychain); @@ -315,7 +315,7 @@ DEFUN (no_key, if (! key) { vty_out (vty, "Can't find key %d\n", index); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } key_delete (keychain, key); @@ -478,20 +478,20 @@ key_lifetime_set (struct vty *vty, struct key_range *krange, if (time_start < 0) { vty_out (vty, "Malformed time value\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } time_end = key_str2time (etime_str, eday_str, emonth_str, eyear_str); if (time_end < 0) { vty_out (vty, "Malformed time value\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (time_end <= time_start) { vty_out (vty, "Expire time is not later than start time\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } krange->start = time_start; @@ -513,7 +513,7 @@ key_lifetime_duration_set (struct vty *vty, struct key_range *krange, if (time_start < 0) { vty_out (vty, "Malformed time value\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } krange->start = time_start; @@ -535,7 +535,7 @@ key_lifetime_infinite_set (struct vty *vty, struct key_range *krange, if (time_start < 0) { vty_out (vty, "Malformed time value\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } krange->start = time_start; diff --git a/lib/module.c b/lib/module.c index c7dd5538c..140fd87b9 100644 --- a/lib/module.c +++ b/lib/module.c @@ -110,7 +110,7 @@ struct frrmod_runtime *frrmod_load(const char *spec, dlclose(handle); if (err) snprintf(err, err_len, - "\"%s\" is not a Quagga module: %s", + "\"%s\" is not an FRR module: %s", name, dlerror()); return NULL; } @@ -317,7 +317,7 @@ DEFUN_NOSH (ns_netns, char *pathname = ns_netns_pathname (vty, argv[idx_name]->arg); if (!pathname) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; ns_id = strtoul (argv[idx_number]->arg, NULL, 10); ns = ns_get (ns_id); @@ -326,7 +326,7 @@ DEFUN_NOSH (ns_netns, { vty_out (vty, "NS %u is already configured with NETNS %s\n", ns->ns_id, ns->name); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (!ns->name) @@ -336,7 +336,7 @@ DEFUN_NOSH (ns_netns, { vty_out (vty, "Can not associate NS %u with NETNS %s\n", ns->ns_id, ns->name); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } return CMD_SUCCESS; @@ -358,7 +358,7 @@ DEFUN (no_ns_netns, char *pathname = ns_netns_pathname (vty, argv[idx_name]->arg); if (!pathname) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; ns_id = strtoul(argv[idx_number]->arg, NULL, 10); ns = ns_lookup (ns_id); @@ -372,7 +372,7 @@ DEFUN (no_ns_netns, if (ns->name && strcmp (ns->name, pathname) != 0) { vty_out (vty, "Incorrect NETNS file name\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } ns_disable (ns); diff --git a/lib/plist.c b/lib/plist.c index 0c04b6247..96c60a489 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -884,7 +884,7 @@ vty_invalid_prefix_range (struct vty *vty, const char *prefix) { vty_out (vty, "%% Invalid prefix range for %s, make sure: len < ge-value <= le-value\n", prefix); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } static int @@ -921,7 +921,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, else { vty_out (vty, "%% prefix type must be permit or deny\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* "any" is special token for matching any IPv4 addresses. */ @@ -941,7 +941,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 prefix\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* make a copy to verify prefix matches mask length */ @@ -963,7 +963,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { vty_out (vty, "%% Malformed IPv6 prefix\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* make a copy to verify prefix matches mask length */ @@ -974,7 +974,7 @@ vty_prefix_list_install (struct vty *vty, afi_t afi, const char *name, case AFI_L2VPN: default: vty_out (vty, "%% Unrecognized AFI (%d)\n", afi); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; break; } @@ -1043,7 +1043,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if (! plist) { vty_out (vty, "%% Can't find specified prefix-list\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* Only prefix-list name specified, delete the entire prefix-list. */ @@ -1058,7 +1058,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if ((typestr == NULL) || (prefix == NULL)) { vty_out (vty, "%% Both prefix and type required\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* Check sequence number. */ @@ -1079,7 +1079,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, else { vty_out (vty, "%% prefix type must be permit or deny\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* "any" is special token for matching any IPv4 addresses. */ @@ -1097,7 +1097,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { vty_out (vty, "%% Malformed IPv4 prefix\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } else if (afi == AFI_IP6) @@ -1114,7 +1114,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if (ret <= 0) { vty_out (vty, "%% Malformed IPv6 prefix\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } @@ -1124,7 +1124,7 @@ vty_prefix_list_uninstall (struct vty *vty, afi_t afi, const char *name, if (pentry == NULL) { vty_out (vty, "%% Can't find specified prefix-list\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* Install new filter to the access_list. */ @@ -1142,7 +1142,7 @@ vty_prefix_list_desc_unset (struct vty *vty, afi_t afi, const char *name) if (! plist) { vty_out (vty, "%% Can't find specified prefix-list\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (plist->desc) @@ -1944,18 +1944,18 @@ prefix_bgp_orf_set (char *name, afi_t afi, struct orf_prefix *orfp, /* ge and le value check */ if (orfp->ge && orfp->ge <= orfp->p.prefixlen) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; if (orfp->le && orfp->le <= orfp->p.prefixlen) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; if (orfp->le && orfp->ge > orfp->le) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; if (orfp->ge && orfp->le == (afi == AFI_IP ? 32 : 128)) orfp->le = 0; plist = prefix_list_get (afi, 1, name); if (! plist) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; if (set) { @@ -1966,7 +1966,7 @@ prefix_bgp_orf_set (char *name, afi_t afi, struct orf_prefix *orfp, if (prefix_entry_dup_check (plist, pentry)) { prefix_list_entry_free (pentry); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } prefix_list_entry_add (plist, pentry); @@ -1978,7 +1978,7 @@ prefix_bgp_orf_set (char *name, afi_t afi, struct orf_prefix *orfp, orfp->seq, orfp->le, orfp->ge); if (! pentry) - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; prefix_list_entry_delete (plist, pentry, 1); } diff --git a/lib/routemap.c b/lib/routemap.c index 5e5f804bf..9ceaa1115 100644 --- a/lib/routemap.c +++ b/lib/routemap.c @@ -522,11 +522,11 @@ generic_match_add (struct vty *vty, struct route_map_index *index, { case RMAP_RULE_MISSING: vty_out (vty, "%% [%s] Can't find rule.\n", frr_protonameinst); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; case RMAP_COMPILE_ERROR: vty_out (vty, "%% [%s] Argument form is unsupported or malformed.\n", frr_protonameinst); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } @@ -579,7 +579,7 @@ generic_match_delete (struct vty *vty, struct route_map_index *index, XFREE(MTYPE_ROUTE_MAP_RULE, dep_name); if (rmap_name) XFREE(MTYPE_ROUTE_MAP_NAME, rmap_name); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (type != RMAP_EVENT_MATCH_DELETED && dep_name) @@ -606,11 +606,11 @@ generic_set_add (struct vty *vty, struct route_map_index *index, { case RMAP_RULE_MISSING: vty_out (vty, "%% [%s] Can't find rule.\n", frr_protonameinst); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; case RMAP_COMPILE_ERROR: vty_out (vty, "%% [%s] Argument form is unsupported or malformed.\n", frr_protonameinst); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } return CMD_SUCCESS; @@ -629,11 +629,11 @@ generic_set_delete (struct vty *vty, struct route_map_index *index, { case RMAP_RULE_MISSING: vty_out (vty, "%% [%s] Can't find rule.\n", frr_protonameinst); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; case RMAP_COMPILE_ERROR: vty_out (vty, "%% [%s] Argument form is unsupported or malformed.\n", frr_protonameinst); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } } return CMD_SUCCESS; @@ -2360,14 +2360,14 @@ DEFUN (set_ip_nexthop, if (ret < 0) { vty_out (vty, "%% Malformed nexthop address\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (su.sin.sin_addr.s_addr == 0 || IPV4_CLASS_DE(su.sin.sin_addr.s_addr)) { vty_out (vty, "%% nexthop address cannot be 0.0.0.0, multicast or reserved\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (rmap_match_set_hook.set_ip_nexthop) @@ -2417,12 +2417,12 @@ DEFUN (set_ipv6_nexthop_local, if (!ret) { vty_out (vty, "%% Malformed nexthop address\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (!IN6_IS_ADDR_LINKLOCAL(&addr)) { vty_out (vty, "%% Invalid link-local nexthop address\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (rmap_match_set_hook.set_ipv6_nexthop_local) @@ -2578,7 +2578,7 @@ DEFUN (no_route_map_all, if (map == NULL) { vty_out (vty, "%% Could not find route-map %s\n", mapname); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } route_map_delete (map); @@ -2613,7 +2613,7 @@ DEFUN (no_route_map, if (map == NULL) { vty_out (vty, "%% Could not find route-map %s\n", mapname); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* Lookup route map index. */ @@ -2622,7 +2622,7 @@ DEFUN (no_route_map, { vty_out (vty, "%% Could not find route-map entry %s %s\n", mapname, prefstr); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } /* Delete index from route map. */ @@ -2649,7 +2649,7 @@ DEFUN (rmap_onmatch_next, { /* Under a deny clause, match means it's finished. No need to set next */ vty_out (vty,"on-match next not supported under route-map deny\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } index->exitpolicy = RMAP_NEXT; } @@ -2690,7 +2690,7 @@ DEFUN (rmap_onmatch_goto, { /* Under a deny clause, match means it's finished. No need to go anywhere */ vty_out (vty,"on-match goto not supported under route-map deny\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (num) @@ -2702,7 +2702,7 @@ DEFUN (rmap_onmatch_goto, { /* Can't allow you to do that, Dave */ vty_out (vty, "can't jump backwards in route-maps\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } else { diff --git a/lib/smux.c b/lib/smux.c index 64b406bd6..d7d99cc8a 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1279,7 +1279,7 @@ smux_peer_oid (struct vty *vty, const char *oid_str, const char *passwd_str) if (ret != 0) { vty_out (vty, "object ID malformed\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (smux_oid) @@ -1339,7 +1339,7 @@ DEFUN (smux_peer, return CMD_SUCCESS; } else - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } DEFUN (smux_peer_password, @@ -1357,7 +1357,7 @@ DEFUN (smux_peer_password, return CMD_SUCCESS; } else - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } DEFUN (no_smux_peer, diff --git a/lib/thread.c b/lib/thread.c index 710ecc2a0..2c87c099d 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -564,6 +564,12 @@ thread_master_free_unused (struct thread_master *m) void thread_master_free (struct thread_master *m) { + pthread_mutex_lock (&masters_mtx); + { + listnode_delete (masters, m); + } + pthread_mutex_unlock (&masters_mtx); + thread_array_free (m, m->read); thread_array_free (m, m->write); thread_queue_free (m, m->timer); @@ -476,7 +476,7 @@ DEFUN_NOSH (vrf, vty_out (vty, "%% VRF name %s is invalid: length exceeds " "%d characters\n", vrfname, VRF_NAMSIZ); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } vrfp = vrf_get (VRF_UNKNOWN, vrfname); @@ -502,13 +502,13 @@ DEFUN_NOSH (no_vrf, if (vrfp == NULL) { vty_out (vty, "%% VRF %s does not exist\n", vrfname); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } if (CHECK_FLAG (vrfp->status, VRF_ACTIVE)) { vty_out (vty, "%% Only inactive VRFs can be deleted\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } vrf_delete(vrfp); @@ -2202,7 +2202,7 @@ vtysh_read (struct thread *thread) if (ret == CMD_SUSPEND) break; - /* warning: watchquagga hardcodes this result write */ + /* warning: watchfrr hardcodes this result write */ header[3] = ret; buffer_put(vty->obuf, header, 4); @@ -2801,7 +2801,7 @@ DEFUN (no_vty_access_class, if (! vty_accesslist_name || (argc == 3 && strcmp(vty_accesslist_name, accesslist))) { vty_out (vty,"Access-class is not currently applied to vty\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } XFREE(MTYPE_VTY, vty_accesslist_name); @@ -2844,7 +2844,7 @@ DEFUN (no_vty_ipv6_access_class, (argc == 4 && strcmp(vty_ipv6_accesslist_name, accesslist))) { vty_out (vty,"IPv6 access-class is not currently applied to vty\n"); - return CMD_WARNING; + return CMD_WARNING_CONFIG_FAILED; } XFREE(MTYPE_VTY, vty_ipv6_accesslist_name); diff --git a/lib/zebra.h b/lib/zebra.h index 901a49073..7f2609c12 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -126,7 +126,7 @@ typedef unsigned char u_int8_t; #define __APPLE_USE_RFC_3542 #endif -#include "lib/openbsd-tree.h" +#include "openbsd-tree.h" #include <netinet/in.h> #include <netinet/in_systm.h> |