Merge pull request #17915 from mjstapp/compile_wshadow

This commit is contained in:
David Lamparter 2025-04-09 09:59:06 +02:00 committed by GitHub
commit 8418e57791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
132 changed files with 1141 additions and 1145 deletions

View file

@ -755,8 +755,10 @@ babel_interface_close_all(void)
} }
/* Disable babel redistribution */ /* Disable babel redistribution */
for (type = 0; type < ZEBRA_ROUTE_MAX; type++) { for (type = 0; type < ZEBRA_ROUTE_MAX; type++) {
zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, type, 0, VRF_DEFAULT); zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, babel_zclient, AFI_IP, type, 0,
zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP6, type, 0, VRF_DEFAULT); VRF_DEFAULT);
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, babel_zclient, AFI_IP6, type, 0,
VRF_DEFAULT);
} }
} }
@ -974,6 +976,7 @@ DEFUN (show_babel_route,
{ {
struct route_stream *routes = NULL; struct route_stream *routes = NULL;
struct xroute_stream *xroutes = NULL; struct xroute_stream *xroutes = NULL;
routes = route_stream(0); routes = route_stream(0);
if(routes) { if(routes) {
while(1) { while(1) {

View file

@ -19,7 +19,7 @@ void babelz_zebra_init(void);
/* we must use a pointer because of zclient.c's functions (new, free). */ /* we must use a pointer because of zclient.c's functions (new, free). */
struct zclient *zclient; struct zclient *babel_zclient;
/* Debug types */ /* Debug types */
static const struct { static const struct {
@ -94,9 +94,10 @@ DEFUN (babel_redistribute_type,
} }
if (!negate) if (!negate)
zclient_redistribute (ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, 0, VRF_DEFAULT); zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, babel_zclient, afi, type, 0, VRF_DEFAULT);
else { else {
zclient_redistribute (ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, type, 0, VRF_DEFAULT); zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, babel_zclient, afi, type, 0,
VRF_DEFAULT);
/* perhaps should we remove xroutes having the same type... */ /* perhaps should we remove xroutes having the same type... */
} }
return CMD_SUCCESS; return CMD_SUCCESS;
@ -230,11 +231,11 @@ static zclient_handler *const babel_handlers[] = {
void babelz_zebra_init(void) void babelz_zebra_init(void)
{ {
zclient = zclient_new(master, &zclient_options_default, babel_handlers, babel_zclient = zclient_new(master, &zclient_options_default, babel_handlers,
array_size(babel_handlers)); array_size(babel_handlers));
zclient_init(zclient, ZEBRA_ROUTE_BABEL, 0, &babeld_privs); zclient_init(babel_zclient, ZEBRA_ROUTE_BABEL, 0, &babeld_privs);
zclient->zebra_connected = babel_zebra_connected; babel_zclient->zebra_connected = babel_zebra_connected;
install_element(BABEL_NODE, &babel_redistribute_type_cmd); install_element(BABEL_NODE, &babel_redistribute_type_cmd);
install_element(ENABLE_NODE, &debug_babel_cmd); install_element(ENABLE_NODE, &debug_babel_cmd);
@ -248,6 +249,6 @@ void babelz_zebra_init(void)
void void
babel_zebra_close_connexion(void) babel_zebra_close_connexion(void)
{ {
zclient_stop(zclient); zclient_stop(babel_zclient);
zclient_free(zclient); zclient_free(babel_zclient);
} }

View file

@ -8,7 +8,7 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
#include "vty.h" #include "vty.h"
extern struct zclient *zclient; extern struct zclient *babel_zclient;
void babelz_zebra_init(void); void babelz_zebra_init(void);
void babel_zebra_close_connexion(void); void babel_zebra_close_connexion(void);

View file

@ -108,8 +108,8 @@ babel_config_write (struct vty *vty)
/* list redistributed protocols */ /* list redistributed protocols */
for (afi = AFI_IP; afi <= AFI_IP6; afi++) { for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
if (i != zclient->redist_default && if (i != babel_zclient->redist_default &&
vrf_bitmap_check(&zclient->redist[afi][i], VRF_DEFAULT)) { vrf_bitmap_check(&babel_zclient->redist[afi][i], VRF_DEFAULT)) {
vty_out(vty, " redistribute %s %s\n", vty_out(vty, " redistribute %s %s\n",
(afi == AFI_IP) ? "ipv4" : "ipv6", (afi == AFI_IP) ? "ipv4" : "ipv6",
zebra_route_string(i)); zebra_route_string(i));

View file

@ -176,8 +176,7 @@ zebra_route(int add, int family, const unsigned char *pref, unsigned short plen,
debugf(BABEL_DEBUG_ROUTE, "%s route (%s) to zebra", debugf(BABEL_DEBUG_ROUTE, "%s route (%s) to zebra",
add ? "adding" : "removing", add ? "adding" : "removing",
(family == AF_INET) ? "ipv4" : "ipv6"); (family == AF_INET) ? "ipv4" : "ipv6");
return zclient_route_send (add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, return zclient_route_send(add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, babel_zclient, &api);
zclient, &api);
} }
int int

View file

@ -38,7 +38,6 @@ struct babel_route {
struct route_stream; struct route_stream;
extern struct babel_route **routes;
extern int kernel_metric; extern int kernel_metric;
extern enum babel_diversity diversity_kind; extern enum babel_diversity diversity_kind;
extern int diversity_factor; extern int diversity_factor;

View file

@ -36,7 +36,7 @@ struct ptm_client {
TAILQ_HEAD(pcqueue, ptm_client); TAILQ_HEAD(pcqueue, ptm_client);
static struct pcqueue pcqueue; static struct pcqueue pcqueue;
static struct zclient *zclient; static struct zclient *bfd_zclient;
/* /*
@ -209,7 +209,7 @@ int ptm_bfd_notify(struct bfd_session *bs, uint8_t notify_state)
* *
* q(64), l(32), w(16), c(8) * q(64), l(32), w(16), c(8)
*/ */
msg = zclient->obuf; msg = bfd_zclient->obuf;
stream_reset(msg); stream_reset(msg);
/* TODO: VRF handling */ /* TODO: VRF handling */
@ -264,7 +264,7 @@ int ptm_bfd_notify(struct bfd_session *bs, uint8_t notify_state)
/* Write packet size. */ /* Write packet size. */
stream_putw_at(msg, 0, stream_get_endp(msg)); stream_putw_at(msg, 0, stream_get_endp(msg));
return zclient_send_message(zclient); return zclient_send_message(bfd_zclient);
} }
static void _ptm_msg_read_address(struct stream *msg, struct sockaddr_any *sa) static void _ptm_msg_read_address(struct stream *msg, struct sockaddr_any *sa)
@ -600,7 +600,7 @@ stream_failure:
static int bfdd_replay(ZAPI_CALLBACK_ARGS) static int bfdd_replay(ZAPI_CALLBACK_ARGS)
{ {
struct stream *msg = zclient->ibuf; struct stream *msg = bfd_zclient->ibuf;
uint32_t rcmd; uint32_t rcmd;
STREAM_GETL(msg, rcmd); STREAM_GETL(msg, rcmd);
@ -653,7 +653,7 @@ static void bfdd_zebra_connected(struct zclient *zc)
zclient_create_header(msg, ZEBRA_INTERFACE_ADD, VRF_DEFAULT); zclient_create_header(msg, ZEBRA_INTERFACE_ADD, VRF_DEFAULT);
/* Send requests. */ /* Send requests. */
zclient_send_message(zclient); zclient_send_message(zc);
} }
static void bfdd_sessions_enable_interface(struct interface *ifp) static void bfdd_sessions_enable_interface(struct interface *ifp)
@ -837,32 +837,32 @@ void bfdd_zclient_init(struct zebra_privs_t *bfdd_priv)
{ {
hook_register_prio(if_real, 0, bfd_ifp_create); hook_register_prio(if_real, 0, bfd_ifp_create);
hook_register_prio(if_unreal, 0, bfd_ifp_destroy); hook_register_prio(if_unreal, 0, bfd_ifp_destroy);
zclient = zclient_new(master, &zclient_options_default, bfd_handlers, bfd_zclient = zclient_new(master, &zclient_options_default, bfd_handlers,
array_size(bfd_handlers)); array_size(bfd_handlers));
assert(zclient != NULL); assert(bfd_zclient != NULL);
zclient_init(zclient, ZEBRA_ROUTE_BFD, 0, bfdd_priv); zclient_init(bfd_zclient, ZEBRA_ROUTE_BFD, 0, bfdd_priv);
/* Send replay request on zebra connect. */ /* Send replay request on zebra connect. */
zclient->zebra_connected = bfdd_zebra_connected; bfd_zclient->zebra_connected = bfdd_zebra_connected;
} }
void bfdd_zclient_register(vrf_id_t vrf_id) void bfdd_zclient_register(vrf_id_t vrf_id)
{ {
if (!zclient || zclient->sock < 0) if (!bfd_zclient || bfd_zclient->sock < 0)
return; return;
zclient_send_reg_requests(zclient, vrf_id); zclient_send_reg_requests(bfd_zclient, vrf_id);
} }
void bfdd_zclient_unregister(vrf_id_t vrf_id) void bfdd_zclient_unregister(vrf_id_t vrf_id)
{ {
if (!zclient || zclient->sock < 0) if (!bfd_zclient || bfd_zclient->sock < 0)
return; return;
zclient_send_dereg_requests(zclient, vrf_id); zclient_send_dereg_requests(bfd_zclient, vrf_id);
} }
void bfdd_zclient_stop(void) void bfdd_zclient_stop(void)
{ {
zclient_stop(zclient); zclient_stop(bfd_zclient);
/* Clean-up and free ptm clients data memory. */ /* Clean-up and free ptm clients data memory. */
pc_free_all(); pc_free_all();
@ -870,7 +870,7 @@ void bfdd_zclient_stop(void)
void bfdd_zclient_terminate(void) void bfdd_zclient_terminate(void)
{ {
zclient_free(zclient); zclient_free(bfd_zclient);
} }

View file

@ -1444,11 +1444,11 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode,
uint8_t *notify_datap = (length > 0 ? args->startp : NULL); uint8_t *notify_datap = (length > 0 ? args->startp : NULL);
if (bgp_debug_update(peer, NULL, NULL, 1)) { if (bgp_debug_update(peer, NULL, NULL, 1)) {
char attr_str[BUFSIZ] = {0}; char str[BUFSIZ] = { 0 };
bgp_dump_attr(attr, attr_str, sizeof(attr_str)); bgp_dump_attr(attr, str, sizeof(str));
zlog_debug("%s: attributes: %s", __func__, attr_str); zlog_debug("%s: attributes: %s", __func__, str);
} }
/* Only relax error handling for eBGP peers */ /* Only relax error handling for eBGP peers */
@ -2043,11 +2043,11 @@ static int bgp_attr_aggregator(struct bgp_attr_parser_args *args)
peer->host, aspath_print(attr->aspath)); peer->host, aspath_print(attr->aspath));
if (bgp_debug_update(peer, NULL, NULL, 1)) { if (bgp_debug_update(peer, NULL, NULL, 1)) {
char attr_str[BUFSIZ] = {0}; char str[BUFSIZ] = { 0 };
bgp_dump_attr(attr, attr_str, sizeof(attr_str)); bgp_dump_attr(attr, str, sizeof(str));
zlog_debug("%s: attributes: %s", __func__, attr_str); zlog_debug("%s: attributes: %s", __func__, str);
} }
} else { } else {
SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR)); SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AGGREGATOR));
@ -2094,11 +2094,11 @@ bgp_attr_as4_aggregator(struct bgp_attr_parser_args *args,
peer->host, aspath_print(attr->aspath)); peer->host, aspath_print(attr->aspath));
if (bgp_debug_update(peer, NULL, NULL, 1)) { if (bgp_debug_update(peer, NULL, NULL, 1)) {
char attr_str[BUFSIZ] = {0}; char str[BUFSIZ] = { 0 };
bgp_dump_attr(attr, attr_str, sizeof(attr_str)); bgp_dump_attr(attr, str, sizeof(str));
zlog_debug("%s: attributes: %s", __func__, attr_str); zlog_debug("%s: attributes: %s", __func__, str);
} }
} else { } else {
SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS4_AGGREGATOR)); SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS4_AGGREGATOR));

View file

@ -30,7 +30,7 @@
DEFINE_MTYPE_STATIC(BGPD, BFD_CONFIG, "BFD configuration data"); DEFINE_MTYPE_STATIC(BGPD, BFD_CONFIG, "BFD configuration data");
extern struct zclient *zclient; extern struct zclient *bgp_zclient;
static void bfd_session_status_update(struct bfd_session_params *bsp, static void bfd_session_status_update(struct bfd_session_params *bsp,
const struct bfd_session_status *bss, const struct bfd_session_status *bss,
@ -651,7 +651,7 @@ DEFUN(no_neighbor_bfd_profile, no_neighbor_bfd_profile_cmd,
void bgp_bfd_init(struct event_loop *tm) void bgp_bfd_init(struct event_loop *tm)
{ {
/* Initialize BFD client functions */ /* Initialize BFD client functions */
bfd_protocol_integration_init(zclient, tm); bfd_protocol_integration_init(bgp_zclient, tm);
/* "neighbor bfd" commands. */ /* "neighbor bfd" commands. */
install_element(BGP_NODE, &neighbor_bfd_cmd); install_element(BGP_NODE, &neighbor_bfd_cmd);

View file

@ -1441,14 +1441,14 @@ static char *_ecommunity_ecom2str(struct ecommunity *ecom, int format, int filte
snprintf(encbuf, sizeof(encbuf), "FS:action %s", snprintf(encbuf, sizeof(encbuf), "FS:action %s",
action); action);
} else if (sub_type == ECOMMUNITY_TRAFFIC_RATE) { } else if (sub_type == ECOMMUNITY_TRAFFIC_RATE) {
union traffic_rate data; union traffic_rate rate;
data.rate_byte[3] = *(pnt+2); rate.rate_byte[3] = *(pnt + 2);
data.rate_byte[2] = *(pnt+3); rate.rate_byte[2] = *(pnt + 3);
data.rate_byte[1] = *(pnt+4); rate.rate_byte[1] = *(pnt + 4);
data.rate_byte[0] = *(pnt+5); rate.rate_byte[0] = *(pnt + 5);
snprintf(encbuf, sizeof(encbuf), "FS:rate %f", snprintf(encbuf, sizeof(encbuf), "FS:rate %f",
data.rate_float); rate.rate_float);
} else if (sub_type == ECOMMUNITY_TRAFFIC_MARKING) { } else if (sub_type == ECOMMUNITY_TRAFFIC_MARKING) {
snprintf(encbuf, sizeof(encbuf), snprintf(encbuf, sizeof(encbuf),
"FS:marking %u", *(pnt + 5)); "FS:marking %u", *(pnt + 5));

View file

@ -905,7 +905,7 @@ static enum zclient_send_status bgp_zebra_send_remote_macip(
bool esi_valid; bool esi_valid;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) { if (!bgp_zclient || bgp_zclient->sock < 0) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zclient or zclient->sock exists", zlog_debug("%s: No zclient or zclient->sock exists",
__func__); __func__);
@ -923,7 +923,7 @@ static enum zclient_send_status bgp_zebra_send_remote_macip(
if (!esi) if (!esi)
esi = zero_esi; esi = zero_esi;
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header( zclient_create_header(
@ -984,7 +984,7 @@ static enum zclient_send_status bgp_zebra_send_remote_macip(
frrtrace(5, frr_bgp, evpn_mac_ip_zsend, add, vpn, p, remote_vtep_ip, frrtrace(5, frr_bgp, evpn_mac_ip_zsend, add, vpn, p, remote_vtep_ip,
esi); esi);
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
/* /*
@ -998,7 +998,7 @@ bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
struct stream *s; struct stream *s;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) { if (!bgp_zclient || bgp_zclient->sock < 0) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zclient or zclient->sock exists", zlog_debug("%s: No zclient or zclient->sock exists",
__func__); __func__);
@ -1014,7 +1014,7 @@ bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
return ZCLIENT_SEND_SUCCESS; return ZCLIENT_SEND_SUCCESS;
} }
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header( zclient_create_header(
@ -1041,7 +1041,7 @@ bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
frrtrace(3, frr_bgp, evpn_bum_vtep_zsend, add, vpn, p); frrtrace(3, frr_bgp, evpn_bum_vtep_zsend, add, vpn, p);
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
/* /*

View file

@ -1387,7 +1387,7 @@ bgp_zebra_send_remote_es_vtep(struct bgp *bgp, struct bgp_evpn_es_vtep *es_vtep,
uint32_t flags = 0; uint32_t flags = 0;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) { if (!bgp_zclient || bgp_zclient->sock < 0) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: No zclient or zclient->sock exists", zlog_debug("%s: No zclient or zclient->sock exists",
__func__); __func__);
@ -1405,7 +1405,7 @@ bgp_zebra_send_remote_es_vtep(struct bgp *bgp, struct bgp_evpn_es_vtep *es_vtep,
if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR)) if (CHECK_FLAG(es_vtep->flags, BGP_EVPNES_VTEP_ESR))
SET_FLAG(flags, ZAPI_ES_VTEP_FLAG_ESR_RXED); SET_FLAG(flags, ZAPI_ES_VTEP_FLAG_ESR_RXED);
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, zclient_create_header(s,
@ -1427,7 +1427,7 @@ bgp_zebra_send_remote_es_vtep(struct bgp *bgp, struct bgp_evpn_es_vtep *es_vtep,
frrtrace(3, frr_bgp, evpn_mh_vtep_zsend, add, es, es_vtep); frrtrace(3, frr_bgp, evpn_mh_vtep_zsend, add, es, es_vtep);
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
static enum zclient_send_status bgp_evpn_es_vtep_re_eval_active( static enum zclient_send_status bgp_evpn_es_vtep_re_eval_active(
@ -2876,7 +2876,7 @@ static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf,
if (!api_nhg.nexthop_num) if (!api_nhg.nexthop_num)
return; return;
zclient_nhg_send(zclient, ZEBRA_NHG_ADD, &api_nhg); zclient_nhg_send(bgp_zclient, ZEBRA_NHG_ADD, &api_nhg);
} }
static bool bgp_evpn_l3nhg_zebra_ok(struct bgp_evpn_es_vrf *es_vrf) static bool bgp_evpn_l3nhg_zebra_ok(struct bgp_evpn_es_vrf *es_vrf)
@ -2885,7 +2885,7 @@ static bool bgp_evpn_l3nhg_zebra_ok(struct bgp_evpn_es_vrf *es_vrf)
return false; return false;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return false; return false;
return true; return true;
@ -2920,7 +2920,7 @@ static void bgp_evpn_l3nhg_zebra_del_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf,
frrtrace(4, frr_bgp, evpn_mh_nhg_zsend, false, v4_nhg, api_nhg.id, frrtrace(4, frr_bgp, evpn_mh_nhg_zsend, false, v4_nhg, api_nhg.id,
es_vrf); es_vrf);
zclient_nhg_send(zclient, ZEBRA_NHG_DEL, &api_nhg); zclient_nhg_send(bgp_zclient, ZEBRA_NHG_DEL, &api_nhg);
} }
static void bgp_evpn_l3nhg_zebra_del(struct bgp_evpn_es_vrf *es_vrf) static void bgp_evpn_l3nhg_zebra_del(struct bgp_evpn_es_vrf *es_vrf)
@ -4476,7 +4476,7 @@ static void bgp_evpn_nh_zebra_update_send(struct bgp_evpn_nh *nh, bool add)
struct bgp *bgp_vrf = nh->bgp_vrf; struct bgp *bgp_vrf = nh->bgp_vrf;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return; return;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
@ -4487,7 +4487,7 @@ static void bgp_evpn_nh_zebra_update_send(struct bgp_evpn_nh *nh, bool add)
return; return;
} }
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header( zclient_create_header(
@ -4512,7 +4512,7 @@ static void bgp_evpn_nh_zebra_update_send(struct bgp_evpn_nh *nh, bool add)
frrtrace(2, frr_bgp, evpn_mh_nh_rmac_zsend, add, nh); frrtrace(2, frr_bgp, evpn_mh_nh_rmac_zsend, add, nh);
zclient_send_message(zclient); zclient_send_message(bgp_zclient);
} }
static void bgp_evpn_nh_zebra_update(struct bgp_evpn_nh *nh, bool add) static void bgp_evpn_nh_zebra_update(struct bgp_evpn_nh *nh, bool add)

View file

@ -673,8 +673,6 @@ static inline bool bgp_evpn_is_path_local(struct bgp *bgp,
&& pi->sub_type == BGP_ROUTE_STATIC); && pi->sub_type == BGP_ROUTE_STATIC);
} }
extern struct zclient *zclient;
extern void bgp_evpn_install_uninstall_default_route(struct bgp *bgp_vrf, extern void bgp_evpn_install_uninstall_default_route(struct bgp *bgp_vrf,
afi_t afi, safi_t safi, afi_t afi, safi_t safi,
bool add); bool add);

View file

@ -1462,22 +1462,22 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
output_count++; output_count++;
if (use_json && json_array) { if (use_json && json_array) {
const struct prefix *p = const struct prefix *pfx =
bgp_dest_get_prefix(rm); bgp_dest_get_prefix(rm);
json_prefix_info = json_object_new_object(); json_prefix_info = json_object_new_object();
json_object_string_addf(json_prefix_info, json_object_string_addf(json_prefix_info,
"prefix", "%pFX", p); "prefix", "%pFX", pfx);
json_object_int_add(json_prefix_info, json_object_int_add(json_prefix_info,
"prefixLen", p->prefixlen); "prefixLen", pfx->prefixlen);
json_object_object_add(json_prefix_info, json_object_object_add(json_prefix_info,
"paths", json_array); "paths", json_array);
json_object_object_addf(json_nroute, json_object_object_addf(json_nroute,
json_prefix_info, json_prefix_info,
"%pFX", p); "%pFX", pfx);
json_array = NULL; json_array = NULL;
} }
} }

View file

@ -26,7 +26,7 @@
#include "bgpd/bgp_debug.h" #include "bgpd/bgp_debug.h"
#include "bgpd/bgp_errors.h" #include "bgpd/bgp_errors.h"
extern struct zclient *zclient; extern struct zclient *bgp_zclient;
/* MPLS Labels hash routines. */ /* MPLS Labels hash routines. */
@ -157,7 +157,7 @@ int bgp_parse_fec_update(void)
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
s = zclient->ibuf; s = bgp_zclient->ibuf;
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
p.family = stream_getw(s); p.family = stream_getw(s);
@ -249,7 +249,7 @@ static void bgp_send_fec_register_label_msg(struct bgp_dest *dest, bool reg,
p = bgp_dest_get_prefix(dest); p = bgp_dest_get_prefix(dest);
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return; return;
if (BGP_DEBUG(labelpool, LABELPOOL)) if (BGP_DEBUG(labelpool, LABELPOOL))
@ -258,7 +258,7 @@ static void bgp_send_fec_register_label_msg(struct bgp_dest *dest, bool reg,
/* If the route node has a local_label assigned or the /* If the route node has a local_label assigned or the
* path node has an MPLS SR label index allowing zebra to * path node has an MPLS SR label index allowing zebra to
* derive the label, proceed with registration. */ * derive the label, proceed with registration. */
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
command = (reg) ? ZEBRA_FEC_REGISTER : ZEBRA_FEC_UNREGISTER; command = (reg) ? ZEBRA_FEC_REGISTER : ZEBRA_FEC_UNREGISTER;
zclient_create_header(s, command, VRF_DEFAULT); zclient_create_header(s, command, VRF_DEFAULT);
@ -288,7 +288,7 @@ static void bgp_send_fec_register_label_msg(struct bgp_dest *dest, bool reg,
if (reg) if (reg)
stream_putw_at(s, flags_pos, flags); stream_putw_at(s, flags_pos, flags);
zclient_send_message(zclient); zclient_send_message(bgp_zclient);
} }
/** /**

View file

@ -46,7 +46,7 @@ DEFINE_MTYPE_STATIC(BGPD, MPLSVPN_NH_LABEL_BIND_CACHE,
/* /*
* Definitions and external declarations. * Definitions and external declarations.
*/ */
extern struct zclient *zclient; extern struct zclient *bgp_zclient;
extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, extern int argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc,
int *index, afi_t *afi) int *index, afi_t *afi)
@ -317,7 +317,7 @@ void vpn_leak_zebra_vrf_label_update(struct bgp *bgp, afi_t afi)
if (label == BGP_PREVENT_VRF_2_VRF_LEAK) if (label == BGP_PREVENT_VRF_2_VRF_LEAK)
label = MPLS_LABEL_NONE; label = MPLS_LABEL_NONE;
zclient_send_vrf_label(zclient, bgp->vrf_id, afi, label, ZEBRA_LSP_BGP); zclient_send_vrf_label(bgp_zclient, bgp->vrf_id, afi, label, ZEBRA_LSP_BGP);
bgp->vpn_policy[afi].tovpn_zebra_vrf_label_last_sent = label; bgp->vpn_policy[afi].tovpn_zebra_vrf_label_last_sent = label;
} }
@ -344,7 +344,7 @@ void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi)
bgp->name_pretty, bgp->vrf_id); bgp->name_pretty, bgp->vrf_id);
} }
zclient_send_vrf_label(zclient, bgp->vrf_id, afi, label, ZEBRA_LSP_BGP); zclient_send_vrf_label(bgp_zclient, bgp->vrf_id, afi, label, ZEBRA_LSP_BGP);
bgp->vpn_policy[afi].tovpn_zebra_vrf_label_last_sent = label; bgp->vpn_policy[afi].tovpn_zebra_vrf_label_last_sent = label;
} }
@ -401,7 +401,7 @@ void vpn_leak_zebra_vrf_sid_update_per_af(struct bgp *bgp, afi_t afi)
ctx.table = vrf->data.l.table_id; ctx.table = vrf->data.l.table_id;
act = afi == AFI_IP ? ZEBRA_SEG6_LOCAL_ACTION_END_DT4 act = afi == AFI_IP ? ZEBRA_SEG6_LOCAL_ACTION_END_DT4
: ZEBRA_SEG6_LOCAL_ACTION_END_DT6; : ZEBRA_SEG6_LOCAL_ACTION_END_DT6;
zclient_send_localsid(zclient, tovpn_sid, bgp->vrf_id, act, &ctx); zclient_send_localsid(bgp_zclient, tovpn_sid, bgp->vrf_id, act, &ctx);
tovpn_sid_ls = XCALLOC(MTYPE_BGP_SRV6_SID, sizeof(struct in6_addr)); tovpn_sid_ls = XCALLOC(MTYPE_BGP_SRV6_SID, sizeof(struct in6_addr));
*tovpn_sid_ls = *tovpn_sid; *tovpn_sid_ls = *tovpn_sid;
@ -457,7 +457,7 @@ void vpn_leak_zebra_vrf_sid_update_per_vrf(struct bgp *bgp)
} }
ctx.table = vrf->data.l.table_id; ctx.table = vrf->data.l.table_id;
act = ZEBRA_SEG6_LOCAL_ACTION_END_DT46; act = ZEBRA_SEG6_LOCAL_ACTION_END_DT46;
zclient_send_localsid(zclient, tovpn_sid, bgp->vrf_id, act, &ctx); zclient_send_localsid(bgp_zclient, tovpn_sid, bgp->vrf_id, act, &ctx);
tovpn_sid_ls = XCALLOC(MTYPE_BGP_SRV6_SID, sizeof(struct in6_addr)); tovpn_sid_ls = XCALLOC(MTYPE_BGP_SRV6_SID, sizeof(struct in6_addr));
*tovpn_sid_ls = *tovpn_sid; *tovpn_sid_ls = *tovpn_sid;
@ -519,7 +519,7 @@ void vpn_leak_zebra_vrf_sid_withdraw_per_af(struct bgp *bgp, afi_t afi)
bgp->vpn_policy[afi] bgp->vpn_policy[afi]
.tovpn_sid_locator->argument_bits_length; .tovpn_sid_locator->argument_bits_length;
} }
zclient_send_localsid(zclient, zclient_send_localsid(bgp_zclient,
bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent, bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent,
bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC, bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC,
&seg6localctx); &seg6localctx);
@ -564,7 +564,7 @@ void vpn_leak_zebra_vrf_sid_withdraw_per_vrf(struct bgp *bgp)
seg6localctx.argument_len = seg6localctx.argument_len =
bgp->tovpn_sid_locator->argument_bits_length; bgp->tovpn_sid_locator->argument_bits_length;
} }
zclient_send_localsid(zclient, bgp->tovpn_zebra_vrf_sid_last_sent, zclient_send_localsid(bgp_zclient, bgp->tovpn_zebra_vrf_sid_last_sent,
bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC, bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC,
&seg6localctx); &seg6localctx);
XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_zebra_vrf_sid_last_sent); XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_zebra_vrf_sid_last_sent);

