summaryrefslogtreecommitdiff
path: root/proto/ospf
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-10-14 15:37:04 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-11-01 14:52:54 +0100
commit3e236955c9369475872b9b86a58502fa777b50b9 (patch)
treed43b519c2289a353e56c32b42c402f9fa12d0e13 /proto/ospf
parent17fe57d8dcc89aea520788914b252cf49cf060ff (diff)
Build: switch on -Wextra, get rid of most of the warnings
There are several unresolved -Wmissing-field-initializers on older versions of GCC than 5.1, all of them false positive.
Diffstat (limited to 'proto/ospf')
-rw-r--r--proto/ospf/dbdes.c2
-rw-r--r--proto/ospf/hello.c5
-rw-r--r--proto/ospf/lsalib.c2
-rw-r--r--proto/ospf/lsalib.h2
-rw-r--r--proto/ospf/lsupd.c6
-rw-r--r--proto/ospf/neighbor.c2
-rw-r--r--proto/ospf/ospf.h8
-rw-r--r--proto/ospf/packet.c4
-rw-r--r--proto/ospf/rt.c2
-rw-r--r--proto/ospf/topology.c8
10 files changed, 22 insertions, 19 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c
index 195b03ad..d6904343 100644
--- a/proto/ospf/dbdes.c
+++ b/proto/ospf/dbdes.c
@@ -39,7 +39,7 @@ struct ospf_dbdes3_packet
static inline uint
-ospf_dbdes_hdrlen(struct ospf_proto *p)
+ospf_dbdes_hdrlen(struct ospf_proto *p UNUSED4 UNUSED6)
{
return ospf_is_v2(p) ?
sizeof(struct ospf_dbdes2_packet) : sizeof(struct ospf_dbdes3_packet);
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index 50cf1407..e00487dc 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -222,9 +222,12 @@ ospf_receive_hello(struct ospf_packet *pkt, struct ospf_iface *ifa,
rcv_priority = ps->priority;
int pxlen = u32_masklen(ntohl(ps->netmask));
+ if (pxlen < 0)
+ DROP("prefix garbled", ntohl(ps->netmask));
+
if ((ifa->type != OSPF_IT_VLINK) &&
(ifa->type != OSPF_IT_PTP) &&
- (pxlen != ifa->addr->pxlen))
+ ((uint) pxlen != ifa->addr->pxlen))
DROP("prefix length mismatch", pxlen);
neighbors = ps->neighbors;
diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c
index 1bbd1372..cb7b186a 100644
--- a/proto/ospf/lsalib.c
+++ b/proto/ospf/lsalib.c
@@ -463,7 +463,7 @@ lsa_validate_sum3_net(struct ospf_lsa_header *lsa, struct ospf_lsa_sum3_net *bod
}
static int
-lsa_validate_sum3_rt(struct ospf_lsa_header *lsa, struct ospf_lsa_sum3_rt *body)
+lsa_validate_sum3_rt(struct ospf_lsa_header *lsa, struct ospf_lsa_sum3_rt *body UNUSED)
{
if (lsa->length != (HDRLEN + sizeof(struct ospf_lsa_sum3_rt)))
return 0;
diff --git a/proto/ospf/lsalib.h b/proto/ospf/lsalib.h
index ae6af044..638b3525 100644
--- a/proto/ospf/lsalib.h
+++ b/proto/ospf/lsalib.h
@@ -41,7 +41,7 @@ void lsa_get_type_domain_(u32 itype, struct ospf_iface *ifa, u32 *otype, u32 *do
static inline void lsa_get_type_domain(struct ospf_lsa_header *lsa, struct ospf_iface *ifa, u32 *otype, u32 *domain)
{ lsa_get_type_domain_(lsa->type_raw, ifa, otype, domain); }
-static inline u32 lsa_get_etype(struct ospf_lsa_header *h, struct ospf_proto *p)
+static inline u32 lsa_get_etype(struct ospf_lsa_header *h, struct ospf_proto *p UNUSED4 UNUSED6)
{ return ospf_is_v2(p) ? (h->type_raw & LSA_T_V2_MASK) : h->type_raw; }
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c
index c6a734ca..157d9628 100644
--- a/proto/ospf/lsupd.c
+++ b/proto/ospf/lsupd.c
@@ -105,7 +105,7 @@ invalid:
static inline void
-ospf_lsa_lsrq_down(struct top_hash_entry *req, struct ospf_neighbor *n, struct ospf_neighbor *from)
+ospf_lsa_lsrq_down(struct top_hash_entry *req, struct ospf_neighbor *n)
{
if (req == n->lsrqi)
n->lsrqi = SNODE_NEXT(req);
@@ -188,7 +188,7 @@ ospf_enqueue_lsa(struct ospf_proto *p, struct top_hash_entry *en, struct ospf_if
{
/* If we already have full queue, we send some packets */
uint sent = ospf_flood_lsupd(p, ifa->flood_queue, ifa->flood_queue_used, ifa->flood_queue_used / 2, ifa);
- int i;
+ uint i;
for (i = 0; i < sent; i++)
ifa->flood_queue[i]->ret_count--;
@@ -275,7 +275,7 @@ ospf_flood_lsa(struct ospf_proto *p, struct top_hash_entry *en, struct ospf_neig
/* If same or newer, remove LSA from the link state request list */
if (cmp > CMP_OLDER)
- ospf_lsa_lsrq_down(req, n, from);
+ ospf_lsa_lsrq_down(req, n);
/* If older or same, skip processing of this neighbor */
if (cmp < CMP_NEWER)
diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c
index 0223ccdf..9fe3c028 100644
--- a/proto/ospf/neighbor.c
+++ b/proto/ospf/neighbor.c
@@ -359,7 +359,7 @@ can_do_adj(struct ospf_neighbor *n)
}
-static inline u32 neigh_get_id(struct ospf_proto *p, struct ospf_neighbor *n)
+static inline u32 neigh_get_id(struct ospf_proto *p UNUSED4 UNUSED6, struct ospf_neighbor *n)
{ return ospf_is_v2(p) ? ipa_to_u32(n->ip) : n->rid; }
static struct ospf_neighbor *
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index a4e525ec..ca30e4e0 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -766,7 +766,7 @@ lsa_get_ipv6_addr(u32 *buf, ip_addr *addr)
}
static inline u32 *
-put_ipv6_prefix(u32 *buf, ip_addr addr, u8 pxlen, u8 pxopts, u16 lh)
+put_ipv6_prefix(u32 *buf, ip_addr addr UNUSED4, u8 pxlen UNUSED4, u8 pxopts UNUSED4, u16 lh UNUSED4)
{
#ifdef IPV6
*buf++ = ((pxlen << 24) | (pxopts << 16) | lh);
@@ -840,7 +840,7 @@ static inline int ospf_is_v2(struct ospf_proto *p)
static inline int ospf_is_v3(struct ospf_proto *p)
{ return ! p->ospf2; }
*/
-static inline int ospf_get_version(struct ospf_proto *p)
+static inline int ospf_get_version(struct ospf_proto *p UNUSED4 UNUSED6)
{ return ospf_is_v2(p) ? 2 : 3; }
struct ospf_area *ospf_find_area(struct ospf_proto *p, u32 aid);
@@ -897,7 +897,7 @@ void ospf_sh_neigh_info(struct ospf_neighbor *n);
/* packet.c */
void ospf_pkt_fill_hdr(struct ospf_iface *ifa, void *buf, u8 h_type);
uint ospf_pkt_maxsize(struct ospf_iface *ifa);
-int ospf_rx_hook(sock * sk, int size);
+int ospf_rx_hook(sock * sk, uint size);
// void ospf_tx_hook(sock * sk);
void ospf_err_hook(sock * sk, int err);
void ospf_verr_hook(sock *sk, int err);
@@ -922,7 +922,7 @@ static inline void ospf_send_to_des(struct ospf_iface *ifa)
#define SKIP(DSC) do { err_dsc = DSC; goto skip; } while(0)
#endif
-static inline uint ospf_pkt_hdrlen(struct ospf_proto *p)
+static inline uint ospf_pkt_hdrlen(struct ospf_proto *p UNUSED4 UNUSED6)
{ return ospf_is_v2(p) ? (sizeof(struct ospf_packet) + sizeof(union ospf_auth)) : sizeof(struct ospf_packet); }
static inline void * ospf_tx_buffer(struct ospf_iface *ifa)
diff --git a/proto/ospf/packet.c b/proto/ospf/packet.c
index 04f0d47c..aa90aa51 100644
--- a/proto/ospf/packet.c
+++ b/proto/ospf/packet.c
@@ -124,7 +124,7 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt)
/* We assume OSPFv2 in ospf_pkt_checkauth() */
static int
-ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_packet *pkt, int len)
+ospf_pkt_checkauth(struct ospf_neighbor *n, struct ospf_iface *ifa, struct ospf_packet *pkt, uint len)
{
struct ospf_proto *p = ifa->oa->po;
union ospf_auth *auth = (void *) (pkt + 1);
@@ -214,7 +214,7 @@ drop:
* non generic functions.
*/
int
-ospf_rx_hook(sock *sk, int len)
+ospf_rx_hook(sock *sk, uint len)
{
/* We want just packets from sk->iface. Unfortunately, on BSD we cannot filter
out other packets at kernel level and we receive all packets on all sockets */
diff --git a/proto/ospf/rt.c b/proto/ospf/rt.c
index cdf8012a..8b3feda9 100644
--- a/proto/ospf/rt.c
+++ b/proto/ospf/rt.c
@@ -1049,7 +1049,7 @@ check_sum_rt_lsa(struct ospf_proto *p, ort *nf)
}
static inline int
-decide_nssa_lsa(struct ospf_proto *p, ort *nf, struct ospf_lsa_ext_local *rt)
+decide_nssa_lsa(struct ospf_proto *p UNUSED4 UNUSED6, ort *nf, struct ospf_lsa_ext_local *rt)
{
struct ospf_area *oa = nf->n.oa;
struct top_hash_entry *en = nf->n.en;
diff --git a/proto/ospf/topology.c b/proto/ospf/topology.c
index 7558d4a0..341eff87 100644
--- a/proto/ospf/topology.c
+++ b/proto/ospf/topology.c
@@ -515,7 +515,7 @@ ospf_update_lsadb(struct ospf_proto *p)
static inline u32
-ort_to_lsaid(struct ospf_proto *p, ort *nf)
+ort_to_lsaid(struct ospf_proto *p UNUSED4 UNUSED6, ort *nf)
{
/*
* In OSPFv2, We have to map IP prefixes to u32 in such manner that resulting
@@ -607,7 +607,7 @@ lsab_offset(struct ospf_proto *p, uint offset)
return ((byte *) p->lsab) + offset;
}
-static inline void *
+static inline void * UNUSED
lsab_end(struct ospf_proto *p)
{
return ((byte *) p->lsab) + p->lsab_used;
@@ -1545,7 +1545,7 @@ static void
add_link_lsa(struct ospf_proto *p, struct ospf_lsa_link *ll, int offset, int *pxc)
{
u32 *pxb = ll->rest;
- int j;
+ uint j;
for (j = 0; j < ll->pxcount; pxb = prefix_advance(pxb), j++)
{
@@ -1748,7 +1748,7 @@ ospf_top_hash(struct top_graph *f, u32 domain, u32 lsaid, u32 rtrid, u32 type)
* and request lists of OSPF neighbors.
*/
struct top_graph *
-ospf_top_new(struct ospf_proto *p, pool *pool)
+ospf_top_new(struct ospf_proto *p UNUSED4 UNUSED6, pool *pool)
{
struct top_graph *f;