forked from Mirror/frr
ospfd: clean up -Wshadow warnings
Clean up various "shadow" warnings. Signed-off-by: Mark Stapp <mjs@cisco.com>
This commit is contained in:
parent
e88f0a4778
commit
0561943a78
|
@ -312,7 +312,7 @@ DEFUN (no_ip_ospf_bfd,
|
||||||
|
|
||||||
void ospf_bfd_init(struct event_loop *tm)
|
void ospf_bfd_init(struct event_loop *tm)
|
||||||
{
|
{
|
||||||
bfd_protocol_integration_init(zclient, tm);
|
bfd_protocol_integration_init(ospf_zclient, tm);
|
||||||
|
|
||||||
/* Install BFD command */
|
/* Install BFD command */
|
||||||
install_element(INTERFACE_NODE, &ip_ospf_bfd_cmd);
|
install_element(INTERFACE_NODE, &ip_ospf_bfd_cmd);
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
#include "ospfd/ospf_zebra.h"
|
#include "ospfd/ospf_zebra.h"
|
||||||
#include "ospfd/ospf_dump.h"
|
#include "ospfd/ospf_dump.h"
|
||||||
|
|
||||||
extern struct zclient *zclient;
|
|
||||||
|
|
||||||
/** @brief Function to refresh type-5 and type-7 DNA
|
/** @brief Function to refresh type-5 and type-7 DNA
|
||||||
* LSAs when we receive an indication LSA.
|
* LSAs when we receive an indication LSA.
|
||||||
* @param Ospf instance.
|
* @param Ospf instance.
|
||||||
|
@ -172,11 +170,11 @@ struct external_info *ospf_external_info_check(struct ospf *ospf,
|
||||||
redist_on =
|
redist_on =
|
||||||
is_default_prefix4(&p)
|
is_default_prefix4(&p)
|
||||||
? vrf_bitmap_check(
|
? vrf_bitmap_check(
|
||||||
&zclient->default_information[AFI_IP],
|
&ospf_zclient->default_information[AFI_IP],
|
||||||
ospf->vrf_id)
|
ospf->vrf_id)
|
||||||
: (zclient->mi_redist[AFI_IP][type].enabled ||
|
: (ospf_zclient->mi_redist[AFI_IP][type].enabled ||
|
||||||
vrf_bitmap_check(
|
vrf_bitmap_check(
|
||||||
&zclient->redist[AFI_IP][type],
|
&ospf_zclient->redist[AFI_IP][type],
|
||||||
ospf->vrf_id));
|
ospf->vrf_id));
|
||||||
// Pending: check for MI above.
|
// Pending: check for MI above.
|
||||||
if (redist_on) {
|
if (redist_on) {
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include "ospf_dump.h"
|
#include "ospf_dump.h"
|
||||||
#include "ospf_ism.h"
|
#include "ospf_ism.h"
|
||||||
|
|
||||||
extern struct zclient *zclient;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LDP-SYNC msg between IGP and LDP
|
* LDP-SYNC msg between IGP and LDP
|
||||||
*/
|
*/
|
||||||
|
@ -98,7 +96,7 @@ void ospf_ldp_sync_state_req_msg(struct interface *ifp)
|
||||||
request.proto = LDP_IGP_SYNC_IF_STATE_REQUEST;
|
request.proto = LDP_IGP_SYNC_IF_STATE_REQUEST;
|
||||||
request.ifindex = ifp->ifindex;
|
request.ifindex = ifp->ifindex;
|
||||||
|
|
||||||
zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
|
zclient_send_opaque(ospf_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
|
||||||
(uint8_t *)&request, sizeof(request));
|
(uint8_t *)&request, sizeof(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,9 +398,9 @@ void ospf_ldp_sync_gbl_exit(struct ospf *ospf, bool remove)
|
||||||
*/
|
*/
|
||||||
if (CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
|
if (CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
|
||||||
/* unregister with opaque client to recv LDP-IGP Sync msgs */
|
/* unregister with opaque client to recv LDP-IGP Sync msgs */
|
||||||
zclient_unregister_opaque(zclient,
|
zclient_unregister_opaque(ospf_zclient,
|
||||||
LDP_IGP_SYNC_IF_STATE_UPDATE);
|
LDP_IGP_SYNC_IF_STATE_UPDATE);
|
||||||
zclient_unregister_opaque(zclient,
|
zclient_unregister_opaque(ospf_zclient,
|
||||||
LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
||||||
|
|
||||||
/* disable LDP globally */
|
/* disable LDP globally */
|
||||||
|
@ -754,8 +752,8 @@ DEFPY (ospf_mpls_ldp_sync,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register with opaque client to recv LDP-IGP Sync msgs */
|
/* register with opaque client to recv LDP-IGP Sync msgs */
|
||||||
zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
|
zclient_register_opaque(ospf_zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
|
||||||
zclient_register_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
zclient_register_opaque(ospf_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
||||||
|
|
||||||
if (!CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
|
if (!CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
|
||||||
SET_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE);
|
SET_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE);
|
||||||
|
|
|
@ -4055,11 +4055,11 @@ void ospf_ls_ack_send_direct(struct ospf_neighbor *nbr, struct ospf_lsa *lsa)
|
||||||
* ignored.
|
* ignored.
|
||||||
*/
|
*/
|
||||||
if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT && !oi->p2mp_non_broadcast) {
|
if (oi->type == OSPF_IFTYPE_POINTOMULTIPOINT && !oi->p2mp_non_broadcast) {
|
||||||
struct ospf_lsa_list_entry *ls_ack_list_entry;
|
struct ospf_lsa_list_entry *ack_list_entry;
|
||||||
struct ospf_lsa *ack_queue_lsa;
|
struct ospf_lsa *ack_queue_lsa;
|
||||||
|
|
||||||
frr_each (ospf_lsa_list, &oi->ls_ack_direct, ls_ack_list_entry) {
|
frr_each (ospf_lsa_list, &oi->ls_ack_direct, ack_list_entry) {
|
||||||
ack_queue_lsa = ls_ack_list_entry->lsa;
|
ack_queue_lsa = ack_list_entry->lsa;
|
||||||
if ((lsa == ack_queue_lsa) ||
|
if ((lsa == ack_queue_lsa) ||
|
||||||
((lsa->data->type == ack_queue_lsa->data->type) &&
|
((lsa->data->type == ack_queue_lsa->data->type) &&
|
||||||
(lsa->data->id.s_addr ==
|
(lsa->data->id.s_addr ==
|
||||||
|
|
|
@ -1709,15 +1709,15 @@ static int ospf_te_export(uint8_t type, void *link_state)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LS_MSG_TYPE_NODE:
|
case LS_MSG_TYPE_NODE:
|
||||||
ls_vertex2msg(&msg, (struct ls_vertex *)link_state);
|
ls_vertex2msg(&msg, (struct ls_vertex *)link_state);
|
||||||
rc = ls_send_msg(zclient, &msg, NULL);
|
rc = ls_send_msg(ospf_zclient, &msg, NULL);
|
||||||
break;
|
break;
|
||||||
case LS_MSG_TYPE_ATTRIBUTES:
|
case LS_MSG_TYPE_ATTRIBUTES:
|
||||||
ls_edge2msg(&msg, (struct ls_edge *)link_state);
|
ls_edge2msg(&msg, (struct ls_edge *)link_state);
|
||||||
rc = ls_send_msg(zclient, &msg, NULL);
|
rc = ls_send_msg(ospf_zclient, &msg, NULL);
|
||||||
break;
|
break;
|
||||||
case LS_MSG_TYPE_PREFIX:
|
case LS_MSG_TYPE_PREFIX:
|
||||||
ls_subnet2msg(&msg, (struct ls_subnet *)link_state);
|
ls_subnet2msg(&msg, (struct ls_subnet *)link_state);
|
||||||
rc = ls_send_msg(zclient, &msg, NULL);
|
rc = ls_send_msg(ospf_zclient, &msg, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rc = -1;
|
rc = -1;
|
||||||
|
@ -3113,7 +3113,7 @@ int ospf_te_sync_ted(struct zapi_opaque_reg_info dst)
|
||||||
if (!OspfMplsTE.enabled || !OspfMplsTE.export)
|
if (!OspfMplsTE.enabled || !OspfMplsTE.export)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
rc = ls_sync_ted(OspfMplsTE.ted, zclient, &dst);
|
rc = ls_sync_ted(OspfMplsTE.ted, ospf_zclient, &dst);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -4306,7 +4306,7 @@ DEFUN (ospf_mpls_te_export,
|
||||||
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
||||||
|
|
||||||
if (OspfMplsTE.enabled) {
|
if (OspfMplsTE.enabled) {
|
||||||
if (ls_register(zclient, true) != 0) {
|
if (ls_register(ospf_zclient, true) != 0) {
|
||||||
vty_out(vty, "Unable to register Link State\n");
|
vty_out(vty, "Unable to register Link State\n");
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
@ -4330,7 +4330,7 @@ DEFUN (no_ospf_mpls_te_export,
|
||||||
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
||||||
|
|
||||||
if (OspfMplsTE.export) {
|
if (OspfMplsTE.export) {
|
||||||
if (ls_unregister(zclient, true) != 0) {
|
if (ls_unregister(ospf_zclient, true) != 0) {
|
||||||
vty_out(vty, "Unable to unregister Link State\n");
|
vty_out(vty, "Unable to unregister Link State\n");
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12308,8 +12308,6 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
|
||||||
else
|
else
|
||||||
vty_out(vty, " ip ospf");
|
vty_out(vty, " ip ospf");
|
||||||
|
|
||||||
char buf[INET_ADDRSTRLEN];
|
|
||||||
|
|
||||||
area_id2str(buf, sizeof(buf), ¶ms->if_area,
|
area_id2str(buf, sizeof(buf), ¶ms->if_area,
|
||||||
params->if_area_id_fmt);
|
params->if_area_id_fmt);
|
||||||
vty_out(vty, " area %s", buf);
|
vty_out(vty, " area %s", buf);
|
||||||
|
|
|
@ -45,7 +45,7 @@ DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute");
|
||||||
|
|
||||||
|
|
||||||
/* Zebra structure to hold current status. */
|
/* Zebra structure to hold current status. */
|
||||||
struct zclient *zclient = NULL;
|
struct zclient *ospf_zclient;
|
||||||
/* and for the Synchronous connection to the Label Manager */
|
/* and for the Synchronous connection to the Label Manager */
|
||||||
struct zclient *zclient_sync;
|
struct zclient *zclient_sync;
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ void ospf_zebra_add(struct ospf *ospf, struct prefix_ipv4 *p,
|
||||||
if (CHECK_FLAG(ospf->config, OSPF_SEND_EXTRA_DATA_TO_ZEBRA))
|
if (CHECK_FLAG(ospf->config, OSPF_SEND_EXTRA_DATA_TO_ZEBRA))
|
||||||
ospf_zebra_append_opaque_attr(or, &api);
|
ospf_zebra_append_opaque_attr(or, &api);
|
||||||
|
|
||||||
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
|
zclient_route_send(ZEBRA_ROUTE_ADD, ospf_zclient, &api);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
|
void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
|
||||||
|
@ -368,7 +368,7 @@ void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
|
||||||
zlog_debug("Zebra: Route delete %pFX(%s)", p,
|
zlog_debug("Zebra: Route delete %pFX(%s)", p,
|
||||||
ospf_vrf_id_to_name(ospf->vrf_id));
|
ospf_vrf_id_to_name(ospf->vrf_id));
|
||||||
|
|
||||||
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
zclient_route_send(ZEBRA_ROUTE_DELETE, ospf_zclient, &api);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ospf_zebra_add_discard(struct ospf *ospf, struct prefix_ipv4 *p)
|
void ospf_zebra_add_discard(struct ospf *ospf, struct prefix_ipv4 *p)
|
||||||
|
@ -390,7 +390,7 @@ void ospf_zebra_add_discard(struct ospf *ospf, struct prefix_ipv4 *p)
|
||||||
memcpy(&api.prefix, p, sizeof(*p));
|
memcpy(&api.prefix, p, sizeof(*p));
|
||||||
zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
|
zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
|
||||||
|
|
||||||
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
|
zclient_route_send(ZEBRA_ROUTE_ADD, ospf_zclient, &api);
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
||||||
zlog_debug("Zebra: Route add discard %pFX(%s)", p,
|
zlog_debug("Zebra: Route add discard %pFX(%s)", p,
|
||||||
|
@ -416,7 +416,7 @@ void ospf_zebra_delete_discard(struct ospf *ospf, struct prefix_ipv4 *p)
|
||||||
memcpy(&api.prefix, p, sizeof(*p));
|
memcpy(&api.prefix, p, sizeof(*p));
|
||||||
zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
|
zapi_route_set_blackhole(&api, BLACKHOLE_NULL);
|
||||||
|
|
||||||
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
zclient_route_send(ZEBRA_ROUTE_DELETE, ospf_zclient, &api);
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
||||||
zlog_debug("Zebra: Route delete discard %pFX(%s)", p,
|
zlog_debug("Zebra: Route delete discard %pFX(%s)", p,
|
||||||
|
@ -695,7 +695,7 @@ void ospf_zebra_update_prefix_sid(const struct sr_prefix *srp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally, send message to zebra. */
|
/* Finally, send message to zebra. */
|
||||||
(void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl);
|
(void)zebra_send_mpls_labels(ospf_zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove NHLFE for Prefix-SID */
|
/* Remove NHLFE for Prefix-SID */
|
||||||
|
@ -722,7 +722,7 @@ void ospf_zebra_delete_prefix_sid(const struct sr_prefix *srp)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send message to zebra. */
|
/* Send message to zebra. */
|
||||||
(void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_DELETE, &zl);
|
(void)zebra_send_mpls_labels(ospf_zclient, ZEBRA_MPLS_LABELS_DELETE, &zl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send MPLS Label entry to Zebra for installation or deletion */
|
/* Send MPLS Label entry to Zebra for installation or deletion */
|
||||||
|
@ -746,7 +746,7 @@ void ospf_zebra_send_adjacency_sid(int cmd, struct sr_nhlfe nhlfe)
|
||||||
znh->label_num = 1;
|
znh->label_num = 1;
|
||||||
znh->labels[0] = nhlfe.label_out;
|
znh->labels[0] = nhlfe.label_out;
|
||||||
|
|
||||||
(void)zebra_send_mpls_labels(zclient, cmd, &zl);
|
(void)zebra_send_mpls_labels(ospf_zclient, cmd, &zl);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ospf_redist *ospf_redist_lookup(struct ospf *ospf, uint8_t type,
|
struct ospf_redist *ospf_redist_lookup(struct ospf *ospf, uint8_t type,
|
||||||
|
@ -815,14 +815,14 @@ int ospf_is_type_redistributed(struct ospf *ospf, int type,
|
||||||
{
|
{
|
||||||
return (DEFAULT_ROUTE_TYPE(type)
|
return (DEFAULT_ROUTE_TYPE(type)
|
||||||
? vrf_bitmap_check(
|
? vrf_bitmap_check(
|
||||||
&zclient->default_information[AFI_IP],
|
&ospf_zclient->default_information[AFI_IP],
|
||||||
ospf->vrf_id)
|
ospf->vrf_id)
|
||||||
: ((instance &&
|
: ((instance &&
|
||||||
redist_check_instance(
|
redist_check_instance(
|
||||||
&zclient->mi_redist[AFI_IP][type],
|
&ospf_zclient->mi_redist[AFI_IP][type],
|
||||||
instance)) ||
|
instance)) ||
|
||||||
(!instance &&
|
(!instance &&
|
||||||
vrf_bitmap_check(&zclient->redist[AFI_IP][type],
|
vrf_bitmap_check(&ospf_zclient->redist[AFI_IP][type],
|
||||||
ospf->vrf_id))));
|
ospf->vrf_id))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,7 +861,7 @@ int ospf_redistribute_set(struct ospf *ospf, struct ospf_redist *red, int type,
|
||||||
|
|
||||||
ospf_external_add(ospf, type, instance);
|
ospf_external_add(ospf, type, instance);
|
||||||
|
|
||||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type,
|
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, ospf_zclient, AFI_IP, type,
|
||||||
instance, ospf->vrf_id);
|
instance, ospf->vrf_id);
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
||||||
|
@ -879,10 +879,10 @@ int ospf_redistribute_set(struct ospf *ospf, struct ospf_redist *red, int type,
|
||||||
int ospf_redistribute_unset(struct ospf *ospf, int type,
|
int ospf_redistribute_unset(struct ospf *ospf, int type,
|
||||||
unsigned short instance)
|
unsigned short instance)
|
||||||
{
|
{
|
||||||
if (type == zclient->redist_default && instance == zclient->instance)
|
if (type == ospf_zclient->redist_default && instance == ospf_zclient->instance)
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type,
|
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, ospf_zclient, AFI_IP, type,
|
||||||
instance, ospf->vrf_id);
|
instance, ospf->vrf_id);
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
||||||
|
@ -933,7 +933,7 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
|
||||||
break;
|
break;
|
||||||
case DEFAULT_ORIGINATE_ZEBRA:
|
case DEFAULT_ORIGINATE_ZEBRA:
|
||||||
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
|
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
|
||||||
zclient, AFI_IP, ospf->vrf_id);
|
ospf_zclient, AFI_IP, ospf->vrf_id);
|
||||||
ospf->redistribute--;
|
ospf->redistribute--;
|
||||||
break;
|
break;
|
||||||
case DEFAULT_ORIGINATE_ALWAYS:
|
case DEFAULT_ORIGINATE_ALWAYS:
|
||||||
|
@ -951,7 +951,7 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
|
||||||
type_str = "normal";
|
type_str = "normal";
|
||||||
ospf->redistribute++;
|
ospf->redistribute++;
|
||||||
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
|
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
|
||||||
zclient, AFI_IP, ospf->vrf_id);
|
ospf_zclient, AFI_IP, ospf->vrf_id);
|
||||||
break;
|
break;
|
||||||
case DEFAULT_ORIGINATE_ALWAYS:
|
case DEFAULT_ORIGINATE_ALWAYS:
|
||||||
type_str = "always";
|
type_str = "always";
|
||||||
|
@ -1242,7 +1242,7 @@ static int ospf_zebra_gr_update(struct ospf *ospf, int command,
|
||||||
{
|
{
|
||||||
struct zapi_cap api;
|
struct zapi_cap api;
|
||||||
|
|
||||||
if (!zclient || zclient->sock < 0 || !ospf)
|
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
memset(&api, 0, sizeof(api));
|
memset(&api, 0, sizeof(api));
|
||||||
|
@ -1250,7 +1250,7 @@ static int ospf_zebra_gr_update(struct ospf *ospf, int command,
|
||||||
api.stale_removal_time = stale_time;
|
api.stale_removal_time = stale_time;
|
||||||
api.vrf_id = ospf->vrf_id;
|
api.vrf_id = ospf->vrf_id;
|
||||||
|
|
||||||
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient,
|
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, ospf_zclient,
|
||||||
&api);
|
&api);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1495,7 +1495,7 @@ void ospf_zebra_import_default_route(struct ospf *ospf, bool unreg)
|
||||||
struct prefix prefix = {};
|
struct prefix prefix = {};
|
||||||
int command;
|
int command;
|
||||||
|
|
||||||
if (zclient->sock < 0) {
|
if (ospf_zclient->sock < 0) {
|
||||||
if (IS_DEBUG_OSPF(zebra, ZEBRA))
|
if (IS_DEBUG_OSPF(zebra, ZEBRA))
|
||||||
zlog_debug(" Not connected to Zebra vrf: %s",
|
zlog_debug(" Not connected to Zebra vrf: %s",
|
||||||
ospf_vrf_id_to_name(ospf->vrf_id));
|
ospf_vrf_id_to_name(ospf->vrf_id));
|
||||||
|
@ -1515,7 +1515,7 @@ void ospf_zebra_import_default_route(struct ospf *ospf, bool unreg)
|
||||||
zserv_command_string(command), &prefix,
|
zserv_command_string(command), &prefix,
|
||||||
ospf_vrf_id_to_name(ospf->vrf_id));
|
ospf_vrf_id_to_name(ospf->vrf_id));
|
||||||
|
|
||||||
if (zclient_send_rnh(zclient, command, &prefix, SAFI_UNICAST, false,
|
if (zclient_send_rnh(ospf_zclient, command, &prefix, SAFI_UNICAST, false,
|
||||||
true, ospf->vrf_id) == ZCLIENT_SEND_FAILURE)
|
true, ospf->vrf_id) == ZCLIENT_SEND_FAILURE)
|
||||||
flog_err(EC_LIB_ZAPI_SOCKET, "%s(%s): zclient_send_rnh() failed",
|
flog_err(EC_LIB_ZAPI_SOCKET, "%s(%s): zclient_send_rnh() failed",
|
||||||
__func__, ospf_vrf_id_to_name(ospf->vrf_id));
|
__func__, ospf_vrf_id_to_name(ospf->vrf_id));
|
||||||
|
@ -2011,7 +2011,7 @@ uint8_t ospf_distance_apply(struct ospf *ospf, struct prefix_ipv4 *p,
|
||||||
|
|
||||||
void ospf_zebra_vrf_register(struct ospf *ospf)
|
void ospf_zebra_vrf_register(struct ospf *ospf)
|
||||||
{
|
{
|
||||||
if (!zclient || zclient->sock < 0 || !ospf)
|
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ospf->vrf_id != VRF_UNKNOWN) {
|
if (ospf->vrf_id != VRF_UNKNOWN) {
|
||||||
|
@ -2019,13 +2019,13 @@ void ospf_zebra_vrf_register(struct ospf *ospf)
|
||||||
zlog_debug("%s: Register VRF %s id %u", __func__,
|
zlog_debug("%s: Register VRF %s id %u", __func__,
|
||||||
ospf_vrf_id_to_name(ospf->vrf_id),
|
ospf_vrf_id_to_name(ospf->vrf_id),
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
zclient_send_reg_requests(zclient, ospf->vrf_id);
|
zclient_send_reg_requests(ospf_zclient, ospf->vrf_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ospf_zebra_vrf_deregister(struct ospf *ospf)
|
void ospf_zebra_vrf_deregister(struct ospf *ospf)
|
||||||
{
|
{
|
||||||
if (!zclient || zclient->sock < 0 || !ospf)
|
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
|
if (ospf->vrf_id != VRF_DEFAULT && ospf->vrf_id != VRF_UNKNOWN) {
|
||||||
|
@ -2035,7 +2035,7 @@ void ospf_zebra_vrf_deregister(struct ospf *ospf)
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
/* Deregister for router-id, interfaces,
|
/* Deregister for router-id, interfaces,
|
||||||
* redistributed routes. */
|
* redistributed routes. */
|
||||||
zclient_send_dereg_requests(zclient, ospf->vrf_id);
|
zclient_send_dereg_requests(ospf_zclient, ospf->vrf_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2230,17 +2230,17 @@ static zclient_handler *const ospf_handlers[] = {
|
||||||
[ZEBRA_CLIENT_CLOSE_NOTIFY] = ospf_zebra_client_close_notify,
|
[ZEBRA_CLIENT_CLOSE_NOTIFY] = ospf_zebra_client_close_notify,
|
||||||
};
|
};
|
||||||
|
|
||||||
void ospf_zebra_init(struct event_loop *master, unsigned short instance)
|
void ospf_zebra_init(struct event_loop *mst, unsigned short instance)
|
||||||
{
|
{
|
||||||
/* Allocate zebra structure. */
|
/* Allocate zebra structure. */
|
||||||
zclient = zclient_new(master, &zclient_options_default, ospf_handlers,
|
ospf_zclient = zclient_new(mst, &zclient_options_default, ospf_handlers,
|
||||||
array_size(ospf_handlers));
|
array_size(ospf_handlers));
|
||||||
zclient_init(zclient, ZEBRA_ROUTE_OSPF, instance, &ospfd_privs);
|
zclient_init(ospf_zclient, ZEBRA_ROUTE_OSPF, instance, &ospfd_privs);
|
||||||
zclient->zebra_connected = ospf_zebra_connected;
|
ospf_zclient->zebra_connected = ospf_zebra_connected;
|
||||||
zclient->nexthop_update = ospf_zebra_import_check_update;
|
ospf_zclient->nexthop_update = ospf_zebra_import_check_update;
|
||||||
|
|
||||||
/* Initialize special zclient for synchronous message exchanges. */
|
/* Initialize special zclient for synchronous message exchanges. */
|
||||||
zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
|
zclient_sync = zclient_new(mst, &zclient_options_sync, NULL, 0);
|
||||||
zclient_sync->sock = -1;
|
zclient_sync->sock = -1;
|
||||||
zclient_sync->redist_default = ZEBRA_ROUTE_OSPF;
|
zclient_sync->redist_default = ZEBRA_ROUTE_OSPF;
|
||||||
zclient_sync->instance = instance;
|
zclient_sync->instance = instance;
|
||||||
|
@ -2259,5 +2259,5 @@ void ospf_zebra_init(struct event_loop *master, unsigned short instance)
|
||||||
|
|
||||||
void ospf_zebra_send_arp(const struct interface *ifp, const struct prefix *p)
|
void ospf_zebra_send_arp(const struct interface *ifp, const struct prefix *p)
|
||||||
{
|
{
|
||||||
zclient_send_neigh_discovery_req(zclient, ifp, p);
|
zclient_send_neigh_discovery_req(ospf_zclient, ifp, p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,6 @@ struct ospf_master *om;
|
||||||
|
|
||||||
unsigned short ospf_instance;
|
unsigned short ospf_instance;
|
||||||
|
|
||||||
extern struct zclient *zclient;
|
|
||||||
extern struct zclient *zclient_sync;
|
|
||||||
|
|
||||||
/* OSPF config processing timer thread */
|
/* OSPF config processing timer thread */
|
||||||
struct event *t_ospf_cfg;
|
struct event *t_ospf_cfg;
|
||||||
|
|
||||||
|
@ -648,8 +645,8 @@ void ospf_terminate(void)
|
||||||
* One or more ospf_finish()'s may have deferred shutdown to a timer
|
* One or more ospf_finish()'s may have deferred shutdown to a timer
|
||||||
* thread
|
* thread
|
||||||
*/
|
*/
|
||||||
zclient_stop(zclient);
|
zclient_stop(ospf_zclient);
|
||||||
zclient_free(zclient);
|
zclient_free(ospf_zclient);
|
||||||
zclient_stop(zclient_sync);
|
zclient_stop(zclient_sync);
|
||||||
zclient_free(zclient_sync);
|
zclient_free(zclient_sync);
|
||||||
|
|
||||||
|
@ -2214,13 +2211,13 @@ void ospf_update_bufsize(struct ospf *ospf, uint32_t recvsize,
|
||||||
ospf_sock_bufsize_update(ospf, ospf->fd, type);
|
ospf_sock_bufsize_update(ospf, ospf->fd, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ospf_master_init(struct event_loop *master)
|
void ospf_master_init(struct event_loop *mst)
|
||||||
{
|
{
|
||||||
memset(&ospf_master, 0, sizeof(ospf_master));
|
memset(&ospf_master, 0, sizeof(ospf_master));
|
||||||
|
|
||||||
om = &ospf_master;
|
om = &ospf_master;
|
||||||
om->ospf = list_new();
|
om->ospf = list_new();
|
||||||
om->master = master;
|
om->master = mst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Link OSPF instance to VRF. */
|
/* Link OSPF instance to VRF. */
|
||||||
|
@ -2273,20 +2270,20 @@ static void ospf_set_redist_vrf_bitmaps(struct ospf *ospf, bool set)
|
||||||
"%s: setting redist vrf %d bitmap for type %d",
|
"%s: setting redist vrf %d bitmap for type %d",
|
||||||
__func__, ospf->vrf_id, type);
|
__func__, ospf->vrf_id, type);
|
||||||
if (set)
|
if (set)
|
||||||
vrf_bitmap_set(&zclient->redist[AFI_IP][type],
|
vrf_bitmap_set(&ospf_zclient->redist[AFI_IP][type],
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
else
|
else
|
||||||
vrf_bitmap_unset(&zclient->redist[AFI_IP][type],
|
vrf_bitmap_unset(&ospf_zclient->redist[AFI_IP][type],
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
red_list = ospf->redist[DEFAULT_ROUTE];
|
red_list = ospf->redist[DEFAULT_ROUTE];
|
||||||
if (red_list) {
|
if (red_list) {
|
||||||
if (set)
|
if (set)
|
||||||
vrf_bitmap_set(&zclient->default_information[AFI_IP],
|
vrf_bitmap_set(&ospf_zclient->default_information[AFI_IP],
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
else
|
else
|
||||||
vrf_bitmap_unset(&zclient->default_information[AFI_IP],
|
vrf_bitmap_unset(&ospf_zclient->default_information[AFI_IP],
|
||||||
ospf->vrf_id);
|
ospf->vrf_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -695,7 +695,8 @@ struct ospf_nbr_nbma {
|
||||||
extern struct ospf_master *om;
|
extern struct ospf_master *om;
|
||||||
extern unsigned short ospf_instance;
|
extern unsigned short ospf_instance;
|
||||||
extern const int ospf_redistributed_proto_max;
|
extern const int ospf_redistributed_proto_max;
|
||||||
extern struct zclient *zclient;
|
extern struct zclient *ospf_zclient;
|
||||||
|
extern struct zclient *zclient_sync;
|
||||||
extern struct event_loop *master;
|
extern struct event_loop *master;
|
||||||
extern int ospf_zlog;
|
extern int ospf_zlog;
|
||||||
extern struct zebra_privs_t ospfd_privs;
|
extern struct zebra_privs_t ospfd_privs;
|
||||||
|
|
Loading…
Reference in a new issue