summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_vty.c34
-rw-r--r--eigrpd/eigrp_topology.c2
-rw-r--r--ldpd/ldp_vty_conf.c3
-rw-r--r--lib/command.c42
-rw-r--r--lib/command.h3
-rw-r--r--lib/libfrr.c4
-rw-r--r--ospf6d/ospf6_intra.c2
-rw-r--r--ospfd/ospf_api.c21
-rw-r--r--ospfd/ospf_vty.c5
-rw-r--r--ospfd/ospf_zebra.c10
-rw-r--r--ospfd/ospfd.c7
-rw-r--r--pimd/mtracebis.c3
-rw-r--r--ripd/ripd.c4
-rw-r--r--vtysh/vtysh.c20
-rw-r--r--zebra/if_netlink.c20
-rw-r--r--zebra/kernel_netlink.c1
-rw-r--r--zebra/rt_netlink.c19
-rw-r--r--zebra/rule_netlink.c6
18 files changed, 103 insertions, 103 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index d98104a9fa..3d1fdfd38d 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -2009,27 +2009,19 @@ DEFUN (no_bgp_fast_external_failover,
CPP_NOTICE("bgpd: remove deprecated '[no] bgp enforce-first-as' commands")
#endif
-DEFUN_DEPRECATED (bgp_enforce_first_as,
- bgp_enforce_first_as_cmd,
- "bgp enforce-first-as",
- BGP_STR
- "Enforce the first AS for EBGP routes\n")
+DEFUN_HIDDEN (bgp_enforce_first_as,
+ bgp_enforce_first_as_cmd,
+ "[no] bgp enforce-first-as",
+ NO_STR
+ BGP_STR
+ "Enforce the first AS for EBGP routes\n")
{
VTY_DECLVAR_CONTEXT(bgp, bgp);
- bgp_flag_set(bgp, BGP_FLAG_ENFORCE_FIRST_AS);
- return CMD_SUCCESS;
-}
-
-DEFUN_DEPRECATED (no_bgp_enforce_first_as,
- no_bgp_enforce_first_as_cmd,
- "no bgp enforce-first-as",
- NO_STR
- BGP_STR
- "Enforce the first AS for EBGP routes\n")
-{
- VTY_DECLVAR_CONTEXT(bgp, bgp);
- bgp_flag_unset(bgp, BGP_FLAG_ENFORCE_FIRST_AS);
+ if (strmatch(argv[0]->text, "no"))
+ bgp_flag_unset(bgp, BGP_FLAG_ENFORCE_FIRST_AS);
+ else
+ bgp_flag_set(bgp, BGP_FLAG_ENFORCE_FIRST_AS);
return CMD_SUCCESS;
}
@@ -6745,6 +6737,11 @@ DEFPY (bgp_imexport_vrf,
safi_t safi;
afi_t afi;
+ if (import_name == NULL) {
+ vty_out(vty, "%% Missing import name\n");
+ return CMD_WARNING;
+ }
+
if (argv_find(argv, argc, "no", &idx))
remove = true;
@@ -12439,7 +12436,6 @@ void bgp_vty_init(void)
/* "bgp enforce-first-as" commands */
install_element(BGP_NODE, &bgp_enforce_first_as_cmd);
- install_element(BGP_NODE, &no_bgp_enforce_first_as_cmd);
/* "bgp bestpath compare-routerid" commands */
install_element(BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 4e26446ebe..8ca0e282a8 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -448,6 +448,8 @@ void eigrp_topology_update_node_flags(struct eigrp_prefix_entry *dest)
struct eigrp_nexthop_entry *entry;
struct eigrp *eigrp = eigrp_lookup();
+ assert(eigrp);
+
for (ALL_LIST_ELEMENTS_RO(dest->entries, node, entry)) {
if (entry->reported_distance < dest->fdistance) {
// is feasible successor, can be successor
diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c
index e5832c5086..4ef57f574a 100644
--- a/ldpd/ldp_vty_conf.c
+++ b/ldpd/ldp_vty_conf.c
@@ -89,6 +89,9 @@ struct cmd_node ldp_pseudowire_node =
int
ldp_get_address(const char *str, int *af, union ldpd_addr *addr)
{
+ if (!str || !af || !addr)
+ return (-1);
+
memset(addr, 0, sizeof(*addr));
if (inet_pton(AF_INET, str, &addr->v4) == 1) {
diff --git a/lib/command.c b/lib/command.c
index 4ab47e5fc2..4d88f295a3 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -515,13 +515,6 @@ static int config_write_host(struct vty *vty)
host.enable);
}
- if (zlog_default->default_lvl != LOG_DEBUG) {
- vty_out(vty,
- "! N.B. The 'log trap' command is deprecated.\n");
- vty_out(vty, "log trap %s\n",
- zlog_priority[zlog_default->default_lvl]);
- }
-
if (host.logfile
&& (zlog_default->maxlvl[ZLOG_DEST_FILE]
!= ZLOG_DISABLED)) {
@@ -2471,6 +2464,9 @@ void command_setup_early_logging(const char *dest, const char *level)
}
token = strstr(dest, ":");
+ if (token == NULL)
+ return;
+
token++;
set_log_file(NULL, token, zlog_default->default_lvl);
@@ -2583,36 +2579,6 @@ DEFUN (no_config_log_facility,
return CMD_SUCCESS;
}
-DEFUN_DEPRECATED(
- config_log_trap, config_log_trap_cmd,
- "log trap <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
- "Logging control\n"
- "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC)
-{
- int new_level;
- int i;
-
- if ((new_level = level_match(argv[2]->arg)) == ZLOG_DISABLED)
- return CMD_ERR_NO_MATCH;
-
- zlog_default->default_lvl = new_level;
- for (i = 0; i < ZLOG_NUM_DESTS; i++)
- if (zlog_default->maxlvl[i] != ZLOG_DISABLED)
- zlog_default->maxlvl[i] = new_level;
- return CMD_SUCCESS;
-}
-
-DEFUN_DEPRECATED(
- no_config_log_trap, no_config_log_trap_cmd,
- "no log trap [emergencies|alerts|critical|errors|warnings|notifications|informational|debugging]",
- NO_STR
- "Logging control\n"
- "Permit all logging information\n" LOG_LEVEL_DESC)
-{
- zlog_default->default_lvl = LOG_DEBUG;
- return CMD_SUCCESS;
-}
-
DEFUN (config_log_record_priority,
config_log_record_priority_cmd,
"log record-priority",
@@ -2902,8 +2868,6 @@ void cmd_init(int terminal)
install_element(CONFIG_NODE, &no_config_log_syslog_cmd);
install_element(CONFIG_NODE, &config_log_facility_cmd);
install_element(CONFIG_NODE, &no_config_log_facility_cmd);
- install_element(CONFIG_NODE, &config_log_trap_cmd);
- install_element(CONFIG_NODE, &no_config_log_trap_cmd);
install_element(CONFIG_NODE, &config_log_record_priority_cmd);
install_element(CONFIG_NODE,
&no_config_log_record_priority_cmd);
diff --git a/lib/command.h b/lib/command.h
index 395c971c55..2d333b098a 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -240,9 +240,6 @@ struct cmd_node {
#define DEFUN_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
-#define DEFUN_DEPRECATED(funcname, cmdname, cmdstr, helpstr) \
- DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED)
-
/* DEFUN_NOSH for commands that vtysh should ignore */
#define DEFUN_NOSH(funcname, cmdname, cmdstr, helpstr) \
DEFUN(funcname, cmdname, cmdstr, helpstr)
diff --git a/lib/libfrr.c b/lib/libfrr.c
index 505bea9b18..9ea5e985cd 100644
--- a/lib/libfrr.c
+++ b/lib/libfrr.c
@@ -846,7 +846,9 @@ static int frr_daemon_ctl(struct thread *t)
switch (buf[0]) {
case 'S': /* SIGTSTP */
vty_stdio_suspend();
- send(daemon_ctl_sock, "s", 1, 0);
+ if (send(daemon_ctl_sock, "s", 1, 0) < 0)
+ zlog_err("%s send(\"s\") error (SIGTSTP propagation)",
+ (di && di->name ? di->name : ""));
break;
case 'R': /* SIGTCNT [implicit] */
vty_stdio_resume();
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index d99541ebad..7898b10905 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -1323,6 +1323,8 @@ static void ospf6_intra_prefix_update_route_origin(struct ospf6_route *oa_route)
g_route = ospf6_route_lookup(&oa_route->prefix,
ospf6->route_table);
+ assert(g_route);
+
for (ospf6_route_lock(g_route); g_route &&
ospf6_route_is_prefix(&oa_route->prefix, g_route);
g_route = nroute) {
diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c
index 8369dde822..b1175a2f68 100644
--- a/ospfd/ospf_api.c
+++ b/ospfd/ospf_api.c
@@ -510,17 +510,18 @@ struct msg *new_msg_originate_request(uint32_t seqnum, struct in_addr ifaddr,
struct msg_originate_request *omsg;
unsigned int omsglen;
char buf[OSPF_API_MAX_MSG_SIZE];
+ size_t off_data = offsetof(struct msg_originate_request, data);
+ size_t data_maxs = sizeof(buf) - off_data;
+ struct lsa_header *omsg_data = (struct lsa_header *)&buf[off_data];
omsg = (struct msg_originate_request *)buf;
omsg->ifaddr = ifaddr;
omsg->area_id = area_id;
omsglen = ntohs(data->length);
- if (omsglen
- > sizeof(buf) - offsetof(struct msg_originate_request, data))
- omsglen = sizeof(buf)
- - offsetof(struct msg_originate_request, data);
- memcpy(&omsg->data, data, omsglen);
+ if (omsglen > data_maxs)
+ omsglen = data_maxs;
+ memcpy(omsg_data, data, omsglen);
omsglen += sizeof(struct msg_originate_request)
- sizeof(struct lsa_header);
@@ -630,6 +631,9 @@ struct msg *new_msg_lsa_change_notify(uint8_t msgtype, uint32_t seqnum,
uint8_t buf[OSPF_API_MAX_MSG_SIZE];
struct msg_lsa_change_notify *nmsg;
unsigned int len;
+ size_t off_data = offsetof(struct msg_lsa_change_notify, data);
+ size_t data_maxs = sizeof(buf) - off_data;
+ struct lsa_header *nmsg_data = (struct lsa_header *)&buf[off_data];
assert(data);
@@ -640,10 +644,9 @@ struct msg *new_msg_lsa_change_notify(uint8_t msgtype, uint32_t seqnum,
memset(&nmsg->pad, 0, sizeof(nmsg->pad));
len = ntohs(data->length);
- if (len > sizeof(buf) - offsetof(struct msg_lsa_change_notify, data))
- len = sizeof(buf)
- - offsetof(struct msg_lsa_change_notify, data);
- memcpy(&nmsg->data, data, len);
+ if (len > data_maxs)
+ len = data_maxs;
+ memcpy(nmsg_data, data, len);
len += sizeof(struct msg_lsa_change_notify) - sizeof(struct lsa_header);
return msg_new(msgtype, nmsg, seqnum, len);
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 7d748419fa..ddf9133ed9 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -8166,6 +8166,11 @@ DEFUN (ospf_redistribute_instance_source,
source = proto_redistnum(AFI_IP, argv[idx_ospf_table]->text);
+ if (source < 0) {
+ vty_out(vty, "Unknown instance redistribution\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
instance = strtoul(argv[idx_number]->arg, NULL, 10);
if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance) {
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index 141ece9c7a..0a7776cced 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -670,6 +670,16 @@ int ospf_redistribute_set(struct ospf *ospf, int type, unsigned short instance,
struct ospf_redist *red;
red = ospf_redist_lookup(ospf, type, instance);
+
+ if (red == NULL) {
+ zlog_err(
+ "Redistribute[%s][%d]: Lookup failed Type[%d] , Metric[%d]",
+ ospf_redist_string(type), instance,
+ metric_type(ospf, type, instance),
+ metric_value(ospf, type, instance));
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
if (ospf_is_type_redistributed(ospf, type, instance)) {
if (mtype != red->dmetric.type) {
red->dmetric.type = mtype;
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 4cf38439c6..f315421843 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -243,13 +243,14 @@ static struct ospf *ospf_new(unsigned short instance, const char *name)
zlog_debug(
"%s: Create new ospf instance with vrf_name %s vrf_id %u",
__PRETTY_FUNCTION__, name, new->vrf_id);
- if (vrf)
- ospf_vrf_link(new, vrf);
} else {
new->vrf_id = VRF_DEFAULT;
vrf = vrf_lookup_by_id(VRF_DEFAULT);
- ospf_vrf_link(new, vrf);
}
+
+ if (vrf)
+ ospf_vrf_link(new, vrf);
+
ospf_zebra_vrf_register(new);
new->abr_type = OSPF_ABR_DEFAULT;
diff --git a/pimd/mtracebis.c b/pimd/mtracebis.c
index c63a6eeca9..a0e8fd1270 100644
--- a/pimd/mtracebis.c
+++ b/pimd/mtracebis.c
@@ -303,6 +303,9 @@ static int recv_response(int fd, int *hops, struct igmp_mtrace *mtracer)
if (mtrace_len < (int)MTRACE_HDR_SIZE)
return -1;
+ if (mtrace_len > (int)MTRACE_BUF_LEN)
+ return -1;
+
sum = mtrace->checksum;
mtrace->checksum = 0;
if (sum != in_cksum(mtrace, mtrace_len)) {
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 92c27106d5..90dc7808eb 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -799,11 +799,11 @@ static int rip_auth_simple_password(struct rte *rte, struct sockaddr_in *from,
struct interface *ifp)
{
struct rip_interface *ri;
- char *auth_str = (char *)&rte->prefix;
+ char *auth_str = (char *)rte + offsetof(struct rte, prefix);
int i;
/* reject passwords with zeros in the middle of the string */
- for (i = strlen(auth_str); i < 16; i++) {
+ for (i = strnlen(auth_str, 16); i < 16; i++) {
if (auth_str[i] != '\0')
return 0;
}
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 66b49800dd..0697cd8b75 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -2441,24 +2441,6 @@ DEFUNSH(VTYSH_ALL, no_vtysh_log_facility, no_vtysh_log_facility_cmd,
return CMD_SUCCESS;
}
-DEFUNSH_DEPRECATED(
- VTYSH_ALL, vtysh_log_trap, vtysh_log_trap_cmd,
- "log trap <emergencies|alerts|critical|errors|warnings|notifications|informational|debugging>",
- "Logging control\n"
- "(Deprecated) Set logging level and default for all destinations\n" LOG_LEVEL_DESC)
-{
- return CMD_SUCCESS;
-}
-
-DEFUNSH_DEPRECATED(VTYSH_ALL, no_vtysh_log_trap, no_vtysh_log_trap_cmd,
- "no log trap [LEVEL]", NO_STR
- "Logging control\n"
- "Permit all logging information\n"
- "Logging level\n")
-{
- return CMD_SUCCESS;
-}
-
DEFUNSH(VTYSH_ALL, vtysh_log_record_priority, vtysh_log_record_priority_cmd,
"log record-priority",
"Logging control\n"
@@ -3766,8 +3748,6 @@ void vtysh_init_vty(void)
install_element(CONFIG_NODE, &no_vtysh_log_monitor_cmd);
install_element(CONFIG_NODE, &vtysh_log_syslog_cmd);
install_element(CONFIG_NODE, &no_vtysh_log_syslog_cmd);
- install_element(CONFIG_NODE, &vtysh_log_trap_cmd);
- install_element(CONFIG_NODE, &no_vtysh_log_trap_cmd);
install_element(CONFIG_NODE, &vtysh_log_facility_cmd);
install_element(CONFIG_NODE, &no_vtysh_log_facility_cmd);
install_element(CONFIG_NODE, &vtysh_log_record_priority_cmd);
diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c
index e6d324ab6a..5c84219418 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -586,8 +586,13 @@ static int netlink_interface(struct nlmsghdr *h, ns_id_t ns_id, int startup)
return 0;
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifinfomsg));
- if (len < 0)
+ if (len < 0) {
+ zlog_err("%s: Message received from netlink is of a broken size: %d %zu",
+ __PRETTY_FUNCTION__,
+ h->nlmsg_len,
+ (size_t)NLMSG_LENGTH(sizeof(struct ifinfomsg)));
return -1;
+ }
/* We are interested in some AF_BRIDGE notifications. */
if (ifi->ifi_family == AF_BRIDGE)
@@ -893,8 +898,13 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
return 0;
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg));
- if (len < 0)
+ if (len < 0) {
+ zlog_err("%s: Message received from netlink is of a broken size: %d %zu",
+ __PRETTY_FUNCTION__,
+ h->nlmsg_len,
+ (size_t)NLMSG_LENGTH(sizeof(struct ifaddrmsg)));
return -1;
+ }
memset(tb, 0, sizeof tb);
netlink_parse_rtattr(tb, IFA_MAX, IFA_RTA(ifa), len);
@@ -1105,8 +1115,12 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
}
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifinfomsg));
- if (len < 0)
+ if (len < 0) {
+ zlog_err("%s: Message received from netlink is of a broken size %d %zu",
+ __PRETTY_FUNCTION__, h->nlmsg_len,
+ (size_t)NLMSG_LENGTH(sizeof(struct ifinfomsg)));
return -1;
+ }
/* We are interested in some AF_BRIDGE notifications. */
if (ifi->ifi_family == AF_BRIDGE)
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index 6d164cfdab..7334c8094a 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -772,6 +772,7 @@ int netlink_parse_info(int (*filter)(struct nlmsghdr *, ns_id_t, int),
error = (*filter)(h, zns->ns_id, startup);
if (error < 0) {
zlog_err("%s filter function error", nl->name);
+ zlog_backtrace(LOG_ERR);
ret = error;
}
}
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index a5f288f541..9033491549 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -295,8 +295,12 @@ static int netlink_route_change_read_unicast(struct nlmsghdr *h, ns_id_t ns_id,
}
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct rtmsg));
- if (len < 0)
+ if (len < 0) {
+ zlog_err("%s: Message received from netlink is of a broken size %d %zu",
+ __PRETTY_FUNCTION__, h->nlmsg_len,
+ (size_t)NLMSG_LENGTH(sizeof(struct rtmsg)));
return -1;
+ }
memset(tb, 0, sizeof tb);
netlink_parse_rtattr(tb, RTA_MAX, RTM_RTA(rtm), len);
@@ -747,8 +751,13 @@ int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
return 0;
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct rtmsg));
- if (len < 0)
+ if (len < 0) {
+ zlog_err("%s: Message received from netlink is of a broken size: %d %zu",
+ __PRETTY_FUNCTION__,
+ h->nlmsg_len,
+ (size_t)NLMSG_LENGTH(sizeof(struct rtmsg)));
return -1;
+ }
if (rtm->rtm_type == RTN_MULTICAST)
netlink_route_change_read_multicast(h, ns_id, startup);
@@ -2356,8 +2365,12 @@ int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id)
/* Length validity. */
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct ndmsg));
- if (len < 0)
+ if (len < 0) {
+ zlog_err("%s: Message received from netlink is of a broken size %d %zu",
+ __PRETTY_FUNCTION__, h->nlmsg_len,
+ (size_t)NLMSG_LENGTH(sizeof(struct ndmsg)));
return -1;
+ }
/* Is this a notification for the MAC FDB or IP neighbor table? */
ndm = NLMSG_DATA(h);
diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c
index bcffdf4722..c7a8517e17 100644
--- a/zebra/rule_netlink.c
+++ b/zebra/rule_netlink.c
@@ -196,8 +196,12 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
return 0;
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct fib_rule_hdr));
- if (len < 0)
+ if (len < 0) {
+ zlog_err("%s: Message received from netlink is of a broken size: %d %zu",
+ __PRETTY_FUNCTION__, h->nlmsg_len,
+ (size_t)NLMSG_LENGTH(sizeof(struct fib_rule_hdr)));
return -1;
+ }
frh = NLMSG_DATA(h);
if (frh->family != AF_INET && frh->family != AF_INET6)