mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 05:27:16 +02:00
zebra: clean up -Wshadow compiler warnings
Clean up variable-shadowing compiler warnings. Signed-off-by: Mark Stapp <mjs@cisco.com>
This commit is contained in:
parent
a2acd59afd
commit
7c98a27f3e
|
@ -1919,8 +1919,7 @@ static void zebra_if_dplane_ifp_handling(struct zebra_dplane_ctx *ctx)
|
|||
if (zif_type == ZEBRA_IF_VRF && !vrf_is_backend_netns())
|
||||
interface_vrf_change(op, ifindex, name, tableid, ns_id);
|
||||
} else {
|
||||
ifindex_t master_ifindex, bridge_ifindex, bond_ifindex,
|
||||
link_ifindex;
|
||||
ifindex_t master_ifindex, bridge_ifindex, link_ifindex;
|
||||
enum zebra_slave_iftype zif_slave_type;
|
||||
uint8_t bypass;
|
||||
uint64_t flags;
|
||||
|
@ -2730,14 +2729,14 @@ static void if_dump_vty(struct vty *vty, struct interface *ifp)
|
|||
}
|
||||
if (gre_info->ifindex_link &&
|
||||
(gre_info->link_nsid != NS_UNKNOWN)) {
|
||||
struct interface *ifp;
|
||||
struct interface *nifp;
|
||||
|
||||
ifp = if_lookup_by_index_per_ns(
|
||||
zebra_ns_lookup(gre_info->link_nsid),
|
||||
gre_info->ifindex_link);
|
||||
nifp = if_lookup_by_index_per_ns(
|
||||
zebra_ns_lookup(gre_info->link_nsid),
|
||||
gre_info->ifindex_link);
|
||||
vty_out(vty, " Link Interface %s\n",
|
||||
ifp == NULL ? "Unknown" :
|
||||
ifp->name);
|
||||
nifp == NULL ? "Unknown" :
|
||||
nifp->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3116,14 +3115,13 @@ static void if_dump_vty_json(struct vty *vty, struct interface *ifp,
|
|||
}
|
||||
if (gre_info->ifindex_link
|
||||
&& (gre_info->link_nsid != NS_UNKNOWN)) {
|
||||
struct interface *ifp;
|
||||
struct interface *nifp;
|
||||
|
||||
ifp = if_lookup_by_index_per_ns(
|
||||
nifp = if_lookup_by_index_per_ns(
|
||||
zebra_ns_lookup(gre_info->link_nsid),
|
||||
gre_info->ifindex_link);
|
||||
json_object_string_add(json_if, "linkInterface",
|
||||
ifp == NULL ? "Unknown"
|
||||
: ifp->name);
|
||||
nifp == NULL ? "Unknown" : nifp->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1054,7 +1054,7 @@ void rtm_read(struct rt_msghdr *rtm)
|
|||
/*
|
||||
* Ignore our own messages.
|
||||
*/
|
||||
if (rtm->rtm_type != RTM_GET && rtm->rtm_pid == pid)
|
||||
if (rtm->rtm_type != RTM_GET && rtm->rtm_pid == zebra_pid)
|
||||
return;
|
||||
|
||||
if (dest.sa.sa_family == AF_INET) {
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
char *zserv_path;
|
||||
|
||||
/* process id. */
|
||||
pid_t pid;
|
||||
pid_t zebra_pid;
|
||||
|
||||
/* Pacify zclient.o in libfrr, which expects this variable. */
|
||||
struct event_loop *master;
|
||||
|
@ -520,7 +520,7 @@ int main(int argc, char **argv)
|
|||
*/
|
||||
|
||||
/* Needed for BSD routing socket. */
|
||||
pid = getpid();
|
||||
zebra_pid = getpid();
|
||||
|
||||
/* Start dataplane system */
|
||||
zebra_dplane_start();
|
||||
|
|
|
@ -628,7 +628,7 @@ extern int rib_add_gr_run(afi_t afi, vrf_id_t vrf_id, uint8_t proto,
|
|||
extern void zebra_vty_init(void);
|
||||
extern uint32_t zebra_rib_dplane_results_count(void);
|
||||
|
||||
extern pid_t pid;
|
||||
extern pid_t zebra_pid;
|
||||
|
||||
extern uint32_t rt_table_main_id;
|
||||
|
||||
|
|
|
@ -3139,13 +3139,11 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
if (nh->nh_srv6->seg6local_action !=
|
||||
ZEBRA_SEG6_LOCAL_ACTION_UNSPEC) {
|
||||
uint32_t action;
|
||||
uint16_t encap;
|
||||
struct rtattr *nest;
|
||||
const struct seg6local_context *ctx;
|
||||
const struct seg6local_context *ctx6;
|
||||
|
||||
req->nhm.nh_family = AF_INET6;
|
||||
action = nh->nh_srv6->seg6local_action;
|
||||
ctx = &nh->nh_srv6->seg6local_ctx;
|
||||
ctx6 = &nh->nh_srv6->seg6local_ctx;
|
||||
encap = LWTUNNEL_ENCAP_SEG6_LOCAL;
|
||||
if (!nl_attr_put(&req->n, buflen,
|
||||
NHA_ENCAP_TYPE,
|
||||
|
@ -3174,7 +3172,7 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
return 0;
|
||||
if (!nl_attr_put(
|
||||
&req->n, buflen,
|
||||
SEG6_LOCAL_NH6, &ctx->nh6,
|
||||
SEG6_LOCAL_NH6, &ctx6->nh6,
|
||||
sizeof(struct in6_addr)))
|
||||
return 0;
|
||||
break;
|
||||
|
@ -3187,7 +3185,7 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
if (!nl_attr_put32(
|
||||
&req->n, buflen,
|
||||
SEG6_LOCAL_TABLE,
|
||||
ctx->table))
|
||||
ctx6->table))
|
||||
return 0;
|
||||
break;
|
||||
case SEG6_LOCAL_ACTION_END_DX4:
|
||||
|
@ -3198,7 +3196,7 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
return 0;
|
||||
if (!nl_attr_put(
|
||||
&req->n, buflen,
|
||||
SEG6_LOCAL_NH4, &ctx->nh4,
|
||||
SEG6_LOCAL_NH4, &ctx6->nh4,
|
||||
sizeof(struct in_addr)))
|
||||
return 0;
|
||||
break;
|
||||
|
@ -3210,7 +3208,7 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
return 0;
|
||||
if (!nl_attr_put(&req->n, buflen,
|
||||
SEG6_LOCAL_NH6,
|
||||
&ctx->nh6,
|
||||
&ctx6->nh6,
|
||||
sizeof(struct in6_addr)))
|
||||
return 0;
|
||||
break;
|
||||
|
@ -3223,7 +3221,7 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
if (!nl_attr_put32(
|
||||
&req->n, buflen,
|
||||
SEG6_LOCAL_TABLE,
|
||||
ctx->table))
|
||||
ctx6->table))
|
||||
return 0;
|
||||
break;
|
||||
case SEG6_LOCAL_ACTION_END_DT4:
|
||||
|
@ -3235,7 +3233,7 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
if (!nl_attr_put32(
|
||||
&req->n, buflen,
|
||||
SEG6_LOCAL_VRFTABLE,
|
||||
ctx->table))
|
||||
ctx6->table))
|
||||
return 0;
|
||||
break;
|
||||
case SEG6_LOCAL_ACTION_END_DT46:
|
||||
|
@ -3247,7 +3245,7 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
if (!nl_attr_put32(
|
||||
&req->n, buflen,
|
||||
SEG6_LOCAL_VRFTABLE,
|
||||
ctx->table))
|
||||
ctx6->table))
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
|
@ -3268,7 +3266,6 @@ ssize_t netlink_nexthop_msg_encode(uint16_t cmd,
|
|||
!sid_zero(nh->nh_srv6->seg6_segs)) {
|
||||
char tun_buf[4096];
|
||||
ssize_t tun_len;
|
||||
struct rtattr *nest;
|
||||
|
||||
if (!nl_attr_put16(&req->n, buflen,
|
||||
NHA_ENCAP_TYPE,
|
||||
|
|
|
@ -1602,8 +1602,6 @@ DEFPY(show_ipv6_nd_ra_if, show_ipv6_nd_ra_if_cmd,
|
|||
struct vrf *vrf;
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||
struct zebra_vrf *zvrf;
|
||||
|
||||
zvrf = vrf->info;
|
||||
if (!zvrf)
|
||||
continue;
|
||||
|
|
|
@ -261,7 +261,7 @@ static int netlink_route_info_fill(struct netlink_route_info *ri, int cmd,
|
|||
ri->prefix = rib_dest_prefix(dest);
|
||||
ri->af = rib_dest_af(dest);
|
||||
|
||||
ri->nlmsg_pid = pid;
|
||||
ri->nlmsg_pid = zebra_pid;
|
||||
|
||||
ri->nlmsg_type = cmd;
|
||||
ri->rtm_protocol = RTPROT_UNSPEC;
|
||||
|
|
|
@ -1161,11 +1161,32 @@ static void zebra_nhg_handle_uninstall(struct nhg_hash_entry *nhe)
|
|||
zebra_nhg_free(nhe);
|
||||
}
|
||||
|
||||
static void nhg_handle_install_one(struct nhg_connected *node)
|
||||
{
|
||||
struct nhg_connected *rb_node_indirect_dep = NULL;
|
||||
|
||||
frr_each_safe (nhg_connected_tree, &node->nhe->nhg_dependents,
|
||||
rb_node_indirect_dep) {
|
||||
SET_FLAG(rb_node_indirect_dep->nhe->flags,
|
||||
NEXTHOP_GROUP_REINSTALL);
|
||||
|
||||
if (IS_ZEBRA_DEBUG_NHG_DETAIL)
|
||||
zlog_debug("%s nh id %u (flags 0x%x) associated dependents NHG %pNG (flags 0x%x) Re-install",
|
||||
__func__, node->nhe->id,
|
||||
node->nhe->flags,
|
||||
rb_node_indirect_dep->nhe,
|
||||
rb_node_indirect_dep->nhe->flags);
|
||||
|
||||
zebra_nhg_install_kernel(rb_node_indirect_dep->nhe,
|
||||
ZEBRA_ROUTE_MAX);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void zebra_nhg_handle_install(struct nhg_hash_entry *nhe, bool install)
|
||||
{
|
||||
/* Update validity of groups depending on it */
|
||||
struct nhg_connected *rb_node_dep;
|
||||
struct nhg_connected *rb_node_indirect_dep = NULL;
|
||||
|
||||
frr_each_safe (nhg_connected_tree, &nhe->nhg_dependents, rb_node_dep) {
|
||||
zebra_nhg_set_valid(rb_node_dep->nhe, true);
|
||||
|
@ -1173,19 +1194,7 @@ static void zebra_nhg_handle_install(struct nhg_hash_entry *nhe, bool install)
|
|||
if (install) {
|
||||
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) &&
|
||||
CHECK_FLAG(rb_node_dep->nhe->flags, NEXTHOP_GROUP_RECURSIVE)) {
|
||||
frr_each_safe (nhg_connected_tree, &rb_node_dep->nhe->nhg_dependents,
|
||||
rb_node_indirect_dep) {
|
||||
SET_FLAG(rb_node_indirect_dep->nhe->flags,
|
||||
NEXTHOP_GROUP_REINSTALL);
|
||||
if (IS_ZEBRA_DEBUG_NHG_DETAIL)
|
||||
zlog_debug("%s nh id %u (flags 0x%x) associated dependents NHG %pNG (flags 0x%x) Re-install",
|
||||
__func__, rb_node_dep->nhe->id,
|
||||
rb_node_dep->nhe->flags,
|
||||
rb_node_indirect_dep->nhe,
|
||||
rb_node_indirect_dep->nhe->flags);
|
||||
zebra_nhg_install_kernel(rb_node_indirect_dep->nhe,
|
||||
ZEBRA_ROUTE_MAX);
|
||||
}
|
||||
nhg_handle_install_one(rb_node_dep);
|
||||
}
|
||||
|
||||
if (IS_ZEBRA_DEBUG_NHG_DETAIL)
|
||||
|
|
|
@ -317,9 +317,9 @@ static ssize_t printfrr_zebra_node(struct fbuf *buf, struct printfrr_eargs *ea,
|
|||
|
||||
#define rnode_debug(node, vrf_id, msg, ...) \
|
||||
do { \
|
||||
struct vrf *vrf = vrf_lookup_by_id(vrf_id); \
|
||||
struct vrf *_vrf = vrf_lookup_by_id(vrf_id); \
|
||||
zlog_debug("%s: (%s:%pZNt):%pZN: " msg, __func__, \
|
||||
VRF_LOGNAME(vrf), node, node, ##__VA_ARGS__); \
|
||||
VRF_LOGNAME(_vrf), node, node, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define rnode_info(node, vrf_id, msg, ...) \
|
||||
|
@ -1225,10 +1225,10 @@ static void rib_process(struct route_node *rn)
|
|||
* will not iterate so we are ok.
|
||||
*/
|
||||
if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
|
||||
struct route_entry *re = re_list_first(&dest->routes);
|
||||
struct route_entry *rent = re_list_first(&dest->routes);
|
||||
|
||||
zlog_debug("%s(%u:%u:%u):%pRN: Processing rn %p", VRF_LOGNAME(vrf), vrf_id,
|
||||
re->table, safi, rn, rn);
|
||||
rent->table, safi, rn, rn);
|
||||
}
|
||||
|
||||
old_fib = dest->selected_fib;
|
||||
|
|
|
@ -418,11 +418,11 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
|
|||
objid[v->namelen + 5] = policy;
|
||||
|
||||
{
|
||||
struct nexthop *nexthop;
|
||||
struct nexthop *nh;
|
||||
|
||||
nexthop = (*re)->nhe->nhg.nexthop;
|
||||
if (nexthop) {
|
||||
pnt = (uint8_t *)&nexthop->gate.ipv4;
|
||||
nh = (*re)->nhe->nhg.nexthop;
|
||||
if (nh) {
|
||||
pnt = (uint8_t *)&nh->gate.ipv4;
|
||||
for (i = 0; i < 4; i++)
|
||||
objid[i + v->namelen + 6] = *pnt++;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ DEFINE_MTYPE_STATIC(SRV6_MGR, ZEBRA_SRV6_USID_WLIB,
|
|||
DEFINE_MTYPE_STATIC(SRV6_MGR, ZEBRA_SRV6_SID, "SRv6 SID");
|
||||
DEFINE_MTYPE_STATIC(SRV6_MGR, ZEBRA_SRV6_SID_CTX, "SRv6 SID context");
|
||||
|
||||
static struct zebra_srv6 g_srv6;
|
||||
|
||||
/* Prototypes */
|
||||
static int release_srv6_sid_func_dynamic(struct zebra_srv6_sid_block *block,
|
||||
uint32_t sid_func);
|
||||
|
@ -705,8 +707,6 @@ void zebra_notify_srv6_locator_delete(struct srv6_locator *locator)
|
|||
}
|
||||
}
|
||||
|
||||
struct zebra_srv6 srv6;
|
||||
|
||||
struct zebra_srv6 *zebra_srv6_get_default(void)
|
||||
{
|
||||
static bool first_execution = true;
|
||||
|
@ -715,11 +715,11 @@ struct zebra_srv6 *zebra_srv6_get_default(void)
|
|||
|
||||
if (first_execution) {
|
||||
first_execution = false;
|
||||
srv6.locators = list_new();
|
||||
g_srv6.locators = list_new();
|
||||
|
||||
/* Initialize list of SID formats */
|
||||
srv6.sid_formats = list_new();
|
||||
srv6.sid_formats->del = delete_srv6_sid_format;
|
||||
g_srv6.sid_formats = list_new();
|
||||
g_srv6.sid_formats->del = delete_srv6_sid_format;
|
||||
|
||||
/* Create SID format `usid-f3216` */
|
||||
format_usidf3216 = create_srv6_sid_format_usid_f3216();
|
||||
|
@ -730,14 +730,14 @@ struct zebra_srv6 *zebra_srv6_get_default(void)
|
|||
srv6_sid_format_register(format_uncompressed);
|
||||
|
||||
/* Init list to store SRv6 SIDs */
|
||||
srv6.sids = list_new();
|
||||
srv6.sids->del = delete_zebra_srv6_sid_ctx;
|
||||
g_srv6.sids = list_new();
|
||||
g_srv6.sids->del = delete_zebra_srv6_sid_ctx;
|
||||
|
||||
/* Init list to store SRv6 SID blocks */
|
||||
srv6.sid_blocks = list_new();
|
||||
srv6.sid_blocks->del = delete_zebra_srv6_sid_block;
|
||||
g_srv6.sid_blocks = list_new();
|
||||
g_srv6.sid_blocks->del = delete_zebra_srv6_sid_block;
|
||||
}
|
||||
return &srv6;
|
||||
return &g_srv6;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2455,51 +2455,51 @@ void zebra_srv6_terminate(void)
|
|||
struct zebra_srv6_sid_block *block;
|
||||
struct zebra_srv6_sid_ctx *sid_ctx;
|
||||
|
||||
if (srv6.locators) {
|
||||
while (listcount(srv6.locators)) {
|
||||
locator = listnode_head(srv6.locators);
|
||||
if (g_srv6.locators) {
|
||||
while (listcount(g_srv6.locators)) {
|
||||
locator = listnode_head(g_srv6.locators);
|
||||
|
||||
listnode_delete(srv6.locators, locator);
|
||||
listnode_delete(g_srv6.locators, locator);
|
||||
srv6_locator_free(locator);
|
||||
}
|
||||
|
||||
list_delete(&srv6.locators);
|
||||
list_delete(&g_srv6.locators);
|
||||
}
|
||||
|
||||
/* Free SRv6 SIDs */
|
||||
if (srv6.sids) {
|
||||
while (listcount(srv6.sids)) {
|
||||
sid_ctx = listnode_head(srv6.sids);
|
||||
if (g_srv6.sids) {
|
||||
while (listcount(g_srv6.sids)) {
|
||||
sid_ctx = listnode_head(g_srv6.sids);
|
||||
|
||||
listnode_delete(srv6.sids, sid_ctx);
|
||||
listnode_delete(g_srv6.sids, sid_ctx);
|
||||
zebra_srv6_sid_ctx_free(sid_ctx);
|
||||
}
|
||||
|
||||
list_delete(&srv6.sids);
|
||||
list_delete(&g_srv6.sids);
|
||||
}
|
||||
|
||||
/* Free SRv6 SID blocks */
|
||||
if (srv6.sid_blocks) {
|
||||
while (listcount(srv6.sid_blocks)) {
|
||||
block = listnode_head(srv6.sid_blocks);
|
||||
if (g_srv6.sid_blocks) {
|
||||
while (listcount(g_srv6.sid_blocks)) {
|
||||
block = listnode_head(g_srv6.sid_blocks);
|
||||
|
||||
listnode_delete(srv6.sid_blocks, block);
|
||||
listnode_delete(g_srv6.sid_blocks, block);
|
||||
zebra_srv6_sid_block_free(block);
|
||||
}
|
||||
|
||||
list_delete(&srv6.sid_blocks);
|
||||
list_delete(&g_srv6.sid_blocks);
|
||||
}
|
||||
|
||||
/* Free SRv6 SID formats */
|
||||
if (srv6.sid_formats) {
|
||||
while (listcount(srv6.sid_formats)) {
|
||||
format = listnode_head(srv6.sid_formats);
|
||||
if (g_srv6.sid_formats) {
|
||||
while (listcount(g_srv6.sid_formats)) {
|
||||
format = listnode_head(g_srv6.sid_formats);
|
||||
|
||||
srv6_sid_format_unregister(format);
|
||||
srv6_sid_format_free(format);
|
||||
}
|
||||
|
||||
list_delete(&srv6.sid_formats);
|
||||
list_delete(&g_srv6.sid_formats);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ DEFUN (show_srv6_locator_detail,
|
|||
}
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(srv6->locators, node, locator)) {
|
||||
struct listnode *node;
|
||||
struct listnode *nnode;
|
||||
struct srv6_locator_chunk *chunk;
|
||||
|
||||
if (strcmp(locator->name, locator_name) != 0)
|
||||
|
@ -247,8 +247,7 @@ DEFUN (show_srv6_locator_detail,
|
|||
}
|
||||
|
||||
vty_out(vty, "Chunks:\n");
|
||||
for (ALL_LIST_ELEMENTS_RO((struct list *)locator->chunks, node,
|
||||
chunk)) {
|
||||
for (ALL_LIST_ELEMENTS_RO((struct list *)locator->chunks, nnode, chunk)) {
|
||||
prefix2str(&chunk->prefix, str, sizeof(str));
|
||||
vty_out(vty, "- prefix: %s, owner: %s\n", str,
|
||||
zebra_route_string(chunk->proto));
|
||||
|
|
|
@ -1490,8 +1490,6 @@ DEFPY(show_nexthop_group,
|
|||
struct vrf *vrf;
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||
struct zebra_vrf *zvrf;
|
||||
|
||||
zvrf = vrf->info;
|
||||
if (!zvrf)
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue