summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
authorAndrew Certain <certain@amazon.com>2012-12-04 13:43:42 -0800
committerScott Feldman <sfeldma@cumulusnetworks.com>2013-01-07 09:59:59 -0800
commit0798cee34f5c436cd2a4b6e1d9a1ca90eee94292 (patch)
tree1b2293b711a12d743a0cd814235589bc4ce8d84f /ospfd
parentde54b26caca7442af29656282e753b02aac6f093 (diff)
ospfd: compile warning cleanups
A set of patches to clarify some comments as well as cleanup code that was causing warnings. After these patches, the code can be compiled with -Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual -Wextra -Wno-unused-parameter -Wno-missing-field-initializers (what is current in trunk plus -Wextra -Wno-unused-parameter -Wno-missing-field-initializers). Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_apiserver.c5
-rw-r--r--ospfd/ospf_ism.c5
-rw-r--r--ospfd/ospf_lsa.c4
-rw-r--r--ospfd/ospf_lsa.h1
-rw-r--r--ospfd/ospf_network.c8
-rw-r--r--ospfd/ospf_network.h2
-rw-r--r--ospfd/ospf_nsm.c5
-rw-r--r--ospfd/ospf_opaque.c12
-rw-r--r--ospfd/ospf_packet.c2
-rw-r--r--ospfd/ospf_vty.c10
-rw-r--r--ospfd/ospf_zebra.c9
-rw-r--r--ospfd/ospf_zebra.h2
-rw-r--r--ospfd/ospfd.c2
-rw-r--r--ospfd/ospfd.h2
14 files changed, 31 insertions, 38 deletions
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index 84d70ccc..db1ccda7 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -299,13 +299,10 @@ void
ospf_apiserver_event (enum event event, int fd,
struct ospf_apiserver *apiserv)
{
- struct thread *apiserver_serv_thread;
-
switch (event)
{
case OSPF_APISERVER_ACCEPT:
- apiserver_serv_thread =
- thread_add_read (master, ospf_apiserver_accept, apiserv, fd);
+ (void)thread_add_read (master, ospf_apiserver_accept, apiserv, fd);
break;
case OSPF_APISERVER_SYNC_READ:
apiserv->t_sync_read =
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index db53882d..fa7d97f2 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -203,7 +203,6 @@ ospf_dr_election (struct ospf_interface *oi)
struct in_addr old_dr, old_bdr;
int old_state, new_state;
struct list *el_list;
- struct ospf_neighbor *dr, *bdr;
/* backup current values. */
old_dr = DR (oi);
@@ -216,8 +215,8 @@ ospf_dr_election (struct ospf_interface *oi)
ospf_dr_eligible_routers (oi->nbrs, el_list);
/* First election of DR and BDR. */
- bdr = ospf_elect_bdr (oi, el_list);
- dr = ospf_elect_dr (oi, el_list);
+ ospf_elect_bdr (oi, el_list);
+ ospf_elect_dr (oi, el_list);
new_state = ospf_ism_state (oi);
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index fb55f7ff..4f7fb00a 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -2733,7 +2733,9 @@ ospf_lsa_install (struct ospf *ospf, struct ospf_interface *oi,
if (IS_LSA_SELF (lsa))
lsa->oi = oi; /* Specify outgoing ospf-interface for this LSA. */
else
- ; /* Incoming "oi" for this LSA has set at LSUpd reception. */
+ {
+ /* Incoming "oi" for this LSA has set at LSUpd reception. */
+ }
/* Fallthrough */
case OSPF_OPAQUE_AREA_LSA:
case OSPF_OPAQUE_AS_LSA:
diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h
index 6c95ff17..9ff2d920 100644
--- a/ospfd/ospf_lsa.h
+++ b/ospfd/ospf_lsa.h
@@ -243,6 +243,7 @@ extern int tv_cmp (struct timeval, struct timeval);
extern int get_age (struct ospf_lsa *);
extern u_int16_t ospf_lsa_checksum (struct lsa_header *);
+extern int ospf_lsa_checksum_valid (struct lsa_header *);
extern int ospf_lsa_refresh_delay (struct ospf_lsa *);
extern const char *dump_lsa_key (struct ospf_lsa *);
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index 3e326a8c..900a5667 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -228,7 +228,7 @@ ospf_sock_init (void)
}
void
-ospf_adjust_sndbuflen (struct ospf * ospf, int buflen)
+ospf_adjust_sndbuflen (struct ospf * ospf, unsigned int buflen)
{
int ret, newbuflen;
/* Check if any work has to be done at all. */
@@ -249,11 +249,11 @@ ospf_adjust_sndbuflen (struct ospf * ospf, int buflen)
*/
ret = setsockopt_so_sendbuf (ospf->fd, buflen);
newbuflen = getsockopt_so_sendbuf (ospf->fd);
- if (ret < 0 || newbuflen < buflen)
- zlog_warn ("%s: tried to set SO_SNDBUF to %d, but got %d",
+ if (ret < 0 || newbuflen < 0 || newbuflen < (int) buflen)
+ zlog_warn ("%s: tried to set SO_SNDBUF to %u, but got %d",
__func__, buflen, newbuflen);
if (newbuflen >= 0)
- ospf->maxsndbuflen = newbuflen;
+ ospf->maxsndbuflen = (unsigned int)newbuflen;
else
zlog_warn ("%s: failed to get SO_SNDBUF", __func__);
if (ospfd_privs.change (ZPRIVS_LOWER))
diff --git a/ospfd/ospf_network.h b/ospfd/ospf_network.h
index f6909912..e0a5c69d 100644
--- a/ospfd/ospf_network.h
+++ b/ospfd/ospf_network.h
@@ -34,6 +34,6 @@ extern int ospf_if_drop_alldrouters (struct ospf *, struct prefix *,
unsigned int);
extern int ospf_if_ipmulticast (struct ospf *, struct prefix *, unsigned int);
extern int ospf_sock_init (void);
-extern void ospf_adjust_sndbuflen (struct ospf *, int);
+extern void ospf_adjust_sndbuflen (struct ospf *, unsigned int);
#endif /* _ZEBRA_OSPF_NETWORK_H */
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index 436896c2..fe4ddf5b 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -72,14 +72,11 @@ ospf_inactivity_timer (struct thread *thread)
static int
ospf_db_desc_timer (struct thread *thread)
{
- struct ospf_interface *oi;
struct ospf_neighbor *nbr;
nbr = THREAD_ARG (thread);
nbr->t_db_desc = NULL;
- oi = nbr->oi;
-
if (IS_DEBUG_OSPF (nsm, NSM_TIMERS))
zlog (NULL, LOG_DEBUG, "NSM[%s:%s]: Timer (DD Retransmit timer expire)",
IF_NAME (nbr->oi), inet_ntoa (nbr->src));
@@ -787,11 +784,9 @@ ospf_nsm_event (struct thread *thread)
int event;
int next_state;
struct ospf_neighbor *nbr;
- struct in_addr router_id;
nbr = THREAD_ARG (thread);
event = THREAD_VAL (thread);
- router_id = nbr->router_id;
if (IS_DEBUG_OSPF (nsm, NSM_EVENTS))
zlog_debug ("NSM[%s:%s]: %s (%s)", IF_NAME (nbr->oi),
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index aa126e19..744952c9 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -223,9 +223,15 @@ ospf_opaque_type_name (u_char opaque_type)
default:
if (OPAQUE_TYPE_RANGE_UNASSIGNED (opaque_type))
name = "Unassigned";
- /* XXX warning: comparison is always true due to limited range of data type */
- else if (OPAQUE_TYPE_RANGE_RESERVED (opaque_type))
- name = "Private/Experimental";
+ else
+ {
+ u_int32_t bigger_range = opaque_type;
+ /*
+ * Get around type-limits warning: comparison is always true due to limited range of data type
+ */
+ if (OPAQUE_TYPE_RANGE_RESERVED (bigger_range))
+ name = "Private/Experimental";
+ }
break;
}
return name;
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index a51db246..9a4587d9 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -1764,7 +1764,7 @@ ospf_ls_upd (struct ip *iph, struct ospf_header *ospfh,
/* Process each LSA received in the one packet.
*
* Numbers in parentheses, e.g. (1), (2), etc., and the corresponding
- * text below are from the stepsin RFC 2328, Section 13.
+ * text below are from the steps in RFC 2328, Section 13.
*/
for (ALL_LIST_ELEMENTS (lsas, node, nnode, lsa))
{
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 45ddc5c4..2ba8188c 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -1742,12 +1742,11 @@ DEFUN (no_ospf_area_default_cost,
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
- u_int32_t cost;
int format;
struct prefix_ipv4 p;
VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
- VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
+ VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[1], 0, OSPF_LS_INFINITY);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
@@ -1933,7 +1932,6 @@ DEFUN (no_ospf_area_filter_list,
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
- struct prefix_list *plist;
int format;
VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
@@ -1941,7 +1939,6 @@ DEFUN (no_ospf_area_filter_list,
if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL)
return CMD_SUCCESS;
- plist = prefix_list_lookup (AFI_IP, argv[1]);
if (strncmp (argv[2], "in", 2) == 0)
{
if (PREFIX_NAME_IN (area))
@@ -2394,11 +2391,10 @@ DEFUN (no_ospf_neighbor,
{
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
- int ret;
VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
- ret = ospf_nbr_nbma_unset (ospf, nbr_addr);
+ (void)ospf_nbr_nbma_unset (ospf, nbr_addr);
return CMD_SUCCESS;
}
@@ -5408,7 +5404,7 @@ DEFUN (ip_ospf_priority,
"Address of interface")
{
struct interface *ifp = vty->index;
- u_int32_t priority;
+ long priority;
struct route_node *rn;
struct in_addr addr;
int ret;
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index f5f49f64..34a3b2a7 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -133,8 +133,8 @@ ospf_interface_delete (int command, struct zclient *zclient,
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
zlog_debug
- ("Zebra: interface delete %s index %d flags %lld metric %d mtu %d",
- ifp->name, ifp->ifindex, ifp->flags, ifp->metric, ifp->mtu);
+ ("Zebra: interface delete %s index %d flags %llx metric %d mtu %d",
+ ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
#ifdef HAVE_SNMP
ospf_snmp_if_delete (ifp);
@@ -1004,7 +1004,7 @@ ospf_distribute_list_update_timer (struct thread *thread)
/* Update distribute-list and set timer to apply access-list. */
void
-ospf_distribute_list_update (struct ospf *ospf, int type)
+ospf_distribute_list_update (struct ospf *ospf, uintptr_t type)
{
struct route_table *rt;
@@ -1217,7 +1217,6 @@ ospf_distance_unset (struct vty *vty, struct ospf *ospf,
{
int ret;
struct prefix_ipv4 p;
- u_char distance;
struct route_node *rn;
struct ospf_distance *odistance;
@@ -1228,8 +1227,6 @@ ospf_distance_unset (struct vty *vty, struct ospf *ospf,
return CMD_WARNING;
}
- distance = atoi (distance_str);
-
rn = route_node_lookup (ospf->distance_table, (struct prefix *) &p);
if (!rn)
{
diff --git a/ospfd/ospf_zebra.h b/ospfd/ospf_zebra.h
index fbb34442..148f6520 100644
--- a/ospfd/ospf_zebra.h
+++ b/ospfd/ospf_zebra.h
@@ -54,7 +54,7 @@ extern int ospf_redistribute_check (struct ospf *, struct external_info *,
int *);
extern int ospf_distribute_check_connected (struct ospf *,
struct external_info *);
-extern void ospf_distribute_list_update (struct ospf *, int);
+extern void ospf_distribute_list_update (struct ospf *, uintptr_t);
extern int ospf_is_type_redistributed (int);
extern void ospf_distance_reset (struct ospf *);
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index d1de29d5..3e2b2348 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -223,7 +223,7 @@ ospf_new (void)
}
new->maxsndbuflen = getsockopt_so_sendbuf (new->fd);
if (IS_DEBUG_OSPF (zebra, ZEBRA_INTERFACE))
- zlog_debug ("%s: starting with OSPF send buffer size %d",
+ zlog_debug ("%s: starting with OSPF send buffer size %u",
__func__, new->maxsndbuflen);
if ((new->ibuf = stream_new(OSPF_MAX_PACKET_SIZE+1)) == NULL)
{
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index cc27f66e..fb57bf51 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -273,7 +273,7 @@ struct ospf
struct thread *t_write;
struct thread *t_read;
int fd;
- int maxsndbuflen;
+ unsigned int maxsndbuflen;
struct stream *ibuf;
struct list *oi_write_q;