summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2015-04-23 13:31:17 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2015-04-23 13:36:08 +0200
commitdc684eb9976f8a1170312be42d142effce26b568 (patch)
tree1d1354118bc0b063e7048c86154339aa2f141d1c /bgpd
parent06bd420d4646333bc7ed9964e348f19a942fcfe2 (diff)
parente691c3bb972c0baf610d9e210ce20ea6546e1de0 (diff)
downloadquagga-dc684eb9976f8a1170312be42d142effce26b568.tar.bz2
quagga-dc684eb9976f8a1170312be42d142effce26b568.tar.xz
Merge branch 'volatile/fix_warnings'
Thanks to Donald Sharp and Greg Troxel for providing feedback! Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/Makefile.am2
-rw-r--r--bgpd/bgp_aspath.c4
-rw-r--r--bgpd/bgp_attr.c1
-rw-r--r--bgpd/bgp_damp.c10
-rw-r--r--bgpd/bgp_ecommunity.c4
-rw-r--r--bgpd/bgp_route.c64
-rw-r--r--bgpd/bgp_routemap.c14
-rw-r--r--bgpd/bgp_snmp.c38
-rw-r--r--bgpd/bgp_table.h2
-rw-r--r--bgpd/bgp_vty.c2
10 files changed, 43 insertions, 98 deletions
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index 42f1f488..92fa10cd 100644
--- a/bgpd/Makefile.am
+++ b/bgpd/Makefile.am
@@ -4,7 +4,7 @@ AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
-AM_CFLAGS = $(PICFLAGS)
+AM_CFLAGS = $(PICFLAGS) $(WERROR)
AM_LDFLAGS = $(PILDFLAGS)
noinst_LIBRARIES = libbgp.a
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index cfa9bc14..0aec3ef1 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -1378,7 +1378,7 @@ static struct aspath *
aspath_add_asns (struct aspath *aspath, as_t asno, u_char type, unsigned num)
{
struct assegment *assegment = aspath->segments;
- int i;
+ unsigned i;
if (assegment && assegment->type == type)
{
@@ -1913,7 +1913,7 @@ aspath_show_all_iterator (struct hash_backet *backet, struct vty *vty)
as = (struct aspath *) backet->data;
- vty_out (vty, "[%p:%u] (%ld) ", backet, backet->key, as->refcnt);
+ vty_out (vty, "[%p:%u] (%ld) ", (void *)backet, backet->key, as->refcnt);
vty_out (vty, "%s%s", as->str, VTY_NEWLINE);
}
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index be316daa..5c832edc 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -72,7 +72,6 @@ static const struct message attr_flag_str[] =
/* bgp_attr_flags_diagnose() relies on this bit being last in this list */
{ BGP_ATTR_FLAG_EXTLEN, "Extended Length" },
};
-static const size_t attr_flag_str_max = array_size(attr_flag_str);
static struct hash *cluster_hash;
diff --git a/bgpd/bgp_damp.c b/bgpd/bgp_damp.c
index dd6c759f..05c30ff0 100644
--- a/bgpd/bgp_damp.c
+++ b/bgpd/bgp_damp.c
@@ -529,15 +529,15 @@ bgp_config_write_damp (struct vty *vty)
&& bgp_damp_cfg.reuse_limit == DEFAULT_REUSE
&& bgp_damp_cfg.suppress_value == DEFAULT_SUPPRESS
&& bgp_damp_cfg.max_suppress_time == bgp_damp_cfg.half_life*4)
- vty_out (vty, " bgp dampening %ld%s",
- bgp_damp_cfg.half_life/60,
+ vty_out (vty, " bgp dampening %lld%s",
+ bgp_damp_cfg.half_life/60LL,
VTY_NEWLINE);
else
- vty_out (vty, " bgp dampening %ld %d %d %ld%s",
- bgp_damp_cfg.half_life/60,
+ vty_out (vty, " bgp dampening %lld %d %d %lld%s",
+ bgp_damp_cfg.half_life/60LL,
bgp_damp_cfg.reuse_limit,
bgp_damp_cfg.suppress_value,
- bgp_damp_cfg.max_suppress_time/60,
+ bgp_damp_cfg.max_suppress_time/60LL,
VTY_NEWLINE);
}
diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c
index 482e76b7..04957d41 100644
--- a/bgpd/bgp_ecommunity.c
+++ b/bgpd/bgp_ecommunity.c
@@ -281,10 +281,10 @@ ecommunity_finish (void)
/* Extended Communities token enum. */
enum ecommunity_token
{
+ ecommunity_token_unknown = 0,
ecommunity_token_rt,
ecommunity_token_soo,
ecommunity_token_val,
- ecommunity_token_unknown
};
/* Get next Extended Communities token from the string. */
@@ -511,7 +511,7 @@ struct ecommunity *
ecommunity_str2com (const char *str, int type, int keyword_included)
{
struct ecommunity *ecom = NULL;
- enum ecommunity_token token;
+ enum ecommunity_token token = ecommunity_token_unknown;
struct ecommunity_val eval;
int keyword = 0;
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index f84a72dc..34cb7c0c 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1666,9 +1666,10 @@ bgp_process_queue_init (void)
bm->process_main_queue->spec.max_retries = 0;
bm->process_main_queue->spec.hold = 50;
- memcpy (bm->process_rsclient_queue, bm->process_main_queue,
- sizeof (struct work_queue *));
bm->process_rsclient_queue->spec.workfunc = &bgp_process_rsclient;
+ bm->process_rsclient_queue->spec.del_item_data = &bgp_processq_del;
+ bm->process_rsclient_queue->spec.max_retries = 0;
+ bm->process_rsclient_queue->spec.hold = 50;
}
void
@@ -7905,19 +7906,13 @@ ALIAS (show_ip_bgp_ipv4_community,
DEFUN (show_bgp_view_afi_safi_community_all,
show_bgp_view_afi_safi_community_all_cmd,
-#ifdef HAVE_IPV6
"show bgp view WORD (ipv4|ipv6) (unicast|multicast) community",
-#else
- "show bgp view WORD ipv4 (unicast|multicast) community",
-#endif
SHOW_STR
BGP_STR
"BGP view\n"
"View name\n"
"Address family\n"
-#ifdef HAVE_IPV6
"Address family\n"
-#endif
"Address Family modifier\n"
"Address Family modifier\n"
"Display routes matching the communities\n")
@@ -7934,31 +7929,20 @@ DEFUN (show_bgp_view_afi_safi_community_all,
return CMD_WARNING;
}
-#ifdef HAVE_IPV6
afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
-#else
- afi = AFI_IP;
- safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
-#endif
return bgp_show (vty, bgp, afi, safi, bgp_show_type_community_all, NULL);
}
DEFUN (show_bgp_view_afi_safi_community,
show_bgp_view_afi_safi_community_cmd,
-#ifdef HAVE_IPV6
"show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
-#else
- "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export)",
-#endif
SHOW_STR
BGP_STR
"BGP view\n"
"View name\n"
"Address family\n"
-#ifdef HAVE_IPV6
"Address family\n"
-#endif
"Address family modifier\n"
"Address family modifier\n"
"Display routes matching the communities\n"
@@ -7970,32 +7954,20 @@ DEFUN (show_bgp_view_afi_safi_community,
int afi;
int safi;
-#ifdef HAVE_IPV6
afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
return bgp_show_community (vty, argv[0], argc-3, &argv[3], 0, afi, safi);
-#else
- afi = AFI_IP;
- safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
- return bgp_show_community (vty, argv[0], argc-2, &argv[2], 0, afi, safi);
-#endif
}
ALIAS (show_bgp_view_afi_safi_community,
show_bgp_view_afi_safi_community2_cmd,
-#ifdef HAVE_IPV6
"show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#else
- "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#endif
SHOW_STR
BGP_STR
"BGP view\n"
"View name\n"
"Address family\n"
-#ifdef HAVE_IPV6
"Address family\n"
-#endif
"Address family modifier\n"
"Address family modifier\n"
"Display routes matching the communities\n"
@@ -8010,19 +7982,13 @@ ALIAS (show_bgp_view_afi_safi_community,
ALIAS (show_bgp_view_afi_safi_community,
show_bgp_view_afi_safi_community3_cmd,
-#ifdef HAVE_IPV6
"show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#else
- "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#endif
SHOW_STR
BGP_STR
"BGP view\n"
"View name\n"
"Address family\n"
-#ifdef HAVE_IPV6
"Address family\n"
-#endif
"Address family modifier\n"
"Address family modifier\n"
"Display routes matching the communities\n"
@@ -8041,19 +8007,13 @@ ALIAS (show_bgp_view_afi_safi_community,
ALIAS (show_bgp_view_afi_safi_community,
show_bgp_view_afi_safi_community4_cmd,
-#ifdef HAVE_IPV6
"show bgp view WORD (ipv4|ipv6) (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#else
- "show bgp view WORD ipv4 (unicast|multicast) community (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export) (AA:NN|local-AS|no-advertise|no-export)",
-#endif
SHOW_STR
BGP_STR
"BGP view\n"
"View name\n"
"Address family\n"
-#ifdef HAVE_IPV6
"Address family\n"
-#endif
"Address family modifier\n"
"Address family modifier\n"
"Display routes matching the communities\n"
@@ -10199,19 +10159,13 @@ DEFUN (show_ip_bgp_ipv4_neighbor_received_routes,
DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes,
show_bgp_view_afi_safi_neighbor_adv_recd_routes_cmd,
-#ifdef HAVE_IPV6
"show bgp view WORD (ipv4|ipv6) (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)",
-#else
- "show bgp view WORD ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X) (advertised-routes|received-routes)",
-#endif
SHOW_STR
BGP_STR
"BGP view\n"
"View name\n"
"Address family\n"
-#ifdef HAVE_IPV6
"Address family\n"
-#endif
"Address family modifier\n"
"Address family modifier\n"
"Detailed information on TCP and BGP neighbor connections\n"
@@ -10225,24 +10179,14 @@ DEFUN (show_bgp_view_afi_safi_neighbor_adv_recd_routes,
int in;
struct peer *peer;
-#ifdef HAVE_IPV6
- peer = peer_lookup_in_view (vty, argv[0], argv[3]);
-#else
- peer = peer_lookup_in_view (vty, argv[0], argv[2]);
-#endif
+ peer = peer_lookup_in_view (vty, argv[0], argv[3]);
if (! peer)
return CMD_WARNING;
-#ifdef HAVE_IPV6
afi = (strncmp (argv[1], "ipv6", 4) == 0) ? AFI_IP6 : AFI_IP;
safi = (strncmp (argv[2], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
in = (strncmp (argv[4], "r", 1) == 0) ? 1 : 0;
-#else
- afi = AFI_IP;
- safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
- in = (strncmp (argv[3], "r", 1) == 0) ? 1 : 0;
-#endif
return peer_adj_routes (vty, peer, afi, safi, in);
}
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 857781fe..416a3e51 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -131,8 +131,8 @@ route_match_peer (void *rule, struct prefix *prefix, route_map_object_t type,
void *object)
{
union sockunion *su;
- union sockunion su_def = { .sa.sa_family = AF_INET,
- .sin.sin_addr.s_addr = INADDR_ANY };
+ union sockunion su_def = { .sin = { .sin_family = AF_INET,
+ .sin_addr.s_addr = INADDR_ANY } };
struct peer_group *group;
struct peer *peer;
struct listnode *node, *nnode;
@@ -826,12 +826,12 @@ route_match_probability (void *rule, struct prefix *prefix,
r = (long) rand();
#endif
- switch (*(unsigned *) rule)
+ switch (*(long *) rule)
{
case 0: break;
case RAND_MAX: return RMAP_MATCH;
default:
- if (r < *(unsigned *) rule)
+ if (r < *(long *) rule)
{
return RMAP_MATCH;
}
@@ -843,7 +843,7 @@ route_match_probability (void *rule, struct prefix *prefix,
static void *
route_match_probability_compile (const char *arg)
{
- unsigned *lobule;
+ long *lobule;
unsigned perc;
#if _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE >= 500
@@ -853,7 +853,7 @@ route_match_probability_compile (const char *arg)
#endif
perc = atoi (arg);
- lobule = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (unsigned));
+ lobule = XMALLOC (MTYPE_ROUTE_MAP_COMPILED, sizeof (long));
switch (perc)
{
@@ -3163,7 +3163,7 @@ ALIAS (set_aspath_prepend,
"Transform BGP AS_PATH attribute\n"
"Prepend to the as-path\n"
"Use the peer's AS-number\n"
- "Number of times to insert");
+ "Number of times to insert")
DEFUN (no_set_aspath_prepend,
no_set_aspath_prepend_cmd,
diff --git a/bgpd/bgp_snmp.c b/bgpd/bgp_snmp.c
index 79aaa03a..0f4aeec8 100644
--- a/bgpd/bgp_snmp.c
+++ b/bgpd/bgp_snmp.c
@@ -337,38 +337,42 @@ bgp_peer_lookup_next (struct in_addr *src)
return NULL;
}
+/* 1.3.6.1.2.1.15.3.1.x = 10 */
+#define PEERTAB_NAMELEN 10
+
static struct peer *
bgpPeerTable_lookup (struct variable *v, oid name[], size_t *length,
struct in_addr *addr, int exact)
{
struct peer *peer = NULL;
+ size_t namelen = v ? v->namelen : PEERTAB_NAMELEN;
int len;
if (exact)
{
/* Check the length. */
- if (*length - v->namelen != sizeof (struct in_addr))
+ if (*length - namelen != sizeof (struct in_addr))
return NULL;
- oid2in_addr (name + v->namelen, IN_ADDR_SIZE, addr);
+ oid2in_addr (name + namelen, IN_ADDR_SIZE, addr);
peer = peer_lookup_addr_ipv4 (addr);
return peer;
}
else
{
- len = *length - v->namelen;
+ len = *length - namelen;
if (len > 4) len = 4;
- oid2in_addr (name + v->namelen, len, addr);
+ oid2in_addr (name + namelen, len, addr);
peer = bgp_peer_lookup_next (addr);
if (peer == NULL)
return NULL;
- oid_copy_addr (name + v->namelen, addr, sizeof (struct in_addr));
- *length = sizeof (struct in_addr) + v->namelen;
+ oid_copy_addr (name + namelen, addr, sizeof (struct in_addr));
+ *length = sizeof (struct in_addr) + namelen;
return peer;
}
@@ -379,14 +383,12 @@ bgpPeerTable_lookup (struct variable *v, oid name[], size_t *length,
static int
write_bgpPeerTable (int action, u_char *var_val,
u_char var_val_type, size_t var_val_len,
- u_char *statP, oid *name, size_t length,
- struct variable *v)
+ u_char *statP, oid *name, size_t length)
{
struct in_addr addr;
struct peer *peer;
long intval;
- size_t bigsize = SNMP_MAX_LEN;
-
+
if (var_val_type != ASN_INTEGER)
{
return SNMP_ERR_WRONGTYPE;
@@ -396,21 +398,21 @@ write_bgpPeerTable (int action, u_char *var_val,
return SNMP_ERR_WRONGLENGTH;
}
- if (! asn_parse_int(var_val, &bigsize, &var_val_type,
- &intval, sizeof(long)))
- {
- return SNMP_ERR_WRONGENCODING;
- }
+ intval = *(long *)var_val;
memset (&addr, 0, sizeof (struct in_addr));
- peer = bgpPeerTable_lookup (v, name, &length, &addr, 1);
+ peer = bgpPeerTable_lookup (NULL, name, &length, &addr, 1);
if (! peer)
return SNMP_ERR_NOSUCHNAME;
- printf ("val: %ld\n", intval);
+ if (action != SNMP_MSG_INTERNAL_SET_COMMIT)
+ return SNMP_ERR_NOERROR;
- switch (v->magic)
+ zlog_info ("%s: SNMP write .%ld = %ld",
+ peer->host, (long)name[PEERTAB_NAMELEN - 1], intval);
+
+ switch (name[PEERTAB_NAMELEN - 1])
{
case BGPPEERADMINSTATUS:
#define BGP_PeerAdmin_stop 1
diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h
index 04a1d379..209a18c9 100644
--- a/bgpd/bgp_table.h
+++ b/bgpd/bgp_table.h
@@ -55,7 +55,7 @@ struct bgp_node
* @see bgp_node_to_rnode
* @see bgp_node_from_rnode
*/
- ROUTE_NODE_FIELDS;
+ ROUTE_NODE_FIELDS
struct bgp_adj_out *adj_out;
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index e6a36605..00d766d6 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -8235,7 +8235,7 @@ community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
struct community *com;
com = (struct community *) backet->data;
- vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
+ vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
community_str (com), VTY_NEWLINE);
}