summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-10-08 19:07:09 -0400
committerGitHub <noreply@github.com>2017-10-08 19:07:09 -0400
commit40aa03ebded76a14fbbb81c84cd5ffe0ccc3ec8b (patch)
tree3193f0bb83acc44942bc6db6ec307502cd62153e
parent75fc729f053b41b2eb214d376042c65bd2af58e8 (diff)
parent85bbc95dc3f3fafde75277dea079b9c87c227881 (diff)
Merge pull request #1307 from vjardin6WIND/clean
Fix many clang warning
-rw-r--r--bgpd/bgp_filter.c4
-rw-r--r--bgpd/bgp_label.c1
-rw-r--r--bgpd/rfapi/rfapi_import.c16
-rw-r--r--bgpd/rfapi/rfapi_monitor.c2
-rw-r--r--eigrpd/eigrp_filter.c1
-rw-r--r--eigrpd/eigrp_packet.c7
-rw-r--r--isisd/isis_te.c3
-rw-r--r--ldpd/address.c1
-rw-r--r--lib/ptm_lib.c2
-rw-r--r--ospf6d/ospf6_abr.c22
-rw-r--r--ospf6d/ospf6_asbr.c14
-rw-r--r--ospf6d/ospf6_intra.c46
-rw-r--r--ospf6d/ospf6_lsa.c68
-rw-r--r--ospf6d/ospf6_lsa.h29
-rw-r--r--ospfd/ospf_apiserver.c2
-rw-r--r--ospfd/ospf_dump.c1
-rw-r--r--ripngd/ripngd.c2
-rw-r--r--vtysh/vtysh_main.c4
-rw-r--r--zebra/rt_netlink.c2
19 files changed, 145 insertions, 82 deletions
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c
index 6e1a1b6d62..ae9d805b05 100644
--- a/bgpd/bgp_filter.c
+++ b/bgpd/bgp_filter.c
@@ -410,8 +410,8 @@ DEFUN (ip_as_path,
char *regstr;
/* Retrieve access list name */
- char *alname =
- argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
+ argv_find(argv, argc, "WORD", &idx);
+ char *alname = argv[idx]->arg;
/* Check the filter type. */
type = argv_find(argv, argc, "deny", &idx) ? AS_FILTER_DENY
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index ad7411990e..06c314de03 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -225,7 +225,6 @@ int bgp_nlri_parse_label(struct peer *peer, struct attr *attr,
for (; pnt < lim; pnt += psize) {
/* Clear prefix structure. */
memset(&p, 0, sizeof(struct prefix));
- llen = 0;
if (addpath_encoded) {
diff --git a/bgpd/rfapi/rfapi_import.c b/bgpd/rfapi/rfapi_import.c
index d963a759ac..083a549307 100644
--- a/bgpd/rfapi/rfapi_import.c
+++ b/bgpd/rfapi/rfapi_import.c
@@ -3861,6 +3861,20 @@ void rfapiBgpInfoFilteredImportVPN(
VNC_ITRCCK;
}
+static void rfapiBgpInfoFilteredImportBadSafi(
+ struct rfapi_import_table *import_table, int action, struct peer *peer,
+ void *rfd, /* set for looped back routes */
+ struct prefix *p,
+ struct prefix *aux_prefix, /* AFI_L2VPN: optional IP */
+ afi_t afi, struct prefix_rd *prd,
+ struct attr *attr, /* part of bgp_info */
+ u_char type, /* part of bgp_info */
+ u_char sub_type, /* part of bgp_info */
+ uint32_t *label) /* part of bgp_info */
+{
+ vnc_zlog_debug_verbose("%s: Error, bad safi", __func__);
+}
+
static rfapi_bi_filtered_import_f *
rfapiBgpInfoFilteredImportFunction(safi_t safi)
{
@@ -3874,7 +3888,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
default:
/* not expected */
zlog_err("%s: bad safi %d", __func__, safi);
- return NULL;
+ return rfapiBgpInfoFilteredImportBadSafi;
}
}
diff --git a/bgpd/rfapi/rfapi_monitor.c b/bgpd/rfapi/rfapi_monitor.c
index 6a7595443a..47a72d75fd 100644
--- a/bgpd/rfapi/rfapi_monitor.c
+++ b/bgpd/rfapi/rfapi_monitor.c
@@ -1378,6 +1378,8 @@ struct route_node *rfapiMonitorEthAdd(struct bgp *bgp,
#if DEBUG_L2_EXTRA
vnc_zlog_debug_verbose("%s: inserted rfd=%p mon_eth=%p, rc=%d",
__func__, rfd, val, rc);
+#else
+ (void)rc;
#endif
/*
diff --git a/eigrpd/eigrp_filter.c b/eigrpd/eigrp_filter.c
index 7b9e0de525..b74127aa42 100644
--- a/eigrpd/eigrp_filter.c
+++ b/eigrpd/eigrp_filter.c
@@ -187,6 +187,7 @@ void eigrp_distribute_update(struct distribute *dist)
break;
}
}
+ assert(ei != NULL);
/* Access-list for interface in */
if (dist->list[DISTRIBUTE_V4_IN]) {
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index f7bbcba328..83ff194729 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -169,7 +169,7 @@ int eigrp_check_md5_digest(struct stream *s,
struct TLV_MD5_Authentication_Type *auth_TLV;
struct eigrp_header *eigrph;
- if (nbr && ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence)) {
+ if (ntohl(nbr->crypt_seqnum) > ntohl(authTLV->key_sequence)) {
zlog_warn(
"interface %s: eigrp_check_md5 bad sequence %d (expect %d)",
IF_NAME(nbr->ei), ntohl(authTLV->key_sequence),
@@ -317,7 +317,6 @@ int eigrp_write(struct thread *thread)
struct ip iph;
struct msghdr msg;
struct iovec iov[2];
- u_int16_t opcode = 0;
u_int32_t seqno, ack;
int ret;
@@ -363,7 +362,6 @@ int eigrp_write(struct thread *thread)
* this outgoing packet.
*/
eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
- opcode = eigrph->opcode;
seqno = ntohl(eigrph->sequence);
ack = ntohl(eigrph->ack);
if (ep->nbr && (ack != ep->nbr->recv_sequence_number)) {
@@ -427,9 +425,8 @@ int eigrp_write(struct thread *thread)
if (IS_DEBUG_EIGRP_TRANSMIT(0, SEND)) {
eigrph = (struct eigrp_header *)STREAM_DATA(ep->s);
- opcode = eigrph->opcode;
zlog_debug("Sending [%s][%d/%d] to [%s] via [%s] ret [%d].",
- lookup_msg(eigrp_packet_type_str, opcode, NULL),
+ lookup_msg(eigrp_packet_type_str, eigrph->opcode, NULL),
seqno, ack,
inet_ntoa(ep->dst), IF_NAME(ei), ret);
}
diff --git a/isisd/isis_te.c b/isisd/isis_te.c
index 70afef1a86..5a4fe82c91 100644
--- a/isisd/isis_te.c
+++ b/isisd/isis_te.c
@@ -223,6 +223,9 @@ uint8_t add_te_subtlvs(uint8_t *buf, struct mpls_te_circuit *mtc)
tlvs += size;
}
+ /* Add before this line any other parsing of TLV */
+ (void)tlvs;
+
/* Update SubTLVs length */
mtc->length = subtlvs_len(mtc);
diff --git a/ldpd/address.c b/ldpd/address.c
index 12356a0b49..9c1564a31f 100644
--- a/ldpd/address.c
+++ b/ldpd/address.c
@@ -88,6 +88,7 @@ send_address(struct nbr *nbr, int af, struct if_addr_head *addr_list,
err |= gen_msg_hdr(buf, msg_type, size);
size -= LDP_MSG_SIZE;
err |= gen_address_list_tlv(buf, af, addr_list, tlv_addr_count);
+ (void)size;
if (err) {
address_list_clr(addr_list);
ibuf_free(buf);
diff --git a/lib/ptm_lib.c b/lib/ptm_lib.c
index f50d1e2989..e881d49225 100644
--- a/lib/ptm_lib.c
+++ b/lib/ptm_lib.c
@@ -330,7 +330,7 @@ int ptm_lib_process_msg(ptm_lib_handle_t *hdl, int fd, char *inbuf, int inlen,
char client_name[32];
int cmd_id, type, ver, msglen;
csv_t *csv;
- ptm_lib_msg_ctxt_t *p_ctxt;
+ ptm_lib_msg_ctxt_t *p_ctxt = NULL;
len = _ptm_lib_read_ptm_socket(fd, inbuf, PTMLIB_MSG_HDR_LEN);
if (len <= 0)
diff --git a/ospf6d/ospf6_abr.c b/ospf6d/ospf6_abr.c
index 36528d063c..d270b9547e 100644
--- a/ospf6d/ospf6_abr.c
+++ b/ospf6d/ospf6_abr.c
@@ -1110,19 +1110,21 @@ void install_element_ospf6_debug_abr(void)
}
struct ospf6_lsa_handler inter_prefix_handler = {
- OSPF6_LSTYPE_INTER_PREFIX,
- "Inter-Prefix",
- "IAP",
- ospf6_inter_area_prefix_lsa_show,
- ospf6_inter_area_prefix_lsa_get_prefix_str,
+ .lh_type = OSPF6_LSTYPE_INTER_PREFIX,
+ .lh_name = "Inter-Prefix",
+ .lh_short_name = "IAP",
+ .lh_show = ospf6_inter_area_prefix_lsa_show,
+ .lh_get_prefix_str = ospf6_inter_area_prefix_lsa_get_prefix_str,
+ .lh_debug = 0
};
struct ospf6_lsa_handler inter_router_handler = {
- OSPF6_LSTYPE_INTER_ROUTER,
- "Inter-Router",
- "IAR",
- ospf6_inter_area_router_lsa_show,
- ospf6_inter_area_router_lsa_get_prefix_str,
+ .lh_type = OSPF6_LSTYPE_INTER_ROUTER,
+ .lh_name = "Inter-Router",
+ .lh_short_name = "IAR",
+ .lh_show = ospf6_inter_area_router_lsa_show,
+ .lh_get_prefix_str = ospf6_inter_area_router_lsa_get_prefix_str,
+ .lh_debug = 0
};
void ospf6_abr_init(void)
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index de20fbc3ab..c65578c11e 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -438,6 +438,9 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
if (!ospf6_zebra_is_redistribute(type))
return;
+ memset(&troute, 0, sizeof(troute));
+ memset(&tinfo, 0, sizeof(tinfo));
+
if (IS_OSPF6_DEBUG_ASBR) {
prefix2str(prefix, pbuf, sizeof(pbuf));
zlog_debug("Redistribute %s (%s)", pbuf, ZROUTE_NAME(type));
@@ -457,8 +460,6 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
/* apply route-map */
if (ospf6->rmap[type].map) {
- memset(&troute, 0, sizeof(troute));
- memset(&tinfo, 0, sizeof(tinfo));
troute.route_option = &tinfo;
tinfo.ifindex = ifindex;
tinfo.tag = tag;
@@ -1234,8 +1235,13 @@ DEFUN (show_ipv6_ospf6_redistribute,
}
struct ospf6_lsa_handler as_external_handler = {
- OSPF6_LSTYPE_AS_EXTERNAL, "AS-External", "ASE",
- ospf6_as_external_lsa_show, ospf6_as_external_lsa_get_prefix_str};
+ .lh_type = OSPF6_LSTYPE_AS_EXTERNAL,
+ .lh_name = "AS-External",
+ .lh_short_name = "ASE",
+ .lh_show = ospf6_as_external_lsa_show,
+ .lh_get_prefix_str = ospf6_as_external_lsa_get_prefix_str,
+ .lh_debug = 0
+};
void ospf6_asbr_init(void)
{
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index e4644bb09f..a2caeccb86 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -1630,21 +1630,41 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
oa->name);
}
-struct ospf6_lsa_handler router_handler = {OSPF6_LSTYPE_ROUTER, "Router", "Rtr",
- ospf6_router_lsa_show,
- ospf6_router_lsa_get_nbr_id};
-
-struct ospf6_lsa_handler network_handler = {OSPF6_LSTYPE_NETWORK, "Network",
- "Net", ospf6_network_lsa_show,
- ospf6_network_lsa_get_ar_id};
-
-struct ospf6_lsa_handler link_handler = {OSPF6_LSTYPE_LINK, "Link", "Lnk",
- ospf6_link_lsa_show,
- ospf6_link_lsa_get_prefix_str};
+struct ospf6_lsa_handler router_handler = {
+ .lh_type = OSPF6_LSTYPE_ROUTER,
+ .lh_name = "Router",
+ .lh_short_name = "Rtr",
+ .lh_show = ospf6_router_lsa_show,
+ .lh_get_prefix_str = ospf6_router_lsa_get_nbr_id,
+ .lh_debug = 0
+};
+
+struct ospf6_lsa_handler network_handler = {
+ .lh_type = OSPF6_LSTYPE_NETWORK,
+ .lh_name = "Network",
+ .lh_short_name = "Net",
+ .lh_show = ospf6_network_lsa_show,
+ .lh_get_prefix_str = ospf6_network_lsa_get_ar_id,
+ .lh_debug = 0
+};
+
+struct ospf6_lsa_handler link_handler = {
+ .lh_type = OSPF6_LSTYPE_LINK,
+ .lh_name = "Link",
+ .lh_short_name = "Lnk",
+ .lh_show = ospf6_link_lsa_show,
+ .lh_get_prefix_str = ospf6_link_lsa_get_prefix_str,
+ .lh_debug = 0
+};
struct ospf6_lsa_handler intra_prefix_handler = {
- OSPF6_LSTYPE_INTRA_PREFIX, "Intra-Prefix", "INP",
- ospf6_intra_prefix_lsa_show, ospf6_intra_prefix_lsa_get_prefix_str};
+ .lh_type = OSPF6_LSTYPE_INTRA_PREFIX,
+ .lh_name = "Intra-Prefix",
+ .lh_short_name = "INP",
+ .lh_show = ospf6_intra_prefix_lsa_show,
+ .lh_get_prefix_str = ospf6_intra_prefix_lsa_get_prefix_str,
+ .lh_debug = 0
+};
void ospf6_intra_init(void)
{
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index a0dad9344a..82f75b153e 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -68,19 +68,25 @@ static int ospf6_unknown_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
return 0;
}
-struct ospf6_lsa_handler unknown_handler = {
- OSPF6_LSTYPE_UNKNOWN, "Unknown", "Unk", ospf6_unknown_lsa_show, NULL};
+static struct ospf6_lsa_handler unknown_handler = {
+ .lh_type = OSPF6_LSTYPE_UNKNOWN,
+ .lh_name = "Unknown",
+ .lh_short_name = "Unk",
+ .lh_show = ospf6_unknown_lsa_show,
+ .lh_get_prefix_str = NULL,
+ .lh_debug = 0 /* No default debug */
+};
-void ospf6_install_lsa_handler(struct ospf6_lsa_handler *handler)
+void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler)
{
/* type in handler is host byte order */
- int index = handler->type & OSPF6_LSTYPE_FCODE_MASK;
- vector_set_index(ospf6_lsa_handler_vector, index, handler);
+ int index = handler->lh_type & OSPF6_LSTYPE_FCODE_MASK;
+ vector_set_index(ospf6_lsa_handler_vector, index, (void *)handler);
}
-struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type)
+const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type)
{
- struct ospf6_lsa_handler *handler = NULL;
+ const struct ospf6_lsa_handler *handler = NULL;
unsigned int index = ntohs(type) & OSPF6_LSTYPE_FCODE_MASK;
if (index >= vector_active(ospf6_lsa_handler_vector))
@@ -97,11 +103,11 @@ struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type)
const char *ospf6_lstype_name(u_int16_t type)
{
static char buf[8];
- struct ospf6_lsa_handler *handler;
+ const struct ospf6_lsa_handler *handler;
handler = ospf6_get_lsa_handler(type);
if (handler && handler != &unknown_handler)
- return handler->name;
+ return handler->lh_name;
snprintf(buf, sizeof(buf), "0x%04hx", ntohs(type));
return buf;
@@ -110,11 +116,11 @@ const char *ospf6_lstype_name(u_int16_t type)
const char *ospf6_lstype_short_name(u_int16_t type)
{
static char buf[8];
- struct ospf6_lsa_handler *handler;
+ const struct ospf6_lsa_handler *handler;
handler = ospf6_get_lsa_handler(type);
if (handler && handler != &unknown_handler)
- return handler->short_name;
+ return handler->lh_short_name;
snprintf(buf, sizeof(buf), "0x%04hx", ntohs(type));
return buf;
@@ -122,7 +128,7 @@ const char *ospf6_lstype_short_name(u_int16_t type)
u_char ospf6_lstype_debug(u_int16_t type)
{
- struct ospf6_lsa_handler *handler;
+ const struct ospf6_lsa_handler *handler;
handler = ospf6_get_lsa_handler(type);
return handler->debug;
}
@@ -369,7 +375,7 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa)
{
char adv_router[16], id[16];
int type;
- struct ospf6_lsa_handler *handler;
+ const struct ospf6_lsa_handler *handler;
char buf[64], tmpbuf[80];
int cnt = 0;
@@ -389,14 +395,14 @@ void ospf6_lsa_show_summary(struct vty *vty, struct ospf6_lsa *lsa)
ospf6_lstype_short_name(lsa->header->type), id,
adv_router, ospf6_lsa_age_current(lsa),
(u_long)ntohl(lsa->header->seqnum),
- handler->get_prefix_str(lsa, buf, sizeof(buf), 0));
+ handler->lh_get_prefix_str(lsa, buf, sizeof(buf), 0));
} else if (type != OSPF6_LSTYPE_UNKNOWN) {
sprintf(tmpbuf, "%-4s %-15s%-15s%4hu %8lx",
ospf6_lstype_short_name(lsa->header->type), id,
adv_router, ospf6_lsa_age_current(lsa),
(u_long)ntohl(lsa->header->seqnum));
- while (handler->get_prefix_str(lsa, buf, sizeof(buf), cnt)
+ while (handler->lh_get_prefix_str(lsa, buf, sizeof(buf), cnt)
!= NULL) {
vty_out(vty, "%s %30s\n", tmpbuf, buf);
cnt++;
@@ -465,7 +471,7 @@ void ospf6_lsa_show_internal(struct vty *vty, struct ospf6_lsa *lsa)
void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
{
char adv_router[64], id[64];
- struct ospf6_lsa_handler *handler;
+ const struct ospf6_lsa_handler *handler;
struct timeval now, res;
char duration[64];
@@ -490,9 +496,13 @@ void ospf6_lsa_show(struct vty *vty, struct ospf6_lsa *lsa)
vty_out(vty, "Duration: %s\n", duration);
handler = ospf6_get_lsa_handler(lsa->header->type);
- if (handler->show == NULL)
- handler = &unknown_handler;
- (*handler->show)(vty, lsa);
+
+ if (handler->lh_show != NULL)
+ handler->lh_show(vty, lsa);
+ else {
+ assert(unknown_handler.lh_show != NULL);
+ unknown_handler.lh_show(vty, lsa);
+ }
vty_out(vty, "\n");
}
@@ -739,22 +749,22 @@ void ospf6_lsa_terminate(void)
vector_free(ospf6_lsa_handler_vector);
}
-static char *ospf6_lsa_handler_name(struct ospf6_lsa_handler *h)
+static char *ospf6_lsa_handler_name(const struct ospf6_lsa_handler *h)
{
static char buf[64];
unsigned int i;
- unsigned int size = strlen(h->name);
+ unsigned int size = strlen(h->lh_name);
- if (!strcmp(h->name, "unknown") && h->type != OSPF6_LSTYPE_UNKNOWN) {
- snprintf(buf, sizeof(buf), "%#04hx", h->type);
+ if (!strcmp(h->lh_name, "unknown") && h->lh_type != OSPF6_LSTYPE_UNKNOWN) {
+ snprintf(buf, sizeof(buf), "%#04hx", h->lh_type);
return buf;
}
for (i = 0; i < MIN(size, sizeof(buf)); i++) {
- if (!islower((unsigned char)h->name[i]))
- buf[i] = tolower((unsigned char)h->name[i]);
+ if (!islower((unsigned char)h->lh_name[i]))
+ buf[i] = tolower((unsigned char)h->lh_name[i]);
else
- buf[i] = h->name[i];
+ buf[i] = h->lh_name[i];
}
buf[size] = '\0';
return buf;
@@ -791,7 +801,7 @@ DEFUN (debug_ospf6_lsa_type,
strlen(argv[idx_lsa]->arg))
== 0)
break;
- if (!strcasecmp(argv[idx_lsa]->arg, handler->name))
+ if (!strcasecmp(argv[idx_lsa]->arg, handler->lh_name))
break;
handler = NULL;
}
@@ -844,7 +854,7 @@ DEFUN (no_debug_ospf6_lsa_type,
strlen(argv[idx_lsa]->arg))
== 0)
break;
- if (!strcasecmp(argv[idx_lsa]->arg, handler->name))
+ if (!strcasecmp(argv[idx_lsa]->arg, handler->lh_name))
break;
}
@@ -875,7 +885,7 @@ void install_element_ospf6_debug_lsa(void)
int config_write_ospf6_debug_lsa(struct vty *vty)
{
u_int i;
- struct ospf6_lsa_handler *handler;
+ const struct ospf6_lsa_handler *handler;
for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) {
handler = vector_slot(ospf6_lsa_handler_vector, i);
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index ef63429fdf..8b6303d23c 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -137,18 +137,25 @@ struct ospf6_lsa {
#define OSPF6_LSA_SEQWRAPPED 0x20
struct ospf6_lsa_handler {
- u_int16_t type; /* host byte order */
- const char *name;
- const char *short_name;
- int (*show)(struct vty *, struct ospf6_lsa *);
- char *(*get_prefix_str)(struct ospf6_lsa *, char *buf, int buflen,
- int pos);
+ const struct {
+ u_int16_t type; /* host byte order */
+ const char *name;
+ const char *short_name;
+ int (*show)(struct vty *, struct ospf6_lsa *);
+ char *(*get_prefix_str)(struct ospf6_lsa *, char *buf, int buflen,
+ int pos);
+ } s;
+#define lh_type s.type
+#define lh_name s.name
+#define lh_short_name s.short_name
+#define lh_show s.show
+#define lh_get_prefix_str s.get_prefix_str
u_char debug;
+#define lh_debug debug
};
-extern struct ospf6_lsa_handler unknown_handler;
-#define OSPF6_LSA_IS_KNOWN(type) \
- (ospf6_get_lsa_handler(type) != &unknown_handler ? 1 : 0)
+#define OSPF6_LSA_IS_KNOWN(t) \
+ (ospf6_get_lsa_handler(t).lh_type != OSPF6_LSTYPE_UNKNOWN ? 1 : 0)
extern vector ospf6_lsa_handler_vector;
@@ -237,8 +244,8 @@ extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *);
extern int ospf6_lsa_prohibited_duration(u_int16_t type, u_int32_t id,
u_int32_t adv_router, void *scope);
-extern void ospf6_install_lsa_handler(struct ospf6_lsa_handler *handler);
-extern struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type);
+extern void ospf6_install_lsa_handler(const struct ospf6_lsa_handler *handler);
+extern const struct ospf6_lsa_handler *ospf6_get_lsa_handler(u_int16_t type);
extern void ospf6_lsa_init(void);
extern void ospf6_lsa_terminate(void);
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index c1485abb81..8c1ad5ff0c 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -2322,7 +2322,7 @@ void ospf_apiserver_clients_notify_nsm_change(struct ospf_neighbor *nbr)
{
struct msg *msg;
struct in_addr ifaddr = {.s_addr = 0L};
- struct in_addr nbraddr = {.s_addr = 0L};
+ struct in_addr nbraddr;
assert(nbr);
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index eca0f85f57..5933f5abfe 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -169,6 +169,7 @@ const char *ospf_timeval_dump(struct timeval *t, char *buf, size_t size)
if (us >= 1000) {
ms = us / 1000;
us %= 1000;
+ (void)us; /* unused */
}
if (ms >= 1000) {
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 0bee9a8bf4..4df1aafe5d 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2010,7 +2010,7 @@ DEFUN (show_ipv6_ripng,
len = 28 - len;
if (len > 0)
- len = vty_out(vty, "%*s", len, " ");
+ vty_out(vty, "%*s", len, " ");
/* from */
if ((rinfo->type == ZEBRA_ROUTE_RIPNG)
diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c
index 99c05ef79b..8509a8a05a 100644
--- a/vtysh/vtysh_main.c
+++ b/vtysh/vtysh_main.c
@@ -451,7 +451,7 @@ int main(int argc, char **argv, char **env)
exit(ret);
}
- if (dryrun && cmd) {
+ if (dryrun && cmd && cmd->line) {
vtysh_execute("enable");
while (cmd) {
struct cmd_rec *cr;
@@ -552,7 +552,7 @@ int main(int argc, char **argv, char **env)
}
/* If eval mode. */
- if (cmd) {
+ if (cmd && cmd->line) {
/* Enter into enable node. */
vtysh_execute("enable");
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 573f60f4ca..0352dbd7e3 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -267,7 +267,7 @@ static int netlink_route_change_read_unicast(struct sockaddr_nl *snl,
struct rtattr *tb[RTA_MAX + 1];
u_char flags = 0;
struct prefix p;
- struct prefix_ipv6 src_p;
+ struct prefix_ipv6 src_p = {};
vrf_id_t vrf_id = VRF_DEFAULT;
char anyaddr[16] = {0};