mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 10:38:05 +00:00
Merge pull request #2884 from opensourcerouting/assorted-20180821
assorted warning fixes
This commit is contained in:
commit
1f063a699b
@ -148,7 +148,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
|
|||||||
|
|
||||||
if (BGP_DEBUG(flowspec, FLOWSPEC)) {
|
if (BGP_DEBUG(flowspec, FLOWSPEC)) {
|
||||||
char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
|
char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
|
||||||
char local_string[BGP_FLOWSPEC_NLRI_STRING_MAX * 2];
|
char local_string[BGP_FLOWSPEC_NLRI_STRING_MAX*2+16];
|
||||||
char ec_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
|
char ec_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
|
|
||||||
|
@ -188,8 +188,24 @@ static void bgp_info_extra_free(struct bgp_info_extra **extra)
|
|||||||
if (e->parent) {
|
if (e->parent) {
|
||||||
struct bgp_info *bi = (struct bgp_info *)e->parent;
|
struct bgp_info *bi = (struct bgp_info *)e->parent;
|
||||||
|
|
||||||
if (bi->net)
|
if (bi->net) {
|
||||||
bi->net = bgp_unlock_node((struct bgp_node *)bi->net);
|
/* FIXME: since multiple e may have the same e->parent
|
||||||
|
* and e->parent->net is holding a refcount for each
|
||||||
|
* of them, we need to do some fudging here.
|
||||||
|
*
|
||||||
|
* WARNING: if bi->net->lock drops to 0, bi may be
|
||||||
|
* freed as well (because bi->net was holding the
|
||||||
|
* last reference to bi) => write after free!
|
||||||
|
*/
|
||||||
|
unsigned refcount;
|
||||||
|
|
||||||
|
bi = bgp_info_lock(bi);
|
||||||
|
refcount = bi->net->lock - 1;
|
||||||
|
bgp_unlock_node((struct bgp_node *)bi->net);
|
||||||
|
if (!refcount)
|
||||||
|
bi->net = NULL;
|
||||||
|
bgp_info_unlock(bi);
|
||||||
|
}
|
||||||
bgp_info_unlock(e->parent);
|
bgp_info_unlock(e->parent);
|
||||||
e->parent = NULL;
|
e->parent = NULL;
|
||||||
}
|
}
|
||||||
|
@ -128,9 +128,9 @@ static inline struct bgp_node *bgp_node_parent_nolock(struct bgp_node *node)
|
|||||||
/*
|
/*
|
||||||
* bgp_unlock_node
|
* bgp_unlock_node
|
||||||
*/
|
*/
|
||||||
static inline struct bgp_node *bgp_unlock_node(struct bgp_node *node)
|
static inline void bgp_unlock_node(struct bgp_node *node)
|
||||||
{
|
{
|
||||||
return (struct bgp_node *)route_unlock_node(bgp_node_to_rnode(node));
|
route_unlock_node(bgp_node_to_rnode(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 5)
|
#if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 5)
|
||||||
# define _RET_NONNULL , returns_nonnull
|
# define _RET_NONNULL , returns_nonnull
|
||||||
#endif
|
#endif
|
||||||
|
#if __has_attribute(fallthrough)
|
||||||
|
# define _FALLTHROUGH __attribute__((fallthrough));
|
||||||
|
#endif
|
||||||
# define _CONSTRUCTOR(x) constructor(x)
|
# define _CONSTRUCTOR(x) constructor(x)
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
|
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)
|
||||||
@ -34,6 +37,9 @@
|
|||||||
# define _DESTRUCTOR(x) destructor(x)
|
# define _DESTRUCTOR(x) destructor(x)
|
||||||
# define _ALLOC_SIZE(x) alloc_size(x)
|
# define _ALLOC_SIZE(x) alloc_size(x)
|
||||||
#endif
|
#endif
|
||||||
|
#if __GNUC__ >= 7
|
||||||
|
# define _FALLTHROUGH __attribute__((fallthrough));
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
@ -55,6 +61,9 @@
|
|||||||
#ifndef _ALLOC_SIZE
|
#ifndef _ALLOC_SIZE
|
||||||
# define _ALLOC_SIZE(x)
|
# define _ALLOC_SIZE(x)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _FALLTHROUGH
|
||||||
|
#define _FALLTHROUGH
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* for warnings on macros, put in the macro content like this:
|
* for warnings on macros, put in the macro content like this:
|
||||||
|
@ -235,17 +235,13 @@ static inline struct route_node *route_lock_node(struct route_node *node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Unlock node. */
|
/* Unlock node. */
|
||||||
static inline struct route_node *route_unlock_node(struct route_node *node)
|
static inline void route_unlock_node(struct route_node *node)
|
||||||
{
|
{
|
||||||
assert(node->lock > 0);
|
assert(node->lock > 0);
|
||||||
(*(unsigned *)&node->lock)--;
|
(*(unsigned *)&node->lock)--;
|
||||||
|
|
||||||
if (node->lock == 0) {
|
if (node->lock == 0)
|
||||||
route_node_delete(node);
|
route_node_delete(node);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -323,8 +323,8 @@ static void pim_show_assert_winner_metric_helper(struct vty *vty,
|
|||||||
char addr_str[INET_ADDRSTRLEN];
|
char addr_str[INET_ADDRSTRLEN];
|
||||||
struct pim_assert_metric *am;
|
struct pim_assert_metric *am;
|
||||||
struct in_addr ifaddr;
|
struct in_addr ifaddr;
|
||||||
char pref_str[5];
|
char pref_str[16];
|
||||||
char metr_str[7];
|
char metr_str[16];
|
||||||
|
|
||||||
ifaddr = pim_ifp->primary_address;
|
ifaddr = pim_ifp->primary_address;
|
||||||
|
|
||||||
|
@ -37,19 +37,20 @@
|
|||||||
|
|
||||||
char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
|
char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
|
||||||
{
|
{
|
||||||
|
char *out;
|
||||||
struct prefix_sg sg;
|
struct prefix_sg sg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
sg.src = c_oil->oil.mfcc_origin;
|
sg.src = c_oil->oil.mfcc_origin;
|
||||||
sg.grp = c_oil->oil.mfcc_mcastgrp;
|
sg.grp = c_oil->oil.mfcc_mcastgrp;
|
||||||
sprintf(buf, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg),
|
snprintf(buf, size, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg),
|
||||||
c_oil->oil.mfcc_parent);
|
c_oil->oil.mfcc_parent);
|
||||||
|
|
||||||
|
out = buf + strlen(buf);
|
||||||
for (i = 0; i < MAXVIFS; i++) {
|
for (i = 0; i < MAXVIFS; i++) {
|
||||||
if (c_oil->oil.mfcc_ttls[i] != 0) {
|
if (c_oil->oil.mfcc_ttls[i] != 0) {
|
||||||
char buf1[10];
|
snprintf(out, buf + size - out, "%d ", i);
|
||||||
sprintf(buf1, "%d ", i);
|
out += strlen(out);
|
||||||
strcat(buf, buf1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -821,7 +821,7 @@ static void parse_test(struct peer *peer, struct test_segment *t, int type)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case CAPABILITY:
|
case CAPABILITY:
|
||||||
len += 2; /* to cover the OPT-Param header */
|
len += 2; /* to cover the OPT-Param header */
|
||||||
__attribute__ ((fallthrough));
|
_FALLTHROUGH
|
||||||
case OPT_PARAM:
|
case OPT_PARAM:
|
||||||
printf("len: %u\n", len);
|
printf("len: %u\n", len);
|
||||||
/* peek_for_as4 wants getp at capibility*/
|
/* peek_for_as4 wants getp at capibility*/
|
||||||
|
Loading…
Reference in New Issue
Block a user