View file

@ -1460,8 +1460,6 @@ static struct bgp_path_info *bgpL3vpnRte_lookup(struct variable *v, oid name[],
pi = bgp_lookup_route_next(l3vpn_bgp, dest, &prefix, policy, pi = bgp_lookup_route_next(l3vpn_bgp, dest, &prefix, policy,
&nexthop); &nexthop);
if (pi) { if (pi) {
uint8_t vrf_name_len =
strnlen((*l3vpn_bgp)->name, VRF_NAMSIZ);
const struct prefix *p = bgp_dest_get_prefix(*dest); const struct prefix *p = bgp_dest_get_prefix(*dest);
uint8_t oid_index; uint8_t oid_index;
bool v4 = (p->family == AF_INET); bool v4 = (p->family == AF_INET);
@ -1469,6 +1467,8 @@ static struct bgp_path_info *bgpL3vpnRte_lookup(struct variable *v, oid name[],
: sizeof(struct in6_addr); : sizeof(struct in6_addr);
struct attr *attr = pi->attr; struct attr *attr = pi->attr;
vrf_name_len = strnlen((*l3vpn_bgp)->name, VRF_NAMSIZ);
/* copy the index parameters */ /* copy the index parameters */
oid_copy_str(&name[namelen], (*l3vpn_bgp)->name, oid_copy_str(&name[namelen], (*l3vpn_bgp)->name,
vrf_name_len); vrf_name_len);

View file

@ -34,7 +34,7 @@
#include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_mplsvpn.h"
#include "bgpd/bgp_ecommunity.h" #include "bgpd/bgp_ecommunity.h"
extern struct zclient *zclient; extern struct zclient *bgp_zclient;
static void register_zebra_rnh(struct bgp_nexthop_cache *bnc); static void register_zebra_rnh(struct bgp_nexthop_cache *bnc);
static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc); static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc);
@ -667,7 +667,7 @@ static void bgp_process_nexthop_update(struct bgp_nexthop_cache *bnc,
nexthop->vrf_id); nexthop->vrf_id);
if (ifp) if (ifp)
zclient_send_interface_radv_req( zclient_send_interface_radv_req(
zclient, nexthop->vrf_id, ifp, bgp_zclient, nexthop->vrf_id, ifp,
true, true,
BGP_UNNUM_DEFAULT_RA_INTERVAL); BGP_UNNUM_DEFAULT_RA_INTERVAL);
} }
@ -1131,11 +1131,11 @@ static bool make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p,
*/ */
static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command) static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
{ {
bool exact_match = false; bool match_p = false;
bool resolve_via_default = false; bool resolve_via_default = false;
int ret; int ret;
if (!zclient) if (!bgp_zclient)
return; return;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
@ -1155,7 +1155,7 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
} }
if (command == ZEBRA_NEXTHOP_REGISTER) { if (command == ZEBRA_NEXTHOP_REGISTER) {
if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED)) if (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED))
exact_match = true; match_p = true;
if (CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH)) if (CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH))
resolve_via_default = true; resolve_via_default = true;
} }
@ -1165,8 +1165,8 @@ static void sendmsg_zebra_rnh(struct bgp_nexthop_cache *bnc, int command)
zserv_command_string(command), &bnc->prefix, zserv_command_string(command), &bnc->prefix,
bnc->bgp->name_pretty); bnc->bgp->name_pretty);
ret = zclient_send_rnh(zclient, command, &bnc->prefix, SAFI_UNICAST, ret = zclient_send_rnh(bgp_zclient, command, &bnc->prefix, SAFI_UNICAST,
exact_match, resolve_via_default, match_p, resolve_via_default,
bnc->bgp->vrf_id); bnc->bgp->vrf_id);
if (ret == ZCLIENT_SEND_FAILURE) { if (ret == ZCLIENT_SEND_FAILURE) {
flog_warn(EC_BGP_ZEBRA_SEND, flog_warn(EC_BGP_ZEBRA_SEND,
@ -1593,7 +1593,7 @@ void bgp_nht_reg_enhe_cap_intfs(struct peer *peer)
if (!ifp) if (!ifp)
continue; continue;
zclient_send_interface_radv_req(zclient, zclient_send_interface_radv_req(bgp_zclient,
nhop->vrf_id, nhop->vrf_id,
ifp, true, ifp, true,
BGP_UNNUM_DEFAULT_RA_INTERVAL); BGP_UNNUM_DEFAULT_RA_INTERVAL);
@ -1643,7 +1643,7 @@ void bgp_nht_dereg_enhe_cap_intfs(struct peer *peer)
if (!ifp) if (!ifp)
continue; continue;
zclient_send_interface_radv_req(zclient, nhop->vrf_id, ifp, 0, zclient_send_interface_radv_req(bgp_zclient, nhop->vrf_id, ifp, 0,
0); 0);
} }
} }

View file

