Clean up variable-shadowing compiler warnings.
Signed-off-by: Mark Stapp <mjs@cisco.com>
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;
}
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);
}
}
}
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);
}
}
/*
* 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) {
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;
*/
/* Needed for BSD routing socket. */
- pid = getpid();
+ zebra_pid = getpid();
/* Start dataplane system */
zebra_dplane_start();
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;
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,
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;
if (!nl_attr_put32(
&req->n, buflen,
SEG6_LOCAL_TABLE,
- ctx->table))
+ ctx6->table))
return 0;
break;
case SEG6_LOCAL_ACTION_END_DX4:
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;
return 0;
if (!nl_attr_put(&req->n, buflen,
SEG6_LOCAL_NH6,
- &ctx->nh6,
+ &ctx6->nh6,
sizeof(struct in6_addr)))
return 0;
break;
if (!nl_attr_put32(
&req->n, buflen,
SEG6_LOCAL_TABLE,
- ctx->table))
+ ctx6->table))
return 0;
break;
case SEG6_LOCAL_ACTION_END_DT4:
if (!nl_attr_put32(
&req->n, buflen,
SEG6_LOCAL_VRFTABLE,
- ctx->table))
+ ctx6->table))
return 0;
break;
case SEG6_LOCAL_ACTION_END_DT46:
if (!nl_attr_put32(
&req->n, buflen,
SEG6_LOCAL_VRFTABLE,
- ctx->table))
+ ctx6->table))
return 0;
break;
default:
!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,
struct vrf *vrf;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- struct zebra_vrf *zvrf;
-
zvrf = vrf->info;
if (!zvrf)
continue;
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;
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);
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)
#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, ...) \
* 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;
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++;
}
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);
}
}
-struct zebra_srv6 srv6;
-
struct zebra_srv6 *zebra_srv6_get_default(void)
{
static bool first_execution = true;
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();
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;
}
/**
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);
}
}
}
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)
}
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));
struct vrf *vrf;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- struct zebra_vrf *zvrf;
-
zvrf = vrf->info;
if (!zvrf)
continue;