@ -3148,8 +3148,6 @@ static void bgp_dynamic_capability_paths_limit(uint8_t *pnt, int action,
SET_FLAG(peer->cap, PEER_CAP_PATHS_LIMIT_RCV); SET_FLAG(peer->cap, PEER_CAP_PATHS_LIMIT_RCV);
while (data + CAPABILITY_CODE_PATHS_LIMIT_LEN <= end) { while (data + CAPABILITY_CODE_PATHS_LIMIT_LEN <= end) {
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi; iana_afi_t pkt_afi;
iana_safi_t pkt_safi; iana_safi_t pkt_safi;
uint16_t paths_limit = 0; uint16_t paths_limit = 0;
@ -3508,8 +3506,6 @@ static void bgp_dynamic_capability_llgr(uint8_t *pnt, int action,
SET_FLAG(peer->cap, PEER_CAP_LLGR_RCV); SET_FLAG(peer->cap, PEER_CAP_LLGR_RCV);
while (data + BGP_CAP_LLGR_MIN_PACKET_LEN <= end) { while (data + BGP_CAP_LLGR_MIN_PACKET_LEN <= end) {
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi; iana_afi_t pkt_afi;
iana_safi_t pkt_safi; iana_safi_t pkt_safi;
struct graceful_restart_af graf; struct graceful_restart_af graf;
@ -3616,8 +3612,6 @@ static void bgp_dynamic_capability_graceful_restart(uint8_t *pnt, int action,
while (data + GRACEFUL_RESTART_CAPABILITY_PER_AFI_SAFI_SIZE <= while (data + GRACEFUL_RESTART_CAPABILITY_PER_AFI_SAFI_SIZE <=
end) { end) {
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi; iana_afi_t pkt_afi;
iana_safi_t pkt_safi; iana_safi_t pkt_safi;
struct graceful_restart_af graf; struct graceful_restart_af graf;

View file

@ -442,7 +442,7 @@ static bool bgp_pbr_extract(struct bgp_pbr_match_val list[],
struct bgp_pbr_range_port *range) struct bgp_pbr_range_port *range)
{ {
int i = 0; int i = 0;
bool exact_match = false; bool match_p = false;
if (range) if (range)
memset(range, 0, sizeof(struct bgp_pbr_range_port)); memset(range, 0, sizeof(struct bgp_pbr_range_port));
@ -457,9 +457,9 @@ static bool bgp_pbr_extract(struct bgp_pbr_match_val list[],
OPERATOR_COMPARE_EQUAL_TO)) { OPERATOR_COMPARE_EQUAL_TO)) {
if (range) if (range)
range->min_port = list[i].value; range->min_port = list[i].value;
exact_match = true; match_p = true;
} }
if (exact_match && i > 0) if (match_p && i > 0)
return false; return false;
if (list[i].compare_operator == if (list[i].compare_operator ==
(OPERATOR_COMPARE_GREATER_THAN + (OPERATOR_COMPARE_GREATER_THAN +

View file

@ -151,8 +151,6 @@ struct bgp_pbr_config {
bool pbr_interface_any_ipv6; bool pbr_interface_any_ipv6;
}; };
extern struct bgp_pbr_config *bgp_pbr_cfg;
struct bgp_pbr_rule { struct bgp_pbr_rule {
uint32_t flags; uint32_t flags;
struct prefix src; struct prefix src;

View file

@ -12034,8 +12034,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
/* Line 7 display Originator, Cluster-id */ /* Line 7 display Originator, Cluster-id */
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) || if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) ||
CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST))) { CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST))) {
char buf[BUFSIZ] = {0};
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))) { if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID))) {
if (json_paths) if (json_paths)
json_object_string_addf(json_path, json_object_string_addf(json_path,
@ -12047,9 +12045,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
} }
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST))) { if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_CLUSTER_LIST))) {
struct cluster_list *cluster = struct cluster_list *cluster = bgp_attr_get_cluster(attr);
bgp_attr_get_cluster(attr);
int i;
if (json_paths) { if (json_paths) {
json_cluster_list = json_object_new_object(); json_cluster_list = json_object_new_object();
@ -13579,7 +13575,7 @@ DEFUN (show_ip_bgp_large_community_list,
afi_t afi = AFI_IP6; afi_t afi = AFI_IP6;
safi_t safi = SAFI_UNICAST; safi_t safi = SAFI_UNICAST;
int idx = 0; int idx = 0;
bool exact_match = 0; bool match_p = 0;
struct bgp *bgp = NULL; struct bgp *bgp = NULL;
bool uj = use_json(argc, argv); bool uj = use_json(argc, argv);
@ -13596,10 +13592,10 @@ DEFUN (show_ip_bgp_large_community_list,
const char *clist_number_or_name = argv[++idx]->arg; const char *clist_number_or_name = argv[++idx]->arg;
if (++idx < argc && strmatch(argv[idx]->text, "exact-match")) if (++idx < argc && strmatch(argv[idx]->text, "exact-match"))
exact_match = 1; match_p = 1;
return bgp_show_lcommunity_list(vty, bgp, clist_number_or_name, return bgp_show_lcommunity_list(vty, bgp, clist_number_or_name,
exact_match, afi, safi, uj); match_p, afi, safi, uj);
} }
DEFUN (show_ip_bgp_large_community, DEFUN (show_ip_bgp_large_community,
show_ip_bgp_large_community_cmd, show_ip_bgp_large_community_cmd,
@ -13618,7 +13614,7 @@ DEFUN (show_ip_bgp_large_community,
afi_t afi = AFI_IP6; afi_t afi = AFI_IP6;
safi_t safi = SAFI_UNICAST; safi_t safi = SAFI_UNICAST;
int idx = 0; int idx = 0;
bool exact_match = 0; bool match_p = false;
struct bgp *bgp = NULL; struct bgp *bgp = NULL;
bool uj = use_json(argc, argv); bool uj = use_json(argc, argv);
uint16_t show_flags = 0; uint16_t show_flags = 0;
@ -13636,10 +13632,10 @@ DEFUN (show_ip_bgp_large_community,
if (argv_find(argv, argc, "AA:BB:CC", &idx)) { if (argv_find(argv, argc, "AA:BB:CC", &idx)) {
if (argv_find(argv, argc, "exact-match", &idx)) { if (argv_find(argv, argc, "exact-match", &idx)) {
argc--; argc--;
exact_match = 1; match_p = true;
} }
return bgp_show_lcommunity(vty, bgp, argc, argv, return bgp_show_lcommunity(vty, bgp, argc, argv,
exact_match, afi, safi, uj); match_p, afi, safi, uj);
} else } else
return bgp_show(vty, bgp, afi, safi, return bgp_show(vty, bgp, afi, safi,
bgp_show_type_lcommunity_all, NULL, show_flags, bgp_show_type_lcommunity_all, NULL, show_flags,
@ -13910,7 +13906,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
void *output_arg = NULL; void *output_arg = NULL;
struct bgp *bgp = NULL; struct bgp *bgp = NULL;
int idx = 0; int idx = 0;
int exact_match = 0; int match_p = 0;
char *community = NULL; char *community = NULL;
bool first = true; bool first = true;
uint16_t show_flags = 0; uint16_t show_flags = 0;
@ -13975,7 +13971,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
community = maybecomm; community = maybecomm;
if (argv_find(argv, argc, "exact-match", &idx)) if (argv_find(argv, argc, "exact-match", &idx))
exact_match = 1; match_p = 1;
if (!community) if (!community)
sh_type = bgp_show_type_community_all; sh_type = bgp_show_type_community_all;
@ -13986,7 +13982,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
struct community_list *list; struct community_list *list;
if (argv_find(argv, argc, "exact-match", &idx)) if (argv_find(argv, argc, "exact-match", &idx))
exact_match = 1; match_p = 1;
list = community_list_lookup(bgp_clist, clist_number_or_name, 0, list = community_list_lookup(bgp_clist, clist_number_or_name, 0,
COMMUNITY_LIST_MASTER); COMMUNITY_LIST_MASTER);
@ -13996,7 +13992,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
return CMD_WARNING; return CMD_WARNING;
} }
if (exact_match) if (match_p)
sh_type = bgp_show_type_community_list_exact; sh_type = bgp_show_type_community_list_exact;
else else
sh_type = bgp_show_type_community_list; sh_type = bgp_show_type_community_list;
@ -14106,7 +14102,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
/* show bgp: AFI_IP6, show ip bgp: AFI_IP */ /* show bgp: AFI_IP6, show ip bgp: AFI_IP */
if (community) if (community)
return bgp_show_community(vty, bgp, community, return bgp_show_community(vty, bgp, community,
exact_match, afi, safi, match_p, afi, safi,
show_flags); show_flags);
else else
return bgp_show(vty, bgp, afi, safi, sh_type, return bgp_show(vty, bgp, afi, safi, sh_type,
@ -14151,7 +14147,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
if (community) if (community)
bgp_show_community( bgp_show_community(
vty, abgp, community, vty, abgp, community,
exact_match, afi, safi, match_p, afi, safi,
show_flags); show_flags);
else else
bgp_show(vty, abgp, afi, safi, bgp_show(vty, abgp, afi, safi,
@ -14199,7 +14195,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
if (community) if (community)
bgp_show_community( bgp_show_community(
vty, abgp, community, vty, abgp, community,
exact_match, afi, safi, match_p, afi, safi,
show_flags); show_flags);
else else
bgp_show(vty, abgp, afi, safi, bgp_show(vty, abgp, afi, safi,
@ -15469,15 +15465,15 @@ show_adj_route(struct vty *vty, struct peer *peer, struct bgp_table *table,
json_net = json_net =
json_object_new_object(); json_object_new_object();
struct bgp_path_info bpi; struct bgp_path_info pathi;
struct bgp_dest buildit = *dest; struct bgp_dest buildit = *dest;
struct bgp_dest *pass_in; struct bgp_dest *pass_in;
if (route_filtered || if (route_filtered ||
ret == RMAP_DENY) { ret == RMAP_DENY) {
bpi.attr = &attr; pathi.attr = &attr;
bpi.peer = peer; pathi.peer = peer;
buildit.info = &bpi; buildit.info = &pathi;
pass_in = &buildit; pass_in = &buildit;
} else } else

View file

@ -1355,7 +1355,7 @@ lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(
{ {
struct routemap_hook_context *rhc; struct routemap_hook_context *rhc;
const char *value; const char *value;
bool exact_match = false; bool match_p = false;
bool any = false; bool any = false;
char *argstr; char *argstr;
const char *condition; const char *condition;
@ -1367,13 +1367,13 @@ lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(
value = yang_dnode_get_string(args->dnode, "comm-list-name"); value = yang_dnode_get_string(args->dnode, "comm-list-name");
if (yang_dnode_exists(args->dnode, "comm-list-name-exact-match")) if (yang_dnode_exists(args->dnode, "comm-list-name-exact-match"))
exact_match = yang_dnode_get_bool( match_p = yang_dnode_get_bool(
args->dnode, "./comm-list-name-exact-match"); args->dnode, "./comm-list-name-exact-match");
if (yang_dnode_exists(args->dnode, "comm-list-name-any")) if (yang_dnode_exists(args->dnode, "comm-list-name-any"))
any = yang_dnode_get_bool(args->dnode, "comm-list-name-any"); any = yang_dnode_get_bool(args->dnode, "comm-list-name-any");
if (exact_match) { if (match_p) {
argstr = XMALLOC(MTYPE_ROUTE_MAP_COMPILED, argstr = XMALLOC(MTYPE_ROUTE_MAP_COMPILED,
strlen(value) + strlen("exact-match") + 2); strlen(value) + strlen("exact-match") + 2);

View file

@ -967,10 +967,10 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
if (ctx->uj) { if (ctx->uj) {
json_peers = json_object_new_array(); json_peers = json_object_new_array();
SUBGRP_FOREACH_PEER (subgrp, paf) { SUBGRP_FOREACH_PEER (subgrp, paf) {
json_object *peer = json_object *jpeer =
json_object_new_string( json_object_new_string(
paf->peer->host); paf->peer->host);
json_object_array_add(json_peers, peer); json_object_array_add(json_peers, jpeer);
} }
json_object_object_add(json_subgrp, "peers", json_object_object_add(json_subgrp, "peers",
json_peers); json_peers);

View file

@ -11504,7 +11504,7 @@ DEFPY (show_bgp_vrfs,
json_vrfs = json_object_new_object(); json_vrfs = json_object_new_object();
for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) { for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) {
const char *name; const char *bname;
/* Skip Views. */ /* Skip Views. */
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
@ -11523,18 +11523,18 @@ DEFPY (show_bgp_vrfs,
json_vrf = json_object_new_object(); json_vrf = json_object_new_object();
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) { if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
name = VRF_DEFAULT_NAME; bname = VRF_DEFAULT_NAME;
type = "DFLT"; type = "DFLT";
} else { } else {
name = bgp->name; bname = bgp->name;
type = "VRF"; type = "VRF";
} }
show_bgp_vrfs_detail_common(vty, bgp, json_vrf, name, type, show_bgp_vrfs_detail_common(vty, bgp, json_vrf, bname, type,
false); false);
if (uj) if (uj)
json_object_object_add(json_vrfs, name, json_vrf); json_object_object_add(json_vrfs, bname, json_vrf);
} }
if (uj) { if (uj) {

View file

@ -56,8 +56,8 @@
#include "bgpd/bgp_lcommunity.h" #include "bgpd/bgp_lcommunity.h"
/* All information about zebra. */ /* All information about zebra. */
struct zclient *zclient = NULL; struct zclient *bgp_zclient = NULL;
struct zclient *zclient_sync; struct zclient *bgp_zclient_sync;
static bool bgp_zebra_label_manager_connect(void); static bool bgp_zebra_label_manager_connect(void);
/* hook to indicate vrf status change for SNMP */ /* hook to indicate vrf status change for SNMP */
@ -69,7 +69,7 @@ DEFINE_MTYPE_STATIC(BGPD, BGP_IF_INFO, "BGP interface context");
/* Can we install into zebra? */ /* Can we install into zebra? */
static inline bool bgp_install_info_to_zebra(struct bgp *bgp) static inline bool bgp_install_info_to_zebra(struct bgp *bgp)
{ {
if (zclient->sock <= 0) if (bgp_zclient->sock <= 0)
return false; return false;
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) { if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) {
@ -1010,15 +1010,15 @@ struct bgp *bgp_tm_bgp;
static void bgp_zebra_tm_connect(struct event *t) static void bgp_zebra_tm_connect(struct event *t)
{ {
struct zclient *zclient; struct zclient *zc;
int delay = 10, ret = 0; int delay = 10, ret = 0;
zclient = EVENT_ARG(t); zc = EVENT_ARG(t);
if (bgp_tm_status_connected && zclient->sock > 0) if (bgp_tm_status_connected && zc->sock > 0)
delay = 60; delay = 60;
else { else {
bgp_tm_status_connected = false; bgp_tm_status_connected = false;
ret = tm_table_manager_connect(zclient); ret = tm_table_manager_connect(zc);
} }
if (ret < 0) { if (ret < 0) {
zlog_err("Error connecting to table manager!"); zlog_err("Error connecting to table manager!");
@ -1031,7 +1031,7 @@ static void bgp_zebra_tm_connect(struct event *t)
} }
bgp_tm_status_connected = true; bgp_tm_status_connected = true;
if (!bgp_tm_chunk_obtained) { if (!bgp_tm_chunk_obtained) {
if (bgp_zebra_get_table_range(zclient, bgp_tm_chunk_size, if (bgp_zebra_get_table_range(zc, bgp_tm_chunk_size,
&bgp_tm_min, &bgp_tm_min,
&bgp_tm_max) >= 0) { &bgp_tm_max) >= 0) {
bgp_tm_chunk_obtained = true; bgp_tm_chunk_obtained = true;
@ -1040,7 +1040,7 @@ static void bgp_zebra_tm_connect(struct event *t)
} }
} }
} }
event_add_timer(bm->master, bgp_zebra_tm_connect, zclient, delay, event_add_timer(bm->master, bgp_zebra_tm_connect, zc, delay,
&bgp_tm_thread_connect); &bgp_tm_thread_connect);
} }
@ -1071,7 +1071,7 @@ void bgp_zebra_init_tm_connect(struct bgp *bgp)
bgp_tm_min = bgp_tm_max = 0; bgp_tm_min = bgp_tm_max = 0;
bgp_tm_chunk_size = BGP_FLOWSPEC_TABLE_CHUNK; bgp_tm_chunk_size = BGP_FLOWSPEC_TABLE_CHUNK;
bgp_tm_bgp = bgp; bgp_tm_bgp = bgp;
event_add_timer(bm->master, bgp_zebra_tm_connect, zclient_sync, delay, event_add_timer(bm->master, bgp_zebra_tm_connect, bgp_zclient_sync, delay,
&bgp_tm_thread_connect); &bgp_tm_thread_connect);
} }
@ -1650,7 +1650,7 @@ bgp_zebra_announce_actual(struct bgp_dest *dest, struct bgp_path_info *info,
__func__, p, (allow_recursion ? "" : "NOT ")); __func__, p, (allow_recursion ? "" : "NOT "));
} }
return zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); return zclient_route_send(ZEBRA_ROUTE_ADD, bgp_zclient, &api);
} }
@ -1747,7 +1747,7 @@ enum zclient_send_status bgp_zebra_withdraw_actual(struct bgp_dest *dest,
zlog_debug("Tx route delete %s (table id %u) %pFX", zlog_debug("Tx route delete %s (table id %u) %pFX",
bgp->name_pretty, api.tableid, &api.prefix); bgp->name_pretty, api.tableid, &api.prefix);
return zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); return zclient_route_send(ZEBRA_ROUTE_DELETE, bgp_zclient, &api);
} }
/* /*
@ -2071,19 +2071,19 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type,
.table_id = instance, .table_id = instance,
.vrf_id = bgp->vrf_id, .vrf_id = bgp->vrf_id,
}; };
if (redist_lookup_table_direct(&zclient->mi_redist[afi][type], &table) != if (redist_lookup_table_direct(&bgp_zclient->mi_redist[afi][type],
NULL) &table) != NULL)
return CMD_WARNING; return CMD_WARNING;
redist_add_table_direct(&zclient->mi_redist[afi][type], &table); redist_add_table_direct(&bgp_zclient->mi_redist[afi][type], &table);
} else { } else {
if (redist_check_instance(&zclient->mi_redist[afi][type], instance)) if (redist_check_instance(&bgp_zclient->mi_redist[afi][type], instance))
return CMD_WARNING; return CMD_WARNING;
redist_add_instance(&zclient->mi_redist[afi][type], instance); redist_add_instance(&bgp_zclient->mi_redist[afi][type], instance);
} }
} else { } else {
if (vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id)) if (vrf_bitmap_check(&bgp_zclient->redist[afi][type], bgp->vrf_id))
return CMD_WARNING; return CMD_WARNING;
#ifdef ENABLE_BGP_VNC #ifdef ENABLE_BGP_VNC
@ -2093,7 +2093,7 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type,
} }
#endif #endif
vrf_bitmap_set(&zclient->redist[afi][type], bgp->vrf_id); vrf_bitmap_set(&bgp_zclient->redist[afi][type], bgp->vrf_id);
} }
/* /*
@ -2111,7 +2111,7 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type,
instance); instance);
/* Send distribute add message to zebra. */ /* Send distribute add message to zebra. */
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, bgp_zclient, afi, type,
instance, bgp->vrf_id); instance, bgp->vrf_id);
return CMD_SUCCESS; return CMD_SUCCESS;
@ -2132,9 +2132,9 @@ int bgp_redistribute_resend(struct bgp *bgp, afi_t afi, int type,
instance); instance);
/* Send distribute add message to zebra. */ /* Send distribute add message to zebra. */
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, type, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, bgp_zclient, afi, type,
instance, bgp->vrf_id); instance, bgp->vrf_id);
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, bgp_zclient, afi, type,
instance, bgp->vrf_id); instance, bgp->vrf_id);
return 0; return 0;
@ -2214,21 +2214,21 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type,
.table_id = instance, .table_id = instance,
.vrf_id = bgp->vrf_id, .vrf_id = bgp->vrf_id,
}; };
if (redist_lookup_table_direct(&zclient->mi_redist[afi][type], &table) == if (redist_lookup_table_direct(&bgp_zclient->mi_redist[afi][type], &table) ==
NULL) NULL)
return CMD_WARNING; return CMD_WARNING;
redist_del_table_direct(&zclient->mi_redist[afi][type], &table); redist_del_table_direct(&bgp_zclient->mi_redist[afi][type], &table);
} else { } else {
if (!redist_check_instance(&zclient->mi_redist[afi][type], instance)) if (!redist_check_instance(&bgp_zclient->mi_redist[afi][type], instance))
return CMD_WARNING; return CMD_WARNING;
redist_del_instance(&zclient->mi_redist[afi][type], instance); redist_del_instance(&bgp_zclient->mi_redist[afi][type], instance);
} }
} else { } else {
if (!vrf_bitmap_check(&zclient->redist[afi][type], bgp->vrf_id)) if (!vrf_bitmap_check(&bgp_zclient->redist[afi][type], bgp->vrf_id))
return CMD_WARNING; return CMD_WARNING;
vrf_bitmap_unset(&zclient->redist[afi][type], bgp->vrf_id); vrf_bitmap_unset(&bgp_zclient->redist[afi][type], bgp->vrf_id);
} }
if (bgp_install_info_to_zebra(bgp)) { if (bgp_install_info_to_zebra(bgp)) {
@ -2237,7 +2237,7 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type,
zlog_debug("Tx redistribute del %s afi %d %s %d", zlog_debug("Tx redistribute del %s afi %d %s %d",
bgp->name_pretty, afi, bgp->name_pretty, afi,
zebra_route_string(type), instance); zebra_route_string(type), instance);
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, bgp_zclient, afi,
type, instance, bgp->vrf_id); type, instance, bgp->vrf_id);
} }
@ -2325,7 +2325,7 @@ void bgp_redistribute_redo(struct bgp *bgp)
void bgp_zclient_reset(void) void bgp_zclient_reset(void)
{ {
zclient_reset(zclient); zclient_reset(bgp_zclient);
} }
/* Register this instance with Zebra. Invoked upon connect (for /* Register this instance with Zebra. Invoked upon connect (for
@ -2335,14 +2335,14 @@ void bgp_zclient_reset(void)
void bgp_zebra_instance_register(struct bgp *bgp) void bgp_zebra_instance_register(struct bgp *bgp)
{ {
/* Don't try to register if we're not connected to Zebra */ /* Don't try to register if we're not connected to Zebra */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return; return;
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Registering %s", bgp->name_pretty); zlog_debug("Registering %s", bgp->name_pretty);
/* Register for router-id, interfaces, redistributed routes. */ /* Register for router-id, interfaces, redistributed routes. */
zclient_send_reg_requests(zclient, bgp->vrf_id); zclient_send_reg_requests(bgp_zclient, bgp->vrf_id);
/* For EVPN instance, register to learn about VNIs, if appropriate. */ /* For EVPN instance, register to learn about VNIs, if appropriate. */
if (bgp->advertise_all_vni) if (bgp->advertise_all_vni)
@ -2364,7 +2364,7 @@ void bgp_zebra_instance_register(struct bgp *bgp)
void bgp_zebra_instance_deregister(struct bgp *bgp) void bgp_zebra_instance_deregister(struct bgp *bgp)
{ {
/* Don't try to deregister if we're not connected to Zebra */ /* Don't try to deregister if we're not connected to Zebra */
if (zclient->sock < 0) if (bgp_zclient->sock < 0)
return; return;
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
@ -2375,7 +2375,7 @@ void bgp_zebra_instance_deregister(struct bgp *bgp)
bgp_zebra_advertise_all_vni(bgp, 0); bgp_zebra_advertise_all_vni(bgp, 0);
/* Deregister for router-id, interfaces, redistributed routes. */ /* Deregister for router-id, interfaces, redistributed routes. */
zclient_send_dereg_requests(zclient, bgp->vrf_id); zclient_send_dereg_requests(bgp_zclient, bgp->vrf_id);
} }
void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer) void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer)
@ -2386,7 +2386,7 @@ void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer)
return; return;
/* Don't try to initiate if we're not connected to Zebra */ /* Don't try to initiate if we're not connected to Zebra */
if (zclient->sock < 0) if (bgp_zclient->sock < 0)
return; return;
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
@ -2398,7 +2398,7 @@ void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer)
* If we don't have an ifp pointer, call function to find the * If we don't have an ifp pointer, call function to find the
* ifps for a numbered enhe peer to turn RAs on. * ifps for a numbered enhe peer to turn RAs on.
*/ */
peer->ifp ? zclient_send_interface_radv_req(zclient, bgp->vrf_id, peer->ifp ? zclient_send_interface_radv_req(bgp_zclient, bgp->vrf_id,
peer->ifp, 1, ra_interval) peer->ifp, 1, ra_interval)
: bgp_nht_reg_enhe_cap_intfs(peer); : bgp_nht_reg_enhe_cap_intfs(peer);
} }
@ -2406,7 +2406,7 @@ void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer)
void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer) void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer)
{ {
/* Don't try to terminate if we're not connected to Zebra */ /* Don't try to terminate if we're not connected to Zebra */
if (zclient->sock < 0) if (bgp_zclient->sock < 0)
return; return;
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
@ -2418,7 +2418,7 @@ void bgp_zebra_terminate_radv(struct bgp *bgp, struct peer *peer)
* If we don't have an ifp pointer, call function to find the * If we don't have an ifp pointer, call function to find the
* ifps for a numbered enhe peer to turn RAs off. * ifps for a numbered enhe peer to turn RAs off.
*/ */
peer->ifp ? zclient_send_interface_radv_req(zclient, bgp->vrf_id, peer->ifp ? zclient_send_interface_radv_req(bgp_zclient, bgp->vrf_id,
peer->ifp, 0, 0) peer->ifp, 0, 0)
: bgp_nht_dereg_enhe_cap_intfs(peer); : bgp_nht_dereg_enhe_cap_intfs(peer);
} }
@ -2428,7 +2428,7 @@ int bgp_zebra_advertise_subnet(struct bgp *bgp, int advertise, vni_t vni)
struct stream *s = NULL; struct stream *s = NULL;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return 0; return 0;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
@ -2440,7 +2440,7 @@ int bgp_zebra_advertise_subnet(struct bgp *bgp, int advertise, vni_t vni)
return 0; return 0;
} }
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_ADVERTISE_SUBNET, bgp->vrf_id); zclient_create_header(s, ZEBRA_ADVERTISE_SUBNET, bgp->vrf_id);
@ -2448,7 +2448,7 @@ int bgp_zebra_advertise_subnet(struct bgp *bgp, int advertise, vni_t vni)
stream_put3(s, vni); stream_put3(s, vni);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
int bgp_zebra_advertise_svi_macip(struct bgp *bgp, int advertise, vni_t vni) int bgp_zebra_advertise_svi_macip(struct bgp *bgp, int advertise, vni_t vni)
@ -2456,14 +2456,14 @@ int bgp_zebra_advertise_svi_macip(struct bgp *bgp, int advertise, vni_t vni)
struct stream *s = NULL; struct stream *s = NULL;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return 0; return 0;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp))
return 0; return 0;
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_ADVERTISE_SVI_MACIP, bgp->vrf_id); zclient_create_header(s, ZEBRA_ADVERTISE_SVI_MACIP, bgp->vrf_id);
@ -2471,7 +2471,7 @@ int bgp_zebra_advertise_svi_macip(struct bgp *bgp, int advertise, vni_t vni)
stream_putl(s, vni); stream_putl(s, vni);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni) int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni)
@ -2479,7 +2479,7 @@ int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni)
struct stream *s = NULL; struct stream *s = NULL;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return 0; return 0;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
@ -2491,7 +2491,7 @@ int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni)
return 0; return 0;
} }
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_ADVERTISE_DEFAULT_GW, bgp->vrf_id); zclient_create_header(s, ZEBRA_ADVERTISE_DEFAULT_GW, bgp->vrf_id);
@ -2499,7 +2499,7 @@ int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni)
stream_putl(s, vni); stream_putl(s, vni);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
int bgp_zebra_vxlan_flood_control(struct bgp *bgp, int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
@ -2508,7 +2508,7 @@ int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
struct stream *s; struct stream *s;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return 0; return 0;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
@ -2520,14 +2520,14 @@ int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
return 0; return 0;
} }
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_VXLAN_FLOOD_CONTROL, bgp->vrf_id); zclient_create_header(s, ZEBRA_VXLAN_FLOOD_CONTROL, bgp->vrf_id);
stream_putc(s, flood_ctrl); stream_putc(s, flood_ctrl);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise) int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise)
@ -2535,14 +2535,14 @@ int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise)
struct stream *s; struct stream *s;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return 0; return 0;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp)) if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp))
return 0; return 0;
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_ADVERTISE_ALL_VNI, bgp->vrf_id); zclient_create_header(s, ZEBRA_ADVERTISE_ALL_VNI, bgp->vrf_id);
@ -2553,7 +2553,7 @@ int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise)
stream_putc(s, bgp->vxlan_flood_ctrl); stream_putc(s, bgp->vxlan_flood_ctrl);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
int bgp_zebra_dup_addr_detection(struct bgp *bgp) int bgp_zebra_dup_addr_detection(struct bgp *bgp)
@ -2561,7 +2561,7 @@ int bgp_zebra_dup_addr_detection(struct bgp *bgp)
struct stream *s; struct stream *s;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!bgp_zclient || bgp_zclient->sock < 0)
return 0; return 0;
/* Don't try to register if Zebra doesn't know of this instance. */ /* Don't try to register if Zebra doesn't know of this instance. */
@ -2578,7 +2578,7 @@ int bgp_zebra_dup_addr_detection(struct bgp *bgp)
"enable" : "disable", "enable" : "disable",
bgp->evpn_info->dad_freeze_time); bgp->evpn_info->dad_freeze_time);
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_DUPLICATE_ADDR_DETECTION, zclient_create_header(s, ZEBRA_DUPLICATE_ADDR_DETECTION,
bgp->vrf_id); bgp->vrf_id);
@ -2589,7 +2589,7 @@ int bgp_zebra_dup_addr_detection(struct bgp *bgp)
stream_putl(s, bgp->evpn_info->dad_freeze_time); stream_putl(s, bgp->evpn_info->dad_freeze_time);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
return zclient_send_message(zclient); return zclient_send_message(bgp_zclient);
} }
static int rule_notify_owner(ZAPI_CALLBACK_ARGS) static int rule_notify_owner(ZAPI_CALLBACK_ARGS)
@ -3965,7 +3965,7 @@ void bgp_if_init(void)
static bool bgp_zebra_label_manager_ready(void) static bool bgp_zebra_label_manager_ready(void)
{ {
return (zclient_sync->sock > 0); return (bgp_zclient_sync->sock > 0);
} }
static void bgp_start_label_manager(struct event *start) static void bgp_start_label_manager(struct event *start)
@ -3979,29 +3979,29 @@ static void bgp_start_label_manager(struct event *start)
static bool bgp_zebra_label_manager_connect(void) static bool bgp_zebra_label_manager_connect(void)
{ {
/* Connect to label manager. */ /* Connect to label manager. */
if (zclient_socket_connect(zclient_sync) < 0) { if (zclient_socket_connect(bgp_zclient_sync) < 0) {
zlog_warn("%s: failed connecting synchronous zclient!", zlog_warn("%s: failed connecting synchronous zclient!",
__func__); __func__);
return false; return false;
} }
/* make socket non-blocking */ /* make socket non-blocking */
set_nonblocking(zclient_sync->sock); set_nonblocking(bgp_zclient_sync->sock);
/* Send hello to notify zebra this is a synchronous client */ /* Send hello to notify zebra this is a synchronous client */
if (zclient_send_hello(zclient_sync) == ZCLIENT_SEND_FAILURE) { if (zclient_send_hello(bgp_zclient_sync) == ZCLIENT_SEND_FAILURE) {
zlog_warn("%s: failed sending hello for synchronous zclient!", zlog_warn("%s: failed sending hello for synchronous zclient!",
__func__); __func__);
close(zclient_sync->sock); close(bgp_zclient_sync->sock);
zclient_sync->sock = -1; bgp_zclient_sync->sock = -1;
return false; return false;
} }
/* Connect to label manager */ /* Connect to label manager */
if (lm_label_manager_connect(zclient_sync, 0) != 0) { if (lm_label_manager_connect(bgp_zclient_sync, 0) != 0) {
zlog_warn("%s: failed connecting to label manager!", __func__); zlog_warn("%s: failed connecting to label manager!", __func__);
if (zclient_sync->sock > 0) { if (bgp_zclient_sync->sock > 0) {
close(zclient_sync->sock); close(bgp_zclient_sync->sock);
zclient_sync->sock = -1; bgp_zclient_sync->sock = -1;
} }
return false; return false;
} }
@ -4030,22 +4030,22 @@ void bgp_zebra_init(struct event_loop *master, unsigned short instance)
hook_register_prio(if_unreal, 0, bgp_ifp_destroy); hook_register_prio(if_unreal, 0, bgp_ifp_destroy);
/* Set default values. */ /* Set default values. */
zclient = zclient_new(master, &zclient_options_default, bgp_handlers, bgp_zclient = zclient_new(master, &zclient_options_default, bgp_handlers,
array_size(bgp_handlers)); array_size(bgp_handlers));
zclient_init(zclient, ZEBRA_ROUTE_BGP, 0, &bgpd_privs); zclient_init(bgp_zclient, ZEBRA_ROUTE_BGP, 0, &bgpd_privs);
zclient->zebra_buffer_write_ready = bgp_zebra_buffer_write_ready; bgp_zclient->zebra_buffer_write_ready = bgp_zebra_buffer_write_ready;
zclient->zebra_connected = bgp_zebra_connected; bgp_zclient->zebra_connected = bgp_zebra_connected;
zclient->zebra_capabilities = bgp_zebra_capabilities; bgp_zclient->zebra_capabilities = bgp_zebra_capabilities;
zclient->nexthop_update = bgp_nexthop_update; bgp_zclient->nexthop_update = bgp_nexthop_update;
zclient->instance = instance; bgp_zclient->instance = instance;
/* Initialize special zclient for synchronous message exchanges. */ /* Initialize special zclient for synchronous message exchanges. */
zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0); bgp_zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1; bgp_zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_BGP; bgp_zclient_sync->redist_default = ZEBRA_ROUTE_BGP;
zclient_sync->instance = instance; bgp_zclient_sync->instance = instance;
zclient_sync->session_id = 1; bgp_zclient_sync->session_id = 1;
zclient_sync->privs = &bgpd_privs; bgp_zclient_sync->privs = &bgpd_privs;
if (!bgp_zebra_label_manager_ready()) if (!bgp_zebra_label_manager_ready())
event_add_timer(master, bgp_start_label_manager, NULL, 1, event_add_timer(master, bgp_start_label_manager, NULL, 1,
@ -4054,17 +4054,17 @@ void bgp_zebra_init(struct event_loop *master, unsigned short instance)
void bgp_zebra_destroy(void) void bgp_zebra_destroy(void)
{ {
if (zclient == NULL) if (bgp_zclient == NULL)
return; return;
zclient_stop(zclient); zclient_stop(bgp_zclient);
zclient_free(zclient); zclient_free(bgp_zclient);
zclient = NULL; bgp_zclient = NULL;
if (zclient_sync == NULL) if (bgp_zclient_sync == NULL)
return; return;
zclient_stop(zclient_sync); zclient_stop(bgp_zclient_sync);
zclient_free(zclient_sync); zclient_free(bgp_zclient_sync);
zclient_sync = NULL; bgp_zclient_sync = NULL;
} }
int bgp_zebra_num_connects(void) int bgp_zebra_num_connects(void)
@ -4090,7 +4090,7 @@ void bgp_send_pbr_rule_action(struct bgp_pbr_action *pbra,
zlog_debug("%s: table %d fwmark %d %d", __func__, zlog_debug("%s: table %d fwmark %d %d", __func__,
pbra->table_id, pbra->fwmark, install); pbra->table_id, pbra->fwmark, install);
} }
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, zclient_create_header(s,
@ -4099,7 +4099,7 @@ void bgp_send_pbr_rule_action(struct bgp_pbr_action *pbra,
bgp_encode_pbr_rule_action(s, pbra, pbr); bgp_encode_pbr_rule_action(s, pbra, pbr);
if ((zclient_send_message(zclient) != ZCLIENT_SEND_FAILURE) if ((zclient_send_message(bgp_zclient) != ZCLIENT_SEND_FAILURE)
&& install) { && install) {
if (!pbr) if (!pbr)
pbra->install_in_progress = true; pbra->install_in_progress = true;
@ -4118,7 +4118,7 @@ void bgp_send_pbr_ipset_match(struct bgp_pbr_match *pbrim, bool install)
zlog_debug("%s: name %s type %d %d, ID %u", __func__, zlog_debug("%s: name %s type %d %d, ID %u", __func__,
pbrim->ipset_name, pbrim->type, install, pbrim->ipset_name, pbrim->type, install,
pbrim->unique); pbrim->unique);
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, zclient_create_header(s,
@ -4131,7 +4131,7 @@ void bgp_send_pbr_ipset_match(struct bgp_pbr_match *pbrim, bool install)
bgp_encode_pbr_ipset_match(s, pbrim); bgp_encode_pbr_ipset_match(s, pbrim);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
if ((zclient_send_message(zclient) != ZCLIENT_SEND_FAILURE) && install) if ((zclient_send_message(bgp_zclient) != ZCLIENT_SEND_FAILURE) && install)
pbrim->install_in_progress = true; pbrim->install_in_progress = true;
} }
@ -4146,7 +4146,7 @@ void bgp_send_pbr_ipset_entry_match(struct bgp_pbr_match_entry *pbrime,
zlog_debug("%s: name %s %d %d, ID %u", __func__, zlog_debug("%s: name %s %d %d, ID %u", __func__,
pbrime->backpointer->ipset_name, pbrime->unique, pbrime->backpointer->ipset_name, pbrime->unique,
install, pbrime->unique); install, pbrime->unique);
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, zclient_create_header(s,
@ -4159,7 +4159,7 @@ void bgp_send_pbr_ipset_entry_match(struct bgp_pbr_match_entry *pbrime,
bgp_encode_pbr_ipset_entry_match(s, pbrime); bgp_encode_pbr_ipset_entry_match(s, pbrime);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
if ((zclient_send_message(zclient) != ZCLIENT_SEND_FAILURE) && install) if ((zclient_send_message(bgp_zclient) != ZCLIENT_SEND_FAILURE) && install)
pbrime->install_in_progress = true; pbrime->install_in_progress = true;
} }
@ -4218,7 +4218,7 @@ void bgp_send_pbr_iptable(struct bgp_pbr_action *pba,
zlog_debug("%s: name %s type %d mark %d %d, ID %u", __func__, zlog_debug("%s: name %s type %d mark %d %d, ID %u", __func__,
pbm->ipset_name, pbm->type, pba->fwmark, install, pbm->ipset_name, pbm->type, pba->fwmark, install,
pbm->unique2); pbm->unique2);
s = zclient->obuf; s = bgp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, zclient_create_header(s,
@ -4232,7 +4232,7 @@ void bgp_send_pbr_iptable(struct bgp_pbr_action *pba,
if (nb_interface) if (nb_interface)
bgp_encode_pbr_interface_list(pba->bgp, s, pbm->family); bgp_encode_pbr_interface_list(pba->bgp, s, pbm->family);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
ret = zclient_send_message(zclient); ret = zclient_send_message(bgp_zclient);
if (install) { if (install) {
if (ret != ZCLIENT_SEND_FAILURE) if (ret != ZCLIENT_SEND_FAILURE)
pba->refcnt++; pba->refcnt++;
@ -4319,7 +4319,7 @@ void bgp_zebra_announce_default(struct bgp *bgp, struct nexthop *nh,
} }
zclient_route_send(announce ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, zclient_route_send(announce ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE,
zclient, &api); bgp_zclient, &api);
} }
/* Send capabilities to RIB */ /* Send capabilities to RIB */
@ -4332,7 +4332,7 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable)
zlog_debug("%s: Sending %sable for %s", __func__, zlog_debug("%s: Sending %sable for %s", __func__,
disable ? "dis" : "en", bgp->name_pretty); disable ? "dis" : "en", bgp->name_pretty);
if (zclient == NULL) { if (bgp_zclient == NULL) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: %s zclient invalid", __func__, zlog_debug("%s: %s zclient invalid", __func__,
bgp->name_pretty); bgp->name_pretty);
@ -4340,7 +4340,7 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable)
} }
/* Check if the client is connected */ /* Check if the client is connected */
if ((zclient->sock < 0) || (zclient->t_connect)) { if ((bgp_zclient->sock < 0) || (bgp_zclient->t_connect)) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: %s client not connected", __func__, zlog_debug("%s: %s client not connected", __func__,
bgp->name_pretty); bgp->name_pretty);
@ -4365,7 +4365,7 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable)
api.vrf_id = bgp->vrf_id; api.vrf_id = bgp->vrf_id;
} }
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api) if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, bgp_zclient, &api)
== ZCLIENT_SEND_FAILURE) { == ZCLIENT_SEND_FAILURE) {
zlog_err("%s(%d): Error sending GR capability to zebra", zlog_err("%s(%d): Error sending GR capability to zebra",
bgp->name_pretty, bgp->vrf_id); bgp->name_pretty, bgp->vrf_id);
@ -4394,7 +4394,7 @@ int bgp_zebra_update(struct bgp *bgp, afi_t afi, safi_t safi,
bgp->name_pretty, afi, safi, bgp->name_pretty, afi, safi,
zserv_gr_client_cap_string(type)); zserv_gr_client_cap_string(type));
if (zclient == NULL) { if (bgp_zclient == NULL) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: %s zclient == NULL, invalid", __func__, zlog_debug("%s: %s zclient == NULL, invalid", __func__,
bgp->name_pretty); bgp->name_pretty);
@ -4402,7 +4402,7 @@ int bgp_zebra_update(struct bgp *bgp, afi_t afi, safi_t safi,
} }
/* Check if the client is connected */ /* Check if the client is connected */
if ((zclient->sock < 0) || (zclient->t_connect)) { if ((bgp_zclient->sock < 0) || (bgp_zclient->t_connect)) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: %s client not connected", __func__, zlog_debug("%s: %s client not connected", __func__,
bgp->name_pretty); bgp->name_pretty);
@ -4414,7 +4414,7 @@ int bgp_zebra_update(struct bgp *bgp, afi_t afi, safi_t safi,
api.vrf_id = bgp->vrf_id; api.vrf_id = bgp->vrf_id;
api.cap = type; api.cap = type;
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api) if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, bgp_zclient, &api)
== ZCLIENT_SEND_FAILURE) { == ZCLIENT_SEND_FAILURE) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: %s error sending capability", __func__, zlog_debug("%s: %s error sending capability", __func__,
@ -4434,14 +4434,14 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp)
zlog_debug("%s: %s Timer Update to %u", __func__, zlog_debug("%s: %s Timer Update to %u", __func__,
bgp->name_pretty, bgp->rib_stale_time); bgp->name_pretty, bgp->rib_stale_time);
if (zclient == NULL) { if (bgp_zclient == NULL) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("zclient invalid"); zlog_debug("zclient invalid");
return BGP_GR_FAILURE; return BGP_GR_FAILURE;
} }
/* Check if the client is connected */ /* Check if the client is connected */
if ((zclient->sock < 0) || (zclient->t_connect)) { if ((bgp_zclient->sock < 0) || (bgp_zclient->t_connect)) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: %s client not connected", __func__, zlog_debug("%s: %s client not connected", __func__,
bgp->name_pretty); bgp->name_pretty);
@ -4452,7 +4452,7 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp)
api.cap = ZEBRA_CLIENT_RIB_STALE_TIME; api.cap = ZEBRA_CLIENT_RIB_STALE_TIME;
api.stale_removal_time = bgp->rib_stale_time; api.stale_removal_time = bgp->rib_stale_time;
api.vrf_id = bgp->vrf_id; api.vrf_id = bgp->vrf_id;
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api) if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, bgp_zclient, &api)
== ZCLIENT_SEND_FAILURE) { == ZCLIENT_SEND_FAILURE) {
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("%s: %s error sending capability", __func__, zlog_debug("%s: %s error sending capability", __func__,
@ -4465,12 +4465,12 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp)
int bgp_zebra_srv6_manager_get_locator_chunk(const char *name) int bgp_zebra_srv6_manager_get_locator_chunk(const char *name)
{ {
return srv6_manager_get_locator_chunk(zclient, name); return srv6_manager_get_locator_chunk(bgp_zclient, name);
} }
int bgp_zebra_srv6_manager_release_locator_chunk(const char *name) int bgp_zebra_srv6_manager_release_locator_chunk(const char *name)
{ {
return srv6_manager_release_locator_chunk(zclient, name); return srv6_manager_release_locator_chunk(bgp_zclient, name);
} }
/** /**
@ -4488,7 +4488,7 @@ int bgp_zebra_srv6_manager_get_locator(const char *name)
* Send the Get Locator request to the SRv6 Manager and return the * Send the Get Locator request to the SRv6 Manager and return the
* result * result
*/ */
return srv6_manager_get_locator(zclient, name); return srv6_manager_get_locator(bgp_zclient, name);
} }
/** /**
@ -4520,7 +4520,7 @@ bool bgp_zebra_request_srv6_sid(const struct srv6_sid_ctx *ctx,
* Send the Get SRv6 SID request to the SRv6 Manager and check the * Send the Get SRv6 SID request to the SRv6 Manager and check the
* result * result
*/ */
ret = srv6_manager_get_sid(zclient, ctx, sid_value, locator_name, ret = srv6_manager_get_sid(bgp_zclient, ctx, sid_value, locator_name,
sid_func); sid_func);
if (ret < 0) { if (ret < 0) {
zlog_warn("%s: error getting SRv6 SID!", __func__); zlog_warn("%s: error getting SRv6 SID!", __func__);
@ -4549,7 +4549,7 @@ void bgp_zebra_release_srv6_sid(const struct srv6_sid_ctx *ctx)
* Send the Release SRv6 SID request to the SRv6 Manager and check the * Send the Release SRv6 SID request to the SRv6 Manager and check the
* result * result
*/ */
ret = srv6_manager_release_sid(zclient, ctx); ret = srv6_manager_release_sid(bgp_zclient, ctx);
if (ret < 0) { if (ret < 0) {
zlog_warn("%s: error releasing SRv6 SID!", __func__); zlog_warn("%s: error releasing SRv6 SID!", __func__);
return; return;
@ -4592,7 +4592,7 @@ void bgp_zebra_send_nexthop_label(int cmd, mpls_label_t label,
znh->labels[i] = out_labels[i]; znh->labels[i] = out_labels[i];
} }
/* vrf_id is DEFAULT_VRF */ /* vrf_id is DEFAULT_VRF */
zebra_send_mpls_labels(zclient, cmd, &zl); zebra_send_mpls_labels(bgp_zclient, cmd, &zl);
} }
bool bgp_zebra_request_label_range(uint32_t base, uint32_t chunk_size, bool bgp_zebra_request_label_range(uint32_t base, uint32_t chunk_size,
@ -4601,10 +4601,10 @@ bool bgp_zebra_request_label_range(uint32_t base, uint32_t chunk_size,
int ret; int ret;
uint32_t start, end; uint32_t start, end;
if (!zclient_sync || !bgp_zebra_label_manager_ready()) if (!bgp_zclient_sync || !bgp_zebra_label_manager_ready())
return false; return false;
ret = lm_get_label_chunk(zclient_sync, 0, base, chunk_size, &start, ret = lm_get_label_chunk(bgp_zclient_sync, 0, base, chunk_size, &start,
&end); &end);
if (ret < 0) { if (ret < 0) {
zlog_warn("%s: error getting label range!", __func__); zlog_warn("%s: error getting label range!", __func__);
@ -4633,10 +4633,10 @@ void bgp_zebra_release_label_range(uint32_t start, uint32_t end)
{ {
int ret; int ret;
if (!zclient_sync || !bgp_zebra_label_manager_ready()) if (!bgp_zclient_sync || !bgp_zebra_label_manager_ready())
return; return;
ret = lm_release_label_chunk(zclient_sync, start, end); ret = lm_release_label_chunk(bgp_zclient_sync, start, end);
if (ret < 0) if (ret < 0)
zlog_warn("%s: error releasing label range!", __func__); zlog_warn("%s: error releasing label range!", __func__);
} }

View file

@ -8,6 +8,9 @@
#include "vxlan.h" #include "vxlan.h"
/* The global zapi session handle */
extern struct zclient *bgp_zclient;
/* Macro to update bgp_original based on bpg_path_info */ /* Macro to update bgp_original based on bpg_path_info */
#define BGP_ORIGINAL_UPDATE(_bgp_orig, _mpinfo, _bgp) \ #define BGP_ORIGINAL_UPDATE(_bgp_orig, _mpinfo, _bgp) \
((_mpinfo->extra && _mpinfo->extra->vrfleak && \ ((_mpinfo->extra && _mpinfo->extra->vrfleak && \

View file

@ -121,7 +121,7 @@ unsigned int bgp_suppress_fib_count;
static void bgp_if_finish(struct bgp *bgp); static void bgp_if_finish(struct bgp *bgp);
static void peer_drop_dynamic_neighbor(struct peer *peer); static void peer_drop_dynamic_neighbor(struct peer *peer);
extern struct zclient *zclient; extern struct zclient *bgp_zclient;
/* handle main socket creation or deletion */ /* handle main socket creation or deletion */
static int bgp_check_main_socket(bool create, struct bgp *bgp) static int bgp_check_main_socket(bool create, struct bgp *bgp)
@ -447,9 +447,9 @@ void bm_wait_for_fib_set(bool set)
send_msg = true; send_msg = true;
} }
if (send_msg && zclient) if (send_msg && bgp_zclient)
zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST, zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
zclient, set); bgp_zclient, set);
/* /*
* If this is configed at a time when peers are already set * If this is configed at a time when peers are already set
@ -507,9 +507,9 @@ void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
if (BGP_DEBUG(zebra, ZEBRA)) if (BGP_DEBUG(zebra, ZEBRA))
zlog_debug("Sending ZEBRA_ROUTE_NOTIFY_REQUEST"); zlog_debug("Sending ZEBRA_ROUTE_NOTIFY_REQUEST");
if (zclient) if (bgp_zclient)
zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST, zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
zclient, set); bgp_zclient, set);
} }
/* /*
@ -3929,16 +3929,16 @@ static void bgp_zclient_set_redist(afi_t afi, int type, unsigned short instance,
{ {
if (instance) { if (instance) {
if (set) if (set)
redist_add_instance(&zclient->mi_redist[afi][type], redist_add_instance(&bgp_zclient->mi_redist[afi][type],
instance); instance);
else else
redist_del_instance(&zclient->mi_redist[afi][type], redist_del_instance(&bgp_zclient->mi_redist[afi][type],
instance); instance);
} else { } else {
if (set) if (set)
vrf_bitmap_set(&zclient->redist[afi][type], vrf_id); vrf_bitmap_set(&bgp_zclient->redist[afi][type], vrf_id);
else else
vrf_bitmap_unset(&zclient->redist[afi][type], vrf_id); vrf_bitmap_unset(&bgp_zclient->redist[afi][type], vrf_id);
} }
} }
@ -4290,8 +4290,7 @@ int bgp_delete(struct bgp *bgp)
FOREACH_AFI_SAFI (afi, safi) { FOREACH_AFI_SAFI (afi, safi) {
struct bgp_aggregate *aggregate = NULL; struct bgp_aggregate *aggregate = NULL;
for (struct bgp_dest *dest = for (dest = bgp_table_top(bgp->aggregate[afi][safi]);
bgp_table_top(bgp->aggregate[afi][safi]);
dest; dest = bgp_route_next(dest)) { dest; dest = bgp_route_next(dest)) {
aggregate = bgp_dest_get_bgp_aggregate_info(dest); aggregate = bgp_dest_get_bgp_aggregate_info(dest);
if (aggregate == NULL) if (aggregate == NULL)

View file

@ -1352,11 +1352,11 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
bgp_attr_extcom_tunnel_type(bpi->attr, &tun_type); bgp_attr_extcom_tunnel_type(bpi->attr, &tun_type);
if (tun_type == BGP_ENCAP_TYPE_MPLS) { if (tun_type == BGP_ENCAP_TYPE_MPLS) {
struct prefix p; struct prefix pfx;
/* MPLS carries UN address in next hop */ /* MPLS carries UN address in next hop */
rfapiNexthop2Prefix(bpi->attr, &p); rfapiNexthop2Prefix(bpi->attr, &pfx);
if (p.family != AF_UNSPEC) { if (pfx.family != AF_UNSPEC) {
rfapiQprefix2Raddr(&p, &new->un_address); rfapiQprefix2Raddr(&pfx, &new->un_address);
have_vnc_tunnel_un = 1; have_vnc_tunnel_un = 1;
} }
} }
@ -1773,7 +1773,7 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList(
* Add non-withdrawn routes from less-specific prefix * Add non-withdrawn routes from less-specific prefix
*/ */
if (parent) { if (parent) {
const struct prefix *p = agg_node_get_prefix(parent); p = agg_node_get_prefix(parent);
rib_rn = rfd_rib_table ? agg_node_get(rfd_rib_table, p) : NULL; rib_rn = rfd_rib_table ? agg_node_get(rfd_rib_table, p) : NULL;
rfapiQprefix2Rprefix(p, &rprefix); rfapiQprefix2Rprefix(p, &rprefix);
@ -3224,7 +3224,7 @@ static void rfapiBgpInfoFilteredImportEncap(
__func__, rn); __func__, rn);
#endif #endif
for (m = RFAPI_MONITOR_ENCAP(rn); m; m = m->next) { for (m = RFAPI_MONITOR_ENCAP(rn); m; m = m->next) {
const struct prefix *p; const struct prefix *pfx;
/* /*
* For each referenced bpi/route, copy the ENCAP route's * For each referenced bpi/route, copy the ENCAP route's
@ -3252,9 +3252,9 @@ static void rfapiBgpInfoFilteredImportEncap(
* list * list
* per prefix. * per prefix.
*/ */
p = agg_node_get_prefix(m->node); pfx = agg_node_get_prefix(m->node);
referenced_vpn_prefix = referenced_vpn_prefix =
agg_node_get(referenced_vpn_table, p); agg_node_get(referenced_vpn_table, pfx);
assert(referenced_vpn_prefix); assert(referenced_vpn_prefix);
for (mnext = referenced_vpn_prefix->info; mnext; for (mnext = referenced_vpn_prefix->info; mnext;
mnext = mnext->next) { mnext = mnext->next) {

View file

@ -338,13 +338,12 @@ static int process_unicast_route(struct bgp *bgp, /* in */
hattr = *attr; hattr = *attr;
if (rmap) { if (rmap) {
struct bgp_path_info info; struct bgp_path_info pinfo = {};
route_map_result_t ret; route_map_result_t ret;
memset(&info, 0, sizeof(info)); pinfo.peer = peer;
info.peer = peer; pinfo.attr = &hattr;
info.attr = &hattr; ret = route_map_apply(rmap, prefix, &pinfo);
ret = route_map_apply(rmap, prefix, &info);
if (ret == RMAP_DENYMATCH) { if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr); bgp_attr_flush(&hattr);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(
@ -768,13 +767,12 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
hattr = *attr; hattr = *attr;
if (rmap) { if (rmap) {
struct bgp_path_info info; struct bgp_path_info pinfo = {};
route_map_result_t ret; route_map_result_t ret;
memset(&info, 0, sizeof(info)); pinfo.peer = peer;
info.peer = peer; pinfo.attr = &hattr;
info.attr = &hattr; ret = route_map_apply(rmap, prefix, &pinfo);
ret = route_map_apply(rmap, prefix, &info);
if (ret == RMAP_DENYMATCH) { if (ret == RMAP_DENYMATCH) {
bgp_attr_flush(&hattr); bgp_attr_flush(&hattr);
vnc_zlog_debug_verbose( vnc_zlog_debug_verbose(

View file

@ -467,6 +467,7 @@ AC_C_FLAG([-Wbad-function-cast])
AC_C_FLAG([-Wwrite-strings]) AC_C_FLAG([-Wwrite-strings])
AC_C_FLAG([-Wundef]) AC_C_FLAG([-Wundef])
AC_C_FLAG([-Wimplicit-fallthrough]) AC_C_FLAG([-Wimplicit-fallthrough])
AC_C_FLAG([-Wshadow])
if test "$enable_gcc_ultra_verbose" = "yes" ; then if test "$enable_gcc_ultra_verbose" = "yes" ; then
AC_C_FLAG([-Wcast-qual]) AC_C_FLAG([-Wcast-qual])
AC_C_FLAG([-Wmissing-noreturn]) AC_C_FLAG([-Wmissing-noreturn])
@ -474,7 +475,6 @@ if test "$enable_gcc_ultra_verbose" = "yes" ; then
AC_C_FLAG([-Wunreachable-code]) AC_C_FLAG([-Wunreachable-code])
AC_C_FLAG([-Wpacked]) AC_C_FLAG([-Wpacked])
AC_C_FLAG([-Wpadded]) AC_C_FLAG([-Wpadded])
AC_C_FLAG([-Wshadow])
else else
AC_C_FLAG([-Wno-unused-result]) AC_C_FLAG([-Wno-unused-result])
fi fi

View file

@ -739,7 +739,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
else else
vrfid = VRF_DEFAULT; vrfid = VRF_DEFAULT;
if (vrf_bitmap_check(&zclient->redist[AFI_IP][proto], vrfid)) if (vrf_bitmap_check(&eigrp_zclient->redist[AFI_IP][proto], vrfid))
return NB_ERR_INCONSISTENCY; return NB_ERR_INCONSISTENCY;
break; break;
case NB_EV_PREPARE: case NB_EV_PREPARE:

View file

@ -280,14 +280,14 @@ DEFPY (show_ip_eigrp_neighbors,
struct eigrp *eigrp; struct eigrp *eigrp;
if (vrf && strncmp(vrf, "all", sizeof("all")) == 0) { if (vrf && strncmp(vrf, "all", sizeof("all")) == 0) {
struct vrf *vrf; struct vrf *tvrf;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { RB_FOREACH (tvrf, vrf_name_head, &vrfs_by_name) {
eigrp = eigrp_lookup(vrf->vrf_id); eigrp = eigrp_lookup(tvrf->vrf_id);
if (!eigrp) if (!eigrp)
continue; continue;
vty_out(vty, "VRF %s:\n", vrf->name); vty_out(vty, "VRF %s:\n", tvrf->name);
eigrp_neighbors_helper(vty, eigrp, ifname, detail); eigrp_neighbors_helper(vty, eigrp, ifname, detail);
} }

View file

@ -46,7 +46,7 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS);
static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS); static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);
/* Zebra structure to hold current status. */ /* Zebra structure to hold current status. */
struct zclient *zclient = NULL; struct zclient *eigrp_zclient = NULL;
/* For registering threads. */ /* For registering threads. */
extern struct event_loop *master; extern struct event_loop *master;
@ -98,17 +98,17 @@ static zclient_handler *const eigrp_handlers[] = {
void eigrp_zebra_init(void) void eigrp_zebra_init(void)
{ {
zclient = zclient_new(master, &zclient_options_default, eigrp_handlers, eigrp_zclient = zclient_new(master, &zclient_options_default, eigrp_handlers,
array_size(eigrp_handlers)); array_size(eigrp_handlers));
zclient_init(zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs); zclient_init(eigrp_zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs);
zclient->zebra_connected = eigrp_zebra_connected; eigrp_zclient->zebra_connected = eigrp_zebra_connected;
} }
void eigrp_zebra_stop(void) void eigrp_zebra_stop(void)
{ {
zclient_stop(zclient); zclient_stop(eigrp_zclient);
zclient_free(zclient); zclient_free(eigrp_zclient);
} }
/* Zebra route add and delete treatment. */ /* Zebra route add and delete treatment. */
@ -192,7 +192,7 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
struct listnode *node; struct listnode *node;
int count = 0; int count = 0;
if (!zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP]) if (!eigrp_zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
return; return;
memset(&api, 0, sizeof(api)); memset(&api, 0, sizeof(api));
@ -226,14 +226,14 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
zlog_debug("Zebra: Route add %pFX", p); zlog_debug("Zebra: Route add %pFX", p);
} }
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); zclient_route_send(ZEBRA_ROUTE_ADD, eigrp_zclient, &api);
} }
void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p) void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p)
{ {
struct zapi_route api; struct zapi_route api;
if (!zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP]) if (!eigrp_zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
return; return;
memset(&api, 0, sizeof(api)); memset(&api, 0, sizeof(api));
@ -241,7 +241,7 @@ void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p)
api.type = ZEBRA_ROUTE_EIGRP; api.type = ZEBRA_ROUTE_EIGRP;
api.safi = SAFI_UNICAST; api.safi = SAFI_UNICAST;
memcpy(&api.prefix, p, sizeof(*p)); memcpy(&api.prefix, p, sizeof(*p));
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, eigrp_zclient, &api);
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE))
zlog_debug("Zebra: Route del %pFX", p); zlog_debug("Zebra: Route del %pFX", p);
@ -252,10 +252,8 @@ void eigrp_zebra_route_delete(struct eigrp *eigrp, struct prefix *p)
static int eigrp_is_type_redistributed(int type, vrf_id_t vrf_id) static int eigrp_is_type_redistributed(int type, vrf_id_t vrf_id)
{ {
return ((DEFAULT_ROUTE_TYPE(type)) return ((DEFAULT_ROUTE_TYPE(type))
? vrf_bitmap_check( ? vrf_bitmap_check(&eigrp_zclient->default_information[AFI_IP], vrf_id)
&zclient->default_information[AFI_IP], vrf_id) : vrf_bitmap_check(&eigrp_zclient->redist[AFI_IP][type], vrf_id));
: vrf_bitmap_check(&zclient->redist[AFI_IP][type],
vrf_id));
} }
int eigrp_redistribute_set(struct eigrp *eigrp, int type, int eigrp_redistribute_set(struct eigrp *eigrp, int type,
@ -280,7 +278,7 @@ int eigrp_redistribute_set(struct eigrp *eigrp, int type,
eigrp->dmetric[type] = metric; eigrp->dmetric[type] = metric;
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type, 0, zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, eigrp_zclient, AFI_IP, type, 0,
eigrp->vrf_id); eigrp->vrf_id);
++eigrp->redistribute; ++eigrp->redistribute;
@ -293,7 +291,7 @@ int eigrp_redistribute_unset(struct eigrp *eigrp, int type)
if (eigrp_is_type_redistributed(type, eigrp->vrf_id)) { if (eigrp_is_type_redistributed(type, eigrp->vrf_id)) {
memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics)); memset(&eigrp->dmetric[type], 0, sizeof(struct eigrp_metrics));
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, AFI_IP, zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, eigrp_zclient, AFI_IP,
type, 0, eigrp->vrf_id); type, 0, eigrp->vrf_id);
--eigrp->redistribute; --eigrp->redistribute;
} }

View file

@ -52,7 +52,6 @@ static struct eigrp_master eigrp_master;
struct eigrp_master *eigrp_om; struct eigrp_master *eigrp_om;
extern struct zclient *zclient;
extern struct in_addr router_id_zebra; extern struct in_addr router_id_zebra;
int eigrp_master_hash_cmp(const struct eigrp *a, const struct eigrp *b) int eigrp_master_hash_cmp(const struct eigrp *a, const struct eigrp *b)

View file

@ -52,7 +52,7 @@ struct eigrp_master {
}; };
/* Extern variables. */ /* Extern variables. */
extern struct zclient *zclient; extern struct zclient *eigrp_zclient;
extern struct event_loop *master; extern struct event_loop *master;
extern struct eigrp_master *eigrp_om; extern struct eigrp_master *eigrp_om;
extern struct zebra_privs_t eigrpd_privs; extern struct zebra_privs_t eigrpd_privs;

View file

@ -653,7 +653,6 @@ void isis_adj_print_json(struct isis_adjacency *adj, struct json_object *json,
json_object_object_add(iface_json, "ipv6-link-local", json_object_object_add(iface_json, "ipv6-link-local",
ipv6_link_json); ipv6_link_json);
for (unsigned int i = 0; i < adj->ll_ipv6_count; i++) { for (unsigned int i = 0; i < adj->ll_ipv6_count; i++) {
char buf[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, &adj->ll_ipv6_addrs[i], buf, inet_ntop(AF_INET6, &adj->ll_ipv6_addrs[i], buf,
sizeof(buf)); sizeof(buf));
json_object_string_add(ipv6_link_json, "ipv6", json_object_string_add(ipv6_link_json, "ipv6",
@ -666,7 +665,6 @@ void isis_adj_print_json(struct isis_adjacency *adj, struct json_object *json,
ipv6_non_link_json); ipv6_non_link_json);
for (unsigned int i = 0; i < adj->global_ipv6_count; for (unsigned int i = 0; i < adj->global_ipv6_count;
i++) { i++) {
char buf[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, &adj->global_ipv6_addrs[i], inet_ntop(AF_INET6, &adj->global_ipv6_addrs[i],
buf, sizeof(buf)); buf, sizeof(buf));
json_object_string_add(ipv6_non_link_json, json_object_string_add(ipv6_non_link_json,

View file

@ -211,7 +211,7 @@ static int bfd_handle_circuit_add_addr(struct isis_circuit *circuit)
void isis_bfd_init(struct event_loop *tm) void isis_bfd_init(struct event_loop *tm)
{ {
bfd_protocol_integration_init(zclient, tm); bfd_protocol_integration_init(isis_zclient, tm);
hook_register(isis_adj_state_change_hook, bfd_handle_adj_state_change); hook_register(isis_adj_state_change_hook, bfd_handle_adj_state_change);
hook_register(isis_adj_ip_enabled_hook, bfd_handle_adj_ip_enabled); hook_register(isis_adj_ip_enabled_hook, bfd_handle_adj_ip_enabled);

View file

@ -26,12 +26,14 @@ long int flags_get_index(struct flags *flags)
{ {
struct listnode *node; struct listnode *node;
long int index; long int index;
const void *ptr;
if (flags->free_idcs == NULL || flags->free_idcs->count == 0) { if (flags->free_idcs == NULL || flags->free_idcs->count == 0) {
index = flags->maxindex++; index = flags->maxindex++;
} else { } else {
node = listhead(flags->free_idcs); node = listhead(flags->free_idcs);
index = (long int)listgetdata(node); ptr = listgetdata(node);
index = (long int)ptr;
listnode_delete(flags->free_idcs, (void *)index); listnode_delete(flags->free_idcs, (void *)index);
index--; index--;
} }

View file

@ -40,10 +40,9 @@
#include "isisd/isis_errors.h" #include "isisd/isis_errors.h"
#include "isisd/isis_tx_queue.h" #include "isisd/isis_tx_queue.h"
#include "isisd/isis_nb.h" #include "isisd/isis_nb.h"
#include "isisd/isis_zebra.h"
#include "isisd/isis_ldp_sync.h" #include "isisd/isis_ldp_sync.h"
extern struct zclient *zclient;
/* /*
* LDP-SYNC msg between IGP and LDP * LDP-SYNC msg between IGP and LDP
*/ */
@ -122,7 +121,7 @@ void isis_ldp_sync_state_req_msg(struct isis_circuit *circuit)
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(isis_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
(uint8_t *)&request, sizeof(request)); (uint8_t *)&request, sizeof(request));
} }

View file

@ -1125,7 +1125,6 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
struct isis_router_cap *rcap; struct isis_router_cap *rcap;
#ifndef FABRICD #ifndef FABRICD
struct isis_router_cap_fad *rcap_fad; struct isis_router_cap_fad *rcap_fad;
struct listnode *node;
struct flex_algo *fa; struct flex_algo *fa;
#endif /* ifndef FABRICD */ #endif /* ifndef FABRICD */

View file

@ -240,7 +240,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
for (ALL_LIST_ELEMENTS_RO(adjacencies, node, vadj)) { for (ALL_LIST_ELEMENTS_RO(adjacencies, node, vadj)) {
struct isis_spf_adj *sadj = vadj->sadj; struct isis_spf_adj *sadj = vadj->sadj;
struct isis_adjacency *adj = sadj->adj; struct isis_adjacency *adj = sadj->adj;
struct isis_sr_psid_info *sr = &vadj->sr; struct isis_sr_psid_info *vsr = &vadj->sr;
struct mpls_label_stack *label_stack = vadj->label_stack; struct mpls_label_stack *label_stack = vadj->label_stack;
/* /*
@ -248,7 +248,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
* environment. * environment.
*/ */
if (CHECK_FLAG(im->options, F_ISIS_UNIT_TEST)) { if (CHECK_FLAG(im->options, F_ISIS_UNIT_TEST)) {
isis_route_add_dummy_nexthops(rinfo, sadj->id, sr, isis_route_add_dummy_nexthops(rinfo, sadj->id, vsr,
label_stack); label_stack);
if (!allow_ecmp) if (!allow_ecmp)
break; break;
@ -260,7 +260,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
ISIS_CIRCUIT_FLAPPED_AFTER_SPF)) ISIS_CIRCUIT_FLAPPED_AFTER_SPF))
SET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC); SET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC);
adjinfo2nexthop(prefix->family, rinfo->nexthops, adj, sr, adjinfo2nexthop(prefix->family, rinfo->nexthops, adj, vsr,
label_stack); label_stack);
if (!allow_ecmp) if (!allow_ecmp)
break; break;

View file

@ -692,15 +692,15 @@ static int isis_circuit_snmp_id_free(struct isis_circuit *circuit)
static struct isis_circuit *isis_snmp_circuit_next(struct isis_circuit *circuit) static struct isis_circuit *isis_snmp_circuit_next(struct isis_circuit *circuit)
{ {
uint32_t start; uint32_t start;
uint32_t off; uint32_t offset;
start = 1; start = 1;
if (circuit != NULL) if (circuit != NULL)
start = circuit->snmp_id + 1; start = circuit->snmp_id + 1;
for (off = start; off < SNMP_CIRCUITS_MAX; off++) { for (offset = start; offset < SNMP_CIRCUITS_MAX; offset++) {
circuit = snmp_circuits[off]; circuit = snmp_circuits[offset];
if (circuit != NULL) if (circuit != NULL)
return circuit; return circuit;
@ -759,7 +759,7 @@ static int isis_snmp_get_level_match(int is_type, int level)
static int isis_snmp_conv_exact(uint8_t *buf, size_t max_len, size_t *out_len, static int isis_snmp_conv_exact(uint8_t *buf, size_t max_len, size_t *out_len,
const oid *idx, size_t idx_len) const oid *idx, size_t idx_len)
{ {
size_t off; size_t offset;
size_t len; size_t len;
/* Oid representation: length followed by bytes */ /* Oid representation: length followed by bytes */
@ -774,11 +774,11 @@ static int isis_snmp_conv_exact(uint8_t *buf, size_t max_len, size_t *out_len,
if (idx_len < len + 1) if (idx_len < len + 1)
return 0; return 0;
for (off = 0; off < len; off++) { for (offset = 0; offset < len; offset++) {
if (idx[off + 1] > 0xff) if (idx[offset + 1] > 0xff)
return 0; return 0;
buf[off] = (uint8_t)(idx[off + 1] & 0xff); buf[offset] = (uint8_t)(idx[offset + 1] & 0xff);
} }
*out_len = len; *out_len = len;
@ -789,7 +789,7 @@ static int isis_snmp_conv_exact(uint8_t *buf, size_t max_len, size_t *out_len,
static int isis_snmp_conv_next(uint8_t *buf, size_t max_len, size_t *out_len, static int isis_snmp_conv_next(uint8_t *buf, size_t max_len, size_t *out_len,
int *try_exact, const oid *idx, size_t idx_len) int *try_exact, const oid *idx, size_t idx_len)
{ {
size_t off; size_t offset;
size_t len; size_t len;
size_t cmp_len; size_t cmp_len;
@ -809,15 +809,15 @@ static int isis_snmp_conv_next(uint8_t *buf, size_t max_len, size_t *out_len,
if ((idx_len - 1) < cmp_len) if ((idx_len - 1) < cmp_len)
cmp_len = idx_len - 1; cmp_len = idx_len - 1;
for (off = 0; off < cmp_len; off++) { for (offset = 0; offset < cmp_len; offset++) {
if (idx[off + 1] > 0xff) { if (idx[offset + 1] > 0xff) {
memset(buf + off, 0xff, len - off); memset(buf + offset, 0xff, len - off);
*out_len = len; *out_len = len;
*try_exact = 1; *try_exact = 1;
return 1; return 1;
} }
buf[off] = (uint8_t)(idx[off + 1] & 0xff); buf[offset] = (uint8_t)(idx[offset + 1] & 0xff);
} }
if (cmp_len < len) if (cmp_len < len)
@ -983,7 +983,7 @@ static int isis_snmp_circuit_lookup_exact(oid *oid_idx, size_t oid_idx_len,
static int isis_snmp_circuit_lookup_next(oid *oid_idx, size_t oid_idx_len, static int isis_snmp_circuit_lookup_next(oid *oid_idx, size_t oid_idx_len,
struct isis_circuit **ret_circuit) struct isis_circuit **ret_circuit)
{ {
oid off; oid offset;
oid start; oid start;
struct isis_circuit *circuit; struct isis_circuit *circuit;
@ -996,10 +996,10 @@ static int isis_snmp_circuit_lookup_next(oid *oid_idx, size_t oid_idx_len,
start = oid_idx[0]; start = oid_idx[0];
} }
for (off = start; off < SNMP_CIRCUITS_MAX; ++off) { for (offset = start; offset < SNMP_CIRCUITS_MAX; ++offset) {
circuit = snmp_circuits[off]; circuit = snmp_circuits[offset];
if (circuit != NULL && off > start) { if (circuit != NULL && offset > start) {
if (ret_circuit != NULL) if (ret_circuit != NULL)
*ret_circuit = circuit; *ret_circuit = circuit;
@ -1052,7 +1052,7 @@ static int isis_snmp_circuit_level_lookup_next(
oid *oid_idx, size_t oid_idx_len, int check_match, oid *oid_idx, size_t oid_idx_len, int check_match,
struct isis_circuit **ret_circuit, int *ret_level) struct isis_circuit **ret_circuit, int *ret_level)
{ {
oid off; oid offset;
oid start; oid start;
struct isis_circuit *circuit = NULL; struct isis_circuit *circuit = NULL;
int level; int level;
@ -1066,13 +1066,13 @@ static int isis_snmp_circuit_level_lookup_next(
start = oid_idx[0]; start = oid_idx[0];
} }
for (off = start; off < SNMP_CIRCUITS_MAX; off++) { for (offset = start; offset < SNMP_CIRCUITS_MAX; offset++) {
circuit = snmp_circuits[off]; circuit = snmp_circuits[offset];
if (circuit == NULL) if (circuit == NULL)
continue; continue;
if (off > start || oid_idx_len < 2) { if (offset > start || oid_idx_len < 2) {
/* Found and can use level 1 */ /* Found and can use level 1 */
level = IS_LEVEL_1; level = IS_LEVEL_1;
break; break;
@ -1504,7 +1504,7 @@ static uint8_t *isis_snmp_find_man_area(struct variable *v, oid *name,
struct iso_address *area_addr = NULL; struct iso_address *area_addr = NULL;
oid *oid_idx; oid *oid_idx;
size_t oid_idx_len; size_t oid_idx_len;
size_t off = 0; size_t offset = 0;
*write_method = NULL; *write_method = NULL;
@ -1539,8 +1539,8 @@ static uint8_t *isis_snmp_find_man_area(struct variable *v, oid *name,
/* Append index */ /* Append index */
name[v->namelen] = area_addr->addr_len; name[v->namelen] = area_addr->addr_len;
for (off = 0; off < area_addr->addr_len; off++) for (offset = 0; offset < area_addr->addr_len; offset++)
name[v->namelen + 1 + off] = area_addr->area_addr[off]; name[v->namelen + 1 + offset] = area_addr->area_addr[offset];
*length = v->namelen + 1 + area_addr->addr_len; *length = v->namelen + 1 + area_addr->addr_len;
} }
@ -1628,7 +1628,7 @@ static uint8_t *isis_snmp_find_router(struct variable *v, oid *name,
struct isis_dynhn *dyn = NULL; struct isis_dynhn *dyn = NULL;
oid *oid_idx; oid *oid_idx;
size_t oid_idx_len; size_t oid_idx_len;
size_t off = 0; size_t offset = 0;
struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT);
if (isis == NULL) if (isis == NULL)
@ -1729,8 +1729,8 @@ static uint8_t *isis_snmp_find_router(struct variable *v, oid *name,
/* Append index */ /* Append index */
name[v->namelen] = ISIS_SYS_ID_LEN; name[v->namelen] = ISIS_SYS_ID_LEN;
for (off = 0; off < ISIS_SYS_ID_LEN; off++) for (offset = 0; offset < ISIS_SYS_ID_LEN; offset++)
name[v->namelen + 1 + off] = dyn->id[off]; name[v->namelen + 1 + off] = dyn->id[offset];
name[v->namelen + 1 + ISIS_SYS_ID_LEN] = (oid)dyn->level; name[v->namelen + 1 + ISIS_SYS_ID_LEN] = (oid)dyn->level;
@ -2803,8 +2803,8 @@ static int isis_snmp_init(struct event_loop *tm)
struct isis_func_to_prefix *h2f = isis_func_to_prefix_arr; struct isis_func_to_prefix *h2f = isis_func_to_prefix_arr;
struct variable *v; struct variable *v;
for (size_t off = 0; off < isis_var_count; off++) { for (size_t offset = 0; offset < isis_var_count; offset++) {
v = &isis_var_arr[off]; v = &isis_var_arr[offset];
if (v->findVar != h2f->ihtp_func) { if (v->findVar != h2f->ihtp_func) {
/* Next table */ /* Next table */
@ -2858,7 +2858,7 @@ static int isis_snmp_db_overload_update(const struct isis_area *area)
{ {
netsnmp_variable_list *notification_vars; netsnmp_variable_list *notification_vars;
long val; long val;
uint32_t off; uint32_t offset;
if (!isis_snmp_trap_throttle(ISIS_TRAP_DB_OVERLOAD)) if (!isis_snmp_trap_throttle(ISIS_TRAP_DB_OVERLOAD))
return 0; return 0;
@ -2880,8 +2880,8 @@ static int isis_snmp_db_overload_update(const struct isis_area *area)
(uint8_t *)&val, sizeof(val)); (uint8_t *)&val, sizeof(val));
/* Patch sys_level_state with proper index */ /* Patch sys_level_state with proper index */
off = array_size(isis_snmp_trap_data_var_sys_level_state) - 1; offset = array_size(isis_snmp_trap_data_var_sys_level_state) - 1;
isis_snmp_trap_data_var_sys_level_state[off] = val; isis_snmp_trap_data_var_sys_level_state[offset] = val;
/* Prepare data */ /* Prepare data */
if (area->overload_bit) if (area->overload_bit)

View file

@ -1195,7 +1195,7 @@ end:
&& !spftree->area->attached_bit_rcv_ignore && !spftree->area->attached_bit_rcv_ignore
&& (spftree->area->is_type & IS_LEVEL_1) && (spftree->area->is_type & IS_LEVEL_1)
&& !isis_level2_adj_up(spftree->area)) { && !isis_level2_adj_up(spftree->area)) {
struct prefix_pair ip_info = { {0} }; memset(&ip_info, 0, sizeof(ip_info));
if (IS_DEBUG_RTE_EVENTS) if (IS_DEBUG_RTE_EVENTS)
zlog_debug("ISIS-Spf (%pLS): add default %s route", zlog_debug("ISIS-Spf (%pLS): add default %s route",
lsp->hdr.lsp_id, lsp->hdr.lsp_id,

View file

@ -749,11 +749,11 @@ void sr_adj_sid_add_single(struct isis_adjacency *adj, int family, bool backup,
sra->backup_nexthops = list_new(); sra->backup_nexthops = list_new();
for (ALL_LIST_ELEMENTS_RO(nexthops, node, vadj)) { for (ALL_LIST_ELEMENTS_RO(nexthops, node, vadj)) {
struct isis_adjacency *adj = vadj->sadj->adj; struct isis_adjacency *tadj = vadj->sadj->adj;
struct mpls_label_stack *label_stack; struct mpls_label_stack *label_stack;
label_stack = vadj->label_stack; label_stack = vadj->label_stack;
adjinfo2nexthop(family, sra->backup_nexthops, adj, NULL, adjinfo2nexthop(family, sra->backup_nexthops, tadj, NULL,
label_stack); label_stack);
} }
} }

View file

@ -704,15 +704,15 @@ static int isis_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(isis_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(isis_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(isis_zclient, &msg, NULL);
break; break;
default: default:
rc = -1; rc = -1;
@ -1494,7 +1494,7 @@ static void isis_te_parse_lsp(struct mpls_te_area *mta, struct isis_lsp *lsp)
/* Clean remaining Orphan Edges or Subnets */ /* Clean remaining Orphan Edges or Subnets */
if (IS_EXPORT_TE(mta)) if (IS_EXPORT_TE(mta))
ls_vertex_clean(ted, vertex, zclient); ls_vertex_clean(ted, vertex, isis_zclient);
else else
ls_vertex_clean(ted, vertex, NULL); ls_vertex_clean(ted, vertex, NULL);
} }
@ -1653,7 +1653,7 @@ int isis_te_sync_ted(struct zapi_opaque_reg_info dst)
if (IS_MPLS_TE(mta) && IS_EXPORT_TE(mta)) { if (IS_MPLS_TE(mta) && IS_EXPORT_TE(mta)) {
te_debug(" |- Export TED from area %s", te_debug(" |- Export TED from area %s",
area->area_tag); area->area_tag);
rc = ls_sync_ted(mta->ted, zclient, &dst); rc = ls_sync_ted(mta->ted, isis_zclient, &dst);
if (rc != 0) if (rc != 0)
return rc; return rc;
} }

View file

@ -518,7 +518,7 @@ static void format_item_asla_subtlvs(struct isis_asla_subtlvs *asla,
asla->max_rsv_bw); asla->max_rsv_bw);
if (IS_SUBTLV(asla, EXT_UNRSV_BW)) { if (IS_SUBTLV(asla, EXT_UNRSV_BW)) {
sbuf_push(buf, indent + 2, "Unreserved Bandwidth:\n"); sbuf_push(buf, indent + 2, "Unreserved Bandwidth:\n");
for (int j = 0; j < MAX_CLASS_TYPE; j += 2) { for (j = 0; j < MAX_CLASS_TYPE; j += 2) {
sbuf_push( sbuf_push(
buf, indent + 2, buf, indent + 2,
"[%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)\n", "[%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)\n",
@ -3209,7 +3209,7 @@ static struct isis_item *copy_item_lsp_entry(struct isis_item *i)
} }
static void format_item_lsp_entry(uint16_t mtid, struct isis_item *i, static void format_item_lsp_entry(uint16_t mtid, struct isis_item *i,
struct sbuf *buf, struct json_object *json, struct sbuf *sbuf, struct json_object *json,
int indent) int indent)
{ {
struct isis_lsp_entry *e = (struct isis_lsp_entry *)i; struct isis_lsp_entry *e = (struct isis_lsp_entry *)i;
@ -3229,8 +3229,7 @@ static void format_item_lsp_entry(uint16_t mtid, struct isis_item *i,
json_object_string_add(lsp_json, "chksum", buf); json_object_string_add(lsp_json, "chksum", buf);
json_object_int_add(lsp_json, "lifetime", e->checksum); json_object_int_add(lsp_json, "lifetime", e->checksum);
} else } else
sbuf_push( sbuf_push(sbuf, indent,
buf, indent,
"LSP Entry: %s, seq 0x%08x, cksum 0x%04hx, lifetime %hus\n", "LSP Entry: %s, seq 0x%08x, cksum 0x%04hx, lifetime %hus\n",
sys_id, e->seqno, e->checksum, e->rem_lifetime); sys_id, e->seqno, e->checksum, e->rem_lifetime);
} }
@ -3553,7 +3552,7 @@ static void copy_tlv_protocols_supported(struct isis_protocols_supported *src,
} }
static void format_tlv_protocols_supported(struct isis_protocols_supported *p, static void format_tlv_protocols_supported(struct isis_protocols_supported *p,
struct sbuf *buf, struct sbuf *sbuf,
struct json_object *json, int indent) struct json_object *json, int indent)
{ {
if (!p || !p->count || !p->protocols) if (!p || !p->count || !p->protocols)
@ -3572,12 +3571,12 @@ static void format_tlv_protocols_supported(struct isis_protocols_supported *p,
nlpid2str(p->protocols[i])); nlpid2str(p->protocols[i]));
} }
} else { } else {
sbuf_push(buf, indent, "Protocols Supported: "); sbuf_push(sbuf, indent, "Protocols Supported: ");
for (uint8_t i = 0; i < p->count; i++) { for (uint8_t i = 0; i < p->count; i++) {
sbuf_push(buf, 0, "%s%s", nlpid2str(p->protocols[i]), sbuf_push(sbuf, 0, "%s%s", nlpid2str(p->protocols[i]),
(i + 1 < p->count) ? ", " : ""); (i + 1 < p->count) ? ", " : "");
} }
sbuf_push(buf, 0, "\n"); sbuf_push(sbuf, 0, "\n");
} }
} }
@ -5275,9 +5274,9 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
/* Flex Algo Definitions */ /* Flex Algo Definitions */
for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { for (int i = 0; i < SR_ALGORITHM_COUNT; i++) {
struct isis_router_cap_fad *fad; struct isis_router_cap_fad *fad;
size_t subtlv_len;
struct admin_group *ag; struct admin_group *ag;
uint32_t admin_group_length; uint32_t admin_group_length;
size_t j;
fad = router_cap->fads[i]; fad = router_cap->fads[i];
if (!fad) if (!fad)
@ -5315,8 +5314,8 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
if (admin_group_length) { if (admin_group_length) {
stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_EXCAG); stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_EXCAG);
stream_putc(s, sizeof(uint32_t) * admin_group_length); stream_putc(s, sizeof(uint32_t) * admin_group_length);
for (size_t i = 0; i < admin_group_length; i++) for (j = 0; j < admin_group_length; j++)
stream_putl(s, admin_group_get_offset(ag, i)); stream_putl(s, admin_group_get_offset(ag, j));
} }
ag = &fad->fad.admin_group_include_any; ag = &fad->fad.admin_group_include_any;
@ -5324,8 +5323,8 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
if (admin_group_length) { if (admin_group_length) {
stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCANYAG); stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCANYAG);
stream_putc(s, sizeof(uint32_t) * admin_group_length); stream_putc(s, sizeof(uint32_t) * admin_group_length);
for (size_t i = 0; i < admin_group_length; i++) for (j = 0; j < admin_group_length; j++)
stream_putl(s, admin_group_get_offset(ag, i)); stream_putl(s, admin_group_get_offset(ag, j));
} }
ag = &fad->fad.admin_group_include_all; ag = &fad->fad.admin_group_include_all;
@ -5333,8 +5332,8 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
if (admin_group_length) { if (admin_group_length) {
stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCALLAG); stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCALLAG);
stream_putc(s, sizeof(uint32_t) * admin_group_length); stream_putc(s, sizeof(uint32_t) * admin_group_length);
for (size_t i = 0; i < admin_group_length; i++) for (j = 0; j < admin_group_length; j++)
stream_putl(s, admin_group_get_offset(ag, i)); stream_putl(s, admin_group_get_offset(ag, j));
} }
if (fad->fad.flags != 0) { if (fad->fad.flags != 0) {

View file

@ -45,7 +45,7 @@
#include "isisd/isis_sr.h" #include "isisd/isis_sr.h"
#include "isisd/isis_ldp_sync.h" #include "isisd/isis_ldp_sync.h"
struct zclient *zclient; struct zclient *isis_zclient;
static struct zclient *zclient_sync; static struct zclient *zclient_sync;
/* Router-id update message from zebra. */ /* Router-id update message from zebra. */
@ -254,7 +254,7 @@ void isis_zebra_route_add_route(struct isis *isis, struct prefix *prefix,
struct zapi_route api; struct zapi_route api;
int count = 0; int count = 0;
if (zclient->sock < 0) if (isis_zclient->sock < 0)
return; return;
/* Uninstall the route if it doesn't have any valid nexthop. */ /* Uninstall the route if it doesn't have any valid nexthop. */
@ -295,7 +295,7 @@ void isis_zebra_route_add_route(struct isis *isis, struct prefix *prefix,
return; return;
api.nexthop_num = count; api.nexthop_num = count;
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); zclient_route_send(ZEBRA_ROUTE_ADD, isis_zclient, &api);
} }
void isis_zebra_route_del_route(struct isis *isis, void isis_zebra_route_del_route(struct isis *isis,
@ -305,7 +305,7 @@ void isis_zebra_route_del_route(struct isis *isis,
{ {
struct zapi_route api; struct zapi_route api;
if (zclient->sock < 0) if (isis_zclient->sock < 0)
return; return;
if (!CHECK_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) if (!CHECK_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED))
@ -321,7 +321,7 @@ void isis_zebra_route_del_route(struct isis *isis,
SET_FLAG(api.message, ZAPI_MESSAGE_SRCPFX); SET_FLAG(api.message, ZAPI_MESSAGE_SRCPFX);
} }
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, isis_zclient, &api);
} }
/** /**
@ -388,7 +388,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area,
} }
/* Send message to zebra. */ /* Send message to zebra. */
(void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl); (void)zebra_send_mpls_labels(isis_zclient, ZEBRA_MPLS_LABELS_REPLACE, &zl);
} }
/** /**
@ -415,7 +415,7 @@ void isis_zebra_prefix_sid_uninstall(struct isis_area *area,
zl.local_label = psid->label; zl.local_label = psid->label;
/* Send message to zebra. */ /* Send message to zebra. */
(void)zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_DELETE, &zl); (void)zebra_send_mpls_labels(isis_zclient, ZEBRA_MPLS_LABELS_DELETE, &zl);
} }
/** /**
@ -471,7 +471,7 @@ void isis_zebra_send_adjacency_sid(int cmd, const struct sr_adjacency *sra)
} }
} }
(void)zebra_send_mpls_labels(zclient, cmd, &zl); (void)zebra_send_mpls_labels(isis_zclient, cmd, &zl);
} }
static int isis_zebra_read(ZAPI_CALLBACK_ARGS) static int isis_zebra_read(ZAPI_CALLBACK_ARGS)
@ -523,9 +523,9 @@ void isis_zebra_redistribute_set(afi_t afi, int type, vrf_id_t vrf_id,
{ {
if (type == DEFAULT_ROUTE) if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
zclient, afi, vrf_id); isis_zclient, afi, vrf_id);
else else
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type, zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, isis_zclient, afi, type,
tableid, vrf_id); tableid, vrf_id);
} }
@ -534,9 +534,9 @@ void isis_zebra_redistribute_unset(afi_t afi, int type, vrf_id_t vrf_id,
{ {
if (type == DEFAULT_ROUTE) if (type == DEFAULT_ROUTE)
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE, zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
zclient, afi, vrf_id); isis_zclient, afi, vrf_id);
else else
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi, zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, isis_zclient, afi,
type, tableid, vrf_id); type, tableid, vrf_id);
} }
@ -549,7 +549,7 @@ int isis_zebra_rlfa_register(struct isis_spftree *spftree, struct rlfa *rlfa)
struct zapi_rlfa_request zr = {}; struct zapi_rlfa_request zr = {};
int ret; int ret;
if (!zclient) if (!isis_zclient)
return 0; return 0;
zr.igp.vrf_id = area->isis->vrf_id; zr.igp.vrf_id = area->isis->vrf_id;
@ -565,7 +565,7 @@ int isis_zebra_rlfa_register(struct isis_spftree *spftree, struct rlfa *rlfa)
zlog_debug("ISIS-LFA: registering RLFA %pFX@%pI4 with LDP", zlog_debug("ISIS-LFA: registering RLFA %pFX@%pI4 with LDP",
&rlfa->prefix, &rlfa->pq_address); &rlfa->prefix, &rlfa->pq_address);
ret = zclient_send_opaque_unicast(zclient, LDP_RLFA_REGISTER, ret = zclient_send_opaque_unicast(isis_zclient, LDP_RLFA_REGISTER,
ZEBRA_ROUTE_LDP, 0, 0, ZEBRA_ROUTE_LDP, 0, 0,
(const uint8_t *)&zr, sizeof(zr)); (const uint8_t *)&zr, sizeof(zr));
if (ret == ZCLIENT_SEND_FAILURE) { if (ret == ZCLIENT_SEND_FAILURE) {
@ -585,8 +585,8 @@ void isis_zebra_rlfa_unregister_all(struct isis_spftree *spftree)
struct zapi_rlfa_igp igp = {}; struct zapi_rlfa_igp igp = {};
int ret; int ret;
if (!zclient || spftree->type != SPF_TYPE_FORWARD if (!isis_zclient || spftree->type != SPF_TYPE_FORWARD ||
|| CHECK_FLAG(spftree->flags, F_SPFTREE_NO_ADJACENCIES)) CHECK_FLAG(spftree->flags, F_SPFTREE_NO_ADJACENCIES))
return; return;
if (IS_DEBUG_LFA) if (IS_DEBUG_LFA)
@ -599,7 +599,7 @@ void isis_zebra_rlfa_unregister_all(struct isis_spftree *spftree)
igp.isis.spf.level = spftree->level; igp.isis.spf.level = spftree->level;
igp.isis.spf.run_id = spftree->runcount; igp.isis.spf.run_id = spftree->runcount;
ret = zclient_send_opaque_unicast(zclient, LDP_RLFA_UNREGISTER_ALL, ret = zclient_send_opaque_unicast(isis_zclient, LDP_RLFA_UNREGISTER_ALL,
ZEBRA_ROUTE_LDP, 0, 0, ZEBRA_ROUTE_LDP, 0, 0,
(const uint8_t *)&igp, sizeof(igp)); (const uint8_t *)&igp, sizeof(igp));
if (ret == ZCLIENT_SEND_FAILURE) if (ret == ZCLIENT_SEND_FAILURE)
@ -774,27 +774,27 @@ int isis_zebra_label_manager_connect(void)
void isis_zebra_vrf_register(struct isis *isis) void isis_zebra_vrf_register(struct isis *isis)
{ {
if (!zclient || zclient->sock < 0 || !isis) if (!isis_zclient || isis_zclient->sock < 0 || !isis)
return; return;
if (isis->vrf_id != VRF_UNKNOWN) { if (isis->vrf_id != VRF_UNKNOWN) {
if (IS_DEBUG_EVENTS) if (IS_DEBUG_EVENTS)
zlog_debug("%s: Register VRF %s id %u", __func__, zlog_debug("%s: Register VRF %s id %u", __func__,
isis->name, isis->vrf_id); isis->name, isis->vrf_id);
zclient_send_reg_requests(zclient, isis->vrf_id); zclient_send_reg_requests(isis_zclient, isis->vrf_id);
} }
} }
void isis_zebra_vrf_deregister(struct isis *isis) void isis_zebra_vrf_deregister(struct isis *isis)
{ {
if (!zclient || zclient->sock < 0 || !isis) if (!isis_zclient || isis_zclient->sock < 0 || !isis)
return; return;
if (isis->vrf_id != VRF_UNKNOWN) { if (isis->vrf_id != VRF_UNKNOWN) {
if (IS_DEBUG_EVENTS) if (IS_DEBUG_EVENTS)
zlog_debug("%s: Deregister VRF %s id %u", __func__, zlog_debug("%s: Deregister VRF %s id %u", __func__,
isis->name, isis->vrf_id); isis->name, isis->vrf_id);
zclient_send_dereg_requests(zclient, isis->vrf_id); zclient_send_dereg_requests(isis_zclient, isis->vrf_id);
} }
} }
@ -820,9 +820,9 @@ int isis_zebra_ls_register(bool up)
int rc; int rc;
if (up) if (up)
rc = ls_register(zclient, true); rc = ls_register(isis_zclient, true);
else else
rc = ls_unregister(zclient, true); rc = ls_unregister(isis_zclient, true);
return rc; return rc;
} }
@ -934,7 +934,7 @@ static void isis_zebra_send_localsid(int cmd, const struct in6_addr *sid,
memcpy(&api.prefix, &p, sizeof(p)); memcpy(&api.prefix, &p, sizeof(p));
if (cmd == ZEBRA_ROUTE_DELETE) if (cmd == ZEBRA_ROUTE_DELETE)
return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, isis_zclient,
&api); &api);
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION); SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
@ -952,7 +952,7 @@ static void isis_zebra_send_localsid(int cmd, const struct in6_addr *sid,
api.nexthop_num = 1; api.nexthop_num = 1;
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); zclient_route_send(ZEBRA_ROUTE_ADD, isis_zclient, &api);
} }
/** /**
@ -1372,7 +1372,7 @@ static int isis_zebra_process_srv6_locator_delete(ZAPI_CALLBACK_ARGS)
*/ */
int isis_zebra_srv6_manager_get_locator_chunk(const char *name) int isis_zebra_srv6_manager_get_locator_chunk(const char *name)
{ {
return srv6_manager_get_locator_chunk(zclient, name); return srv6_manager_get_locator_chunk(isis_zclient, name);
} }
@ -1385,7 +1385,7 @@ int isis_zebra_srv6_manager_get_locator_chunk(const char *name)
*/ */
int isis_zebra_srv6_manager_release_locator_chunk(const char *name) int isis_zebra_srv6_manager_release_locator_chunk(const char *name)
{ {
return srv6_manager_release_locator_chunk(zclient, name); return srv6_manager_release_locator_chunk(isis_zclient, name);
} }
/** /**
@ -1403,7 +1403,7 @@ int isis_zebra_srv6_manager_get_locator(const char *name)
* Send the Get Locator request to the SRv6 Manager and return the * Send the Get Locator request to the SRv6 Manager and return the
* result * result
*/ */
return srv6_manager_get_locator(zclient, name); return srv6_manager_get_locator(isis_zclient, name);
} }
/** /**
@ -1434,7 +1434,7 @@ bool isis_zebra_request_srv6_sid(const struct srv6_sid_ctx *ctx,
* Send the Get SRv6 SID request to the SRv6 Manager and check the * Send the Get SRv6 SID request to the SRv6 Manager and check the
* result * result
*/ */
ret = srv6_manager_get_sid(zclient, ctx, sid_value, locator_name, NULL); ret = srv6_manager_get_sid(isis_zclient, ctx, sid_value, locator_name, NULL);
if (ret < 0) { if (ret < 0) {
zlog_warn("%s: error getting SRv6 SID!", __func__); zlog_warn("%s: error getting SRv6 SID!", __func__);
return false; return false;
@ -1462,7 +1462,7 @@ void isis_zebra_release_srv6_sid(const struct srv6_sid_ctx *ctx)
* Send the Release SRv6 SID request to the SRv6 Manager and check the * Send the Release SRv6 SID request to the SRv6 Manager and check the
* result * result
*/ */
ret = srv6_manager_release_sid(zclient, ctx); ret = srv6_manager_release_sid(isis_zclient, ctx);
if (ret < 0) { if (ret < 0) {
zlog_warn("%s: error releasing SRv6 SID!", __func__); zlog_warn("%s: error releasing SRv6 SID!", __func__);
return; return;
@ -1631,16 +1631,16 @@ static zclient_handler *const isis_handlers[] = {
[ZEBRA_SRV6_SID_NOTIFY] = isis_zebra_srv6_sid_notify, [ZEBRA_SRV6_SID_NOTIFY] = isis_zebra_srv6_sid_notify,
}; };
void isis_zebra_init(struct event_loop *master, int instance) void isis_zebra_init(struct event_loop *mst, int instance)
{ {
/* Initialize asynchronous zclient. */ /* Initialize asynchronous zclient. */
zclient = zclient_new(master, &zclient_options_default, isis_handlers, isis_zclient = zclient_new(mst, &zclient_options_default, isis_handlers,
array_size(isis_handlers)); array_size(isis_handlers));
zclient_init(zclient, PROTO_TYPE, 0, &isisd_privs); zclient_init(isis_zclient, PROTO_TYPE, 0, &isisd_privs);
zclient->zebra_connected = isis_zebra_connected; isis_zclient->zebra_connected = isis_zebra_connected;
/* 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_ISIS; zclient_sync->redist_default = ZEBRA_ROUTE_ISIS;
zclient_sync->instance = instance; zclient_sync->instance = instance;
@ -1654,11 +1654,11 @@ void isis_zebra_init(struct event_loop *master, int instance)
void isis_zebra_stop(void) void isis_zebra_stop(void)
{ {
zclient_unregister_opaque(zclient, LDP_RLFA_LABELS); zclient_unregister_opaque(isis_zclient, LDP_RLFA_LABELS);
zclient_unregister_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE); zclient_unregister_opaque(isis_zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
zclient_unregister_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE); zclient_unregister_opaque(isis_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
zclient_stop(zclient_sync); zclient_stop(zclient_sync);
zclient_free(zclient_sync); zclient_free(zclient_sync);
zclient_stop(zclient); zclient_stop(isis_zclient);
zclient_free(zclient); zclient_free(isis_zclient);
} }

View file

@ -11,7 +11,7 @@
#include "isisd.h" #include "isisd.h"
extern struct zclient *zclient; extern struct zclient *isis_zclient;
struct label_chunk { struct label_chunk {
uint32_t start; uint32_t start;

View file

@ -187,12 +187,12 @@ struct isis *isis_lookup_by_sysid(const uint8_t *sysid)
return NULL; return NULL;
} }
void isis_master_init(struct event_loop *master) void isis_master_init(struct event_loop *mst)
{ {
memset(&isis_master, 0, sizeof(isis_master)); memset(&isis_master, 0, sizeof(isis_master));
im = &isis_master; im = &isis_master;
im->isis = list_new(); im->isis = list_new();
im->master = master; im->master = mst;
} }
void isis_master_terminate(void) void isis_master_terminate(void)
@ -694,24 +694,24 @@ static void isis_set_redist_vrf_bitmaps(struct isis *isis, bool set)
if (type == DEFAULT_ROUTE) { if (type == DEFAULT_ROUTE) {
if (set) if (set)
vrf_bitmap_set( vrf_bitmap_set(
&zclient->default_information &isis_zclient->default_information
[afi], [afi],
isis->vrf_id); isis->vrf_id);
else else
vrf_bitmap_unset( vrf_bitmap_unset(
&zclient->default_information &isis_zclient->default_information
[afi], [afi],
isis->vrf_id); isis->vrf_id);
} else { } else {
if (set) if (set)
vrf_bitmap_set( vrf_bitmap_set(
&zclient->redist &isis_zclient->redist
[afi] [afi]
[type], [type],
isis->vrf_id); isis->vrf_id);
else else
vrf_bitmap_unset( vrf_bitmap_unset(
&zclient->redist &isis_zclient->redist
[afi] [afi]
[type], [type],
isis->vrf_id); isis->vrf_id);

View file

@ -538,8 +538,8 @@ static void lde_dispatch_parent(struct event *thread)
sizeof(struct ldpd_init)) sizeof(struct ldpd_init))
fatalx("INIT imsg with wrong len"); fatalx("INIT imsg with wrong len");
memcpy(&init, imsg.data, sizeof(init)); memcpy(&ldp_init, imsg.data, sizeof(ldp_init));
lde_init(&init); lde_init(&ldp_init);
break; break;
case IMSG_AGENTX_ENABLED: case IMSG_AGENTX_ENABLED:
ldp_agentx_enabled(); ldp_agentx_enabled();

View file

@ -620,10 +620,10 @@ static uint8_t *ldpHelloAdjacencyTable(struct variable *v, oid name[], size_t *l
memcpy(name, v->name, v->namelen * sizeof(oid)); memcpy(name, v->name, v->namelen * sizeof(oid));
/* Append index */ /* Append index */
struct in_addr entityLdpId = {.s_addr = 0}; entityLdpId.s_addr = 0;
entityLdpId.s_addr = ldp_rtr_id_get(leconf); entityLdpId.s_addr = ldp_rtr_id_get(leconf);
struct in_addr peerLdpId = ctl_adj->id; peerLdpId = ctl_adj->id;
oid_copy_in_addr(name + v->namelen, &entityLdpId); oid_copy_in_addr(name + v->namelen, &entityLdpId);
name[v->namelen + 4] = 0; name[v->namelen + 4] = 0;

View file

@ -1954,10 +1954,9 @@ ldp_vty_show_interface(struct vty *vty, const char *af_str, const char *json)
return (ldp_vty_dispatch(vty, &ibuf, SHOW_IFACE, &params)); return (ldp_vty_dispatch(vty, &ibuf, SHOW_IFACE, &params));
} }
int int ldp_vty_show_capabilities(struct vty *vty, const char *use_json)
ldp_vty_show_capabilities(struct vty *vty, const char *json)
{ {
if (json) { if (use_json) {
json_object *json; json_object *json;
json_object *json_array; json_object *json_array;
json_object *json_cap; json_object *json_cap;

View file

@ -38,7 +38,7 @@ static int ldp_sync_zebra_send_announce(void);
static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS);
static void ldp_sync_zebra_init(void); static void ldp_sync_zebra_init(void);
static struct zclient *zclient; static struct zclient *ldp_zclient;
extern struct zclient *zclient_sync; extern struct zclient *zclient_sync;
static bool zebra_registered = false; static bool zebra_registered = false;
@ -100,23 +100,23 @@ pw2zpw(struct l2vpn_pw *pw, struct zapi_pw *zpw)
static void static void
ldp_zebra_opaque_register(void) ldp_zebra_opaque_register(void)
{ {
zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST); zclient_register_opaque(ldp_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST);
zclient_register_opaque(zclient, LDP_RLFA_REGISTER); zclient_register_opaque(ldp_zclient, LDP_RLFA_REGISTER);
zclient_register_opaque(zclient, LDP_RLFA_UNREGISTER_ALL); zclient_register_opaque(ldp_zclient, LDP_RLFA_UNREGISTER_ALL);
} }
static void static void
ldp_zebra_opaque_unregister(void) ldp_zebra_opaque_unregister(void)
{ {
zclient_unregister_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST); zclient_unregister_opaque(ldp_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST);
zclient_unregister_opaque(zclient, LDP_RLFA_REGISTER); zclient_unregister_opaque(ldp_zclient, LDP_RLFA_REGISTER);
zclient_unregister_opaque(zclient, LDP_RLFA_UNREGISTER_ALL); zclient_unregister_opaque(ldp_zclient, LDP_RLFA_UNREGISTER_ALL);
} }
int int
ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *state) ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *state)
{ {
if (zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE, if (zclient_send_opaque(ldp_zclient, LDP_IGP_SYNC_IF_STATE_UPDATE,
(const uint8_t *)state, sizeof(*state)) (const uint8_t *)state, sizeof(*state))
== ZCLIENT_SEND_FAILURE) == ZCLIENT_SEND_FAILURE)
return -1; return -1;
@ -130,9 +130,9 @@ ldp_sync_zebra_send_announce(void)
struct ldp_igp_sync_announce announce; struct ldp_igp_sync_announce announce;
announce.proto = ZEBRA_ROUTE_LDP; announce.proto = ZEBRA_ROUTE_LDP;
if (zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE, if (zclient_send_opaque(ldp_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE,
(const uint8_t *)&announce, sizeof(announce)) (const uint8_t *)&announce,
== ZCLIENT_SEND_FAILURE) sizeof(announce)) == ZCLIENT_SEND_FAILURE)
return -1; return -1;
else else
return 0; return 0;
@ -142,7 +142,7 @@ int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response *rlfa_labels)
{ {
int ret; int ret;
ret = zclient_send_opaque(zclient, LDP_RLFA_LABELS, ret = zclient_send_opaque(ldp_zclient, LDP_RLFA_LABELS,
(const uint8_t *)rlfa_labels, (const uint8_t *)rlfa_labels,
sizeof(*rlfa_labels)); sizeof(*rlfa_labels));
if (ret == ZCLIENT_SEND_FAILURE) { if (ret == ZCLIENT_SEND_FAILURE) {
@ -271,7 +271,7 @@ ldp_zebra_send_mpls_labels(int cmd, struct kroute *kr)
znh->label_num = 1; znh->label_num = 1;
znh->labels[0] = kr->remote_label; znh->labels[0] = kr->remote_label;
if (zebra_send_mpls_labels(zclient, cmd, &zl) == ZCLIENT_SEND_FAILURE) if (zebra_send_mpls_labels(ldp_zclient, cmd, &zl) == ZCLIENT_SEND_FAILURE)
return -1; return -1;
return 0; return 0;
@ -295,7 +295,7 @@ kmpw_add(struct zapi_pw *zpw)
debug_zebra_out("pseudowire %s nexthop %s (add)", debug_zebra_out("pseudowire %s nexthop %s (add)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop)); zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
return zebra_send_pw(zclient, ZEBRA_PW_ADD, zpw) == ZCLIENT_SEND_FAILURE; return zebra_send_pw(ldp_zclient, ZEBRA_PW_ADD, zpw) == ZCLIENT_SEND_FAILURE;
} }
int int
@ -304,7 +304,7 @@ kmpw_del(struct zapi_pw *zpw)
debug_zebra_out("pseudowire %s nexthop %s (del)", debug_zebra_out("pseudowire %s nexthop %s (del)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop)); zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
return zebra_send_pw(zclient, ZEBRA_PW_DELETE, zpw) == ZCLIENT_SEND_FAILURE; return zebra_send_pw(ldp_zclient, ZEBRA_PW_DELETE, zpw) == ZCLIENT_SEND_FAILURE;
} }
int int
@ -314,7 +314,7 @@ kmpw_set(struct zapi_pw *zpw)
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop), zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop),
zpw->local_label, zpw->remote_label); zpw->local_label, zpw->remote_label);
return zebra_send_pw(zclient, ZEBRA_PW_SET, zpw) == ZCLIENT_SEND_FAILURE; return zebra_send_pw(ldp_zclient, ZEBRA_PW_SET, zpw) == ZCLIENT_SEND_FAILURE;
} }
int int
@ -323,7 +323,7 @@ kmpw_unset(struct zapi_pw *zpw)
debug_zebra_out("pseudowire %s nexthop %s (unset)", debug_zebra_out("pseudowire %s nexthop %s (unset)",
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop)); zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop));
return zebra_send_pw(zclient, ZEBRA_PW_UNSET, zpw) == ZCLIENT_SEND_FAILURE; return zebra_send_pw(ldp_zclient, ZEBRA_PW_UNSET, zpw) == ZCLIENT_SEND_FAILURE;
} }
void void
@ -620,18 +620,18 @@ void ldp_zebra_regdereg_zebra_info(bool want_register)
want_register ? "Register" : "De-register"); want_register ? "Register" : "De-register");
if (want_register) { if (want_register) {
zclient_send_reg_requests(zclient, VRF_DEFAULT); zclient_send_reg_requests(ldp_zclient, VRF_DEFAULT);
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, ldp_zclient, AFI_IP,
ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT); ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT);
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, ldp_zclient,
AFI_IP6, ZEBRA_ROUTE_ALL, 0, AFI_IP6, ZEBRA_ROUTE_ALL, 0,
VRF_DEFAULT); VRF_DEFAULT);
} else { } else {
zclient_send_dereg_requests(zclient, VRF_DEFAULT); zclient_send_dereg_requests(ldp_zclient, VRF_DEFAULT);
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, ldp_zclient,
AFI_IP, ZEBRA_ROUTE_ALL, 0, AFI_IP, ZEBRA_ROUTE_ALL, 0,
VRF_DEFAULT); VRF_DEFAULT);
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, ldp_zclient,
AFI_IP6, ZEBRA_ROUTE_ALL, 0, AFI_IP6, ZEBRA_ROUTE_ALL, 0,
VRF_DEFAULT); VRF_DEFAULT);
} }
@ -678,7 +678,7 @@ static zclient_handler *const ldp_handlers[] = {
[ZEBRA_OPAQUE_MESSAGE] = ldp_zebra_opaque_msg_handler, [ZEBRA_OPAQUE_MESSAGE] = ldp_zebra_opaque_msg_handler,
}; };
void ldp_zebra_init(struct event_loop *master) void ldp_zebra_init(struct event_loop *mst)
{ {
hook_register_prio(if_real, 0, ldp_ifp_create); hook_register_prio(if_real, 0, ldp_ifp_create);
hook_register_prio(if_up, 0, ldp_ifp_up); hook_register_prio(if_up, 0, ldp_ifp_up);
@ -686,12 +686,12 @@ void ldp_zebra_init(struct event_loop *master)
hook_register_prio(if_unreal, 0, ldp_ifp_destroy); hook_register_prio(if_unreal, 0, ldp_ifp_destroy);
/* Set default values. */ /* Set default values. */
zclient = zclient_new(master, &zclient_options_default, ldp_handlers, ldp_zclient = zclient_new(mst, &zclient_options_default, ldp_handlers,
array_size(ldp_handlers)); array_size(ldp_handlers));
zclient_init(zclient, ZEBRA_ROUTE_LDP, 0, &ldpd_privs); zclient_init(ldp_zclient, ZEBRA_ROUTE_LDP, 0, &ldpd_privs);
/* set callbacks */ /* set callbacks */
zclient->zebra_connected = ldp_zebra_connected; ldp_zclient->zebra_connected = ldp_zebra_connected;
/* Access list initialize. */ /* Access list initialize. */
access_list_add_hook(ldp_zebra_filter_update); access_list_add_hook(ldp_zebra_filter_update);
@ -702,9 +702,9 @@ void
ldp_zebra_destroy(void) ldp_zebra_destroy(void)
{ {
ldp_zebra_opaque_unregister(); ldp_zebra_opaque_unregister();
zclient_stop(zclient); zclient_stop(ldp_zclient);
zclient_free(zclient); zclient_free(ldp_zclient);
zclient = NULL; ldp_zclient = NULL;
if (zclient_sync == NULL) if (zclient_sync == NULL)
return; return;

View file

@ -74,7 +74,7 @@ DEFINE_QOBJ_TYPE(ldpd_conf);
const char *log_procname; const char *log_procname;
struct ldpd_global global; struct ldpd_global global;
struct ldpd_init init; struct ldpd_init ldp_init;
struct ldpd_conf *ldpd_conf, *vty_conf; struct ldpd_conf *ldpd_conf, *vty_conf;
static struct imsgev *iev_ldpe, *iev_ldpe_sync; static struct imsgev *iev_ldpe, *iev_ldpe_sync;
@ -272,8 +272,8 @@ main(int argc, char *argv[])
"%s/" LDPD_SOCK_NAME, optarg); "%s/" LDPD_SOCK_NAME, optarg);
break; break;
case 'n': case 'n':
init.instance = atoi(optarg); ldp_init.instance = atoi(optarg);
if (init.instance < 1) if (ldp_init.instance < 1)
exit(0); exit(0);
break; break;
case 'L': case 'L':
@ -291,11 +291,11 @@ main(int argc, char *argv[])
snprintf(ctl_sock_path, sizeof(ctl_sock_path), snprintf(ctl_sock_path, sizeof(ctl_sock_path),
"%s/" LDPD_SOCK_NAME, frr_runstatedir); "%s/" LDPD_SOCK_NAME, frr_runstatedir);
strlcpy(init.user, ldpd_privs.user, sizeof(init.user)); strlcpy(ldp_init.user, ldpd_privs.user, sizeof(ldp_init.user));
strlcpy(init.group, ldpd_privs.group, sizeof(init.group)); strlcpy(ldp_init.group, ldpd_privs.group, sizeof(ldp_init.group));
strlcpy(init.ctl_sock_path, ctl_sock_path, sizeof(init.ctl_sock_path)); strlcpy(ldp_init.ctl_sock_path, ctl_sock_path, sizeof(ldp_init.ctl_sock_path));
strlcpy(init.zclient_serv_path, frr_zclientpath, strlcpy(ldp_init.zclient_serv_path, frr_zclientpath,
sizeof(init.zclient_serv_path)); sizeof(ldp_init.zclient_serv_path));
argc -= optind; argc -= optind;
if (argc > 0 || (lflag && eflag)) if (argc > 0 || (lflag && eflag))
@ -428,7 +428,7 @@ main(int argc, char *argv[])
fatal("could not establish imsg links"); fatal("could not establish imsg links");
main_imsg_compose_both(IMSG_DEBUG_UPDATE, &ldp_debug, sizeof(ldp_debug)); main_imsg_compose_both(IMSG_DEBUG_UPDATE, &ldp_debug, sizeof(ldp_debug));
main_imsg_compose_both(IMSG_INIT, &init, sizeof(init)); main_imsg_compose_both(IMSG_INIT, &ldp_init, sizeof(ldp_init));
main_imsg_send_config(ldpd_conf); main_imsg_send_config(ldpd_conf);
if (CHECK_FLAG(ldpd_conf->ipv4.flags, F_LDPD_AF_ENABLED)) if (CHECK_FLAG(ldpd_conf->ipv4.flags, F_LDPD_AF_ENABLED))

View file

@ -739,7 +739,7 @@ struct ctl_ldp_sync {
extern struct ldpd_conf *ldpd_conf, *vty_conf; extern struct ldpd_conf *ldpd_conf, *vty_conf;
extern struct ldpd_global global; extern struct ldpd_global global;
extern struct ldpd_init init; extern struct ldpd_init ldp_init;
/* parse.y */ /* parse.y */
struct ldpd_conf *parse_config(char *); struct ldpd_conf *parse_config(char *);

View file

@ -373,8 +373,8 @@ static void ldpe_dispatch_main(struct event *thread)
if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(struct ldpd_init)) if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(struct ldpd_init))
fatalx("INIT imsg with wrong len"); fatalx("INIT imsg with wrong len");
memcpy(&init, imsg.data, sizeof(init)); memcpy(&ldp_init, imsg.data, sizeof(ldp_init));
ldpe_init(&init); ldpe_init(&ldp_init);
break; break;
case IMSG_AGENTX_ENABLED: case IMSG_AGENTX_ENABLED:
ldp_agentx_enabled(); ldp_agentx_enabled();

View file

@ -511,11 +511,11 @@ void *__darr_resize(void *a, uint count, size_t esize, struct memtype *mt);
*/ */
#define darr_pop(A) \ #define darr_pop(A) \
({ \ ({ \
uint __len = _darr_len(A); \ uint __poplen = _darr_len(A); \
assert(__len); \ assert(__poplen); \
darr_remove(A, __len - 1); \ darr_remove(A, __poplen - 1); \
/* count on fact that we don't resize */ \ /* count on fact that we don't resize */ \
(A)[__len - 1]; \ (A)[__poplen - 1]; \
}) })
/** /**

View file

@ -518,12 +518,12 @@ static void elfsect_add_relocations(struct elfsect *w, Elf_Scn *rel,
relw->es = w; relw->es = w;
if (relhdr->sh_type == SHT_REL) { if (relhdr->sh_type == SHT_REL) {
GElf_Rel _rel, *rel; GElf_Rel _rel, *erel;
rel = gelf_getrel(reldata, i, &_rel); erel = gelf_getrel(reldata, i, &_rel);
relw->rela = &relw->_rela; relw->rela = &relw->_rela;
relw->rela->r_offset = rel->r_offset; relw->rela->r_offset = erel->r_offset;
relw->rela->r_info = rel->r_info; relw->rela->r_info = erel->r_info;
relw->rela->r_addend = 0; relw->rela->r_addend = 0;
relw->relative = true; relw->relative = true;
} else } else
@ -581,14 +581,14 @@ static PyObject *elfsect_wrap(struct elffile *ef, Elf_Scn *scn, size_t idx,
elfrelocs_init(&w->relocs); elfrelocs_init(&w->relocs);
for (i = 0; i < ef->ehdr->e_shnum; i++) { for (i = 0; i < ef->ehdr->e_shnum; i++) {
Elf_Scn *scn = elf_getscn(ef->elf, i); Elf_Scn *escn = elf_getscn(ef->elf, i);
GElf_Shdr _shdr, *shdr = gelf_getshdr(scn, &_shdr); GElf_Shdr _shdr, *shdr = gelf_getshdr(escn, &_shdr);
if (shdr->sh_type != SHT_RELA && shdr->sh_type != SHT_REL) if (shdr->sh_type != SHT_RELA && shdr->sh_type != SHT_REL)
continue; continue;
if (shdr->sh_info && shdr->sh_info != idx) if (shdr->sh_info && shdr->sh_info != idx)
continue; continue;
elfsect_add_relocations(w, scn, shdr); elfsect_add_relocations(w, escn, shdr);
} }
return (PyObject *)w; return (PyObject *)w;

View file

@ -233,11 +233,13 @@ int frr_pthread_non_controlled_startup(pthread_t thread, const char *name,
unused, cleanup(_frr_mtx_unlock))) = _frr_mtx_lock(mutex), \ unused, cleanup(_frr_mtx_unlock))) = _frr_mtx_lock(mutex), \
/* end */ /* end */
#define frr_with_mutex(...) \ #define _frr_with_mutex_once(_once, ...) \
for (pthread_mutex_t MACRO_REPEAT(_frr_with_mutex, ##__VA_ARGS__) \ for (pthread_mutex_t MACRO_REPEAT(_frr_with_mutex, ##__VA_ARGS__)*_once = NULL; \
*_once = NULL; _once == NULL; _once = (void *)1) \ _once == NULL; _once = (void *)1) \
/* end */ /* end */
#define frr_with_mutex(...) _frr_with_mutex_once(NAMECTR(_once_), __VA_ARGS__)
/* variant 2: /* variant 2:
* (more suitable for long blocks, no extra indentation) * (more suitable for long blocks, no extra indentation)
* *

View file

@ -1192,9 +1192,10 @@ void frr_detach(void)
frr_check_detach(); frr_check_detach();
} }
void frr_run(struct event_loop *master) void frr_run(struct event_loop *loop)
{ {
char instanceinfo[64] = ""; char instanceinfo[64] = "";
struct event thread;
if (!(di->flags & FRR_MANUAL_VTY_START)) if (!(di->flags & FRR_MANUAL_VTY_START))
frr_vty_serv_start(false); frr_vty_serv_start(false);
@ -1212,7 +1213,7 @@ void frr_run(struct event_loop *master)
vty_stdio(frr_terminal_close); vty_stdio(frr_terminal_close);
if (daemon_ctl_sock != -1) { if (daemon_ctl_sock != -1) {
set_nonblocking(daemon_ctl_sock); set_nonblocking(daemon_ctl_sock);
event_add_read(master, frr_daemon_ctl, NULL, event_add_read(loop, frr_daemon_ctl, NULL,
daemon_ctl_sock, &daemon_ctl_thread); daemon_ctl_sock, &daemon_ctl_thread);
} }
} else if (di->daemon_mode) { } else if (di->daemon_mode) {
@ -1242,8 +1243,7 @@ void frr_run(struct event_loop *master)
/* end fixed stderr startup logging */ /* end fixed stderr startup logging */
zlog_startup_end(); zlog_startup_end();
struct event thread; while (event_fetch(loop, &thread))
while (event_fetch(master, &thread))
event_call(&thread); event_call(&thread);
} }

View file

@ -2555,9 +2555,9 @@ static void ls_show_edge_json(struct ls_edge *edge, struct json_object *json)
if (CHECK_FLAG(attr->flags, LS_ATTR_UNRSV_BW)) { if (CHECK_FLAG(attr->flags, LS_ATTR_UNRSV_BW)) {
jbw = json_object_new_array(); jbw = json_object_new_array();
json_object_object_add(jte, "unreserved-bandwidth", jbw); json_object_object_add(jte, "unreserved-bandwidth", jbw);
for (int i = 0; i < MAX_CLASS_TYPE; i++) { for (i = 0; i < MAX_CLASS_TYPE; i++) {
jobj = json_object_new_object(); jobj = json_object_new_object();
snprintfrr(buf, 13, "class-type-%u", i); snprintfrr(buf, 13, "class-type-%u", (unsigned int)i);
json_object_double_add(jobj, buf, json_object_double_add(jobj, buf,
attr->standard.unrsv_bw[i]); attr->standard.unrsv_bw[i]);
json_object_array_add(jbw, jobj); json_object_array_add(jbw, jobj);
@ -2599,7 +2599,7 @@ static void ls_show_edge_json(struct ls_edge *edge, struct json_object *json)
if (CHECK_FLAG(attr->flags, LS_ATTR_SRLG)) { if (CHECK_FLAG(attr->flags, LS_ATTR_SRLG)) {
jsrlg = json_object_new_array(); jsrlg = json_object_new_array();
json_object_object_add(jte, "srlgs", jsrlg); json_object_object_add(jte, "srlgs", jsrlg);
for (int i = 1; i < attr->srlg_len; i++) { for (i = 1; i < attr->srlg_len; i++) {
jobj = json_object_new_object(); jobj = json_object_new_object();
json_object_int_add(jobj, "srlg", attr->srlgs[i]); json_object_int_add(jobj, "srlg", attr->srlgs[i]);
json_object_array_add(jsrlg, jobj); json_object_array_add(jsrlg, jobj);

View file

@ -67,7 +67,11 @@ struct list {
#define listcount(X) ((X)->count) #define listcount(X) ((X)->count)
#define list_isempty(X) ((X)->head == NULL && (X)->tail == NULL) #define list_isempty(X) ((X)->head == NULL && (X)->tail == NULL)
/* return X->data only if X and X->data are not NULL */ /* return X->data only if X and X->data are not NULL */
#define listgetdata(X) (assert(X), assert((X)->data != NULL), (X)->data) static inline void *listgetdata(const struct listnode *X)
{
assert((X != NULL) && ((X)->data != NULL));
return X->data;
}
/* App is going to manage listnode memory */ /* App is going to manage listnode memory */
#define listset_app_node_mem(X) ((X)->flags |= LINKLIST_FLAG_NODE_MEM_BY_APP) #define listset_app_node_mem(X) ((X)->flags |= LINKLIST_FLAG_NODE_MEM_BY_APP)
#define listnode_init(X, val) ((X)->data = (val)) #define listnode_init(X, val) ((X)->data = (val))

View file

@ -157,6 +157,7 @@ nb_op_create_yield_state(const char *xpath, struct yang_translator *translator,
/* remove trailing '/'s */ /* remove trailing '/'s */
while (darr_len(ys->xpath) > 1 && ys->xpath[darr_len(ys->xpath) - 2] == '/') { while (darr_len(ys->xpath) > 1 && ys->xpath[darr_len(ys->xpath) - 2] == '/') {
darr_setlen(ys->xpath, darr_len(ys->xpath) - 1); darr_setlen(ys->xpath, darr_len(ys->xpath) - 1);
if (darr_last(ys->xpath))
*darr_last(ys->xpath) = 0; *darr_last(ys->xpath) = 0;
} }
ys->xpath_orig = darr_strdup(xpath); ys->xpath_orig = darr_strdup(xpath);

View file

@ -556,23 +556,23 @@ reswitch: switch (ch) {
case 'G': case 'G':
if (flags & LONGDBL) { if (flags & LONGDBL) {
long double arg = GETARG(long double); long double arg = GETARG(long double);
char fmt[6] = "%.*L"; char lfmt[6] = "%.*L";
fmt[4] = ch; lfmt[4] = ch;
fmt[5] = '\0'; lfmt[5] = '\0';
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral" #pragma GCC diagnostic ignored "-Wformat-nonliteral"
snprintf(buf, sizeof(buf), fmt, prec, arg); snprintf(buf, sizeof(buf), lfmt, prec, arg);
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
} else { } else {
double arg = GETARG(double); double arg = GETARG(double);
char fmt[5] = "%.*"; char lfmt[5] = "%.*";
fmt[3] = ch; lfmt[3] = ch;
fmt[4] = '\0'; lfmt[4] = '\0';
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral" #pragma GCC diagnostic ignored "-Wformat-nonliteral"
snprintf(buf, sizeof(buf), fmt, prec, arg); snprintf(buf, sizeof(buf), lfmt, prec, arg);
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
} }
cp = buf; cp = buf;

View file

@ -3014,7 +3014,7 @@ size_t zebra_interface_link_params_write(struct stream *s,
size_t w, nb_ext_adm_grp; size_t w, nb_ext_adm_grp;
struct if_link_params *iflp; struct if_link_params *iflp;
int i; int i;
size_t j;
if (s == NULL || ifp == NULL) if (s == NULL || ifp == NULL)
return 0; return 0;
@ -3045,8 +3045,8 @@ size_t zebra_interface_link_params_write(struct stream *s,
/* Extended Administrative Group */ /* Extended Administrative Group */
nb_ext_adm_grp = admin_group_nb_words(&iflp->ext_admin_grp); nb_ext_adm_grp = admin_group_nb_words(&iflp->ext_admin_grp);
w += stream_putc(s, nb_ext_adm_grp); w += stream_putc(s, nb_ext_adm_grp);
for (size_t i = 0; i < nb_ext_adm_grp; i++) for (j = 0; j < nb_ext_adm_grp; j++)
stream_putl(s, admin_group_get_offset(&iflp->ext_admin_grp, i)); stream_putl(s, admin_group_get_offset(&iflp->ext_admin_grp, j));
w += stream_putl(s, iflp->rmt_as); w += stream_putl(s, iflp->rmt_as);
w += stream_put_in_addr(s, &iflp->rmt_ip); w += stream_put_in_addr(s, &iflp->rmt_ip);

View file

@ -151,9 +151,9 @@ void mgmt_ds_reset_candidate(void)
} }
int mgmt_ds_init(struct mgmt_master *mm) int mgmt_ds_init(struct mgmt_master *m)
{ {
if (mgmt_ds_mm || mm->running_ds || mm->candidate_ds || mm->oper_ds) if (mgmt_ds_mm || m->running_ds || m->candidate_ds || m->oper_ds)
assert(!"MGMTD: Call ds_init only once!"); assert(!"MGMTD: Call ds_init only once!");
/* Use Running DS from NB module??? */ /* Use Running DS from NB module??? */
@ -178,10 +178,10 @@ int mgmt_ds_init(struct mgmt_master *mm)
oper.config_ds = false; oper.config_ds = false;
oper.ds_id = MGMTD_DS_OPERATIONAL; oper.ds_id = MGMTD_DS_OPERATIONAL;
mm->running_ds = &running; m->running_ds = &running;
mm->candidate_ds = &candidate; m->candidate_ds = &candidate;
mm->oper_ds = &oper; m->oper_ds = &oper;
mgmt_ds_mm = mm; mgmt_ds_mm = m;
return 0; return 0;
} }
@ -195,16 +195,15 @@ void mgmt_ds_destroy(void)
oper.root.dnode_root = NULL; oper.root.dnode_root = NULL;
} }
struct mgmt_ds_ctx *mgmt_ds_get_ctx_by_id(struct mgmt_master *mm, struct mgmt_ds_ctx *mgmt_ds_get_ctx_by_id(struct mgmt_master *m, Mgmtd__DatastoreId ds_id)
Mgmtd__DatastoreId ds_id)
{ {
switch (ds_id) { switch (ds_id) {
case MGMTD_DS_CANDIDATE: case MGMTD_DS_CANDIDATE:
return (mm->candidate_ds); return (m->candidate_ds);
case MGMTD_DS_RUNNING: case MGMTD_DS_RUNNING:
return (mm->running_ds); return (m->running_ds);
case MGMTD_DS_OPERATIONAL: case MGMTD_DS_OPERATIONAL:
return (mm->oper_ds); return (m->oper_ds);
case MGMTD_DS_NONE: case MGMTD_DS_NONE:
case MGMTD__DATASTORE_ID__STARTUP_DS: case MGMTD__DATASTORE_ID__STARTUP_DS:
case _MGMTD__DATASTORE_ID_IS_INT_SIZE: case _MGMTD__DATASTORE_ID_IS_INT_SIZE:

View file

@ -1442,7 +1442,6 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session,
/* Check for yang-library shortcut */ /* Check for yang-library shortcut */
if (nb_oper_is_yang_lib_query(msg->xpath)) { if (nb_oper_is_yang_lib_query(msg->xpath)) {
struct lyd_node *ylib = NULL; struct lyd_node *ylib = NULL;
LY_ERR err;
err = ly_ctx_get_yanglib_data(ly_native_ctx, &ylib, "%u", err = ly_ctx_get_yanglib_data(ly_native_ctx, &ylib, "%u",
ly_ctx_get_change_count( ly_ctx_get_change_count(

View file

@ -1993,17 +1993,17 @@ static void mgmt_txn_register_event(struct mgmt_txn_ctx *txn,
} }
} }
int mgmt_txn_init(struct mgmt_master *mm, struct event_loop *tm) int mgmt_txn_init(struct mgmt_master *m, struct event_loop *loop)
{ {
if (mgmt_txn_mm || mgmt_txn_tm) if (mgmt_txn_mm || mgmt_txn_tm)
assert(!"MGMTD TXN: Call txn_init() only once"); assert(!"MGMTD TXN: Call txn_init() only once");
mgmt_txn_mm = mm; mgmt_txn_mm = m;
mgmt_txn_tm = tm; mgmt_txn_tm = loop;
mgmt_txns_init(&mm->txn_list); mgmt_txns_init(&m->txn_list);
mgmt_txn_hash_init(); mgmt_txn_hash_init();
assert(!mm->cfg_txn); assert(!m->cfg_txn);
mm->cfg_txn = NULL; m->cfg_txn = NULL;
return 0; return 0;
} }

View file

@ -16,7 +16,7 @@
DEFINE_MTYPE_STATIC(NHRPD, NHRP_ROUTE, "NHRP routing entry"); DEFINE_MTYPE_STATIC(NHRPD, NHRP_ROUTE, "NHRP routing entry");
static struct zclient *zclient; static struct zclient *nhrp_zclient;
static struct route_table *zebra_rib[AFI_MAX]; static struct route_table *zebra_rib[AFI_MAX];
struct route_info { struct route_info {
@ -95,7 +95,7 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type,
struct zapi_route api; struct zapi_route api;
struct zapi_nexthop *api_nh; struct zapi_nexthop *api_nh;
if (zclient->sock < 0) if (nhrp_zclient->sock < 0)
return; return;
memset(&api, 0, sizeof(api)); memset(&api, 0, sizeof(api));
@ -196,7 +196,7 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type,
api.metric, api.nexthop_num, ifp ? ifp->name : "none"); api.metric, api.nexthop_num, ifp ? ifp->name : "none");
} }
zclient_route_send(add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, zclient, zclient_route_send(add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, nhrp_zclient,
&api); &api);
} }
@ -374,10 +374,10 @@ void nhrp_zebra_init(void)
zebra_rib[AFI_IP] = route_table_init(); zebra_rib[AFI_IP] = route_table_init();
zebra_rib[AFI_IP6] = route_table_init(); zebra_rib[AFI_IP6] = route_table_init();
zclient = zclient_new(master, &zclient_options_default, nhrp_handlers, nhrp_zclient = zclient_new(master, &zclient_options_default, nhrp_handlers,
array_size(nhrp_handlers)); array_size(nhrp_handlers));
zclient->zebra_connected = nhrp_zebra_connected; nhrp_zclient->zebra_connected = nhrp_zebra_connected;
zclient_init(zclient, ZEBRA_ROUTE_NHRP, 0, &nhrpd_privs); zclient_init(nhrp_zclient, ZEBRA_ROUTE_NHRP, 0, &nhrpd_privs);
} }
static void nhrp_table_node_cleanup(struct route_table *table, static void nhrp_table_node_cleanup(struct route_table *table,
@ -393,18 +393,18 @@ void nhrp_send_zebra_configure_arp(struct interface *ifp, int family)
{ {
struct stream *s; struct stream *s;
if (!zclient || zclient->sock < 0) { if (!nhrp_zclient || nhrp_zclient->sock < 0) {
debugf(NHRP_DEBUG_COMMON, "%s() : zclient not ready", debugf(NHRP_DEBUG_COMMON, "%s() : zclient not ready",
__func__); __func__);
return; return;
} }
s = zclient->obuf; s = nhrp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_CONFIGURE_ARP, ifp->vrf->vrf_id); zclient_create_header(s, ZEBRA_CONFIGURE_ARP, ifp->vrf->vrf_id);
stream_putc(s, family); stream_putc(s, family);
stream_putl(s, ifp->ifindex); stream_putl(s, ifp->ifindex);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
zclient_send_message(zclient); zclient_send_message(nhrp_zclient);
} }
void nhrp_send_zebra_gre_source_set(struct interface *ifp, void nhrp_send_zebra_gre_source_set(struct interface *ifp,
@ -413,7 +413,7 @@ void nhrp_send_zebra_gre_source_set(struct interface *ifp,
{ {
struct stream *s; struct stream *s;
if (!zclient || zclient->sock < 0) { if (!nhrp_zclient || nhrp_zclient->sock < 0) {
zlog_err("%s : zclient not ready", __func__); zlog_err("%s : zclient not ready", __func__);
return; return;
} }
@ -421,7 +421,7 @@ void nhrp_send_zebra_gre_source_set(struct interface *ifp,
/* silently ignore */ /* silently ignore */
return; return;
} }
s = zclient->obuf; s = nhrp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_GRE_SOURCE_SET, ifp->vrf->vrf_id); zclient_create_header(s, ZEBRA_GRE_SOURCE_SET, ifp->vrf->vrf_id);
stream_putl(s, ifp->ifindex); stream_putl(s, ifp->ifindex);
@ -429,7 +429,7 @@ void nhrp_send_zebra_gre_source_set(struct interface *ifp,
stream_putl(s, link_vrf_id); stream_putl(s, link_vrf_id);
stream_putl(s, 0); /* mtu provisioning */ stream_putl(s, 0); /* mtu provisioning */
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
zclient_send_message(zclient); zclient_send_message(nhrp_zclient);
} }
void nhrp_send_zebra_nbr(union sockunion *in, void nhrp_send_zebra_nbr(union sockunion *in,
@ -438,9 +438,9 @@ void nhrp_send_zebra_nbr(union sockunion *in,
{ {
struct stream *s; struct stream *s;
if (!zclient || zclient->sock < 0) if (!nhrp_zclient || nhrp_zclient->sock < 0)
return; return;
s = zclient->obuf; s = nhrp_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_neigh_ip_encode(s, out ? ZEBRA_NEIGH_IP_ADD : ZEBRA_NEIGH_IP_DEL, zclient_neigh_ip_encode(s, out ? ZEBRA_NEIGH_IP_ADD : ZEBRA_NEIGH_IP_DEL,
in, out, ifp, in, out, ifp,
@ -448,26 +448,26 @@ void nhrp_send_zebra_nbr(union sockunion *in,
: ZEBRA_NEIGH_STATE_FAILED, : ZEBRA_NEIGH_STATE_FAILED,
0); 0);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
zclient_send_message(zclient); zclient_send_message(nhrp_zclient);
} }
int nhrp_send_zebra_gre_request(struct interface *ifp) int nhrp_send_zebra_gre_request(struct interface *ifp)
{ {
return zclient_send_zebra_gre_request(zclient, ifp); return zclient_send_zebra_gre_request(nhrp_zclient, ifp);
} }
void nhrp_interface_update_arp(struct interface *ifp, bool arp_enable) void nhrp_interface_update_arp(struct interface *ifp, bool arp_enable)
{ {
zclient_interface_set_arp(zclient, ifp, arp_enable); zclient_interface_set_arp(nhrp_zclient, ifp, arp_enable);
} }
void nhrp_zebra_terminate(void) void nhrp_zebra_terminate(void)
{ {
zclient_register_neigh(zclient, VRF_DEFAULT, AFI_IP, false); zclient_register_neigh(nhrp_zclient, VRF_DEFAULT, AFI_IP, false);
zclient_register_neigh(zclient, VRF_DEFAULT, AFI_IP6, false); zclient_register_neigh(nhrp_zclient, VRF_DEFAULT, AFI_IP6, false);
zclient_stop(zclient); zclient_stop(nhrp_zclient);
zclient_free(zclient); zclient_free(nhrp_zclient);
zebra_rib[AFI_IP]->cleanup = nhrp_table_node_cleanup; zebra_rib[AFI_IP]->cleanup = nhrp_table_node_cleanup;
zebra_rib[AFI_IP6]->cleanup = nhrp_table_node_cleanup; zebra_rib[AFI_IP6]->cleanup = nhrp_table_node_cleanup;

View file

@ -515,8 +515,6 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
summary->path.origin.id = summary->path.origin.id =
ADV_ROUTER_IN_PREFIX(&route->prefix); ADV_ROUTER_IN_PREFIX(&route->prefix);
} else { } else {
struct ospf6_lsa *old;
summary->path.origin.type = summary->path.origin.type =
htons(OSPF6_LSTYPE_INTER_PREFIX); htons(OSPF6_LSTYPE_INTER_PREFIX);

View file

@ -123,16 +123,16 @@ struct ospf6_area {
#define OSPF6_CMD_AREA_GET(str, oa, ospf6) \ #define OSPF6_CMD_AREA_GET(str, oa, ospf6) \
{ \ { \
uint32_t area_id; \ uint32_t _area_id; \
int format, ret; \ int _format, _ret; \
ret = str2area_id(str, &area_id, &format); \ _ret = str2area_id(str, &_area_id, &_format); \
if (ret) { \ if (_ret) { \
vty_out(vty, "Malformed Area-ID: %s\n", str); \ vty_out(vty, "Malformed Area-ID: %s\n", str); \
return CMD_WARNING; \ return CMD_WARNING; \
} \ } \
oa = ospf6_area_lookup(area_id, ospf6); \ oa = ospf6_area_lookup(_area_id, ospf6); \
if (oa == NULL) \ if (oa == NULL) \
oa = ospf6_area_create(area_id, ospf6, format); \ oa = ospf6_area_create(_area_id, ospf6, _format); \
} }
/* prototypes */ /* prototypes */

View file

@ -1899,7 +1899,7 @@ static void ospf6_redistribute_default_set(struct ospf6 *ospf6, int originate)
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_IP6, ospf6->vrf_id); ospf6_zclient, AFI_IP6, ospf6->vrf_id);
ospf6_asbr_redistribute_remove(DEFAULT_ROUTE, 0, ospf6_asbr_redistribute_remove(DEFAULT_ROUTE, 0,
(struct prefix *)&p, ospf6); (struct prefix *)&p, ospf6);
@ -1915,7 +1915,7 @@ static void ospf6_redistribute_default_set(struct ospf6 *ospf6, int originate)
break; break;
case DEFAULT_ORIGINATE_ZEBRA: case DEFAULT_ORIGINATE_ZEBRA:
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD, zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
zclient, AFI_IP6, ospf6->vrf_id); ospf6_zclient, AFI_IP6, ospf6->vrf_id);
break; break;
case DEFAULT_ORIGINATE_ALWAYS: case DEFAULT_ORIGINATE_ALWAYS:

View file

@ -27,8 +27,6 @@
#include "ospf6_zebra.h" #include "ospf6_zebra.h"
#include "ospf6_bfd.h" #include "ospf6_bfd.h"
extern struct zclient *zclient;
/* /*
* ospf6_bfd_trigger_event - Neighbor is registered/deregistered with BFD when * ospf6_bfd_trigger_event - Neighbor is registered/deregistered with BFD when
* neighbor state is changed to/from 2way. * neighbor state is changed to/from 2way.
@ -280,7 +278,7 @@ DEFUN (no_ipv6_ospf6_bfd,
void ospf6_bfd_init(void) void ospf6_bfd_init(void)
{ {
bfd_protocol_integration_init(zclient, master); bfd_protocol_integration_init(ospf6_zclient, master);
/* Install BFD command */ /* Install BFD command */
install_element(INTERFACE_NODE, &ipv6_ospf6_bfd_cmd); install_element(INTERFACE_NODE, &ipv6_ospf6_bfd_cmd);

View file

@ -104,9 +104,9 @@ static void __attribute__((noreturn)) ospf6_exit(int status)
vrf_terminate(); vrf_terminate();
if (zclient) { if (ospf6_zclient) {
zclient_stop(zclient); zclient_stop(ospf6_zclient);
zclient_free(zclient); zclient_free(ospf6_zclient);
} }
ospf6_master_delete(); ospf6_master_delete();

View file

@ -1382,9 +1382,9 @@ static int ospf6TrapIfStateChange(struct ospf6_interface *oi, int next_state,
} }
/* Register OSPFv3-MIB. */ /* Register OSPFv3-MIB. */
static int ospf6_snmp_init(struct event_loop *master) static int ospf6_snmp_init(struct event_loop *mstr)
{ {
smux_init(master); smux_init(mstr);
REGISTER_MIB("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid); REGISTER_MIB("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid);
return 0; return 0;
} }

View file

@ -142,20 +142,20 @@ static void ospf6_set_redist_vrf_bitmaps(struct ospf6 *ospf6, bool set)
"%s: setting redist vrf %d bitmap for type %d", "%s: setting redist vrf %d bitmap for type %d",
__func__, ospf6->vrf_id, type); __func__, ospf6->vrf_id, type);
if (set) if (set)
vrf_bitmap_set(&zclient->redist[AFI_IP6][type], vrf_bitmap_set(&ospf6_zclient->redist[AFI_IP6][type],
ospf6->vrf_id); ospf6->vrf_id);
else else
vrf_bitmap_unset(&zclient->redist[AFI_IP6][type], vrf_bitmap_unset(&ospf6_zclient->redist[AFI_IP6][type],
ospf6->vrf_id); ospf6->vrf_id);
} }
red_list = ospf6->redist[DEFAULT_ROUTE]; red_list = ospf6->redist[DEFAULT_ROUTE];
if (red_list) { if (red_list) {
if (set) if (set)
vrf_bitmap_set(&zclient->default_information[AFI_IP6], vrf_bitmap_set(&ospf6_zclient->default_information[AFI_IP6],
ospf6->vrf_id); ospf6->vrf_id);
else else
vrf_bitmap_unset(&zclient->default_information[AFI_IP6], vrf_bitmap_unset(&ospf6_zclient->default_information[AFI_IP6],
ospf6->vrf_id); ospf6->vrf_id);
} }
} }
@ -566,13 +566,13 @@ static void ospf6_disable(struct ospf6 *o)
} }
} }
void ospf6_master_init(struct event_loop *master) void ospf6_master_init(struct event_loop *mst)
{ {
memset(&ospf6_master, 0, sizeof(ospf6_master)); memset(&ospf6_master, 0, sizeof(ospf6_master));
om6 = &ospf6_master; om6 = &ospf6_master;
om6->ospf6 = list_new(); om6->ospf6 = list_new();
om6->master = master; om6->master = mst;
} }
void ospf6_master_delete(void) void ospf6_master_delete(void)

View file

@ -231,7 +231,6 @@ DECLARE_QOBJ_TYPE(ospf6);
#define OSPF6_STUB_ROUTER 0x02 #define OSPF6_STUB_ROUTER 0x02
/* global pointer for OSPF top data structure */ /* global pointer for OSPF top data structure */
extern struct ospf6 *ospf6;
extern struct ospf6_master *om6; extern struct ospf6_master *om6;
/* prototypes */ /* prototypes */

View file

@ -36,11 +36,11 @@ DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_DISTANCE, "OSPF6 distance");
unsigned char conf_debug_ospf6_zebra = 0; unsigned char conf_debug_ospf6_zebra = 0;
/* information about zebra. */ /* information about zebra. */
struct zclient *zclient = NULL; struct zclient *ospf6_zclient = NULL;
void ospf6_zebra_vrf_register(struct ospf6 *ospf6) void ospf6_zebra_vrf_register(struct ospf6 *ospf6)
{ {
if (!zclient || zclient->sock < 0 || !ospf6) if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
return; return;
if (ospf6->vrf_id != VRF_UNKNOWN) { if (ospf6->vrf_id != VRF_UNKNOWN) {
@ -49,13 +49,13 @@ void ospf6_zebra_vrf_register(struct ospf6 *ospf6)
ospf6_vrf_id_to_name(ospf6->vrf_id), ospf6_vrf_id_to_name(ospf6->vrf_id),
ospf6->vrf_id); ospf6->vrf_id);
} }
zclient_send_reg_requests(zclient, ospf6->vrf_id); zclient_send_reg_requests(ospf6_zclient, ospf6->vrf_id);
} }
} }
void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6) void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6)
{ {
if (!zclient || zclient->sock < 0 || !ospf6) if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
return; return;
if (ospf6->vrf_id != VRF_DEFAULT && ospf6->vrf_id != VRF_UNKNOWN) { if (ospf6->vrf_id != VRF_DEFAULT && ospf6->vrf_id != VRF_UNKNOWN) {
@ -67,7 +67,7 @@ void ospf6_zebra_vrf_deregister(struct ospf6 *ospf6)
} }
/* Deregister for router-id, interfaces, /* Deregister for router-id, interfaces,
* redistributed routes. */ * redistributed routes. */
zclient_send_dereg_requests(zclient, ospf6->vrf_id); zclient_send_dereg_requests(ospf6_zclient, ospf6->vrf_id);
} }
} }
@ -98,22 +98,22 @@ static int ospf6_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
/* redistribute function */ /* redistribute function */
void ospf6_zebra_redistribute(int type, vrf_id_t vrf_id) void ospf6_zebra_redistribute(int type, vrf_id_t vrf_id)
{ {
if (vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id)) if (vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][type], vrf_id))
return; return;
vrf_bitmap_set(&zclient->redist[AFI_IP6][type], vrf_id); vrf_bitmap_set(&ospf6_zclient->redist[AFI_IP6][type], vrf_id);
if (zclient->sock > 0) if (ospf6_zclient->sock > 0)
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, ospf6_zclient,
AFI_IP6, type, 0, vrf_id); AFI_IP6, type, 0, vrf_id);
} }
void ospf6_zebra_no_redistribute(int type, vrf_id_t vrf_id) void ospf6_zebra_no_redistribute(int type, vrf_id_t vrf_id)
{ {
if (!vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id)) if (!vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][type], vrf_id))
return; return;
vrf_bitmap_unset(&zclient->redist[AFI_IP6][type], vrf_id); vrf_bitmap_unset(&ospf6_zclient->redist[AFI_IP6][type], vrf_id);
if (zclient->sock > 0) if (ospf6_zclient->sock > 0)
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient, zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, ospf6_zclient,
AFI_IP6, type, 0, vrf_id); AFI_IP6, type, 0, vrf_id);
} }
@ -122,7 +122,7 @@ void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg)
struct prefix prefix = {}; struct prefix prefix = {};
int command; int command;
if (zclient->sock < 0) { if (ospf6_zclient->sock < 0) {
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) if (IS_OSPF6_DEBUG_ZEBRA(SEND))
zlog_debug(" Not connected to Zebra"); zlog_debug(" Not connected to Zebra");
return; return;
@ -141,7 +141,7 @@ void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg)
zserv_command_string(command), &prefix, zserv_command_string(command), &prefix,
ospf6->vrf_id); ospf6->vrf_id);
if (zclient_send_rnh(zclient, command, &prefix, SAFI_UNICAST, false, if (zclient_send_rnh(ospf6_zclient, command, &prefix, SAFI_UNICAST, false,
true, ospf6->vrf_id) true, ospf6->vrf_id)
== ZCLIENT_SEND_FAILURE) == ZCLIENT_SEND_FAILURE)
flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_send_rnh() failed", flog_err(EC_LIB_ZAPI_SOCKET, "%s: zclient_send_rnh() failed",
@ -216,7 +216,7 @@ static int ospf6_zebra_gr_update(struct ospf6 *ospf6, int command,
{ {
struct zapi_cap api; struct zapi_cap api;
if (!zclient || zclient->sock < 0 || !ospf6) if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
return 1; return 1;
memset(&api, 0, sizeof(api)); memset(&api, 0, sizeof(api));
@ -224,7 +224,7 @@ static int ospf6_zebra_gr_update(struct ospf6 *ospf6, int command,
api.stale_removal_time = stale_time; api.stale_removal_time = stale_time;
api.vrf_id = ospf6->vrf_id; api.vrf_id = ospf6->vrf_id;
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, (void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, ospf6_zclient,
&api); &api);
return 0; return 0;
@ -313,7 +313,7 @@ DEFUN(show_zebra,
json_object *json_zebra; json_object *json_zebra;
json_object *json_array; json_object *json_array;
if (zclient == NULL) { if (ospf6_zclient == NULL) {
vty_out(vty, "Not connected to zebra\n"); vty_out(vty, "Not connected to zebra\n");
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -323,13 +323,13 @@ DEFUN(show_zebra,
json_zebra = json_object_new_object(); json_zebra = json_object_new_object();
json_array = json_object_new_array(); json_array = json_object_new_array();
json_object_int_add(json_zebra, "fail", zclient->fail); json_object_int_add(json_zebra, "fail", ospf6_zclient->fail);
json_object_int_add( json_object_int_add(
json_zebra, "redistributeDefault", json_zebra, "redistributeDefault",
vrf_bitmap_check(&zclient->default_information[AFI_IP6], vrf_bitmap_check(&ospf6_zclient->default_information[AFI_IP6],
VRF_DEFAULT)); VRF_DEFAULT));
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
if (vrf_bitmap_check(&zclient->redist[AFI_IP6][i], if (vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][i],
VRF_DEFAULT)) VRF_DEFAULT))
json_object_array_add( json_object_array_add(
json_array, json_array,
@ -342,13 +342,13 @@ DEFUN(show_zebra,
vty_json(vty, json); vty_json(vty, json);
} else { } else {
vty_out(vty, "Zebra Information\n"); vty_out(vty, "Zebra Information\n");
vty_out(vty, " fail: %d\n", zclient->fail); vty_out(vty, " fail: %d\n", ospf6_zclient->fail);
vty_out(vty, " redistribute default: %d\n", vty_out(vty, " redistribute default: %d\n",
vrf_bitmap_check(&zclient->default_information[AFI_IP6], vrf_bitmap_check(&ospf6_zclient->default_information[AFI_IP6],
VRF_DEFAULT)); VRF_DEFAULT));
vty_out(vty, " redistribute:"); vty_out(vty, " redistribute:");
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) { for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
if (vrf_bitmap_check(&zclient->redist[AFI_IP6][i], if (vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][i],
VRF_DEFAULT)) VRF_DEFAULT))
vty_out(vty, " %s", zebra_route_string(i)); vty_out(vty, " %s", zebra_route_string(i));
} }
@ -403,7 +403,7 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
zlog_debug("Zebra Send %s route: %pFX", zlog_debug("Zebra Send %s route: %pFX",
(type == REM ? "remove" : "add"), &request->prefix); (type == REM ? "remove" : "add"), &request->prefix);
if (zclient->sock < 0) { if (ospf6_zclient->sock < 0) {
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) if (IS_OSPF6_DEBUG_ZEBRA(SEND))
zlog_debug(" Not connected to Zebra"); zlog_debug(" Not connected to Zebra");
return; return;
@ -487,9 +487,9 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
ospf6_zebra_append_opaque_attr(request, &api); ospf6_zebra_append_opaque_attr(request, &api);
if (type == REM) if (type == REM)
ret = zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); ret = zclient_route_send(ZEBRA_ROUTE_DELETE, ospf6_zclient, &api);
else else
ret = zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api); ret = zclient_route_send(ZEBRA_ROUTE_ADD, ospf6_zclient, &api);
if (ret == ZCLIENT_SEND_FAILURE) if (ret == ZCLIENT_SEND_FAILURE)
flog_err(EC_LIB_ZAPI_SOCKET, flog_err(EC_LIB_ZAPI_SOCKET,
@ -552,7 +552,7 @@ void ospf6_zebra_add_discard(struct ospf6_route *request, struct ospf6 *ospf6)
api.prefix = *dest; api.prefix = *dest;
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, ospf6_zclient, &api);
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) if (IS_OSPF6_DEBUG_ZEBRA(SEND))
zlog_debug("Zebra: Route add discard %pFX", dest); zlog_debug("Zebra: Route add discard %pFX", dest);
@ -589,7 +589,7 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request,
api.prefix = *dest; api.prefix = *dest;
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, ospf6_zclient, &api);
if (IS_OSPF6_DEBUG_ZEBRA(SEND)) if (IS_OSPF6_DEBUG_ZEBRA(SEND))
zlog_debug("Zebra: Route delete discard %pFX", dest); zlog_debug("Zebra: Route delete discard %pFX", dest);
@ -758,14 +758,14 @@ static zclient_handler *const ospf6_handlers[] = {
[ZEBRA_REDISTRIBUTE_ROUTE_DEL] = ospf6_zebra_read_route, [ZEBRA_REDISTRIBUTE_ROUTE_DEL] = ospf6_zebra_read_route,
}; };
void ospf6_zebra_init(struct event_loop *master) void ospf6_zebra_init(struct event_loop *mst)
{ {
/* Allocate zebra structure. */ /* Allocate zebra structure. */
zclient = zclient_new(master, &zclient_options_default, ospf6_handlers, ospf6_zclient = zclient_new(mst, &zclient_options_default, ospf6_handlers,
array_size(ospf6_handlers)); array_size(ospf6_handlers));
zclient_init(zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs); zclient_init(ospf6_zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
zclient->zebra_connected = ospf6_zebra_connected; ospf6_zclient->zebra_connected = ospf6_zebra_connected;
zclient->nexthop_update = ospf6_zebra_import_check_update; ospf6_zclient->nexthop_update = ospf6_zebra_import_check_update;
/* Install command element for zebra node. */ /* Install command element for zebra node. */
install_element(VIEW_NODE, &show_ospf6_zebra_cmd); install_element(VIEW_NODE, &show_ospf6_zebra_cmd);

View file

@ -27,7 +27,7 @@ struct ospf6_distance {
char *access_list; char *access_list;
}; };
extern struct zclient *zclient; extern struct zclient *ospf6_zclient;
struct ospf6; struct ospf6;
extern void ospf6_zebra_route_update_add(struct ospf6_route *request, extern void ospf6_zebra_route_update_add(struct ospf6_route *request,
@ -38,7 +38,7 @@ extern void ospf6_zebra_route_update_remove(struct ospf6_route *request,
extern void ospf6_zebra_redistribute(int, vrf_id_t vrf_id); extern void ospf6_zebra_redistribute(int, vrf_id_t vrf_id);
extern void ospf6_zebra_no_redistribute(int, vrf_id_t vrf_id); extern void ospf6_zebra_no_redistribute(int, vrf_id_t vrf_id);
#define ospf6_zebra_is_redistribute(type, vrf_id) \ #define ospf6_zebra_is_redistribute(type, vrf_id) \
vrf_bitmap_check(&zclient->redist[AFI_IP6][type], vrf_id) vrf_bitmap_check(&ospf6_zclient->redist[AFI_IP6][type], vrf_id)
extern void ospf6_zebra_init(struct event_loop *tm); extern void ospf6_zebra_init(struct event_loop *tm);
extern void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg); extern void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg);
extern void ospf6_zebra_add_discard(struct ospf6_route *request, extern void ospf6_zebra_add_discard(struct ospf6_route *request,

View file

@ -1408,13 +1408,13 @@ static void install_element_ospf6_debug_event(void)
} }
/* Install ospf related commands. */ /* Install ospf related commands. */
void ospf6_init(struct event_loop *master) void ospf6_init(struct event_loop *mst)
{ {
ospf6_top_init(); ospf6_top_init();
ospf6_area_init(); ospf6_area_init();
ospf6_interface_init(); ospf6_interface_init();
ospf6_neighbor_init(); ospf6_neighbor_init();
ospf6_zebra_init(master); ospf6_zebra_init(mst);
ospf6_lsa_init(); ospf6_lsa_init();
ospf6_spf_init(); ospf6_spf_init();

View file

@ -54,7 +54,7 @@ struct zebra_privs_t ospfd_privs = {.user = NULL,
struct event_loop *master; struct event_loop *master;
/* Global variables */ /* Global variables */
struct ospf_apiclient *oclient; struct ospf_apiclient *g_oclient;
char **args; char **args;
/* Our opaque LSAs have the following format. */ /* Our opaque LSAs have the following format. */
@ -209,13 +209,13 @@ static void ready_callback(uint8_t lsa_type, uint8_t opaque_type,
lsa_type, opaque_type, &addr); lsa_type, opaque_type, &addr);
/* Schedule opaque LSA originate in 5 secs */ /* Schedule opaque LSA originate in 5 secs */
event_add_timer(master, lsa_inject, oclient, 5, NULL); event_add_timer(master, lsa_inject, g_oclient, 5, NULL);
/* Schedule opaque LSA update with new value */ /* Schedule opaque LSA update with new value */
event_add_timer(master, lsa_inject, oclient, 10, NULL); event_add_timer(master, lsa_inject, g_oclient, 10, NULL);
/* Schedule delete */ /* Schedule delete */
event_add_timer(master, lsa_delete, oclient, 30, NULL); event_add_timer(master, lsa_delete, g_oclient, 30, NULL);
} }
static void new_if_callback(struct in_addr ifaddr, struct in_addr area_id) static void new_if_callback(struct in_addr ifaddr, struct in_addr area_id)
@ -296,27 +296,27 @@ int main(int argc, char *argv[])
master = event_master_create(NULL); master = event_master_create(NULL);
/* Open connection to OSPF daemon */ /* Open connection to OSPF daemon */
oclient = ospf_apiclient_connect(args[1], ASYNCPORT); g_oclient = ospf_apiclient_connect(args[1], ASYNCPORT);
if (!oclient) { if (!g_oclient) {
printf("Connecting to OSPF daemon on %s failed!\n", args[1]); printf("Connecting to OSPF daemon on %s failed!\n", args[1]);
exit(1); exit(1);
} }
/* Register callback functions. */ /* Register callback functions. */
ospf_apiclient_register_callback( ospf_apiclient_register_callback(
oclient, ready_callback, new_if_callback, del_if_callback, g_oclient, ready_callback, new_if_callback, del_if_callback,
ism_change_callback, nsm_change_callback, lsa_update_callback, ism_change_callback, nsm_change_callback, lsa_update_callback,
lsa_delete_callback); lsa_delete_callback);
/* Register LSA type and opaque type. */ /* Register LSA type and opaque type. */
ospf_apiclient_register_opaque_type(oclient, atoi(args[2]), ospf_apiclient_register_opaque_type(g_oclient, atoi(args[2]),
atoi(args[3])); atoi(args[3]));
/* Synchronize database with OSPF daemon. */ /* Synchronize database with OSPF daemon. */
ospf_apiclient_sync_lsdb(oclient); ospf_apiclient_sync_lsdb(g_oclient);
/* Schedule thread that handles asynchronous messages */ /* Schedule thread that handles asynchronous messages */
event_add_read(master, lsa_read, oclient, oclient->fd_async, NULL); event_add_read(master, lsa_read, g_oclient, g_oclient->fd_async, NULL);
/* Now connection is established, run loop */ /* Now connection is established, run loop */
while (1) { while (1) {

View file

@ -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);

View file

@ -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) {

View file

@ -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);

View file

@ -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 ==

View file

@ -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;
} }

View file

@ -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), &params->if_area, area_id2str(buf, sizeof(buf), &params->if_area,
params->if_area_id_fmt); params->if_area_id_fmt);
vty_out(vty, " area %s", buf); vty_out(vty, " area %s", buf);

View file

@ -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);
} }

View file

@ -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);
} }
} }

View file

@ -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;

View file

@ -31,7 +31,7 @@ static enum zclient_send_status path_ted_link_state_sync(void);
static void path_ted_timer_handler_sync(struct event *thread); static void path_ted_timer_handler_sync(struct event *thread);
static void path_ted_timer_handler_refresh(struct event *thread); static void path_ted_timer_handler_refresh(struct event *thread);
extern struct zclient *zclient; extern struct zclient *pathd_zclient;
struct ted_state ted_state_g = { .dbg = { .conf = "debug pathd mpls-te", struct ted_state ted_state_g = { .dbg = { .conf = "debug pathd mpls-te",
.desc = "Pathd TED" } }; .desc = "Pathd TED" } };
@ -40,9 +40,9 @@ struct ted_state ted_state_g = { .dbg = { .conf = "debug pathd mpls-te",
* path_path_ted public API function implementations * path_path_ted public API function implementations
*/ */
void path_ted_init(struct event_loop *master) void path_ted_init(struct event_loop *loop)
{ {
ted_state_g.main = master; ted_state_g.main = loop;
ted_state_g.link_state_delay_interval = TIMER_RETRY_DELAY; ted_state_g.link_state_delay_interval = TIMER_RETRY_DELAY;
ted_state_g.segment_list_refresh_interval = TIMER_RETRY_DELAY; ted_state_g.segment_list_refresh_interval = TIMER_RETRY_DELAY;
path_ted_register_vty(); path_ted_register_vty();
@ -82,7 +82,7 @@ uint32_t path_ted_start_importing_igp(const char *daemon_str)
return 1; return 1;
} }
if (ls_register(zclient, false /*client*/) != 0) { if (ls_register(pathd_zclient, false /*client*/) != 0) {
PATH_TED_ERROR("%s: PATHD-TED: Unable to register Link State", PATH_TED_ERROR("%s: PATHD-TED: Unable to register Link State",
__func__); __func__);
ted_state_g.import = IMPORT_UNKNOWN; ted_state_g.import = IMPORT_UNKNOWN;
@ -113,7 +113,7 @@ uint32_t path_ted_stop_importing_igp(void)
uint32_t status = 0; uint32_t status = 0;
if (ted_state_g.import != IMPORT_UNKNOWN) { if (ted_state_g.import != IMPORT_UNKNOWN) {
if (ls_unregister(zclient, false /*client*/) != 0) { if (ls_unregister(pathd_zclient, false /*client*/) != 0) {
PATH_TED_ERROR( PATH_TED_ERROR(
"%s: PATHD-TED: Unable to unregister Link State", "%s: PATHD-TED: Unable to unregister Link State",
__func__); __func__);
@ -382,7 +382,7 @@ DEFUN (no_path_ted,
ted_state_g.enabled = false; ted_state_g.enabled = false;
PATH_TED_DEBUG("%s: PATHD-TED: ON -> OFF", __func__); PATH_TED_DEBUG("%s: PATHD-TED: ON -> OFF", __func__);
ted_state_g.import = IMPORT_UNKNOWN; ted_state_g.import = IMPORT_UNKNOWN;
if (ls_unregister(zclient, false /*client*/) != 0) { if (ls_unregister(pathd_zclient, false /*client*/) != 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;
} }
@ -538,7 +538,7 @@ enum zclient_send_status path_ted_link_state_sync(void)
{ {
enum zclient_send_status status; enum zclient_send_status status;
status = ls_request_sync(zclient); status = ls_request_sync(pathd_zclient);
if (status == -1) { if (status == -1) {
PATH_TED_ERROR( PATH_TED_ERROR(
"%s: PATHD-TED: Opaque error asking for TED sync ", "%s: PATHD-TED: Opaque error asking for TED sync ",

View file

@ -26,7 +26,7 @@
static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS); static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS);
struct zclient *zclient; struct zclient *pathd_zclient;
static struct zclient *zclient_sync; static struct zclient *zclient_sync;
/* Event to retry synch zapi setup for label-manager */ /* Event to retry synch zapi setup for label-manager */
@ -189,7 +189,7 @@ void path_zebra_add_sr_policy(struct srte_policy *policy,
segment->sid_value; segment->sid_value;
policy->status = SRTE_POLICY_STATUS_GOING_UP; policy->status = SRTE_POLICY_STATUS_GOING_UP;
(void)zebra_send_sr_policy(zclient, ZEBRA_SR_POLICY_SET, &zp); (void)zebra_send_sr_policy(pathd_zclient, ZEBRA_SR_POLICY_SET, &zp);
} }
/** /**
@ -209,7 +209,7 @@ void path_zebra_delete_sr_policy(struct srte_policy *policy)
zp.segment_list.label_num = 0; zp.segment_list.label_num = 0;
policy->status = SRTE_POLICY_STATUS_DOWN; policy->status = SRTE_POLICY_STATUS_DOWN;
(void)zebra_send_sr_policy(zclient, ZEBRA_SR_POLICY_DELETE, &zp); (void)zebra_send_sr_policy(pathd_zclient, ZEBRA_SR_POLICY_DELETE, &zp);
} }
/** /**
@ -351,13 +351,13 @@ static zclient_handler *const path_handlers[] = {
* *
* @param master The master thread * @param master The master thread
*/ */
void path_zebra_init(struct event_loop *master) void path_zebra_init(struct event_loop *loop)
{ {
/* Initialize asynchronous zclient. */ /* Initialize asynchronous zclient. */
zclient = zclient_new(master, &zclient_options_default, path_handlers, pathd_zclient = zclient_new(loop, &zclient_options_default, path_handlers,
array_size(path_handlers)); array_size(path_handlers));
zclient_init(zclient, ZEBRA_ROUTE_SRTE, 0, &pathd_privs); zclient_init(pathd_zclient, ZEBRA_ROUTE_SRTE, 0, &pathd_privs);
zclient->zebra_connected = path_zebra_connected; pathd_zclient->zebra_connected = path_zebra_connected;
/* 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(master, &zclient_options_sync, NULL, 0);
@ -373,8 +373,8 @@ void path_zebra_init(struct event_loop *master)
void path_zebra_stop(void) void path_zebra_stop(void)
{ {
zclient_stop(zclient); zclient_stop(pathd_zclient);
zclient_free(zclient); zclient_free(pathd_zclient);
event_cancel(&t_sync_connect); event_cancel(&t_sync_connect);
zclient_stop(zclient_sync); zclient_stop(zclient_sync);
zclient_free(zclient_sync); zclient_free(zclient_sync);

View file

@ -35,7 +35,7 @@
DEFINE_MTYPE_STATIC(PBRD, PBR_INTERFACE, "PBR Interface"); DEFINE_MTYPE_STATIC(PBRD, PBR_INTERFACE, "PBR Interface");
/* Zebra structure to hold current status. */ /* Zebra structure to hold current status. */
struct zclient *zclient; struct zclient *pbr_zclient;
struct pbr_interface *pbr_if_new(struct interface *ifp) struct pbr_interface *pbr_if_new(struct interface *ifp)
{ {
@ -272,7 +272,7 @@ static void route_add_helper(struct zapi_route *api, struct nexthop_group nhg,
} }
api->nexthop_num = i; api->nexthop_num = i;
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, api); zclient_route_send(ZEBRA_ROUTE_ADD, pbr_zclient, api);
} }
/* /*
@ -342,17 +342,17 @@ void route_delete(struct pbr_nexthop_group_cache *pnhgc, afi_t afi)
switch (afi) { switch (afi) {
case AFI_IP: case AFI_IP:
api.prefix.family = AF_INET; api.prefix.family = AF_INET;
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
break; break;
case AFI_IP6: case AFI_IP6:
api.prefix.family = AF_INET6; api.prefix.family = AF_INET6;
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
break; break;
case AFI_MAX: case AFI_MAX:
api.prefix.family = AF_INET; api.prefix.family = AF_INET;
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
api.prefix.family = AF_INET6; api.prefix.family = AF_INET6;
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api); zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
break; break;
case AFI_L2VPN: case AFI_L2VPN:
DEBUGD(&pbr_dbg_zebra, DEBUGD(&pbr_dbg_zebra,
@ -403,22 +403,22 @@ static zclient_handler *const pbr_handlers[] = {
void pbr_zebra_init(void) void pbr_zebra_init(void)
{ {
zclient = zclient_new(master, &zclient_options_default, pbr_handlers, pbr_zclient = zclient_new(master, &zclient_options_default, pbr_handlers,
array_size(pbr_handlers)); array_size(pbr_handlers));
zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs); zclient_init(pbr_zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
zclient->zebra_connected = zebra_connected; pbr_zclient->zebra_connected = zebra_connected;
zclient->nexthop_update = pbr_zebra_nexthop_update; pbr_zclient->nexthop_update = pbr_zebra_nexthop_update;
} }
void pbr_zebra_destroy(void) void pbr_zebra_destroy(void)
{ {
if (zclient == NULL) if (pbr_zclient == NULL)
return; return;
zclient_stop(zclient); zclient_stop(pbr_zclient);
zclient_free(zclient); zclient_free(pbr_zclient);
zclient = NULL; pbr_zclient = NULL;
} }
void pbr_send_rnh(struct nexthop *nhop, bool reg) void pbr_send_rnh(struct nexthop *nhop, bool reg)
@ -454,7 +454,7 @@ void pbr_send_rnh(struct nexthop *nhop, bool reg)
break; break;
} }
if (zclient_send_rnh(zclient, command, &p, SAFI_UNICAST, false, false, if (zclient_send_rnh(pbr_zclient, command, &p, SAFI_UNICAST, false, false,
nhop->vrf_id) nhop->vrf_id)
== ZCLIENT_SEND_FAILURE) { == ZCLIENT_SEND_FAILURE) {
zlog_warn("%s: Failure to send nexthop to zebra", __func__); zlog_warn("%s: Failure to send nexthop to zebra", __func__);
@ -608,7 +608,7 @@ bool pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
if (!install && !is_installed) if (!install && !is_installed)
return false; return false;
s = zclient->obuf; s = pbr_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, zclient_create_header(s,
@ -621,7 +621,7 @@ bool pbr_send_pbr_map(struct pbr_map_sequence *pbrms,
if (pbr_encode_pbr_map_sequence(s, pbrms, pmi->ifp)) { if (pbr_encode_pbr_map_sequence(s, pbrms, pmi->ifp)) {
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
zclient_send_message(zclient); zclient_send_message(pbr_zclient);
} else { } else {
DEBUGD(&pbr_dbg_zebra, "%s: %s seq %u encode failed, skipped", DEBUGD(&pbr_dbg_zebra, "%s: %s seq %u encode failed, skipped",
__func__, pbrm->name, pbrms->seqno); __func__, pbrm->name, pbrms->seqno);

View file

@ -47,11 +47,11 @@ struct cmd_line_args {
}; };
bool pcc_active_ = true; bool pcc_active_ = true;
pcep_session *session = NULL; pcep_session *g_session = NULL;
struct cmd_line_args *cmd_line_args = NULL; struct cmd_line_args *g_cmd_line_args = NULL;
/* pcep_event callback variables */ /* pcep_event callback variables */
bool pcep_event_condition = false; bool pcep_event_condition = false;
struct pcep_event *event = NULL; struct pcep_event *g_event = NULL;
pthread_mutex_t pcep_event_mutex; pthread_mutex_t pcep_event_mutex;
pthread_cond_t pcep_event_cond_var; pthread_cond_t pcep_event_cond_var;
@ -180,7 +180,7 @@ void handle_signal_action(int sig_number)
if (sig_number == SIGINT) { if (sig_number == SIGINT) {
pcep_log(LOG_INFO, "%s: SIGINT was caught!", __func__); pcep_log(LOG_INFO, "%s: SIGINT was caught!", __func__);
pcc_active_ = false; pcc_active_ = false;
if (cmd_line_args->eventpoll == false) { if (g_cmd_line_args->eventpoll == false) {
pthread_mutex_lock(&pcep_event_mutex); pthread_mutex_lock(&pcep_event_mutex);
pcep_event_condition = true; pcep_event_condition = true;
pthread_cond_signal(&pcep_event_cond_var); pthread_cond_signal(&pcep_event_cond_var);
@ -189,12 +189,12 @@ void handle_signal_action(int sig_number)
} else if (sig_number == SIGUSR1) { } else if (sig_number == SIGUSR1) {
pcep_log(LOG_INFO, "%s: SIGUSR1 was caught, dumping counters", pcep_log(LOG_INFO, "%s: SIGUSR1 was caught, dumping counters",
__func__); __func__);
dump_pcep_session_counters(session); dump_pcep_session_counters(g_session);
pceplib_memory_dump(); pceplib_memory_dump();
} else if (sig_number == SIGUSR2) { } else if (sig_number == SIGUSR2) {
pcep_log(LOG_INFO, "%s: SIGUSR2 was caught, reseting counters", pcep_log(LOG_INFO, "%s: SIGUSR2 was caught, reseting counters",
__func__); __func__);
reset_pcep_session_counters(session); reset_pcep_session_counters(g_session);
} }
} }
@ -377,7 +377,7 @@ void pcep_event_callback(void *cb_data, pcep_event *e)
pcep_log(LOG_NOTICE, "%s: [%ld-%ld] pcep_event_callback", __func__, pcep_log(LOG_NOTICE, "%s: [%ld-%ld] pcep_event_callback", __func__,
time(NULL), pthread_self()); time(NULL), pthread_self());
pthread_mutex_lock(&pcep_event_mutex); pthread_mutex_lock(&pcep_event_mutex);
event = e; g_event = e;
pcep_event_condition = true; pcep_event_condition = true;
pthread_cond_signal(&pcep_event_cond_var); pthread_cond_signal(&pcep_event_cond_var);
pthread_mutex_unlock(&pcep_event_mutex); pthread_mutex_unlock(&pcep_event_mutex);
@ -388,14 +388,14 @@ int main(int argc, char **argv)
pcep_log(LOG_NOTICE, "%s: [%ld-%ld] starting pcc_pcep example client", pcep_log(LOG_NOTICE, "%s: [%ld-%ld] starting pcc_pcep example client",
__func__, time(NULL), pthread_self()); __func__, time(NULL), pthread_self());
cmd_line_args = get_cmdline_args(argc, argv); g_cmd_line_args = get_cmdline_args(argc, argv);
if (cmd_line_args == NULL) { if (g_cmd_line_args == NULL) {
return -1; return -1;
} }
setup_signals(); setup_signals();
if (cmd_line_args->eventpoll == false) { if (g_cmd_line_args->eventpoll == false) {
struct pceplib_infra_config infra_config; struct pceplib_infra_config infra_config;
memset(&infra_config, 0, sizeof(infra_config)); memset(&infra_config, 0, sizeof(infra_config));
infra_config.pcep_event_func = pcep_event_callback; infra_config.pcep_event_func = pcep_event_callback;
@ -415,31 +415,31 @@ int main(int argc, char **argv)
pcep_configuration *config = create_default_pcep_configuration(); pcep_configuration *config = create_default_pcep_configuration();
config->pcep_msg_versioning->draft_ietf_pce_segment_routing_07 = true; config->pcep_msg_versioning->draft_ietf_pce_segment_routing_07 = true;
config->src_pcep_port = cmd_line_args->src_tcp_port; config->src_pcep_port = g_cmd_line_args->src_tcp_port;
config->is_tcp_auth_md5 = true; config->is_tcp_auth_md5 = true;
strlcpy(config->tcp_authentication_str, cmd_line_args->tcp_md5_str, strlcpy(config->tcp_authentication_str, g_cmd_line_args->tcp_md5_str,
sizeof(config->tcp_authentication_str)); sizeof(config->tcp_authentication_str));
int af = (cmd_line_args->is_ipv6 ? AF_INET6 : AF_INET); int af = (g_cmd_line_args->is_ipv6 ? AF_INET6 : AF_INET);
struct hostent *host_info = struct hostent *host_info =
gethostbyname2(cmd_line_args->dest_ip_str, af); gethostbyname2(g_cmd_line_args->dest_ip_str, af);
if (host_info == NULL) { if (host_info == NULL) {
pcep_log(LOG_ERR, "%s: Error getting IP address.", __func__); pcep_log(LOG_ERR, "%s: Error getting IP address.", __func__);
return -1; return -1;
} }
if (cmd_line_args->is_ipv6) { if (g_cmd_line_args->is_ipv6) {
struct in6_addr host_address; struct in6_addr host_address;
memcpy(&host_address, host_info->h_addr, host_info->h_length); memcpy(&host_address, host_info->h_addr, host_info->h_length);
session = connect_pce_ipv6(config, &host_address); g_session = connect_pce_ipv6(config, &host_address);
} else { } else {
struct in_addr host_address; struct in_addr host_address;
memcpy(&host_address, host_info->h_addr, host_info->h_length); memcpy(&host_address, host_info->h_addr, host_info->h_length);
session = connect_pce(config, &host_address); g_session = connect_pce(config, &host_address);
} }
if (session == NULL) { if (g_session == NULL) {
pcep_log(LOG_WARNING, "%s: Error in connect_pce.", __func__); pcep_log(LOG_WARNING, "%s: Error in connect_pce.", __func__);
destroy_pcep_configuration(config); destroy_pcep_configuration(config);
return -1; return -1;
@ -447,12 +447,12 @@ int main(int argc, char **argv)
sleep(2); sleep(2);
send_pce_report_message(session); send_pce_report_message(g_session);
/*send_pce_path_request_message(session);*/ /*send_pce_path_request_message(session);*/
/* Wait for pcep_event's either by polling the event queue or by /* Wait for pcep_event's either by polling the event queue or by
* callback */ * callback */
if (cmd_line_args->eventpoll == true) { if (g_cmd_line_args->eventpoll == true) {
/* Poll the pcep_event queue*/ /* Poll the pcep_event queue*/
while (pcc_active_) { while (pcc_active_) {
if (event_queue_is_empty() == false) { if (event_queue_is_empty() == false) {
@ -479,8 +479,8 @@ int main(int argc, char **argv)
/* Check if we have been interrupted by SIGINT */ /* Check if we have been interrupted by SIGINT */
if (pcc_active_) { if (pcc_active_) {
print_queue_event(event); print_queue_event(g_event);
destroy_pcep_event(event); destroy_pcep_event(g_event);
} }
pcep_event_condition = false; pcep_event_condition = false;
@ -492,9 +492,9 @@ int main(int argc, char **argv)
} }
pcep_log(LOG_NOTICE, "%s: Disconnecting from PCE", __func__); pcep_log(LOG_NOTICE, "%s: Disconnecting from PCE", __func__);
disconnect_pce(session); disconnect_pce(g_session);
destroy_pcep_configuration(config); destroy_pcep_configuration(config);
free(cmd_line_args); free(g_cmd_line_args);
if (!destroy_pcc()) { if (!destroy_pcc()) {
pcep_log(LOG_NOTICE, "%s: Error stopping PCC.", __func__); pcep_log(LOG_NOTICE, "%s: Error stopping PCC.", __func__);

View file

@ -44,15 +44,15 @@ void *PCEPLIB_INFRA = &pceplib_infra_mt;
void *PCEPLIB_MESSAGES = &pceplib_messages_mt; void *PCEPLIB_MESSAGES = &pceplib_messages_mt;
/* Initialize memory function pointers and memory type pointers */ /* Initialize memory function pointers and memory type pointers */
bool pceplib_memory_initialize(void *pceplib_infra_mt, bool pceplib_memory_initialize(void *infra_mt,
void *pceplib_messages_mt, void *messages_mt,
pceplib_malloc_func mf, pceplib_calloc_func cf, pceplib_malloc_func mf, pceplib_calloc_func cf,
pceplib_realloc_func rf, pceplib_strdup_func sf, pceplib_realloc_func rf, pceplib_strdup_func sf,
pceplib_free_func ff) pceplib_free_func ff)
{ {
PCEPLIB_INFRA = (pceplib_infra_mt ? pceplib_infra_mt : PCEPLIB_INFRA); PCEPLIB_INFRA = (infra_mt ? infra_mt : PCEPLIB_INFRA);
PCEPLIB_MESSAGES = PCEPLIB_MESSAGES =
(pceplib_messages_mt ? pceplib_messages_mt : PCEPLIB_MESSAGES); (messages_mt ? messages_mt : PCEPLIB_MESSAGES);
mfunc = (mf ? mf : mfunc); mfunc = (mf ? mf : mfunc);
cfunc = (cf ? cf : cfunc); cfunc = (cf ? cf : cfunc);

View file

@ -15,7 +15,7 @@
#include "pim_upstream.h" #include "pim_upstream.h"
#include "pim_vxlan.h" #include "pim_vxlan.h"
extern struct zclient *zclient; extern struct zclient *pim_zclient;
#define PIM_MLAG_METADATA_LEN 4 #define PIM_MLAG_METADATA_LEN 4
@ -925,7 +925,7 @@ static void pim_mlag_register_handler(struct event *thread)
{ {
uint32_t bit_mask = 0; uint32_t bit_mask = 0;
if (!zclient) if (!pim_zclient)
return; return;
SET_FLAG(bit_mask, (1 << MLAG_STATUS_UPDATE)); SET_FLAG(bit_mask, (1 << MLAG_STATUS_UPDATE));
@ -942,7 +942,7 @@ static void pim_mlag_register_handler(struct event *thread)
zlog_debug("%s: Posting Client Register to MLAG mask: 0x%x", zlog_debug("%s: Posting Client Register to MLAG mask: 0x%x",
__func__, bit_mask); __func__, bit_mask);
zclient_send_mlag_register(zclient, bit_mask); zclient_send_mlag_register(pim_zclient, bit_mask);
} }
void pim_mlag_register(void) void pim_mlag_register(void)
@ -958,14 +958,14 @@ void pim_mlag_register(void)
static void pim_mlag_deregister_handler(struct event *thread) static void pim_mlag_deregister_handler(struct event *thread)
{ {
if (!zclient) if (!pim_zclient)
return; return;
if (PIM_DEBUG_MLAG) if (PIM_DEBUG_MLAG)
zlog_debug("%s: Posting Client De-Register to MLAG from PIM", zlog_debug("%s: Posting Client De-Register to MLAG from PIM",
__func__); __func__);
router->connected_to_mlag = false; router->connected_to_mlag = false;
zclient_send_mlag_deregister(zclient); zclient_send_mlag_deregister(pim_zclient);
} }
void pim_mlag_deregister(void) void pim_mlag_deregister(void)

View file

@ -780,7 +780,6 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
*/ */
struct pim_zlookup_nexthop nexthop_tab[router->multipath]; struct pim_zlookup_nexthop nexthop_tab[router->multipath];
ifindex_t i; ifindex_t i;
struct interface *ifp = NULL;
int num_ifindex; int num_ifindex;
memset(nexthop_tab, 0, sizeof(nexthop_tab)); memset(nexthop_tab, 0, sizeof(nexthop_tab));

View file

@ -1624,8 +1624,7 @@ void pim_upstream_set_sptbit(struct pim_upstream *up,
if (!starup if (!starup
|| up->rpf.source_nexthop || up->rpf.source_nexthop
.interface != starup->rpf.source_nexthop.interface) { .interface != starup->rpf.source_nexthop.interface) {
struct pim_upstream *starup = up->parent; starup = up->parent;
if (PIM_DEBUG_PIM_TRACE) if (PIM_DEBUG_PIM_TRACE)
zlog_debug( zlog_debug(
"%s: %s RPF_interface(S) != RPF_interface(RP(G))", "%s: %s RPF_interface(S) != RPF_interface(RP(G))",

View file

@ -38,7 +38,7 @@
#undef PIM_DEBUG_IFADDR_DUMP #undef PIM_DEBUG_IFADDR_DUMP
#define PIM_DEBUG_IFADDR_DUMP #define PIM_DEBUG_IFADDR_DUMP
struct zclient *zclient; struct zclient *pim_zclient;
/* Router-id update message from zebra. */ /* Router-id update message from zebra. */
@ -349,16 +349,16 @@ static void pim_zebra_vxlan_replay(void)
struct stream *s = NULL; struct stream *s = NULL;
/* Check socket. */ /* Check socket. */
if (!zclient || zclient->sock < 0) if (!pim_zclient || pim_zclient->sock < 0)
return; return;
s = zclient->obuf; s = pim_zclient->obuf;
stream_reset(s); stream_reset(s);
zclient_create_header(s, ZEBRA_VXLAN_SG_REPLAY, VRF_DEFAULT); zclient_create_header(s, ZEBRA_VXLAN_SG_REPLAY, VRF_DEFAULT);
stream_putw_at(s, 0, stream_get_endp(s)); stream_putw_at(s, 0, stream_get_endp(s));
zclient_send_message(zclient); zclient_send_message(pim_zclient);
} }
void pim_scan_oil(struct pim_instance *pim) void pim_scan_oil(struct pim_instance *pim)
@ -448,14 +448,14 @@ static zclient_handler *const pim_handlers[] = {
void pim_zebra_init(void) void pim_zebra_init(void)
{ {
/* Socket for receiving updates from Zebra daemon */ /* Socket for receiving updates from Zebra daemon */
zclient = zclient_new(router->master, &zclient_options_default, pim_zclient = zclient_new(router->master, &zclient_options_default,
pim_handlers, array_size(pim_handlers)); pim_handlers, array_size(pim_handlers));
zclient->zebra_capabilities = pim_zebra_capabilities; pim_zclient->zebra_capabilities = pim_zebra_capabilities;
zclient->zebra_connected = pim_zebra_connected; pim_zclient->zebra_connected = pim_zebra_connected;
zclient->nexthop_update = pim_nexthop_update; pim_zclient->nexthop_update = pim_nexthop_update;
zclient_init(zclient, ZEBRA_ROUTE_PIM, 0, &pimd_privs); zclient_init(pim_zclient, ZEBRA_ROUTE_PIM, 0, &pimd_privs);
if (PIM_DEBUG_PIM_TRACE) { if (PIM_DEBUG_PIM_TRACE) {
zlog_notice("%s: zclient socket initialized", __func__); zlog_notice("%s: zclient socket initialized", __func__);
} }
@ -508,8 +508,8 @@ void pim_zebra_zclient_update(struct vty *vty)
{ {
vty_out(vty, "Zclient update socket: "); vty_out(vty, "Zclient update socket: ");
if (zclient) { if (pim_zclient) {
vty_out(vty, "%d failures=%d\n", zclient->sock, zclient->fail); vty_out(vty, "%d failures=%d\n", pim_zclient->sock, pim_zclient->fail);
} else { } else {
vty_out(vty, "<null zclient>\n"); vty_out(vty, "<null zclient>\n");
} }
@ -517,8 +517,8 @@ void pim_zebra_zclient_update(struct vty *vty)
struct zclient *pim_zebra_zclient_get(void) struct zclient *pim_zebra_zclient_get(void)
{ {
if (zclient) if (pim_zclient)
return zclient; return pim_zclient;
else else
return NULL; return NULL;
} }
@ -526,5 +526,5 @@ struct zclient *pim_zebra_zclient_get(void)
void pim_zebra_interface_set_master(struct interface *vrf, void pim_zebra_interface_set_master(struct interface *vrf,
struct interface *ifp) struct interface *ifp)
{ {
zclient_interface_set_master(zclient, vrf, ifp); zclient_interface_set_master(pim_zclient, vrf, ifp);
} }

Some files were not shown because too many files have changed in this diff Show more