mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
Merge pull request #17915 from mjstapp/compile_wshadow
This commit is contained in:
commit
8418e57791
|
@ -755,8 +755,10 @@ babel_interface_close_all(void)
|
|||
}
|
||||
/* Disable babel redistribution */
|
||||
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, zclient, AFI_IP6, type, 0, VRF_DEFAULT);
|
||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, babel_zclient, AFI_IP, type, 0,
|
||||
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 xroute_stream *xroutes = NULL;
|
||||
|
||||
routes = route_stream(0);
|
||||
if(routes) {
|
||||
while(1) {
|
||||
|
|
|
@ -19,7 +19,7 @@ void babelz_zebra_init(void);
|
|||
|
||||
|
||||
/* we must use a pointer because of zclient.c's functions (new, free). */
|
||||
struct zclient *zclient;
|
||||
struct zclient *babel_zclient;
|
||||
|
||||
/* Debug types */
|
||||
static const struct {
|
||||
|
@ -94,9 +94,10 @@ DEFUN (babel_redistribute_type,
|
|||
}
|
||||
|
||||
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 {
|
||||
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... */
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
|
@ -230,11 +231,11 @@ static zclient_handler *const babel_handlers[] = {
|
|||
|
||||
void babelz_zebra_init(void)
|
||||
{
|
||||
zclient = zclient_new(master, &zclient_options_default, babel_handlers,
|
||||
array_size(babel_handlers));
|
||||
zclient_init(zclient, ZEBRA_ROUTE_BABEL, 0, &babeld_privs);
|
||||
babel_zclient = zclient_new(master, &zclient_options_default, babel_handlers,
|
||||
array_size(babel_handlers));
|
||||
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(ENABLE_NODE, &debug_babel_cmd);
|
||||
|
@ -248,6 +249,6 @@ void babelz_zebra_init(void)
|
|||
void
|
||||
babel_zebra_close_connexion(void)
|
||||
{
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient_stop(babel_zclient);
|
||||
zclient_free(babel_zclient);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
|
|||
|
||||
#include "vty.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *babel_zclient;
|
||||
|
||||
void babelz_zebra_init(void);
|
||||
void babel_zebra_close_connexion(void);
|
||||
|
|
|
@ -108,8 +108,8 @@ babel_config_write (struct vty *vty)
|
|||
/* list redistributed protocols */
|
||||
for (afi = AFI_IP; afi <= AFI_IP6; afi++) {
|
||||
for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
|
||||
if (i != zclient->redist_default &&
|
||||
vrf_bitmap_check(&zclient->redist[afi][i], VRF_DEFAULT)) {
|
||||
if (i != babel_zclient->redist_default &&
|
||||
vrf_bitmap_check(&babel_zclient->redist[afi][i], VRF_DEFAULT)) {
|
||||
vty_out(vty, " redistribute %s %s\n",
|
||||
(afi == AFI_IP) ? "ipv4" : "ipv6",
|
||||
zebra_route_string(i));
|
||||
|
|
|
@ -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",
|
||||
add ? "adding" : "removing",
|
||||
(family == AF_INET) ? "ipv4" : "ipv6");
|
||||
return zclient_route_send (add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE,
|
||||
zclient, &api);
|
||||
return zclient_route_send(add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, babel_zclient, &api);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -38,7 +38,6 @@ struct babel_route {
|
|||
|
||||
struct route_stream;
|
||||
|
||||
extern struct babel_route **routes;
|
||||
extern int kernel_metric;
|
||||
extern enum babel_diversity diversity_kind;
|
||||
extern int diversity_factor;
|
||||
|
|
|
@ -36,7 +36,7 @@ struct ptm_client {
|
|||
TAILQ_HEAD(pcqueue, ptm_client);
|
||||
|
||||
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)
|
||||
*/
|
||||
msg = zclient->obuf;
|
||||
msg = bfd_zclient->obuf;
|
||||
stream_reset(msg);
|
||||
|
||||
/* TODO: VRF handling */
|
||||
|
@ -264,7 +264,7 @@ int ptm_bfd_notify(struct bfd_session *bs, uint8_t notify_state)
|
|||
/* Write packet size. */
|
||||
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)
|
||||
|
@ -600,7 +600,7 @@ stream_failure:
|
|||
|
||||
static int bfdd_replay(ZAPI_CALLBACK_ARGS)
|
||||
{
|
||||
struct stream *msg = zclient->ibuf;
|
||||
struct stream *msg = bfd_zclient->ibuf;
|
||||
uint32_t 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);
|
||||
|
||||
/* Send requests. */
|
||||
zclient_send_message(zclient);
|
||||
zclient_send_message(zc);
|
||||
}
|
||||
|
||||
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_unreal, 0, bfd_ifp_destroy);
|
||||
zclient = zclient_new(master, &zclient_options_default, bfd_handlers,
|
||||
array_size(bfd_handlers));
|
||||
assert(zclient != NULL);
|
||||
zclient_init(zclient, ZEBRA_ROUTE_BFD, 0, bfdd_priv);
|
||||
bfd_zclient = zclient_new(master, &zclient_options_default, bfd_handlers,
|
||||
array_size(bfd_handlers));
|
||||
assert(bfd_zclient != NULL);
|
||||
zclient_init(bfd_zclient, ZEBRA_ROUTE_BFD, 0, bfdd_priv);
|
||||
|
||||
/* 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)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bfd_zclient || bfd_zclient->sock < 0)
|
||||
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)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bfd_zclient || bfd_zclient->sock < 0)
|
||||
return;
|
||||
zclient_send_dereg_requests(zclient, vrf_id);
|
||||
zclient_send_dereg_requests(bfd_zclient, vrf_id);
|
||||
}
|
||||
|
||||
void bfdd_zclient_stop(void)
|
||||
{
|
||||
zclient_stop(zclient);
|
||||
zclient_stop(bfd_zclient);
|
||||
|
||||
/* Clean-up and free ptm clients data memory. */
|
||||
pc_free_all();
|
||||
|
@ -870,7 +870,7 @@ void bfdd_zclient_stop(void)
|
|||
|
||||
void bfdd_zclient_terminate(void)
|
||||
{
|
||||
zclient_free(zclient);
|
||||
zclient_free(bfd_zclient);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
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 */
|
||||
|
@ -2043,11 +2043,11 @@ static int bgp_attr_aggregator(struct bgp_attr_parser_args *args)
|
|||
peer->host, aspath_print(attr->aspath));
|
||||
|
||||
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 {
|
||||
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));
|
||||
|
||||
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 {
|
||||
SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS4_AGGREGATOR));
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
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,
|
||||
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)
|
||||
{
|
||||
/* Initialize BFD client functions */
|
||||
bfd_protocol_integration_init(zclient, tm);
|
||||
bfd_protocol_integration_init(bgp_zclient, tm);
|
||||
|
||||
/* "neighbor bfd" commands. */
|
||||
install_element(BGP_NODE, &neighbor_bfd_cmd);
|
||||
|
|
|
@ -1441,14 +1441,14 @@ static char *_ecommunity_ecom2str(struct ecommunity *ecom, int format, int filte
|
|||
snprintf(encbuf, sizeof(encbuf), "FS:action %s",
|
||||
action);
|
||||
} else if (sub_type == ECOMMUNITY_TRAFFIC_RATE) {
|
||||
union traffic_rate data;
|
||||
union traffic_rate rate;
|
||||
|
||||
data.rate_byte[3] = *(pnt+2);
|
||||
data.rate_byte[2] = *(pnt+3);
|
||||
data.rate_byte[1] = *(pnt+4);
|
||||
data.rate_byte[0] = *(pnt+5);
|
||||
rate.rate_byte[3] = *(pnt + 2);
|
||||
rate.rate_byte[2] = *(pnt + 3);
|
||||
rate.rate_byte[1] = *(pnt + 4);
|
||||
rate.rate_byte[0] = *(pnt + 5);
|
||||
snprintf(encbuf, sizeof(encbuf), "FS:rate %f",
|
||||
data.rate_float);
|
||||
rate.rate_float);
|
||||
} else if (sub_type == ECOMMUNITY_TRAFFIC_MARKING) {
|
||||
snprintf(encbuf, sizeof(encbuf),
|
||||
"FS:marking %u", *(pnt + 5));
|
||||
|
|
|
@ -905,7 +905,7 @@ static enum zclient_send_status bgp_zebra_send_remote_macip(
|
|||
bool esi_valid;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0) {
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("%s: No zclient or zclient->sock exists",
|
||||
__func__);
|
||||
|
@ -923,7 +923,7 @@ static enum zclient_send_status bgp_zebra_send_remote_macip(
|
|||
|
||||
if (!esi)
|
||||
esi = zero_esi;
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
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,
|
||||
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;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0) {
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("%s: No zclient or zclient->sock exists",
|
||||
__func__);
|
||||
|
@ -1014,7 +1014,7 @@ bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn,
|
|||
return ZCLIENT_SEND_SUCCESS;
|
||||
}
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
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);
|
||||
|
||||
return zclient_send_message(zclient);
|
||||
return zclient_send_message(bgp_zclient);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1387,7 +1387,7 @@ bgp_zebra_send_remote_es_vtep(struct bgp *bgp, struct bgp_evpn_es_vtep *es_vtep,
|
|||
uint32_t flags = 0;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0) {
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("%s: No zclient or zclient->sock exists",
|
||||
__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))
|
||||
SET_FLAG(flags, ZAPI_ES_VTEP_FLAG_ESR_RXED);
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(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);
|
||||
|
||||
return zclient_send_message(zclient);
|
||||
return zclient_send_message(bgp_zclient);
|
||||
}
|
||||
|
||||
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)
|
||||
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)
|
||||
|
@ -2885,7 +2885,7 @@ static bool bgp_evpn_l3nhg_zebra_ok(struct bgp_evpn_es_vrf *es_vrf)
|
|||
return false;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return false;
|
||||
|
||||
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,
|
||||
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)
|
||||
|
@ -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;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
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);
|
||||
|
||||
zclient_send_message(zclient);
|
||||
zclient_send_message(bgp_zclient);
|
||||
}
|
||||
|
||||
static void bgp_evpn_nh_zebra_update(struct bgp_evpn_nh *nh, bool add)
|
||||
|
|
|
@ -673,8 +673,6 @@ static inline bool bgp_evpn_is_path_local(struct bgp *bgp,
|
|||
&& pi->sub_type == BGP_ROUTE_STATIC);
|
||||
}
|
||||
|
||||
extern struct zclient *zclient;
|
||||
|
||||
extern void bgp_evpn_install_uninstall_default_route(struct bgp *bgp_vrf,
|
||||
afi_t afi, safi_t safi,
|
||||
bool add);
|
||||
|
|
|
@ -1462,22 +1462,22 @@ static int bgp_show_ethernet_vpn(struct vty *vty, struct prefix_rd *prd,
|
|||
output_count++;
|
||||
|
||||
if (use_json && json_array) {
|
||||
const struct prefix *p =
|
||||
const struct prefix *pfx =
|
||||
bgp_dest_get_prefix(rm);
|
||||
|
||||
json_prefix_info = json_object_new_object();
|
||||
|
||||
json_object_string_addf(json_prefix_info,
|
||||
"prefix", "%pFX", p);
|
||||
"prefix", "%pFX", pfx);
|
||||
|
||||
json_object_int_add(json_prefix_info,
|
||||
"prefixLen", p->prefixlen);
|
||||
"prefixLen", pfx->prefixlen);
|
||||
|
||||
json_object_object_add(json_prefix_info,
|
||||
"paths", json_array);
|
||||
json_object_object_addf(json_nroute,
|
||||
json_prefix_info,
|
||||
"%pFX", p);
|
||||
"%pFX", pfx);
|
||||
json_array = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "bgpd/bgp_debug.h"
|
||||
#include "bgpd/bgp_errors.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *bgp_zclient;
|
||||
|
||||
|
||||
/* MPLS Labels hash routines. */
|
||||
|
@ -157,7 +157,7 @@ int bgp_parse_fec_update(void)
|
|||
afi_t afi;
|
||||
safi_t safi;
|
||||
|
||||
s = zclient->ibuf;
|
||||
s = bgp_zclient->ibuf;
|
||||
|
||||
memset(&p, 0, sizeof(p));
|
||||
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);
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
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
|
||||
* path node has an MPLS SR label index allowing zebra to
|
||||
* derive the label, proceed with registration. */
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
command = (reg) ? ZEBRA_FEC_REGISTER : ZEBRA_FEC_UNREGISTER;
|
||||
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)
|
||||
stream_putw_at(s, flags_pos, flags);
|
||||
|
||||
zclient_send_message(zclient);
|
||||
zclient_send_message(bgp_zclient);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,7 +46,7 @@ DEFINE_MTYPE_STATIC(BGPD, MPLSVPN_NH_LABEL_BIND_CACHE,
|
|||
/*
|
||||
* 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,
|
||||
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)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ void vpn_leak_zebra_vrf_label_withdraw(struct bgp *bgp, afi_t afi)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
act = afi == AFI_IP ? ZEBRA_SEG6_LOCAL_ACTION_END_DT4
|
||||
: 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 = *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;
|
||||
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 = *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]
|
||||
.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->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC,
|
||||
&seg6localctx);
|
||||
|
@ -564,7 +564,7 @@ void vpn_leak_zebra_vrf_sid_withdraw_per_vrf(struct bgp *bgp)
|
|||
seg6localctx.argument_len =
|
||||
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,
|
||||
&seg6localctx);
|
||||
XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_zebra_vrf_sid_last_sent);
|
||||
|
|
|
@ -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,
|
||||
&nexthop);
|
||||
if (pi) {
|
||||
uint8_t vrf_name_len =
|
||||
strnlen((*l3vpn_bgp)->name, VRF_NAMSIZ);
|
||||
const struct prefix *p = bgp_dest_get_prefix(*dest);
|
||||
uint8_t oid_index;
|
||||
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);
|
||||
struct attr *attr = pi->attr;
|
||||
|
||||
vrf_name_len = strnlen((*l3vpn_bgp)->name, VRF_NAMSIZ);
|
||||
|
||||
/* copy the index parameters */
|
||||
oid_copy_str(&name[namelen], (*l3vpn_bgp)->name,
|
||||
vrf_name_len);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "bgpd/bgp_mplsvpn.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 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);
|
||||
if (ifp)
|
||||
zclient_send_interface_radv_req(
|
||||
zclient, nexthop->vrf_id, ifp,
|
||||
bgp_zclient, nexthop->vrf_id, ifp,
|
||||
true,
|
||||
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)
|
||||
{
|
||||
bool exact_match = false;
|
||||
bool match_p = false;
|
||||
bool resolve_via_default = false;
|
||||
int ret;
|
||||
|
||||
if (!zclient)
|
||||
if (!bgp_zclient)
|
||||
return;
|
||||
|
||||
/* 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 (CHECK_FLAG(bnc->flags, BGP_NEXTHOP_CONNECTED))
|
||||
exact_match = true;
|
||||
match_p = true;
|
||||
if (CHECK_FLAG(bnc->flags, BGP_STATIC_ROUTE_EXACT_MATCH))
|
||||
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,
|
||||
bnc->bgp->name_pretty);
|
||||
|
||||
ret = zclient_send_rnh(zclient, command, &bnc->prefix, SAFI_UNICAST,
|
||||
exact_match, resolve_via_default,
|
||||
ret = zclient_send_rnh(bgp_zclient, command, &bnc->prefix, SAFI_UNICAST,
|
||||
match_p, resolve_via_default,
|
||||
bnc->bgp->vrf_id);
|
||||
if (ret == ZCLIENT_SEND_FAILURE) {
|
||||
flog_warn(EC_BGP_ZEBRA_SEND,
|
||||
|
@ -1593,7 +1593,7 @@ void bgp_nht_reg_enhe_cap_intfs(struct peer *peer)
|
|||
if (!ifp)
|
||||
continue;
|
||||
|
||||
zclient_send_interface_radv_req(zclient,
|
||||
zclient_send_interface_radv_req(bgp_zclient,
|
||||
nhop->vrf_id,
|
||||
ifp, true,
|
||||
BGP_UNNUM_DEFAULT_RA_INTERVAL);
|
||||
|
@ -1643,7 +1643,7 @@ void bgp_nht_dereg_enhe_cap_intfs(struct peer *peer)
|
|||
if (!ifp)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
while (data + CAPABILITY_CODE_PATHS_LIMIT_LEN <= end) {
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
iana_afi_t pkt_afi;
|
||||
iana_safi_t pkt_safi;
|
||||
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);
|
||||
|
||||
while (data + BGP_CAP_LLGR_MIN_PACKET_LEN <= end) {
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
iana_afi_t pkt_afi;
|
||||
iana_safi_t pkt_safi;
|
||||
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 <=
|
||||
end) {
|
||||
afi_t afi;
|
||||
safi_t safi;
|
||||
iana_afi_t pkt_afi;
|
||||
iana_safi_t pkt_safi;
|
||||
struct graceful_restart_af graf;
|
||||
|
|
|
@ -442,7 +442,7 @@ static bool bgp_pbr_extract(struct bgp_pbr_match_val list[],
|
|||
struct bgp_pbr_range_port *range)
|
||||
{
|
||||
int i = 0;
|
||||
bool exact_match = false;
|
||||
bool match_p = false;
|
||||
|
||||
if (range)
|
||||
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)) {
|
||||
if (range)
|
||||
range->min_port = list[i].value;
|
||||
exact_match = true;
|
||||
match_p = true;
|
||||
}
|
||||
if (exact_match && i > 0)
|
||||
if (match_p && i > 0)
|
||||
return false;
|
||||
if (list[i].compare_operator ==
|
||||
(OPERATOR_COMPARE_GREATER_THAN +
|
||||
|
|
|
@ -151,8 +151,6 @@ struct bgp_pbr_config {
|
|||
bool pbr_interface_any_ipv6;
|
||||
};
|
||||
|
||||
extern struct bgp_pbr_config *bgp_pbr_cfg;
|
||||
|
||||
struct bgp_pbr_rule {
|
||||
uint32_t flags;
|
||||
struct prefix src;
|
||||
|
|
|
@ -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 */
|
||||
if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_ORIGINATOR_ID)) ||
|
||||
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 (json_paths)
|
||||
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))) {
|
||||
struct cluster_list *cluster =
|
||||
bgp_attr_get_cluster(attr);
|
||||
int i;
|
||||
struct cluster_list *cluster = bgp_attr_get_cluster(attr);
|
||||
|
||||
if (json_paths) {
|
||||
json_cluster_list = json_object_new_object();
|
||||
|
@ -13579,7 +13575,7 @@ DEFUN (show_ip_bgp_large_community_list,
|
|||
afi_t afi = AFI_IP6;
|
||||
safi_t safi = SAFI_UNICAST;
|
||||
int idx = 0;
|
||||
bool exact_match = 0;
|
||||
bool match_p = 0;
|
||||
struct bgp *bgp = NULL;
|
||||
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;
|
||||
|
||||
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,
|
||||
exact_match, afi, safi, uj);
|
||||
match_p, afi, safi, uj);
|
||||
}
|
||||
DEFUN (show_ip_bgp_large_community,
|
||||
show_ip_bgp_large_community_cmd,
|
||||
|
@ -13618,7 +13614,7 @@ DEFUN (show_ip_bgp_large_community,
|
|||
afi_t afi = AFI_IP6;
|
||||
safi_t safi = SAFI_UNICAST;
|
||||
int idx = 0;
|
||||
bool exact_match = 0;
|
||||
bool match_p = false;
|
||||
struct bgp *bgp = NULL;
|
||||
bool uj = use_json(argc, argv);
|
||||
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, "exact-match", &idx)) {
|
||||
argc--;
|
||||
exact_match = 1;
|
||||
match_p = true;
|
||||
}
|
||||
return bgp_show_lcommunity(vty, bgp, argc, argv,
|
||||
exact_match, afi, safi, uj);
|
||||
match_p, afi, safi, uj);
|
||||
} else
|
||||
return bgp_show(vty, bgp, afi, safi,
|
||||
bgp_show_type_lcommunity_all, NULL, show_flags,
|
||||
|
@ -13910,7 +13906,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||
void *output_arg = NULL;
|
||||
struct bgp *bgp = NULL;
|
||||
int idx = 0;
|
||||
int exact_match = 0;
|
||||
int match_p = 0;
|
||||
char *community = NULL;
|
||||
bool first = true;
|
||||
uint16_t show_flags = 0;
|
||||
|
@ -13975,7 +13971,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||
community = maybecomm;
|
||||
|
||||
if (argv_find(argv, argc, "exact-match", &idx))
|
||||
exact_match = 1;
|
||||
match_p = 1;
|
||||
|
||||
if (!community)
|
||||
sh_type = bgp_show_type_community_all;
|
||||
|
@ -13986,7 +13982,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||
struct community_list *list;
|
||||
|
||||
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,
|
||||
COMMUNITY_LIST_MASTER);
|
||||
|
@ -13996,7 +13992,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
if (exact_match)
|
||||
if (match_p)
|
||||
sh_type = bgp_show_type_community_list_exact;
|
||||
else
|
||||
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 */
|
||||
if (community)
|
||||
return bgp_show_community(vty, bgp, community,
|
||||
exact_match, afi, safi,
|
||||
match_p, afi, safi,
|
||||
show_flags);
|
||||
else
|
||||
return bgp_show(vty, bgp, afi, safi, sh_type,
|
||||
|
@ -14151,7 +14147,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||
if (community)
|
||||
bgp_show_community(
|
||||
vty, abgp, community,
|
||||
exact_match, afi, safi,
|
||||
match_p, afi, safi,
|
||||
show_flags);
|
||||
else
|
||||
bgp_show(vty, abgp, afi, safi,
|
||||
|
@ -14199,7 +14195,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||
if (community)
|
||||
bgp_show_community(
|
||||
vty, abgp, community,
|
||||
exact_match, afi, safi,
|
||||
match_p, afi, safi,
|
||||
show_flags);
|
||||
else
|
||||
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_object_new_object();
|
||||
|
||||
struct bgp_path_info bpi;
|
||||
struct bgp_path_info pathi;
|
||||
struct bgp_dest buildit = *dest;
|
||||
struct bgp_dest *pass_in;
|
||||
|
||||
if (route_filtered ||
|
||||
ret == RMAP_DENY) {
|
||||
bpi.attr = &attr;
|
||||
bpi.peer = peer;
|
||||
buildit.info = &bpi;
|
||||
pathi.attr = &attr;
|
||||
pathi.peer = peer;
|
||||
buildit.info = &pathi;
|
||||
|
||||
pass_in = &buildit;
|
||||
} else
|
||||
|
|
|
@ -1355,7 +1355,7 @@ lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(
|
|||
{
|
||||
struct routemap_hook_context *rhc;
|
||||
const char *value;
|
||||
bool exact_match = false;
|
||||
bool match_p = false;
|
||||
bool any = false;
|
||||
char *argstr;
|
||||
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");
|
||||
|
||||
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");
|
||||
|
||||
if (yang_dnode_exists(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,
|
||||
strlen(value) + strlen("exact-match") + 2);
|
||||
|
||||
|
|
|
@ -967,10 +967,10 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
|
|||
if (ctx->uj) {
|
||||
json_peers = json_object_new_array();
|
||||
SUBGRP_FOREACH_PEER (subgrp, paf) {
|
||||
json_object *peer =
|
||||
json_object *jpeer =
|
||||
json_object_new_string(
|
||||
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_peers);
|
||||
|
|
|
@ -11504,7 +11504,7 @@ DEFPY (show_bgp_vrfs,
|
|||
json_vrfs = json_object_new_object();
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(inst, node, bgp)) {
|
||||
const char *name;
|
||||
const char *bname;
|
||||
|
||||
/* Skip Views. */
|
||||
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
|
||||
|
@ -11523,18 +11523,18 @@ DEFPY (show_bgp_vrfs,
|
|||
json_vrf = json_object_new_object();
|
||||
|
||||
if (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) {
|
||||
name = VRF_DEFAULT_NAME;
|
||||
bname = VRF_DEFAULT_NAME;
|
||||
type = "DFLT";
|
||||
} else {
|
||||
name = bgp->name;
|
||||
bname = bgp->name;
|
||||
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);
|
||||
|
||||
if (uj)
|
||||
json_object_object_add(json_vrfs, name, json_vrf);
|
||||
json_object_object_add(json_vrfs, bname, json_vrf);
|
||||
}
|
||||
|
||||
if (uj) {
|
||||
|
|
232
bgpd/bgp_zebra.c
232
bgpd/bgp_zebra.c
|
@ -56,8 +56,8 @@
|
|||
#include "bgpd/bgp_lcommunity.h"
|
||||
|
||||
/* All information about zebra. */
|
||||
struct zclient *zclient = NULL;
|
||||
struct zclient *zclient_sync;
|
||||
struct zclient *bgp_zclient = NULL;
|
||||
struct zclient *bgp_zclient_sync;
|
||||
static bool bgp_zebra_label_manager_connect(void);
|
||||
|
||||
/* 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? */
|
||||
static inline bool bgp_install_info_to_zebra(struct bgp *bgp)
|
||||
{
|
||||
if (zclient->sock <= 0)
|
||||
if (bgp_zclient->sock <= 0)
|
||||
return false;
|
||||
|
||||
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)
|
||||
{
|
||||
struct zclient *zclient;
|
||||
struct zclient *zc;
|
||||
int delay = 10, ret = 0;
|
||||
|
||||
zclient = EVENT_ARG(t);
|
||||
if (bgp_tm_status_connected && zclient->sock > 0)
|
||||
zc = EVENT_ARG(t);
|
||||
if (bgp_tm_status_connected && zc->sock > 0)
|
||||
delay = 60;
|
||||
else {
|
||||
bgp_tm_status_connected = false;
|
||||
ret = tm_table_manager_connect(zclient);
|
||||
ret = tm_table_manager_connect(zc);
|
||||
}
|
||||
if (ret < 0) {
|
||||
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;
|
||||
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_max) >= 0) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1071,7 +1071,7 @@ void bgp_zebra_init_tm_connect(struct bgp *bgp)
|
|||
bgp_tm_min = bgp_tm_max = 0;
|
||||
bgp_tm_chunk_size = BGP_FLOWSPEC_TABLE_CHUNK;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1650,7 +1650,7 @@ bgp_zebra_announce_actual(struct bgp_dest *dest, struct bgp_path_info *info,
|
|||
__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",
|
||||
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,
|
||||
.vrf_id = bgp->vrf_id,
|
||||
};
|
||||
if (redist_lookup_table_direct(&zclient->mi_redist[afi][type], &table) !=
|
||||
NULL)
|
||||
if (redist_lookup_table_direct(&bgp_zclient->mi_redist[afi][type],
|
||||
&table) != NULL)
|
||||
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 {
|
||||
if (redist_check_instance(&zclient->mi_redist[afi][type], instance))
|
||||
if (redist_check_instance(&bgp_zclient->mi_redist[afi][type], instance))
|
||||
return CMD_WARNING;
|
||||
|
||||
redist_add_instance(&zclient->mi_redist[afi][type], instance);
|
||||
redist_add_instance(&bgp_zclient->mi_redist[afi][type], instance);
|
||||
}
|
||||
} 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;
|
||||
|
||||
#ifdef ENABLE_BGP_VNC
|
||||
|
@ -2093,7 +2093,7 @@ int bgp_redistribute_set(struct bgp *bgp, afi_t afi, int type,
|
|||
}
|
||||
#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);
|
||||
|
||||
/* 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);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
|
@ -2132,9 +2132,9 @@ int bgp_redistribute_resend(struct bgp *bgp, afi_t afi, int type,
|
|||
instance);
|
||||
|
||||
/* 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);
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type,
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, bgp_zclient, afi, type,
|
||||
instance, bgp->vrf_id);
|
||||
|
||||
return 0;
|
||||
|
@ -2214,21 +2214,21 @@ int bgp_redistribute_unreg(struct bgp *bgp, afi_t afi, int type,
|
|||
.table_id = instance,
|
||||
.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)
|
||||
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 {
|
||||
if (!redist_check_instance(&zclient->mi_redist[afi][type], instance))
|
||||
if (!redist_check_instance(&bgp_zclient->mi_redist[afi][type], instance))
|
||||
return CMD_WARNING;
|
||||
|
||||
redist_del_instance(&zclient->mi_redist[afi][type], instance);
|
||||
redist_del_instance(&bgp_zclient->mi_redist[afi][type], instance);
|
||||
}
|
||||
} 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;
|
||||
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)) {
|
||||
|
@ -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",
|
||||
bgp->name_pretty, afi,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -2325,7 +2325,7 @@ void bgp_redistribute_redo(struct bgp *bgp)
|
|||
|
||||
void bgp_zclient_reset(void)
|
||||
{
|
||||
zclient_reset(zclient);
|
||||
zclient_reset(bgp_zclient);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
/* 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;
|
||||
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("Registering %s", bgp->name_pretty);
|
||||
|
||||
/* 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. */
|
||||
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)
|
||||
{
|
||||
/* Don't try to deregister if we're not connected to Zebra */
|
||||
if (zclient->sock < 0)
|
||||
if (bgp_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
|
@ -2375,7 +2375,7 @@ void bgp_zebra_instance_deregister(struct bgp *bgp)
|
|||
bgp_zebra_advertise_all_vni(bgp, 0);
|
||||
|
||||
/* 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)
|
||||
|
@ -2386,7 +2386,7 @@ void bgp_zebra_initiate_radv(struct bgp *bgp, struct peer *peer)
|
|||
return;
|
||||
|
||||
/* Don't try to initiate if we're not connected to Zebra */
|
||||
if (zclient->sock < 0)
|
||||
if (bgp_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
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
|
||||
* 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)
|
||||
: 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)
|
||||
{
|
||||
/* Don't try to terminate if we're not connected to Zebra */
|
||||
if (zclient->sock < 0)
|
||||
if (bgp_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
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
|
||||
* 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)
|
||||
: 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;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return 0;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
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_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)
|
||||
|
@ -2456,14 +2456,14 @@ int bgp_zebra_advertise_svi_macip(struct bgp *bgp, int advertise, vni_t vni)
|
|||
struct stream *s = NULL;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return 0;
|
||||
|
||||
/* Don't try to register if Zebra doesn't know of this instance. */
|
||||
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp))
|
||||
return 0;
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
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_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)
|
||||
|
@ -2479,7 +2479,7 @@ int bgp_zebra_advertise_gw_macip(struct bgp *bgp, int advertise, vni_t vni)
|
|||
struct stream *s = NULL;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return 0;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
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_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,
|
||||
|
@ -2508,7 +2508,7 @@ int bgp_zebra_vxlan_flood_control(struct bgp *bgp,
|
|||
struct stream *s;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return 0;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
zclient_create_header(s, ZEBRA_VXLAN_FLOOD_CONTROL, bgp->vrf_id);
|
||||
stream_putc(s, flood_ctrl);
|
||||
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)
|
||||
|
@ -2535,14 +2535,14 @@ int bgp_zebra_advertise_all_vni(struct bgp *bgp, int advertise)
|
|||
struct stream *s;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return 0;
|
||||
|
||||
/* Don't try to register if Zebra doesn't know of this instance. */
|
||||
if (!IS_BGP_INST_KNOWN_TO_ZEBRA(bgp))
|
||||
return 0;
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
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_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)
|
||||
|
@ -2561,7 +2561,7 @@ int bgp_zebra_dup_addr_detection(struct bgp *bgp)
|
|||
struct stream *s;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!bgp_zclient || bgp_zclient->sock < 0)
|
||||
return 0;
|
||||
|
||||
/* 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",
|
||||
bgp->evpn_info->dad_freeze_time);
|
||||
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
zclient_create_header(s, ZEBRA_DUPLICATE_ADDR_DETECTION,
|
||||
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_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)
|
||||
|
@ -3965,7 +3965,7 @@ void bgp_if_init(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)
|
||||
|
@ -3979,29 +3979,29 @@ static void bgp_start_label_manager(struct event *start)
|
|||
static bool bgp_zebra_label_manager_connect(void)
|
||||
{
|
||||
/* 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!",
|
||||
__func__);
|
||||
return false;
|
||||
}
|
||||
/* 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 */
|
||||
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!",
|
||||
__func__);
|
||||
close(zclient_sync->sock);
|
||||
zclient_sync->sock = -1;
|
||||
close(bgp_zclient_sync->sock);
|
||||
bgp_zclient_sync->sock = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 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__);
|
||||
if (zclient_sync->sock > 0) {
|
||||
close(zclient_sync->sock);
|
||||
zclient_sync->sock = -1;
|
||||
if (bgp_zclient_sync->sock > 0) {
|
||||
close(bgp_zclient_sync->sock);
|
||||
bgp_zclient_sync->sock = -1;
|
||||
}
|
||||
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);
|
||||
|
||||
/* Set default values. */
|
||||
zclient = zclient_new(master, &zclient_options_default, bgp_handlers,
|
||||
array_size(bgp_handlers));
|
||||
zclient_init(zclient, ZEBRA_ROUTE_BGP, 0, &bgpd_privs);
|
||||
zclient->zebra_buffer_write_ready = bgp_zebra_buffer_write_ready;
|
||||
zclient->zebra_connected = bgp_zebra_connected;
|
||||
zclient->zebra_capabilities = bgp_zebra_capabilities;
|
||||
zclient->nexthop_update = bgp_nexthop_update;
|
||||
zclient->instance = instance;
|
||||
bgp_zclient = zclient_new(master, &zclient_options_default, bgp_handlers,
|
||||
array_size(bgp_handlers));
|
||||
zclient_init(bgp_zclient, ZEBRA_ROUTE_BGP, 0, &bgpd_privs);
|
||||
bgp_zclient->zebra_buffer_write_ready = bgp_zebra_buffer_write_ready;
|
||||
bgp_zclient->zebra_connected = bgp_zebra_connected;
|
||||
bgp_zclient->zebra_capabilities = bgp_zebra_capabilities;
|
||||
bgp_zclient->nexthop_update = bgp_nexthop_update;
|
||||
bgp_zclient->instance = instance;
|
||||
|
||||
/* Initialize special zclient for synchronous message exchanges. */
|
||||
zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
|
||||
zclient_sync->sock = -1;
|
||||
zclient_sync->redist_default = ZEBRA_ROUTE_BGP;
|
||||
zclient_sync->instance = instance;
|
||||
zclient_sync->session_id = 1;
|
||||
zclient_sync->privs = &bgpd_privs;
|
||||
bgp_zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
|
||||
bgp_zclient_sync->sock = -1;
|
||||
bgp_zclient_sync->redist_default = ZEBRA_ROUTE_BGP;
|
||||
bgp_zclient_sync->instance = instance;
|
||||
bgp_zclient_sync->session_id = 1;
|
||||
bgp_zclient_sync->privs = &bgpd_privs;
|
||||
|
||||
if (!bgp_zebra_label_manager_ready())
|
||||
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)
|
||||
{
|
||||
if (zclient == NULL)
|
||||
if (bgp_zclient == NULL)
|
||||
return;
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient = NULL;
|
||||
zclient_stop(bgp_zclient);
|
||||
zclient_free(bgp_zclient);
|
||||
bgp_zclient = NULL;
|
||||
|
||||
if (zclient_sync == NULL)
|
||||
if (bgp_zclient_sync == NULL)
|
||||
return;
|
||||
zclient_stop(zclient_sync);
|
||||
zclient_free(zclient_sync);
|
||||
zclient_sync = NULL;
|
||||
zclient_stop(bgp_zclient_sync);
|
||||
zclient_free(bgp_zclient_sync);
|
||||
bgp_zclient_sync = NULL;
|
||||
}
|
||||
|
||||
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__,
|
||||
pbra->table_id, pbra->fwmark, install);
|
||||
}
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(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);
|
||||
|
||||
if ((zclient_send_message(zclient) != ZCLIENT_SEND_FAILURE)
|
||||
if ((zclient_send_message(bgp_zclient) != ZCLIENT_SEND_FAILURE)
|
||||
&& install) {
|
||||
if (!pbr)
|
||||
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__,
|
||||
pbrim->ipset_name, pbrim->type, install,
|
||||
pbrim->unique);
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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__,
|
||||
pbrime->backpointer->ipset_name, pbrime->unique,
|
||||
install, pbrime->unique);
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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__,
|
||||
pbm->ipset_name, pbm->type, pba->fwmark, install,
|
||||
pbm->unique2);
|
||||
s = zclient->obuf;
|
||||
s = bgp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
zclient_create_header(s,
|
||||
|
@ -4232,7 +4232,7 @@ void bgp_send_pbr_iptable(struct bgp_pbr_action *pba,
|
|||
if (nb_interface)
|
||||
bgp_encode_pbr_interface_list(pba->bgp, s, pbm->family);
|
||||
stream_putw_at(s, 0, stream_get_endp(s));
|
||||
ret = zclient_send_message(zclient);
|
||||
ret = zclient_send_message(bgp_zclient);
|
||||
if (install) {
|
||||
if (ret != ZCLIENT_SEND_FAILURE)
|
||||
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, &api);
|
||||
bgp_zclient, &api);
|
||||
}
|
||||
|
||||
/* 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__,
|
||||
disable ? "dis" : "en", bgp->name_pretty);
|
||||
|
||||
if (zclient == NULL) {
|
||||
if (bgp_zclient == NULL) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("%s: %s zclient invalid", __func__,
|
||||
bgp->name_pretty);
|
||||
|
@ -4340,7 +4340,7 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable)
|
|||
}
|
||||
|
||||
/* 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))
|
||||
zlog_debug("%s: %s client not connected", __func__,
|
||||
bgp->name_pretty);
|
||||
|
@ -4365,7 +4365,7 @@ int bgp_zebra_send_capabilities(struct bgp *bgp, bool disable)
|
|||
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) {
|
||||
zlog_err("%s(%d): Error sending GR capability to zebra",
|
||||
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,
|
||||
zserv_gr_client_cap_string(type));
|
||||
|
||||
if (zclient == NULL) {
|
||||
if (bgp_zclient == NULL) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("%s: %s zclient == NULL, invalid", __func__,
|
||||
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 */
|
||||
if ((zclient->sock < 0) || (zclient->t_connect)) {
|
||||
if ((bgp_zclient->sock < 0) || (bgp_zclient->t_connect)) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("%s: %s client not connected", __func__,
|
||||
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.cap = type;
|
||||
|
||||
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient, &api)
|
||||
if (zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, bgp_zclient, &api)
|
||||
== ZCLIENT_SEND_FAILURE) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
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__,
|
||||
bgp->name_pretty, bgp->rib_stale_time);
|
||||
|
||||
if (zclient == NULL) {
|
||||
if (bgp_zclient == NULL) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("zclient invalid");
|
||||
return BGP_GR_FAILURE;
|
||||
}
|
||||
|
||||
/* 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))
|
||||
zlog_debug("%s: %s client not connected", __func__,
|
||||
bgp->name_pretty);
|
||||
|
@ -4452,7 +4452,7 @@ int bgp_zebra_stale_timer_update(struct bgp *bgp)
|
|||
api.cap = ZEBRA_CLIENT_RIB_STALE_TIME;
|
||||
api.stale_removal_time = bgp->rib_stale_time;
|
||||
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) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
* 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
|
||||
* 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);
|
||||
if (ret < 0) {
|
||||
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
|
||||
* result
|
||||
*/
|
||||
ret = srv6_manager_release_sid(zclient, ctx);
|
||||
ret = srv6_manager_release_sid(bgp_zclient, ctx);
|
||||
if (ret < 0) {
|
||||
zlog_warn("%s: error releasing SRv6 SID!", __func__);
|
||||
return;
|
||||
|
@ -4592,7 +4592,7 @@ void bgp_zebra_send_nexthop_label(int cmd, mpls_label_t label,
|
|||
znh->labels[i] = out_labels[i];
|
||||
}
|
||||
/* 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,
|
||||
|
@ -4601,10 +4601,10 @@ bool bgp_zebra_request_label_range(uint32_t base, uint32_t chunk_size,
|
|||
int ret;
|
||||
uint32_t start, end;
|
||||
|
||||
if (!zclient_sync || !bgp_zebra_label_manager_ready())
|
||||
if (!bgp_zclient_sync || !bgp_zebra_label_manager_ready())
|
||||
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);
|
||||
if (ret < 0) {
|
||||
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;
|
||||
|
||||
if (!zclient_sync || !bgp_zebra_label_manager_ready())
|
||||
if (!bgp_zclient_sync || !bgp_zebra_label_manager_ready())
|
||||
return;
|
||||
|
||||
ret = lm_release_label_chunk(zclient_sync, start, end);
|
||||
ret = lm_release_label_chunk(bgp_zclient_sync, start, end);
|
||||
if (ret < 0)
|
||||
zlog_warn("%s: error releasing label range!", __func__);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
|
||||
#include "vxlan.h"
|
||||
|
||||
/* The global zapi session handle */
|
||||
extern struct zclient *bgp_zclient;
|
||||
|
||||
/* Macro to update bgp_original based on bpg_path_info */
|
||||
#define BGP_ORIGINAL_UPDATE(_bgp_orig, _mpinfo, _bgp) \
|
||||
((_mpinfo->extra && _mpinfo->extra->vrfleak && \
|
||||
|
|
21
bgpd/bgpd.c
21
bgpd/bgpd.c
|
@ -121,7 +121,7 @@ unsigned int bgp_suppress_fib_count;
|
|||
static void bgp_if_finish(struct bgp *bgp);
|
||||
static void peer_drop_dynamic_neighbor(struct peer *peer);
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *bgp_zclient;
|
||||
|
||||
/* handle main socket creation or deletion */
|
||||
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;
|
||||
}
|
||||
|
||||
if (send_msg && zclient)
|
||||
if (send_msg && bgp_zclient)
|
||||
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
|
||||
|
@ -507,9 +507,9 @@ void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
|
|||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("Sending ZEBRA_ROUTE_NOTIFY_REQUEST");
|
||||
|
||||
if (zclient)
|
||||
if (bgp_zclient)
|
||||
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 (set)
|
||||
redist_add_instance(&zclient->mi_redist[afi][type],
|
||||
redist_add_instance(&bgp_zclient->mi_redist[afi][type],
|
||||
instance);
|
||||
else
|
||||
redist_del_instance(&zclient->mi_redist[afi][type],
|
||||
redist_del_instance(&bgp_zclient->mi_redist[afi][type],
|
||||
instance);
|
||||
} else {
|
||||
if (set)
|
||||
vrf_bitmap_set(&zclient->redist[afi][type], vrf_id);
|
||||
vrf_bitmap_set(&bgp_zclient->redist[afi][type], vrf_id);
|
||||
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) {
|
||||
struct bgp_aggregate *aggregate = NULL;
|
||||
|
||||
for (struct bgp_dest *dest =
|
||||
bgp_table_top(bgp->aggregate[afi][safi]);
|
||||
for (dest = bgp_table_top(bgp->aggregate[afi][safi]);
|
||||
dest; dest = bgp_route_next(dest)) {
|
||||
aggregate = bgp_dest_get_bgp_aggregate_info(dest);
|
||||
if (aggregate == NULL)
|
||||
|
|
|
@ -1352,11 +1352,11 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
|
|||
|
||||
bgp_attr_extcom_tunnel_type(bpi->attr, &tun_type);
|
||||
if (tun_type == BGP_ENCAP_TYPE_MPLS) {
|
||||
struct prefix p;
|
||||
struct prefix pfx;
|
||||
/* MPLS carries UN address in next hop */
|
||||
rfapiNexthop2Prefix(bpi->attr, &p);
|
||||
if (p.family != AF_UNSPEC) {
|
||||
rfapiQprefix2Raddr(&p, &new->un_address);
|
||||
rfapiNexthop2Prefix(bpi->attr, &pfx);
|
||||
if (pfx.family != AF_UNSPEC) {
|
||||
rfapiQprefix2Raddr(&pfx, &new->un_address);
|
||||
have_vnc_tunnel_un = 1;
|
||||
}
|
||||
}
|
||||
|
@ -1773,7 +1773,7 @@ struct rfapi_next_hop_entry *rfapiRouteNode2NextHopList(
|
|||
* Add non-withdrawn routes from less-specific prefix
|
||||
*/
|
||||
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;
|
||||
rfapiQprefix2Rprefix(p, &rprefix);
|
||||
|
@ -3224,7 +3224,7 @@ static void rfapiBgpInfoFilteredImportEncap(
|
|||
__func__, rn);
|
||||
#endif
|
||||
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
|
||||
|
@ -3252,9 +3252,9 @@ static void rfapiBgpInfoFilteredImportEncap(
|
|||
* list
|
||||
* per prefix.
|
||||
*/
|
||||
p = agg_node_get_prefix(m->node);
|
||||
pfx = agg_node_get_prefix(m->node);
|
||||
referenced_vpn_prefix =
|
||||
agg_node_get(referenced_vpn_table, p);
|
||||
agg_node_get(referenced_vpn_table, pfx);
|
||||
assert(referenced_vpn_prefix);
|
||||
for (mnext = referenced_vpn_prefix->info; mnext;
|
||||
mnext = mnext->next) {
|
||||
|
|
|
@ -338,13 +338,12 @@ static int process_unicast_route(struct bgp *bgp, /* in */
|
|||
hattr = *attr;
|
||||
|
||||
if (rmap) {
|
||||
struct bgp_path_info info;
|
||||
struct bgp_path_info pinfo = {};
|
||||
route_map_result_t ret;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.peer = peer;
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(rmap, prefix, &info);
|
||||
pinfo.peer = peer;
|
||||
pinfo.attr = &hattr;
|
||||
ret = route_map_apply(rmap, prefix, &pinfo);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
vnc_zlog_debug_verbose(
|
||||
|
@ -768,13 +767,12 @@ static void vnc_import_bgp_add_route_mode_plain(struct bgp *bgp,
|
|||
hattr = *attr;
|
||||
|
||||
if (rmap) {
|
||||
struct bgp_path_info info;
|
||||
struct bgp_path_info pinfo = {};
|
||||
route_map_result_t ret;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
info.peer = peer;
|
||||
info.attr = &hattr;
|
||||
ret = route_map_apply(rmap, prefix, &info);
|
||||
pinfo.peer = peer;
|
||||
pinfo.attr = &hattr;
|
||||
ret = route_map_apply(rmap, prefix, &pinfo);
|
||||
if (ret == RMAP_DENYMATCH) {
|
||||
bgp_attr_flush(&hattr);
|
||||
vnc_zlog_debug_verbose(
|
||||
|
|
|
@ -467,6 +467,7 @@ AC_C_FLAG([-Wbad-function-cast])
|
|||
AC_C_FLAG([-Wwrite-strings])
|
||||
AC_C_FLAG([-Wundef])
|
||||
AC_C_FLAG([-Wimplicit-fallthrough])
|
||||
AC_C_FLAG([-Wshadow])
|
||||
if test "$enable_gcc_ultra_verbose" = "yes" ; then
|
||||
AC_C_FLAG([-Wcast-qual])
|
||||
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([-Wpacked])
|
||||
AC_C_FLAG([-Wpadded])
|
||||
AC_C_FLAG([-Wshadow])
|
||||
else
|
||||
AC_C_FLAG([-Wno-unused-result])
|
||||
fi
|
||||
|
|
|
@ -739,7 +739,7 @@ static int eigrpd_instance_redistribute_create(struct nb_cb_create_args *args)
|
|||
else
|
||||
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;
|
||||
break;
|
||||
case NB_EV_PREPARE:
|
||||
|
|
|
@ -280,14 +280,14 @@ DEFPY (show_ip_eigrp_neighbors,
|
|||
struct eigrp *eigrp;
|
||||
|
||||
if (vrf && strncmp(vrf, "all", sizeof("all")) == 0) {
|
||||
struct vrf *vrf;
|
||||
struct vrf *tvrf;
|
||||
|
||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||
eigrp = eigrp_lookup(vrf->vrf_id);
|
||||
RB_FOREACH (tvrf, vrf_name_head, &vrfs_by_name) {
|
||||
eigrp = eigrp_lookup(tvrf->vrf_id);
|
||||
if (!eigrp)
|
||||
continue;
|
||||
|
||||
vty_out(vty, "VRF %s:\n", vrf->name);
|
||||
vty_out(vty, "VRF %s:\n", tvrf->name);
|
||||
|
||||
eigrp_neighbors_helper(vty, eigrp, ifname, detail);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ static int eigrp_interface_address_delete(ZAPI_CALLBACK_ARGS);
|
|||
static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS);
|
||||
|
||||
/* Zebra structure to hold current status. */
|
||||
struct zclient *zclient = NULL;
|
||||
struct zclient *eigrp_zclient = NULL;
|
||||
|
||||
/* For registering threads. */
|
||||
extern struct event_loop *master;
|
||||
|
@ -98,17 +98,17 @@ static zclient_handler *const eigrp_handlers[] = {
|
|||
|
||||
void eigrp_zebra_init(void)
|
||||
{
|
||||
zclient = zclient_new(master, &zclient_options_default, eigrp_handlers,
|
||||
array_size(eigrp_handlers));
|
||||
eigrp_zclient = zclient_new(master, &zclient_options_default, eigrp_handlers,
|
||||
array_size(eigrp_handlers));
|
||||
|
||||
zclient_init(zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs);
|
||||
zclient->zebra_connected = eigrp_zebra_connected;
|
||||
zclient_init(eigrp_zclient, ZEBRA_ROUTE_EIGRP, 0, &eigrpd_privs);
|
||||
eigrp_zclient->zebra_connected = eigrp_zebra_connected;
|
||||
}
|
||||
|
||||
void eigrp_zebra_stop(void)
|
||||
{
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient_stop(eigrp_zclient);
|
||||
zclient_free(eigrp_zclient);
|
||||
}
|
||||
|
||||
/* Zebra route add and delete treatment. */
|
||||
|
@ -192,7 +192,7 @@ void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
|
|||
struct listnode *node;
|
||||
int count = 0;
|
||||
|
||||
if (!zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
|
||||
if (!eigrp_zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct zapi_route api;
|
||||
|
||||
if (!zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
|
||||
if (!eigrp_zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
|
||||
return;
|
||||
|
||||
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.safi = SAFI_UNICAST;
|
||||
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))
|
||||
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)
|
||||
{
|
||||
return ((DEFAULT_ROUTE_TYPE(type))
|
||||
? vrf_bitmap_check(
|
||||
&zclient->default_information[AFI_IP], vrf_id)
|
||||
: vrf_bitmap_check(&zclient->redist[AFI_IP][type],
|
||||
vrf_id));
|
||||
? vrf_bitmap_check(&eigrp_zclient->default_information[AFI_IP], vrf_id)
|
||||
: vrf_bitmap_check(&eigrp_zclient->redist[AFI_IP][type], vrf_id));
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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->redistribute;
|
||||
|
@ -293,7 +291,7 @@ int eigrp_redistribute_unset(struct eigrp *eigrp, int type)
|
|||
|
||||
if (eigrp_is_type_redistributed(type, eigrp->vrf_id)) {
|
||||
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);
|
||||
--eigrp->redistribute;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,6 @@ static struct eigrp_master eigrp_master;
|
|||
|
||||
struct eigrp_master *eigrp_om;
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct in_addr router_id_zebra;
|
||||
|
||||
int eigrp_master_hash_cmp(const struct eigrp *a, const struct eigrp *b)
|
||||
|
|
|
@ -52,7 +52,7 @@ struct eigrp_master {
|
|||
};
|
||||
|
||||
/* Extern variables. */
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *eigrp_zclient;
|
||||
extern struct event_loop *master;
|
||||
extern struct eigrp_master *eigrp_om;
|
||||
extern struct zebra_privs_t eigrpd_privs;
|
||||
|
|
|
@ -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",
|
||||
ipv6_link_json);
|
||||
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,
|
||||
sizeof(buf));
|
||||
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);
|
||||
for (unsigned int i = 0; i < adj->global_ipv6_count;
|
||||
i++) {
|
||||
char buf[INET6_ADDRSTRLEN];
|
||||
inet_ntop(AF_INET6, &adj->global_ipv6_addrs[i],
|
||||
buf, sizeof(buf));
|
||||
json_object_string_add(ipv6_non_link_json,
|
||||
|
|
|
@ -211,7 +211,7 @@ static int bfd_handle_circuit_add_addr(struct isis_circuit *circuit)
|
|||
|
||||
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_ip_enabled_hook, bfd_handle_adj_ip_enabled);
|
||||
|
|
|
@ -26,12 +26,14 @@ long int flags_get_index(struct flags *flags)
|
|||
{
|
||||
struct listnode *node;
|
||||
long int index;
|
||||
const void *ptr;
|
||||
|
||||
if (flags->free_idcs == NULL || flags->free_idcs->count == 0) {
|
||||
index = flags->maxindex++;
|
||||
} else {
|
||||
node = listhead(flags->free_idcs);
|
||||
index = (long int)listgetdata(node);
|
||||
ptr = listgetdata(node);
|
||||
index = (long int)ptr;
|
||||
listnode_delete(flags->free_idcs, (void *)index);
|
||||
index--;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,9 @@
|
|||
#include "isisd/isis_errors.h"
|
||||
#include "isisd/isis_tx_queue.h"
|
||||
#include "isisd/isis_nb.h"
|
||||
#include "isisd/isis_zebra.h"
|
||||
#include "isisd/isis_ldp_sync.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
|
||||
/*
|
||||
* LDP-SYNC msg between IGP and LDP
|
||||
*/
|
||||
|
@ -122,8 +121,8 @@ void isis_ldp_sync_state_req_msg(struct isis_circuit *circuit)
|
|||
request.proto = LDP_IGP_SYNC_IF_STATE_REQUEST;
|
||||
request.ifindex = ifp->ifindex;
|
||||
|
||||
zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
|
||||
(uint8_t *)&request, sizeof(request));
|
||||
zclient_send_opaque(isis_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
|
||||
(uint8_t *)&request, sizeof(request));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1125,7 +1125,6 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area)
|
|||
struct isis_router_cap *rcap;
|
||||
#ifndef FABRICD
|
||||
struct isis_router_cap_fad *rcap_fad;
|
||||
struct listnode *node;
|
||||
struct flex_algo *fa;
|
||||
#endif /* ifndef FABRICD */
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
|
|||
for (ALL_LIST_ELEMENTS_RO(adjacencies, node, vadj)) {
|
||||
struct isis_spf_adj *sadj = vadj->sadj;
|
||||
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;
|
||||
|
||||
/*
|
||||
|
@ -248,7 +248,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
|
|||
* environment.
|
||||
*/
|
||||
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);
|
||||
if (!allow_ecmp)
|
||||
break;
|
||||
|
@ -260,7 +260,7 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
|
|||
ISIS_CIRCUIT_FLAPPED_AFTER_SPF))
|
||||
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);
|
||||
if (!allow_ecmp)
|
||||
break;
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
uint32_t start;
|
||||
uint32_t off;
|
||||
uint32_t offset;
|
||||
|
||||
start = 1;
|
||||
|
||||
if (circuit != NULL)
|
||||
start = circuit->snmp_id + 1;
|
||||
|
||||
for (off = start; off < SNMP_CIRCUITS_MAX; off++) {
|
||||
circuit = snmp_circuits[off];
|
||||
for (offset = start; offset < SNMP_CIRCUITS_MAX; offset++) {
|
||||
circuit = snmp_circuits[offset];
|
||||
|
||||
if (circuit != NULL)
|
||||
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,
|
||||
const oid *idx, size_t idx_len)
|
||||
{
|
||||
size_t off;
|
||||
size_t offset;
|
||||
size_t len;
|
||||
|
||||
/* 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)
|
||||
return 0;
|
||||
|
||||
for (off = 0; off < len; off++) {
|
||||
if (idx[off + 1] > 0xff)
|
||||
for (offset = 0; offset < len; offset++) {
|
||||
if (idx[offset + 1] > 0xff)
|
||||
return 0;
|
||||
|
||||
buf[off] = (uint8_t)(idx[off + 1] & 0xff);
|
||||
buf[offset] = (uint8_t)(idx[offset + 1] & 0xff);
|
||||
}
|
||||
|
||||
*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,
|
||||
int *try_exact, const oid *idx, size_t idx_len)
|
||||
{
|
||||
size_t off;
|
||||
size_t offset;
|
||||
size_t 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)
|
||||
cmp_len = idx_len - 1;
|
||||
|
||||
for (off = 0; off < cmp_len; off++) {
|
||||
if (idx[off + 1] > 0xff) {
|
||||
memset(buf + off, 0xff, len - off);
|
||||
for (offset = 0; offset < cmp_len; offset++) {
|
||||
if (idx[offset + 1] > 0xff) {
|
||||
memset(buf + offset, 0xff, len - off);
|
||||
*out_len = len;
|
||||
*try_exact = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
buf[off] = (uint8_t)(idx[off + 1] & 0xff);
|
||||
buf[offset] = (uint8_t)(idx[offset + 1] & 0xff);
|
||||
}
|
||||
|
||||
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,
|
||||
struct isis_circuit **ret_circuit)
|
||||
{
|
||||
oid off;
|
||||
oid offset;
|
||||
oid start;
|
||||
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];
|
||||
}
|
||||
|
||||
for (off = start; off < SNMP_CIRCUITS_MAX; ++off) {
|
||||
circuit = snmp_circuits[off];
|
||||
for (offset = start; offset < SNMP_CIRCUITS_MAX; ++offset) {
|
||||
circuit = snmp_circuits[offset];
|
||||
|
||||
if (circuit != NULL && off > start) {
|
||||
if (circuit != NULL && offset > start) {
|
||||
if (ret_circuit != NULL)
|
||||
*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,
|
||||
struct isis_circuit **ret_circuit, int *ret_level)
|
||||
{
|
||||
oid off;
|
||||
oid offset;
|
||||
oid start;
|
||||
struct isis_circuit *circuit = NULL;
|
||||
int level;
|
||||
|
@ -1066,13 +1066,13 @@ static int isis_snmp_circuit_level_lookup_next(
|
|||
start = oid_idx[0];
|
||||
}
|
||||
|
||||
for (off = start; off < SNMP_CIRCUITS_MAX; off++) {
|
||||
circuit = snmp_circuits[off];
|
||||
for (offset = start; offset < SNMP_CIRCUITS_MAX; offset++) {
|
||||
circuit = snmp_circuits[offset];
|
||||
|
||||
if (circuit == NULL)
|
||||
continue;
|
||||
|
||||
if (off > start || oid_idx_len < 2) {
|
||||
if (offset > start || oid_idx_len < 2) {
|
||||
/* Found and can use level 1 */
|
||||
level = IS_LEVEL_1;
|
||||
break;
|
||||
|
@ -1504,7 +1504,7 @@ static uint8_t *isis_snmp_find_man_area(struct variable *v, oid *name,
|
|||
struct iso_address *area_addr = NULL;
|
||||
oid *oid_idx;
|
||||
size_t oid_idx_len;
|
||||
size_t off = 0;
|
||||
size_t offset = 0;
|
||||
|
||||
*write_method = NULL;
|
||||
|
||||
|
@ -1539,8 +1539,8 @@ static uint8_t *isis_snmp_find_man_area(struct variable *v, oid *name,
|
|||
/* Append index */
|
||||
name[v->namelen] = area_addr->addr_len;
|
||||
|
||||
for (off = 0; off < area_addr->addr_len; off++)
|
||||
name[v->namelen + 1 + off] = area_addr->area_addr[off];
|
||||
for (offset = 0; offset < area_addr->addr_len; offset++)
|
||||
name[v->namelen + 1 + offset] = area_addr->area_addr[offset];
|
||||
|
||||
*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;
|
||||
oid *oid_idx;
|
||||
size_t oid_idx_len;
|
||||
size_t off = 0;
|
||||
size_t offset = 0;
|
||||
struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT);
|
||||
|
||||
if (isis == NULL)
|
||||
|
@ -1729,8 +1729,8 @@ static uint8_t *isis_snmp_find_router(struct variable *v, oid *name,
|
|||
/* Append index */
|
||||
name[v->namelen] = ISIS_SYS_ID_LEN;
|
||||
|
||||
for (off = 0; off < ISIS_SYS_ID_LEN; off++)
|
||||
name[v->namelen + 1 + off] = dyn->id[off];
|
||||
for (offset = 0; offset < ISIS_SYS_ID_LEN; offset++)
|
||||
name[v->namelen + 1 + off] = dyn->id[offset];
|
||||
|
||||
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 variable *v;
|
||||
|
||||
for (size_t off = 0; off < isis_var_count; off++) {
|
||||
v = &isis_var_arr[off];
|
||||
for (size_t offset = 0; offset < isis_var_count; offset++) {
|
||||
v = &isis_var_arr[offset];
|
||||
|
||||
if (v->findVar != h2f->ihtp_func) {
|
||||
/* Next table */
|
||||
|
@ -2858,7 +2858,7 @@ static int isis_snmp_db_overload_update(const struct isis_area *area)
|
|||
{
|
||||
netsnmp_variable_list *notification_vars;
|
||||
long val;
|
||||
uint32_t off;
|
||||
uint32_t offset;
|
||||
|
||||
if (!isis_snmp_trap_throttle(ISIS_TRAP_DB_OVERLOAD))
|
||||
return 0;
|
||||
|
@ -2880,8 +2880,8 @@ static int isis_snmp_db_overload_update(const struct isis_area *area)
|
|||
(uint8_t *)&val, sizeof(val));
|
||||
|
||||
/* Patch sys_level_state with proper index */
|
||||
off = array_size(isis_snmp_trap_data_var_sys_level_state) - 1;
|
||||
isis_snmp_trap_data_var_sys_level_state[off] = val;
|
||||
offset = array_size(isis_snmp_trap_data_var_sys_level_state) - 1;
|
||||
isis_snmp_trap_data_var_sys_level_state[offset] = val;
|
||||
|
||||
/* Prepare data */
|
||||
if (area->overload_bit)
|
||||
|
|
|
@ -1195,7 +1195,7 @@ end:
|
|||
&& !spftree->area->attached_bit_rcv_ignore
|
||||
&& (spftree->area->is_type & IS_LEVEL_1)
|
||||
&& !isis_level2_adj_up(spftree->area)) {
|
||||
struct prefix_pair ip_info = { {0} };
|
||||
memset(&ip_info, 0, sizeof(ip_info));
|
||||
if (IS_DEBUG_RTE_EVENTS)
|
||||
zlog_debug("ISIS-Spf (%pLS): add default %s route",
|
||||
lsp->hdr.lsp_id,
|
||||
|
|
|
@ -749,11 +749,11 @@ void sr_adj_sid_add_single(struct isis_adjacency *adj, int family, bool backup,
|
|||
|
||||
sra->backup_nexthops = list_new();
|
||||
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;
|
||||
|
||||
label_stack = vadj->label_stack;
|
||||
adjinfo2nexthop(family, sra->backup_nexthops, adj, NULL,
|
||||
adjinfo2nexthop(family, sra->backup_nexthops, tadj, NULL,
|
||||
label_stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -704,15 +704,15 @@ static int isis_te_export(uint8_t type, void *link_state)
|
|||
switch (type) {
|
||||
case LS_MSG_TYPE_NODE:
|
||||
ls_vertex2msg(&msg, (struct ls_vertex *)link_state);
|
||||
rc = ls_send_msg(zclient, &msg, NULL);
|
||||
rc = ls_send_msg(isis_zclient, &msg, NULL);
|
||||
break;
|
||||
case LS_MSG_TYPE_ATTRIBUTES:
|
||||
ls_edge2msg(&msg, (struct ls_edge *)link_state);
|
||||
rc = ls_send_msg(zclient, &msg, NULL);
|
||||
rc = ls_send_msg(isis_zclient, &msg, NULL);
|
||||
break;
|
||||
case LS_MSG_TYPE_PREFIX:
|
||||
ls_subnet2msg(&msg, (struct ls_subnet *)link_state);
|
||||
rc = ls_send_msg(zclient, &msg, NULL);
|
||||
rc = ls_send_msg(isis_zclient, &msg, NULL);
|
||||
break;
|
||||
default:
|
||||
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 */
|
||||
if (IS_EXPORT_TE(mta))
|
||||
ls_vertex_clean(ted, vertex, zclient);
|
||||
ls_vertex_clean(ted, vertex, isis_zclient);
|
||||
else
|
||||
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)) {
|
||||
te_debug(" |- Export TED from area %s",
|
||||
area->area_tag);
|
||||
rc = ls_sync_ted(mta->ted, zclient, &dst);
|
||||
rc = ls_sync_ted(mta->ted, isis_zclient, &dst);
|
||||
if (rc != 0)
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -518,7 +518,7 @@ static void format_item_asla_subtlvs(struct isis_asla_subtlvs *asla,
|
|||
asla->max_rsv_bw);
|
||||
if (IS_SUBTLV(asla, EXT_UNRSV_BW)) {
|
||||
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(
|
||||
buf, indent + 2,
|
||||
"[%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,
|
||||
struct sbuf *buf, struct json_object *json,
|
||||
struct sbuf *sbuf, struct json_object *json,
|
||||
int indent)
|
||||
{
|
||||
struct isis_lsp_entry *e = (struct isis_lsp_entry *)i;
|
||||
|
@ -3229,10 +3229,9 @@ static void format_item_lsp_entry(uint16_t mtid, struct isis_item *i,
|
|||
json_object_string_add(lsp_json, "chksum", buf);
|
||||
json_object_int_add(lsp_json, "lifetime", e->checksum);
|
||||
} else
|
||||
sbuf_push(
|
||||
buf, indent,
|
||||
"LSP Entry: %s, seq 0x%08x, cksum 0x%04hx, lifetime %hus\n",
|
||||
sys_id, e->seqno, e->checksum, e->rem_lifetime);
|
||||
sbuf_push(sbuf, indent,
|
||||
"LSP Entry: %s, seq 0x%08x, cksum 0x%04hx, lifetime %hus\n",
|
||||
sys_id, e->seqno, e->checksum, e->rem_lifetime);
|
||||
}
|
||||
|
||||
static void free_item_lsp_entry(struct isis_item *i)
|
||||
|
@ -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,
|
||||
struct sbuf *buf,
|
||||
struct sbuf *sbuf,
|
||||
struct json_object *json, int indent)
|
||||
{
|
||||
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]));
|
||||
}
|
||||
} else {
|
||||
sbuf_push(buf, indent, "Protocols Supported: ");
|
||||
sbuf_push(sbuf, indent, "Protocols Supported: ");
|
||||
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) ? ", " : "");
|
||||
}
|
||||
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 */
|
||||
for (int i = 0; i < SR_ALGORITHM_COUNT; i++) {
|
||||
struct isis_router_cap_fad *fad;
|
||||
size_t subtlv_len;
|
||||
struct admin_group *ag;
|
||||
uint32_t admin_group_length;
|
||||
size_t j;
|
||||
|
||||
fad = router_cap->fads[i];
|
||||
if (!fad)
|
||||
|
@ -5315,8 +5314,8 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap,
|
|||
if (admin_group_length) {
|
||||
stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_EXCAG);
|
||||
stream_putc(s, sizeof(uint32_t) * admin_group_length);
|
||||
for (size_t i = 0; i < admin_group_length; i++)
|
||||
stream_putl(s, admin_group_get_offset(ag, i));
|
||||
for (j = 0; j < admin_group_length; j++)
|
||||
stream_putl(s, admin_group_get_offset(ag, j));
|
||||
}
|
||||
|
||||
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) {
|
||||
stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCANYAG);
|
||||
stream_putc(s, sizeof(uint32_t) * admin_group_length);
|
||||
for (size_t i = 0; i < admin_group_length; i++)
|
||||
stream_putl(s, admin_group_get_offset(ag, i));
|
||||
for (j = 0; j < admin_group_length; j++)
|
||||
stream_putl(s, admin_group_get_offset(ag, j));
|
||||
}
|
||||
|
||||
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) {
|
||||
stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCALLAG);
|
||||
stream_putc(s, sizeof(uint32_t) * admin_group_length);
|
||||
for (size_t i = 0; i < admin_group_length; i++)
|
||||
stream_putl(s, admin_group_get_offset(ag, i));
|
||||
for (j = 0; j < admin_group_length; j++)
|
||||
stream_putl(s, admin_group_get_offset(ag, j));
|
||||
}
|
||||
|
||||
if (fad->fad.flags != 0) {
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "isisd/isis_sr.h"
|
||||
#include "isisd/isis_ldp_sync.h"
|
||||
|
||||
struct zclient *zclient;
|
||||
struct zclient *isis_zclient;
|
||||
static struct zclient *zclient_sync;
|
||||
|
||||
/* 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;
|
||||
int count = 0;
|
||||
|
||||
if (zclient->sock < 0)
|
||||
if (isis_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
/* 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;
|
||||
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,
|
||||
|
@ -305,7 +305,7 @@ void isis_zebra_route_del_route(struct isis *isis,
|
|||
{
|
||||
struct zapi_route api;
|
||||
|
||||
if (zclient->sock < 0)
|
||||
if (isis_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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. */
|
||||
(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;
|
||||
|
||||
/* 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)
|
||||
|
@ -523,9 +523,9 @@ void isis_zebra_redistribute_set(afi_t afi, int type, vrf_id_t vrf_id,
|
|||
{
|
||||
if (type == DEFAULT_ROUTE)
|
||||
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
|
||||
zclient, afi, vrf_id);
|
||||
isis_zclient, afi, vrf_id);
|
||||
else
|
||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, afi, type,
|
||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, isis_zclient, afi, type,
|
||||
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)
|
||||
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
|
||||
zclient, afi, vrf_id);
|
||||
isis_zclient, afi, vrf_id);
|
||||
else
|
||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, zclient, afi,
|
||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_DELETE, isis_zclient, afi,
|
||||
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 = {};
|
||||
int ret;
|
||||
|
||||
if (!zclient)
|
||||
if (!isis_zclient)
|
||||
return 0;
|
||||
|
||||
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",
|
||||
&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,
|
||||
(const uint8_t *)&zr, sizeof(zr));
|
||||
if (ret == ZCLIENT_SEND_FAILURE) {
|
||||
|
@ -585,8 +585,8 @@ void isis_zebra_rlfa_unregister_all(struct isis_spftree *spftree)
|
|||
struct zapi_rlfa_igp igp = {};
|
||||
int ret;
|
||||
|
||||
if (!zclient || spftree->type != SPF_TYPE_FORWARD
|
||||
|| CHECK_FLAG(spftree->flags, F_SPFTREE_NO_ADJACENCIES))
|
||||
if (!isis_zclient || spftree->type != SPF_TYPE_FORWARD ||
|
||||
CHECK_FLAG(spftree->flags, F_SPFTREE_NO_ADJACENCIES))
|
||||
return;
|
||||
|
||||
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.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,
|
||||
(const uint8_t *)&igp, sizeof(igp));
|
||||
if (ret == ZCLIENT_SEND_FAILURE)
|
||||
|
@ -774,27 +774,27 @@ int isis_zebra_label_manager_connect(void)
|
|||
|
||||
void isis_zebra_vrf_register(struct isis *isis)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0 || !isis)
|
||||
if (!isis_zclient || isis_zclient->sock < 0 || !isis)
|
||||
return;
|
||||
|
||||
if (isis->vrf_id != VRF_UNKNOWN) {
|
||||
if (IS_DEBUG_EVENTS)
|
||||
zlog_debug("%s: Register VRF %s id %u", __func__,
|
||||
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)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0 || !isis)
|
||||
if (!isis_zclient || isis_zclient->sock < 0 || !isis)
|
||||
return;
|
||||
|
||||
if (isis->vrf_id != VRF_UNKNOWN) {
|
||||
if (IS_DEBUG_EVENTS)
|
||||
zlog_debug("%s: Deregister VRF %s id %u", __func__,
|
||||
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;
|
||||
|
||||
if (up)
|
||||
rc = ls_register(zclient, true);
|
||||
rc = ls_register(isis_zclient, true);
|
||||
else
|
||||
rc = ls_unregister(zclient, true);
|
||||
rc = ls_unregister(isis_zclient, true);
|
||||
|
||||
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));
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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
|
||||
* 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
|
||||
* 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) {
|
||||
zlog_warn("%s: error getting SRv6 SID!", __func__);
|
||||
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
|
||||
* result
|
||||
*/
|
||||
ret = srv6_manager_release_sid(zclient, ctx);
|
||||
ret = srv6_manager_release_sid(isis_zclient, ctx);
|
||||
if (ret < 0) {
|
||||
zlog_warn("%s: error releasing SRv6 SID!", __func__);
|
||||
return;
|
||||
|
@ -1631,16 +1631,16 @@ static zclient_handler *const isis_handlers[] = {
|
|||
[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. */
|
||||
zclient = zclient_new(master, &zclient_options_default, isis_handlers,
|
||||
isis_zclient = zclient_new(mst, &zclient_options_default, isis_handlers,
|
||||
array_size(isis_handlers));
|
||||
zclient_init(zclient, PROTO_TYPE, 0, &isisd_privs);
|
||||
zclient->zebra_connected = isis_zebra_connected;
|
||||
zclient_init(isis_zclient, PROTO_TYPE, 0, &isisd_privs);
|
||||
isis_zclient->zebra_connected = isis_zebra_connected;
|
||||
|
||||
/* 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->redist_default = ZEBRA_ROUTE_ISIS;
|
||||
zclient_sync->instance = instance;
|
||||
|
@ -1654,11 +1654,11 @@ void isis_zebra_init(struct event_loop *master, int instance)
|
|||
|
||||
void isis_zebra_stop(void)
|
||||
{
|
||||
zclient_unregister_opaque(zclient, LDP_RLFA_LABELS);
|
||||
zclient_unregister_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
|
||||
zclient_unregister_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
||||
zclient_unregister_opaque(isis_zclient, LDP_RLFA_LABELS);
|
||||
zclient_unregister_opaque(isis_zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
|
||||
zclient_unregister_opaque(isis_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
||||
zclient_stop(zclient_sync);
|
||||
zclient_free(zclient_sync);
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient_stop(isis_zclient);
|
||||
zclient_free(isis_zclient);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "isisd.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *isis_zclient;
|
||||
|
||||
struct label_chunk {
|
||||
uint32_t start;
|
||||
|
|
|
@ -187,12 +187,12 @@ struct isis *isis_lookup_by_sysid(const uint8_t *sysid)
|
|||
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));
|
||||
im = &isis_master;
|
||||
im->isis = list_new();
|
||||
im->master = master;
|
||||
im->master = mst;
|
||||
}
|
||||
|
||||
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 (set)
|
||||
vrf_bitmap_set(
|
||||
&zclient->default_information
|
||||
&isis_zclient->default_information
|
||||
[afi],
|
||||
isis->vrf_id);
|
||||
else
|
||||
vrf_bitmap_unset(
|
||||
&zclient->default_information
|
||||
&isis_zclient->default_information
|
||||
[afi],
|
||||
isis->vrf_id);
|
||||
} else {
|
||||
if (set)
|
||||
vrf_bitmap_set(
|
||||
&zclient->redist
|
||||
&isis_zclient->redist
|
||||
[afi]
|
||||
[type],
|
||||
isis->vrf_id);
|
||||
else
|
||||
vrf_bitmap_unset(
|
||||
&zclient->redist
|
||||
&isis_zclient->redist
|
||||
[afi]
|
||||
[type],
|
||||
isis->vrf_id);
|
||||
|
|
|
@ -538,8 +538,8 @@ static void lde_dispatch_parent(struct event *thread)
|
|||
sizeof(struct ldpd_init))
|
||||
fatalx("INIT imsg with wrong len");
|
||||
|
||||
memcpy(&init, imsg.data, sizeof(init));
|
||||
lde_init(&init);
|
||||
memcpy(&ldp_init, imsg.data, sizeof(ldp_init));
|
||||
lde_init(&ldp_init);
|
||||
break;
|
||||
case IMSG_AGENTX_ENABLED:
|
||||
ldp_agentx_enabled();
|
||||
|
|
|
@ -620,10 +620,10 @@ static uint8_t *ldpHelloAdjacencyTable(struct variable *v, oid name[], size_t *l
|
|||
memcpy(name, v->name, v->namelen * sizeof(oid));
|
||||
|
||||
/* Append index */
|
||||
struct in_addr entityLdpId = {.s_addr = 0};
|
||||
entityLdpId.s_addr = 0;
|
||||
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);
|
||||
name[v->namelen + 4] = 0;
|
||||
|
|
|
@ -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, ¶ms));
|
||||
}
|
||||
|
||||
int
|
||||
ldp_vty_show_capabilities(struct vty *vty, const char *json)
|
||||
int ldp_vty_show_capabilities(struct vty *vty, const char *use_json)
|
||||
{
|
||||
if (json) {
|
||||
if (use_json) {
|
||||
json_object *json;
|
||||
json_object *json_array;
|
||||
json_object *json_cap;
|
||||
|
|
|
@ -38,7 +38,7 @@ static int ldp_sync_zebra_send_announce(void);
|
|||
static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS);
|
||||
static void ldp_sync_zebra_init(void);
|
||||
|
||||
static struct zclient *zclient;
|
||||
static struct zclient *ldp_zclient;
|
||||
extern struct zclient *zclient_sync;
|
||||
static bool zebra_registered = false;
|
||||
|
||||
|
@ -100,23 +100,23 @@ pw2zpw(struct l2vpn_pw *pw, struct zapi_pw *zpw)
|
|||
static void
|
||||
ldp_zebra_opaque_register(void)
|
||||
{
|
||||
zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST);
|
||||
zclient_register_opaque(zclient, LDP_RLFA_REGISTER);
|
||||
zclient_register_opaque(zclient, LDP_RLFA_UNREGISTER_ALL);
|
||||
zclient_register_opaque(ldp_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST);
|
||||
zclient_register_opaque(ldp_zclient, LDP_RLFA_REGISTER);
|
||||
zclient_register_opaque(ldp_zclient, LDP_RLFA_UNREGISTER_ALL);
|
||||
}
|
||||
|
||||
static void
|
||||
ldp_zebra_opaque_unregister(void)
|
||||
{
|
||||
zclient_unregister_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST);
|
||||
zclient_unregister_opaque(zclient, LDP_RLFA_REGISTER);
|
||||
zclient_unregister_opaque(zclient, LDP_RLFA_UNREGISTER_ALL);
|
||||
zclient_unregister_opaque(ldp_zclient, LDP_IGP_SYNC_IF_STATE_REQUEST);
|
||||
zclient_unregister_opaque(ldp_zclient, LDP_RLFA_REGISTER);
|
||||
zclient_unregister_opaque(ldp_zclient, LDP_RLFA_UNREGISTER_ALL);
|
||||
}
|
||||
|
||||
int
|
||||
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))
|
||||
== ZCLIENT_SEND_FAILURE)
|
||||
return -1;
|
||||
|
@ -130,9 +130,9 @@ ldp_sync_zebra_send_announce(void)
|
|||
struct ldp_igp_sync_announce announce;
|
||||
announce.proto = ZEBRA_ROUTE_LDP;
|
||||
|
||||
if (zclient_send_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE,
|
||||
(const uint8_t *)&announce, sizeof(announce))
|
||||
== ZCLIENT_SEND_FAILURE)
|
||||
if (zclient_send_opaque(ldp_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE,
|
||||
(const uint8_t *)&announce,
|
||||
sizeof(announce)) == ZCLIENT_SEND_FAILURE)
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -142,7 +142,7 @@ int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response *rlfa_labels)
|
|||
{
|
||||
int ret;
|
||||
|
||||
ret = zclient_send_opaque(zclient, LDP_RLFA_LABELS,
|
||||
ret = zclient_send_opaque(ldp_zclient, LDP_RLFA_LABELS,
|
||||
(const uint8_t *)rlfa_labels,
|
||||
sizeof(*rlfa_labels));
|
||||
if (ret == ZCLIENT_SEND_FAILURE) {
|
||||
|
@ -271,7 +271,7 @@ ldp_zebra_send_mpls_labels(int cmd, struct kroute *kr)
|
|||
znh->label_num = 1;
|
||||
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 0;
|
||||
|
@ -295,7 +295,7 @@ kmpw_add(struct zapi_pw *zpw)
|
|||
debug_zebra_out("pseudowire %s nexthop %s (add)",
|
||||
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
|
||||
|
@ -304,7 +304,7 @@ kmpw_del(struct zapi_pw *zpw)
|
|||
debug_zebra_out("pseudowire %s nexthop %s (del)",
|
||||
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
|
||||
|
@ -314,7 +314,7 @@ kmpw_set(struct zapi_pw *zpw)
|
|||
zpw->ifname, log_addr(zpw->af, (union ldpd_addr *)&zpw->nexthop),
|
||||
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
|
||||
|
@ -323,7 +323,7 @@ kmpw_unset(struct zapi_pw *zpw)
|
|||
debug_zebra_out("pseudowire %s nexthop %s (unset)",
|
||||
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
|
||||
|
@ -620,18 +620,18 @@ void ldp_zebra_regdereg_zebra_info(bool want_register)
|
|||
want_register ? "Register" : "De-register");
|
||||
|
||||
if (want_register) {
|
||||
zclient_send_reg_requests(zclient, VRF_DEFAULT);
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
|
||||
zclient_send_reg_requests(ldp_zclient, VRF_DEFAULT);
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, ldp_zclient, AFI_IP,
|
||||
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,
|
||||
VRF_DEFAULT);
|
||||
} else {
|
||||
zclient_send_dereg_requests(zclient, VRF_DEFAULT);
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
|
||||
zclient_send_dereg_requests(ldp_zclient, VRF_DEFAULT);
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, ldp_zclient,
|
||||
AFI_IP, ZEBRA_ROUTE_ALL, 0,
|
||||
VRF_DEFAULT);
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, ldp_zclient,
|
||||
AFI_IP6, ZEBRA_ROUTE_ALL, 0,
|
||||
VRF_DEFAULT);
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ static zclient_handler *const ldp_handlers[] = {
|
|||
[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_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);
|
||||
|
||||
/* Set default values. */
|
||||
zclient = zclient_new(master, &zclient_options_default, ldp_handlers,
|
||||
array_size(ldp_handlers));
|
||||
zclient_init(zclient, ZEBRA_ROUTE_LDP, 0, &ldpd_privs);
|
||||
ldp_zclient = zclient_new(mst, &zclient_options_default, ldp_handlers,
|
||||
array_size(ldp_handlers));
|
||||
zclient_init(ldp_zclient, ZEBRA_ROUTE_LDP, 0, &ldpd_privs);
|
||||
|
||||
/* set callbacks */
|
||||
zclient->zebra_connected = ldp_zebra_connected;
|
||||
ldp_zclient->zebra_connected = ldp_zebra_connected;
|
||||
|
||||
/* Access list initialize. */
|
||||
access_list_add_hook(ldp_zebra_filter_update);
|
||||
|
@ -702,9 +702,9 @@ void
|
|||
ldp_zebra_destroy(void)
|
||||
{
|
||||
ldp_zebra_opaque_unregister();
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient = NULL;
|
||||
zclient_stop(ldp_zclient);
|
||||
zclient_free(ldp_zclient);
|
||||
ldp_zclient = NULL;
|
||||
|
||||
if (zclient_sync == NULL)
|
||||
return;
|
||||
|
|
18
ldpd/ldpd.c
18
ldpd/ldpd.c
|
@ -74,7 +74,7 @@ DEFINE_QOBJ_TYPE(ldpd_conf);
|
|||
const char *log_procname;
|
||||
|
||||
struct ldpd_global global;
|
||||
struct ldpd_init init;
|
||||
struct ldpd_init ldp_init;
|
||||
struct ldpd_conf *ldpd_conf, *vty_conf;
|
||||
|
||||
static struct imsgev *iev_ldpe, *iev_ldpe_sync;
|
||||
|
@ -272,8 +272,8 @@ main(int argc, char *argv[])
|
|||
"%s/" LDPD_SOCK_NAME, optarg);
|
||||
break;
|
||||
case 'n':
|
||||
init.instance = atoi(optarg);
|
||||
if (init.instance < 1)
|
||||
ldp_init.instance = atoi(optarg);
|
||||
if (ldp_init.instance < 1)
|
||||
exit(0);
|
||||
break;
|
||||
case 'L':
|
||||
|
@ -291,11 +291,11 @@ main(int argc, char *argv[])
|
|||
snprintf(ctl_sock_path, sizeof(ctl_sock_path),
|
||||
"%s/" LDPD_SOCK_NAME, frr_runstatedir);
|
||||
|
||||
strlcpy(init.user, ldpd_privs.user, sizeof(init.user));
|
||||
strlcpy(init.group, ldpd_privs.group, sizeof(init.group));
|
||||
strlcpy(init.ctl_sock_path, ctl_sock_path, sizeof(init.ctl_sock_path));
|
||||
strlcpy(init.zclient_serv_path, frr_zclientpath,
|
||||
sizeof(init.zclient_serv_path));
|
||||
strlcpy(ldp_init.user, ldpd_privs.user, sizeof(ldp_init.user));
|
||||
strlcpy(ldp_init.group, ldpd_privs.group, sizeof(ldp_init.group));
|
||||
strlcpy(ldp_init.ctl_sock_path, ctl_sock_path, sizeof(ldp_init.ctl_sock_path));
|
||||
strlcpy(ldp_init.zclient_serv_path, frr_zclientpath,
|
||||
sizeof(ldp_init.zclient_serv_path));
|
||||
|
||||
argc -= optind;
|
||||
if (argc > 0 || (lflag && eflag))
|
||||
|
@ -428,7 +428,7 @@ main(int argc, char *argv[])
|
|||
fatal("could not establish imsg links");
|
||||
|
||||
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);
|
||||
|
||||
if (CHECK_FLAG(ldpd_conf->ipv4.flags, F_LDPD_AF_ENABLED))
|
||||
|
|
|
@ -739,7 +739,7 @@ struct ctl_ldp_sync {
|
|||
|
||||
extern struct ldpd_conf *ldpd_conf, *vty_conf;
|
||||
extern struct ldpd_global global;
|
||||
extern struct ldpd_init init;
|
||||
extern struct ldpd_init ldp_init;
|
||||
|
||||
/* parse.y */
|
||||
struct ldpd_conf *parse_config(char *);
|
||||
|
|
|
@ -373,8 +373,8 @@ static void ldpe_dispatch_main(struct event *thread)
|
|||
if (imsg.hdr.len != IMSG_HEADER_SIZE + sizeof(struct ldpd_init))
|
||||
fatalx("INIT imsg with wrong len");
|
||||
|
||||
memcpy(&init, imsg.data, sizeof(init));
|
||||
ldpe_init(&init);
|
||||
memcpy(&ldp_init, imsg.data, sizeof(ldp_init));
|
||||
ldpe_init(&ldp_init);
|
||||
break;
|
||||
case IMSG_AGENTX_ENABLED:
|
||||
ldp_agentx_enabled();
|
||||
|
|
|
@ -511,11 +511,11 @@ void *__darr_resize(void *a, uint count, size_t esize, struct memtype *mt);
|
|||
*/
|
||||
#define darr_pop(A) \
|
||||
({ \
|
||||
uint __len = _darr_len(A); \
|
||||
assert(__len); \
|
||||
darr_remove(A, __len - 1); \
|
||||
uint __poplen = _darr_len(A); \
|
||||
assert(__poplen); \
|
||||
darr_remove(A, __poplen - 1); \
|
||||
/* count on fact that we don't resize */ \
|
||||
(A)[__len - 1]; \
|
||||
(A)[__poplen - 1]; \
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
14
lib/elf_py.c
14
lib/elf_py.c
|
@ -518,12 +518,12 @@ static void elfsect_add_relocations(struct elfsect *w, Elf_Scn *rel,
|
|||
relw->es = w;
|
||||
|
||||
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->r_offset = rel->r_offset;
|
||||
relw->rela->r_info = rel->r_info;
|
||||
relw->rela->r_offset = erel->r_offset;
|
||||
relw->rela->r_info = erel->r_info;
|
||||
relw->rela->r_addend = 0;
|
||||
relw->relative = true;
|
||||
} else
|
||||
|
@ -581,14 +581,14 @@ static PyObject *elfsect_wrap(struct elffile *ef, Elf_Scn *scn, size_t idx,
|
|||
elfrelocs_init(&w->relocs);
|
||||
|
||||
for (i = 0; i < ef->ehdr->e_shnum; i++) {
|
||||
Elf_Scn *scn = elf_getscn(ef->elf, i);
|
||||
GElf_Shdr _shdr, *shdr = gelf_getshdr(scn, &_shdr);
|
||||
Elf_Scn *escn = elf_getscn(ef->elf, i);
|
||||
GElf_Shdr _shdr, *shdr = gelf_getshdr(escn, &_shdr);
|
||||
|
||||
if (shdr->sh_type != SHT_RELA && shdr->sh_type != SHT_REL)
|
||||
continue;
|
||||
if (shdr->sh_info && shdr->sh_info != idx)
|
||||
continue;
|
||||
elfsect_add_relocations(w, scn, shdr);
|
||||
elfsect_add_relocations(w, escn, shdr);
|
||||
}
|
||||
|
||||
return (PyObject *)w;
|
||||
|
|
|
@ -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), \
|
||||
/* end */
|
||||
|
||||
#define frr_with_mutex(...) \
|
||||
for (pthread_mutex_t MACRO_REPEAT(_frr_with_mutex, ##__VA_ARGS__) \
|
||||
*_once = NULL; _once == NULL; _once = (void *)1) \
|
||||
#define _frr_with_mutex_once(_once, ...) \
|
||||
for (pthread_mutex_t MACRO_REPEAT(_frr_with_mutex, ##__VA_ARGS__)*_once = NULL; \
|
||||
_once == NULL; _once = (void *)1) \
|
||||
/* end */
|
||||
|
||||
#define frr_with_mutex(...) _frr_with_mutex_once(NAMECTR(_once_), __VA_ARGS__)
|
||||
|
||||
/* variant 2:
|
||||
* (more suitable for long blocks, no extra indentation)
|
||||
*
|
||||
|
|
|
@ -1192,9 +1192,10 @@ void frr_detach(void)
|
|||
frr_check_detach();
|
||||
}
|
||||
|
||||
void frr_run(struct event_loop *master)
|
||||
void frr_run(struct event_loop *loop)
|
||||
{
|
||||
char instanceinfo[64] = "";
|
||||
struct event thread;
|
||||
|
||||
if (!(di->flags & FRR_MANUAL_VTY_START))
|
||||
frr_vty_serv_start(false);
|
||||
|
@ -1212,7 +1213,7 @@ void frr_run(struct event_loop *master)
|
|||
vty_stdio(frr_terminal_close);
|
||||
if (daemon_ctl_sock != -1) {
|
||||
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);
|
||||
}
|
||||
} else if (di->daemon_mode) {
|
||||
|
@ -1242,8 +1243,7 @@ void frr_run(struct event_loop *master)
|
|||
/* end fixed stderr startup logging */
|
||||
zlog_startup_end();
|
||||
|
||||
struct event thread;
|
||||
while (event_fetch(master, &thread))
|
||||
while (event_fetch(loop, &thread))
|
||||
event_call(&thread);
|
||||
}
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
jbw = json_object_new_array();
|
||||
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();
|
||||
snprintfrr(buf, 13, "class-type-%u", i);
|
||||
snprintfrr(buf, 13, "class-type-%u", (unsigned int)i);
|
||||
json_object_double_add(jobj, buf,
|
||||
attr->standard.unrsv_bw[i]);
|
||||
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)) {
|
||||
jsrlg = json_object_new_array();
|
||||
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();
|
||||
json_object_int_add(jobj, "srlg", attr->srlgs[i]);
|
||||
json_object_array_add(jsrlg, jobj);
|
||||
|
|
|
@ -67,7 +67,11 @@ struct list {
|
|||
#define listcount(X) ((X)->count)
|
||||
#define list_isempty(X) ((X)->head == NULL && (X)->tail == 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 */
|
||||
#define listset_app_node_mem(X) ((X)->flags |= LINKLIST_FLAG_NODE_MEM_BY_APP)
|
||||
#define listnode_init(X, val) ((X)->data = (val))
|
||||
|
|
|
@ -157,7 +157,8 @@ nb_op_create_yield_state(const char *xpath, struct yang_translator *translator,
|
|||
/* remove trailing '/'s */
|
||||
while (darr_len(ys->xpath) > 1 && ys->xpath[darr_len(ys->xpath) - 2] == '/') {
|
||||
darr_setlen(ys->xpath, darr_len(ys->xpath) - 1);
|
||||
*darr_last(ys->xpath) = 0;
|
||||
if (darr_last(ys->xpath))
|
||||
*darr_last(ys->xpath) = 0;
|
||||
}
|
||||
ys->xpath_orig = darr_strdup(xpath);
|
||||
ys->translator = translator;
|
||||
|
|
|
@ -556,23 +556,23 @@ reswitch: switch (ch) {
|
|||
case 'G':
|
||||
if (flags & LONGDBL) {
|
||||
long double arg = GETARG(long double);
|
||||
char fmt[6] = "%.*L";
|
||||
fmt[4] = ch;
|
||||
fmt[5] = '\0';
|
||||
char lfmt[6] = "%.*L";
|
||||
lfmt[4] = ch;
|
||||
lfmt[5] = '\0';
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
snprintf(buf, sizeof(buf), fmt, prec, arg);
|
||||
snprintf(buf, sizeof(buf), lfmt, prec, arg);
|
||||
#pragma GCC diagnostic pop
|
||||
} else {
|
||||
double arg = GETARG(double);
|
||||
char fmt[5] = "%.*";
|
||||
fmt[3] = ch;
|
||||
fmt[4] = '\0';
|
||||
char lfmt[5] = "%.*";
|
||||
lfmt[3] = ch;
|
||||
lfmt[4] = '\0';
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
snprintf(buf, sizeof(buf), fmt, prec, arg);
|
||||
snprintf(buf, sizeof(buf), lfmt, prec, arg);
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
cp = buf;
|
||||
|
|
|
@ -3014,7 +3014,7 @@ size_t zebra_interface_link_params_write(struct stream *s,
|
|||
size_t w, nb_ext_adm_grp;
|
||||
struct if_link_params *iflp;
|
||||
int i;
|
||||
|
||||
size_t j;
|
||||
|
||||
if (s == NULL || ifp == NULL)
|
||||
return 0;
|
||||
|
@ -3045,8 +3045,8 @@ size_t zebra_interface_link_params_write(struct stream *s,
|
|||
/* Extended Administrative Group */
|
||||
nb_ext_adm_grp = admin_group_nb_words(&iflp->ext_admin_grp);
|
||||
w += stream_putc(s, nb_ext_adm_grp);
|
||||
for (size_t i = 0; i < nb_ext_adm_grp; i++)
|
||||
stream_putl(s, admin_group_get_offset(&iflp->ext_admin_grp, i));
|
||||
for (j = 0; j < nb_ext_adm_grp; j++)
|
||||
stream_putl(s, admin_group_get_offset(&iflp->ext_admin_grp, j));
|
||||
|
||||
w += stream_putl(s, iflp->rmt_as);
|
||||
w += stream_put_in_addr(s, &iflp->rmt_ip);
|
||||
|
|
|
@ -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!");
|
||||
|
||||
/* Use Running DS from NB module??? */
|
||||
|
@ -178,10 +178,10 @@ int mgmt_ds_init(struct mgmt_master *mm)
|
|||
oper.config_ds = false;
|
||||
oper.ds_id = MGMTD_DS_OPERATIONAL;
|
||||
|
||||
mm->running_ds = &running;
|
||||
mm->candidate_ds = &candidate;
|
||||
mm->oper_ds = &oper;
|
||||
mgmt_ds_mm = mm;
|
||||
m->running_ds = &running;
|
||||
m->candidate_ds = &candidate;
|
||||
m->oper_ds = &oper;
|
||||
mgmt_ds_mm = m;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -195,16 +195,15 @@ void mgmt_ds_destroy(void)
|
|||
oper.root.dnode_root = NULL;
|
||||
}
|
||||
|
||||
struct mgmt_ds_ctx *mgmt_ds_get_ctx_by_id(struct mgmt_master *mm,
|
||||
Mgmtd__DatastoreId ds_id)
|
||||
struct mgmt_ds_ctx *mgmt_ds_get_ctx_by_id(struct mgmt_master *m, Mgmtd__DatastoreId ds_id)
|
||||
{
|
||||
switch (ds_id) {
|
||||
case MGMTD_DS_CANDIDATE:
|
||||
return (mm->candidate_ds);
|
||||
return (m->candidate_ds);
|
||||
case MGMTD_DS_RUNNING:
|
||||
return (mm->running_ds);
|
||||
return (m->running_ds);
|
||||
case MGMTD_DS_OPERATIONAL:
|
||||
return (mm->oper_ds);
|
||||
return (m->oper_ds);
|
||||
case MGMTD_DS_NONE:
|
||||
case MGMTD__DATASTORE_ID__STARTUP_DS:
|
||||
case _MGMTD__DATASTORE_ID_IS_INT_SIZE:
|
||||
|
|
|
@ -1442,7 +1442,6 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session,
|
|||
/* Check for yang-library shortcut */
|
||||
if (nb_oper_is_yang_lib_query(msg->xpath)) {
|
||||
struct lyd_node *ylib = NULL;
|
||||
LY_ERR err;
|
||||
|
||||
err = ly_ctx_get_yanglib_data(ly_native_ctx, &ylib, "%u",
|
||||
ly_ctx_get_change_count(
|
||||
|
|
|
@ -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)
|
||||
assert(!"MGMTD TXN: Call txn_init() only once");
|
||||
|
||||
mgmt_txn_mm = mm;
|
||||
mgmt_txn_tm = tm;
|
||||
mgmt_txns_init(&mm->txn_list);
|
||||
mgmt_txn_mm = m;
|
||||
mgmt_txn_tm = loop;
|
||||
mgmt_txns_init(&m->txn_list);
|
||||
mgmt_txn_hash_init();
|
||||
assert(!mm->cfg_txn);
|
||||
mm->cfg_txn = NULL;
|
||||
assert(!m->cfg_txn);
|
||||
m->cfg_txn = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
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];
|
||||
|
||||
struct route_info {
|
||||
|
@ -95,7 +95,7 @@ void nhrp_route_announce(int add, enum nhrp_cache_type type,
|
|||
struct zapi_route api;
|
||||
struct zapi_nexthop *api_nh;
|
||||
|
||||
if (zclient->sock < 0)
|
||||
if (nhrp_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
zclient_route_send(add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, zclient,
|
||||
zclient_route_send(add ? ZEBRA_ROUTE_ADD : ZEBRA_ROUTE_DELETE, nhrp_zclient,
|
||||
&api);
|
||||
}
|
||||
|
||||
|
@ -374,10 +374,10 @@ void nhrp_zebra_init(void)
|
|||
zebra_rib[AFI_IP] = route_table_init();
|
||||
zebra_rib[AFI_IP6] = route_table_init();
|
||||
|
||||
zclient = zclient_new(master, &zclient_options_default, nhrp_handlers,
|
||||
array_size(nhrp_handlers));
|
||||
zclient->zebra_connected = nhrp_zebra_connected;
|
||||
zclient_init(zclient, ZEBRA_ROUTE_NHRP, 0, &nhrpd_privs);
|
||||
nhrp_zclient = zclient_new(master, &zclient_options_default, nhrp_handlers,
|
||||
array_size(nhrp_handlers));
|
||||
nhrp_zclient->zebra_connected = nhrp_zebra_connected;
|
||||
zclient_init(nhrp_zclient, ZEBRA_ROUTE_NHRP, 0, &nhrpd_privs);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (!zclient || zclient->sock < 0) {
|
||||
if (!nhrp_zclient || nhrp_zclient->sock < 0) {
|
||||
debugf(NHRP_DEBUG_COMMON, "%s() : zclient not ready",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
s = zclient->obuf;
|
||||
s = nhrp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
zclient_create_header(s, ZEBRA_CONFIGURE_ARP, ifp->vrf->vrf_id);
|
||||
stream_putc(s, family);
|
||||
stream_putl(s, ifp->ifindex);
|
||||
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,
|
||||
|
@ -413,7 +413,7 @@ void nhrp_send_zebra_gre_source_set(struct interface *ifp,
|
|||
{
|
||||
struct stream *s;
|
||||
|
||||
if (!zclient || zclient->sock < 0) {
|
||||
if (!nhrp_zclient || nhrp_zclient->sock < 0) {
|
||||
zlog_err("%s : zclient not ready", __func__);
|
||||
return;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ void nhrp_send_zebra_gre_source_set(struct interface *ifp,
|
|||
/* silently ignore */
|
||||
return;
|
||||
}
|
||||
s = zclient->obuf;
|
||||
s = nhrp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
zclient_create_header(s, ZEBRA_GRE_SOURCE_SET, ifp->vrf->vrf_id);
|
||||
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, 0); /* mtu provisioning */
|
||||
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,
|
||||
|
@ -438,9 +438,9 @@ void nhrp_send_zebra_nbr(union sockunion *in,
|
|||
{
|
||||
struct stream *s;
|
||||
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!nhrp_zclient || nhrp_zclient->sock < 0)
|
||||
return;
|
||||
s = zclient->obuf;
|
||||
s = nhrp_zclient->obuf;
|
||||
stream_reset(s);
|
||||
zclient_neigh_ip_encode(s, out ? ZEBRA_NEIGH_IP_ADD : ZEBRA_NEIGH_IP_DEL,
|
||||
in, out, ifp,
|
||||
|
@ -448,26 +448,26 @@ void nhrp_send_zebra_nbr(union sockunion *in,
|
|||
: ZEBRA_NEIGH_STATE_FAILED,
|
||||
0);
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
zclient_interface_set_arp(zclient, ifp, arp_enable);
|
||||
zclient_interface_set_arp(nhrp_zclient, ifp, arp_enable);
|
||||
}
|
||||
|
||||
|
||||
void nhrp_zebra_terminate(void)
|
||||
{
|
||||
zclient_register_neigh(zclient, VRF_DEFAULT, AFI_IP, false);
|
||||
zclient_register_neigh(zclient, VRF_DEFAULT, AFI_IP6, false);
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient_register_neigh(nhrp_zclient, VRF_DEFAULT, AFI_IP, false);
|
||||
zclient_register_neigh(nhrp_zclient, VRF_DEFAULT, AFI_IP6, false);
|
||||
zclient_stop(nhrp_zclient);
|
||||
zclient_free(nhrp_zclient);
|
||||
|
||||
zebra_rib[AFI_IP]->cleanup = nhrp_table_node_cleanup;
|
||||
zebra_rib[AFI_IP6]->cleanup = nhrp_table_node_cleanup;
|
||||
|
|
|
@ -515,8 +515,6 @@ int ospf6_abr_originate_summary_to_area(struct ospf6_route *route,
|
|||
summary->path.origin.id =
|
||||
ADV_ROUTER_IN_PREFIX(&route->prefix);
|
||||
} else {
|
||||
struct ospf6_lsa *old;
|
||||
|
||||
summary->path.origin.type =
|
||||
htons(OSPF6_LSTYPE_INTER_PREFIX);
|
||||
|
||||
|
|
|
@ -123,16 +123,16 @@ struct ospf6_area {
|
|||
|
||||
#define OSPF6_CMD_AREA_GET(str, oa, ospf6) \
|
||||
{ \
|
||||
uint32_t area_id; \
|
||||
int format, ret; \
|
||||
ret = str2area_id(str, &area_id, &format); \
|
||||
if (ret) { \
|
||||
uint32_t _area_id; \
|
||||
int _format, _ret; \
|
||||
_ret = str2area_id(str, &_area_id, &_format); \
|
||||
if (_ret) { \
|
||||
vty_out(vty, "Malformed Area-ID: %s\n", str); \
|
||||
return CMD_WARNING; \
|
||||
} \
|
||||
oa = ospf6_area_lookup(area_id, ospf6); \
|
||||
oa = ospf6_area_lookup(_area_id, ospf6); \
|
||||
if (oa == NULL) \
|
||||
oa = ospf6_area_create(area_id, ospf6, format); \
|
||||
oa = ospf6_area_create(_area_id, ospf6, _format); \
|
||||
}
|
||||
|
||||
/* prototypes */
|
||||
|
|
|
@ -1899,7 +1899,7 @@ static void ospf6_redistribute_default_set(struct ospf6 *ospf6, int originate)
|
|||
break;
|
||||
case DEFAULT_ORIGINATE_ZEBRA:
|
||||
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,
|
||||
(struct prefix *)&p, ospf6);
|
||||
|
||||
|
@ -1915,7 +1915,7 @@ static void ospf6_redistribute_default_set(struct ospf6 *ospf6, int originate)
|
|||
break;
|
||||
case DEFAULT_ORIGINATE_ZEBRA:
|
||||
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
|
||||
zclient, AFI_IP6, ospf6->vrf_id);
|
||||
ospf6_zclient, AFI_IP6, ospf6->vrf_id);
|
||||
|
||||
break;
|
||||
case DEFAULT_ORIGINATE_ALWAYS:
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "ospf6_zebra.h"
|
||||
#include "ospf6_bfd.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
|
||||
/*
|
||||
* ospf6_bfd_trigger_event - Neighbor is registered/deregistered with BFD when
|
||||
* neighbor state is changed to/from 2way.
|
||||
|
@ -280,7 +278,7 @@ DEFUN (no_ipv6_ospf6_bfd,
|
|||
|
||||
void ospf6_bfd_init(void)
|
||||
{
|
||||
bfd_protocol_integration_init(zclient, master);
|
||||
bfd_protocol_integration_init(ospf6_zclient, master);
|
||||
|
||||
/* Install BFD command */
|
||||
install_element(INTERFACE_NODE, &ipv6_ospf6_bfd_cmd);
|
||||
|
|
|
@ -104,9 +104,9 @@ static void __attribute__((noreturn)) ospf6_exit(int status)
|
|||
|
||||
vrf_terminate();
|
||||
|
||||
if (zclient) {
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
if (ospf6_zclient) {
|
||||
zclient_stop(ospf6_zclient);
|
||||
zclient_free(ospf6_zclient);
|
||||
}
|
||||
|
||||
ospf6_master_delete();
|
||||
|
|
|
@ -1382,9 +1382,9 @@ static int ospf6TrapIfStateChange(struct ospf6_interface *oi, int next_state,
|
|||
}
|
||||
|
||||
/* 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);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
__func__, ospf6->vrf_id, type);
|
||||
if (set)
|
||||
vrf_bitmap_set(&zclient->redist[AFI_IP6][type],
|
||||
vrf_bitmap_set(&ospf6_zclient->redist[AFI_IP6][type],
|
||||
ospf6->vrf_id);
|
||||
else
|
||||
vrf_bitmap_unset(&zclient->redist[AFI_IP6][type],
|
||||
vrf_bitmap_unset(&ospf6_zclient->redist[AFI_IP6][type],
|
||||
ospf6->vrf_id);
|
||||
}
|
||||
|
||||
red_list = ospf6->redist[DEFAULT_ROUTE];
|
||||
if (red_list) {
|
||||
if (set)
|
||||
vrf_bitmap_set(&zclient->default_information[AFI_IP6],
|
||||
vrf_bitmap_set(&ospf6_zclient->default_information[AFI_IP6],
|
||||
ospf6->vrf_id);
|
||||
else
|
||||
vrf_bitmap_unset(&zclient->default_information[AFI_IP6],
|
||||
vrf_bitmap_unset(&ospf6_zclient->default_information[AFI_IP6],
|
||||
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));
|
||||
|
||||
om6 = &ospf6_master;
|
||||
om6->ospf6 = list_new();
|
||||
om6->master = master;
|
||||
om6->master = mst;
|
||||
}
|
||||
|
||||
void ospf6_master_delete(void)
|
||||
|
|
|
@ -231,7 +231,6 @@ DECLARE_QOBJ_TYPE(ospf6);
|
|||
#define OSPF6_STUB_ROUTER 0x02
|
||||
|
||||
/* global pointer for OSPF top data structure */
|
||||
extern struct ospf6 *ospf6;
|
||||
extern struct ospf6_master *om6;
|
||||
|
||||
/* prototypes */
|
||||
|
|
|
@ -36,11 +36,11 @@ DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_DISTANCE, "OSPF6 distance");
|
|||
unsigned char conf_debug_ospf6_zebra = 0;
|
||||
|
||||
/* information about zebra. */
|
||||
struct zclient *zclient = NULL;
|
||||
struct zclient *ospf6_zclient = NULL;
|
||||
|
||||
void ospf6_zebra_vrf_register(struct ospf6 *ospf6)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0 || !ospf6)
|
||||
if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0 || !ospf6)
|
||||
if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
|
||||
return;
|
||||
|
||||
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,
|
||||
* 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 */
|
||||
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;
|
||||
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)
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient,
|
||||
if (ospf6_zclient->sock > 0)
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, ospf6_zclient,
|
||||
AFI_IP6, type, 0, 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;
|
||||
vrf_bitmap_unset(&zclient->redist[AFI_IP6][type], vrf_id);
|
||||
if (zclient->sock > 0)
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
|
||||
vrf_bitmap_unset(&ospf6_zclient->redist[AFI_IP6][type], vrf_id);
|
||||
if (ospf6_zclient->sock > 0)
|
||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, ospf6_zclient,
|
||||
AFI_IP6, type, 0, vrf_id);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg)
|
|||
struct prefix prefix = {};
|
||||
int command;
|
||||
|
||||
if (zclient->sock < 0) {
|
||||
if (ospf6_zclient->sock < 0) {
|
||||
if (IS_OSPF6_DEBUG_ZEBRA(SEND))
|
||||
zlog_debug(" Not connected to Zebra");
|
||||
return;
|
||||
|
@ -141,7 +141,7 @@ void ospf6_zebra_import_default_route(struct ospf6 *ospf6, bool unreg)
|
|||
zserv_command_string(command), &prefix,
|
||||
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)
|
||||
== ZCLIENT_SEND_FAILURE)
|
||||
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;
|
||||
|
||||
if (!zclient || zclient->sock < 0 || !ospf6)
|
||||
if (!ospf6_zclient || ospf6_zclient->sock < 0 || !ospf6)
|
||||
return 1;
|
||||
|
||||
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.vrf_id = ospf6->vrf_id;
|
||||
|
||||
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient,
|
||||
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, ospf6_zclient,
|
||||
&api);
|
||||
|
||||
return 0;
|
||||
|
@ -313,7 +313,7 @@ DEFUN(show_zebra,
|
|||
json_object *json_zebra;
|
||||
json_object *json_array;
|
||||
|
||||
if (zclient == NULL) {
|
||||
if (ospf6_zclient == NULL) {
|
||||
vty_out(vty, "Not connected to zebra\n");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -323,13 +323,13 @@ DEFUN(show_zebra,
|
|||
json_zebra = json_object_new_object();
|
||||
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_zebra, "redistributeDefault",
|
||||
vrf_bitmap_check(&zclient->default_information[AFI_IP6],
|
||||
vrf_bitmap_check(&ospf6_zclient->default_information[AFI_IP6],
|
||||
VRF_DEFAULT));
|
||||
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))
|
||||
json_object_array_add(
|
||||
json_array,
|
||||
|
@ -342,13 +342,13 @@ DEFUN(show_zebra,
|
|||
vty_json(vty, json);
|
||||
} else {
|
||||
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",
|
||||
vrf_bitmap_check(&zclient->default_information[AFI_IP6],
|
||||
vrf_bitmap_check(&ospf6_zclient->default_information[AFI_IP6],
|
||||
VRF_DEFAULT));
|
||||
vty_out(vty, " redistribute:");
|
||||
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))
|
||||
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",
|
||||
(type == REM ? "remove" : "add"), &request->prefix);
|
||||
|
||||
if (zclient->sock < 0) {
|
||||
if (ospf6_zclient->sock < 0) {
|
||||
if (IS_OSPF6_DEBUG_ZEBRA(SEND))
|
||||
zlog_debug(" Not connected to Zebra");
|
||||
return;
|
||||
|
@ -487,9 +487,9 @@ static void ospf6_zebra_route_update(int type, struct ospf6_route *request,
|
|||
ospf6_zebra_append_opaque_attr(request, &api);
|
||||
|
||||
if (type == REM)
|
||||
ret = zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
||||
ret = zclient_route_send(ZEBRA_ROUTE_DELETE, ospf6_zclient, &api);
|
||||
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)
|
||||
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;
|
||||
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))
|
||||
zlog_debug("Zebra: Route add discard %pFX", dest);
|
||||
|
@ -589,7 +589,7 @@ void ospf6_zebra_delete_discard(struct ospf6_route *request,
|
|||
api.prefix = *dest;
|
||||
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))
|
||||
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,
|
||||
};
|
||||
|
||||
void ospf6_zebra_init(struct event_loop *master)
|
||||
void ospf6_zebra_init(struct event_loop *mst)
|
||||
{
|
||||
/* Allocate zebra structure. */
|
||||
zclient = zclient_new(master, &zclient_options_default, ospf6_handlers,
|
||||
array_size(ospf6_handlers));
|
||||
zclient_init(zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
|
||||
zclient->zebra_connected = ospf6_zebra_connected;
|
||||
zclient->nexthop_update = ospf6_zebra_import_check_update;
|
||||
ospf6_zclient = zclient_new(mst, &zclient_options_default, ospf6_handlers,
|
||||
array_size(ospf6_handlers));
|
||||
zclient_init(ospf6_zclient, ZEBRA_ROUTE_OSPF6, 0, &ospf6d_privs);
|
||||
ospf6_zclient->zebra_connected = ospf6_zebra_connected;
|
||||
ospf6_zclient->nexthop_update = ospf6_zebra_import_check_update;
|
||||
|
||||
/* Install command element for zebra node. */
|
||||
install_element(VIEW_NODE, &show_ospf6_zebra_cmd);
|
||||
|
|
|
@ -27,7 +27,7 @@ struct ospf6_distance {
|
|||
char *access_list;
|
||||
};
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *ospf6_zclient;
|
||||
struct ospf6;
|
||||
|
||||
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_no_redistribute(int, vrf_id_t 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_import_default_route(struct ospf6 *ospf6, bool unreg);
|
||||
extern void ospf6_zebra_add_discard(struct ospf6_route *request,
|
||||
|
|
|
@ -1408,13 +1408,13 @@ static void install_element_ospf6_debug_event(void)
|
|||
}
|
||||
|
||||
/* Install ospf related commands. */
|
||||
void ospf6_init(struct event_loop *master)
|
||||
void ospf6_init(struct event_loop *mst)
|
||||
{
|
||||
ospf6_top_init();
|
||||
ospf6_area_init();
|
||||
ospf6_interface_init();
|
||||
ospf6_neighbor_init();
|
||||
ospf6_zebra_init(master);
|
||||
ospf6_zebra_init(mst);
|
||||
|
||||
ospf6_lsa_init();
|
||||
ospf6_spf_init();
|
||||
|
|
|
@ -54,7 +54,7 @@ struct zebra_privs_t ospfd_privs = {.user = NULL,
|
|||
struct event_loop *master;
|
||||
|
||||
/* Global variables */
|
||||
struct ospf_apiclient *oclient;
|
||||
struct ospf_apiclient *g_oclient;
|
||||
char **args;
|
||||
|
||||
/* 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);
|
||||
|
||||
/* 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 */
|
||||
event_add_timer(master, lsa_inject, oclient, 10, NULL);
|
||||
event_add_timer(master, lsa_inject, g_oclient, 10, NULL);
|
||||
|
||||
/* 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)
|
||||
|
@ -296,27 +296,27 @@ int main(int argc, char *argv[])
|
|||
master = event_master_create(NULL);
|
||||
|
||||
/* Open connection to OSPF daemon */
|
||||
oclient = ospf_apiclient_connect(args[1], ASYNCPORT);
|
||||
if (!oclient) {
|
||||
g_oclient = ospf_apiclient_connect(args[1], ASYNCPORT);
|
||||
if (!g_oclient) {
|
||||
printf("Connecting to OSPF daemon on %s failed!\n", args[1]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Register callback functions. */
|
||||
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,
|
||||
lsa_delete_callback);
|
||||
|
||||
/* 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]));
|
||||
|
||||
/* Synchronize database with OSPF daemon. */
|
||||
ospf_apiclient_sync_lsdb(oclient);
|
||||
ospf_apiclient_sync_lsdb(g_oclient);
|
||||
|
||||
/* 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 */
|
||||
while (1) {
|
||||
|
|
|
@ -312,7 +312,7 @@ DEFUN (no_ip_ospf_bfd,
|
|||
|
||||
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_element(INTERFACE_NODE, &ip_ospf_bfd_cmd);
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#include "ospfd/ospf_zebra.h"
|
||||
#include "ospfd/ospf_dump.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
|
||||
/** @brief Function to refresh type-5 and type-7 DNA
|
||||
* LSAs when we receive an indication LSA.
|
||||
* @param Ospf instance.
|
||||
|
@ -172,11 +170,11 @@ struct external_info *ospf_external_info_check(struct ospf *ospf,
|
|||
redist_on =
|
||||
is_default_prefix4(&p)
|
||||
? vrf_bitmap_check(
|
||||
&zclient->default_information[AFI_IP],
|
||||
&ospf_zclient->default_information[AFI_IP],
|
||||
ospf->vrf_id)
|
||||
: (zclient->mi_redist[AFI_IP][type].enabled ||
|
||||
: (ospf_zclient->mi_redist[AFI_IP][type].enabled ||
|
||||
vrf_bitmap_check(
|
||||
&zclient->redist[AFI_IP][type],
|
||||
&ospf_zclient->redist[AFI_IP][type],
|
||||
ospf->vrf_id));
|
||||
// Pending: check for MI above.
|
||||
if (redist_on) {
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#include "ospf_dump.h"
|
||||
#include "ospf_ism.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
|
||||
/*
|
||||
* LDP-SYNC msg between IGP and LDP
|
||||
*/
|
||||
|
@ -98,8 +96,8 @@ void ospf_ldp_sync_state_req_msg(struct interface *ifp)
|
|||
request.proto = LDP_IGP_SYNC_IF_STATE_REQUEST;
|
||||
request.ifindex = ifp->ifindex;
|
||||
|
||||
zclient_send_opaque(zclient, LDP_IGP_SYNC_IF_STATE_REQUEST,
|
||||
(uint8_t *)&request, sizeof(request));
|
||||
zclient_send_opaque(ospf_zclient, LDP_IGP_SYNC_IF_STATE_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)) {
|
||||
/* 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);
|
||||
zclient_unregister_opaque(zclient,
|
||||
zclient_unregister_opaque(ospf_zclient,
|
||||
LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
||||
|
||||
/* disable LDP globally */
|
||||
|
@ -754,8 +752,8 @@ DEFPY (ospf_mpls_ldp_sync,
|
|||
}
|
||||
|
||||
/* register with opaque client to recv LDP-IGP Sync msgs */
|
||||
zclient_register_opaque(zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
|
||||
zclient_register_opaque(zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
||||
zclient_register_opaque(ospf_zclient, LDP_IGP_SYNC_IF_STATE_UPDATE);
|
||||
zclient_register_opaque(ospf_zclient, LDP_IGP_SYNC_ANNOUNCE_UPDATE);
|
||||
|
||||
if (!CHECK_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE)) {
|
||||
SET_FLAG(ospf->ldp_sync_cmd.flags, LDP_SYNC_FLAG_ENABLE);
|
||||
|
|
|
@ -4055,11 +4055,11 @@ void ospf_ls_ack_send_direct(struct ospf_neighbor *nbr, struct ospf_lsa *lsa)
|
|||
* ignored.
|
||||
*/
|
||||
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;
|
||||
|
||||
frr_each (ospf_lsa_list, &oi->ls_ack_direct, ls_ack_list_entry) {
|
||||
ack_queue_lsa = ls_ack_list_entry->lsa;
|
||||
frr_each (ospf_lsa_list, &oi->ls_ack_direct, ack_list_entry) {
|
||||
ack_queue_lsa = ack_list_entry->lsa;
|
||||
if ((lsa == ack_queue_lsa) ||
|
||||
((lsa->data->type == ack_queue_lsa->data->type) &&
|
||||
(lsa->data->id.s_addr ==
|
||||
|
|
|
@ -1709,15 +1709,15 @@ static int ospf_te_export(uint8_t type, void *link_state)
|
|||
switch (type) {
|
||||
case LS_MSG_TYPE_NODE:
|
||||
ls_vertex2msg(&msg, (struct ls_vertex *)link_state);
|
||||
rc = ls_send_msg(zclient, &msg, NULL);
|
||||
rc = ls_send_msg(ospf_zclient, &msg, NULL);
|
||||
break;
|
||||
case LS_MSG_TYPE_ATTRIBUTES:
|
||||
ls_edge2msg(&msg, (struct ls_edge *)link_state);
|
||||
rc = ls_send_msg(zclient, &msg, NULL);
|
||||
rc = ls_send_msg(ospf_zclient, &msg, NULL);
|
||||
break;
|
||||
case LS_MSG_TYPE_PREFIX:
|
||||
ls_subnet2msg(&msg, (struct ls_subnet *)link_state);
|
||||
rc = ls_send_msg(zclient, &msg, NULL);
|
||||
rc = ls_send_msg(ospf_zclient, &msg, NULL);
|
||||
break;
|
||||
default:
|
||||
rc = -1;
|
||||
|
@ -3113,7 +3113,7 @@ int ospf_te_sync_ted(struct zapi_opaque_reg_info dst)
|
|||
if (!OspfMplsTE.enabled || !OspfMplsTE.export)
|
||||
return rc;
|
||||
|
||||
rc = ls_sync_ted(OspfMplsTE.ted, zclient, &dst);
|
||||
rc = ls_sync_ted(OspfMplsTE.ted, ospf_zclient, &dst);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -4306,7 +4306,7 @@ DEFUN (ospf_mpls_te_export,
|
|||
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
||||
|
||||
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");
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
@ -4330,7 +4330,7 @@ DEFUN (no_ospf_mpls_te_export,
|
|||
VTY_DECLVAR_INSTANCE_CONTEXT(ospf, ospf);
|
||||
|
||||
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");
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
|
|
@ -12308,8 +12308,6 @@ static int config_write_interface_one(struct vty *vty, struct vrf *vrf)
|
|||
else
|
||||
vty_out(vty, " ip ospf");
|
||||
|
||||
char buf[INET_ADDRSTRLEN];
|
||||
|
||||
area_id2str(buf, sizeof(buf), ¶ms->if_area,
|
||||
params->if_area_id_fmt);
|
||||
vty_out(vty, " area %s", buf);
|
||||
|
|
|
@ -45,7 +45,7 @@ DEFINE_MTYPE_STATIC(OSPFD, OSPF_REDISTRIBUTE, "OSPF Redistriute");
|
|||
|
||||
|
||||
/* Zebra structure to hold current status. */
|
||||
struct zclient *zclient = NULL;
|
||||
struct zclient *ospf_zclient;
|
||||
/* and for the Synchronous connection to the Label Manager */
|
||||
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))
|
||||
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,
|
||||
|
@ -368,7 +368,7 @@ void ospf_zebra_delete(struct ospf *ospf, struct prefix_ipv4 *p,
|
|||
zlog_debug("Zebra: Route delete %pFX(%s)", p,
|
||||
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)
|
||||
|
@ -390,7 +390,7 @@ void ospf_zebra_add_discard(struct ospf *ospf, struct prefix_ipv4 *p)
|
|||
memcpy(&api.prefix, p, sizeof(*p));
|
||||
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))
|
||||
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));
|
||||
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))
|
||||
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. */
|
||||
(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 */
|
||||
|
@ -722,7 +722,7 @@ void ospf_zebra_delete_prefix_sid(const struct sr_prefix *srp)
|
|||
}
|
||||
|
||||
/* 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 */
|
||||
|
@ -746,7 +746,7 @@ void ospf_zebra_send_adjacency_sid(int cmd, struct sr_nhlfe nhlfe)
|
|||
znh->label_num = 1;
|
||||
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,
|
||||
|
@ -815,14 +815,14 @@ int ospf_is_type_redistributed(struct ospf *ospf, int type,
|
|||
{
|
||||
return (DEFAULT_ROUTE_TYPE(type)
|
||||
? vrf_bitmap_check(
|
||||
&zclient->default_information[AFI_IP],
|
||||
&ospf_zclient->default_information[AFI_IP],
|
||||
ospf->vrf_id)
|
||||
: ((instance &&
|
||||
redist_check_instance(
|
||||
&zclient->mi_redist[AFI_IP][type],
|
||||
&ospf_zclient->mi_redist[AFI_IP][type],
|
||||
instance)) ||
|
||||
(!instance &&
|
||||
vrf_bitmap_check(&zclient->redist[AFI_IP][type],
|
||||
vrf_bitmap_check(&ospf_zclient->redist[AFI_IP][type],
|
||||
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);
|
||||
|
||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type,
|
||||
zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, ospf_zclient, AFI_IP, type,
|
||||
instance, ospf->vrf_id);
|
||||
|
||||
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,
|
||||
unsigned short instance)
|
||||
{
|
||||
if (type == zclient->redist_default && instance == zclient->instance)
|
||||
if (type == ospf_zclient->redist_default && instance == ospf_zclient->instance)
|
||||
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);
|
||||
|
||||
if (IS_DEBUG_OSPF(zebra, ZEBRA_REDISTRIBUTE))
|
||||
|
@ -933,7 +933,7 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
|
|||
break;
|
||||
case DEFAULT_ORIGINATE_ZEBRA:
|
||||
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_DELETE,
|
||||
zclient, AFI_IP, ospf->vrf_id);
|
||||
ospf_zclient, AFI_IP, ospf->vrf_id);
|
||||
ospf->redistribute--;
|
||||
break;
|
||||
case DEFAULT_ORIGINATE_ALWAYS:
|
||||
|
@ -951,7 +951,7 @@ int ospf_redistribute_default_set(struct ospf *ospf, int originate, int mtype,
|
|||
type_str = "normal";
|
||||
ospf->redistribute++;
|
||||
zclient_redistribute_default(ZEBRA_REDISTRIBUTE_DEFAULT_ADD,
|
||||
zclient, AFI_IP, ospf->vrf_id);
|
||||
ospf_zclient, AFI_IP, ospf->vrf_id);
|
||||
break;
|
||||
case DEFAULT_ORIGINATE_ALWAYS:
|
||||
type_str = "always";
|
||||
|
@ -1242,7 +1242,7 @@ static int ospf_zebra_gr_update(struct ospf *ospf, int command,
|
|||
{
|
||||
struct zapi_cap api;
|
||||
|
||||
if (!zclient || zclient->sock < 0 || !ospf)
|
||||
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
|
||||
return 1;
|
||||
|
||||
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.vrf_id = ospf->vrf_id;
|
||||
|
||||
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, zclient,
|
||||
(void)zclient_capabilities_send(ZEBRA_CLIENT_CAPABILITIES, ospf_zclient,
|
||||
&api);
|
||||
|
||||
return 0;
|
||||
|
@ -1495,7 +1495,7 @@ void ospf_zebra_import_default_route(struct ospf *ospf, bool unreg)
|
|||
struct prefix prefix = {};
|
||||
int command;
|
||||
|
||||
if (zclient->sock < 0) {
|
||||
if (ospf_zclient->sock < 0) {
|
||||
if (IS_DEBUG_OSPF(zebra, ZEBRA))
|
||||
zlog_debug(" Not connected to Zebra vrf: %s",
|
||||
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,
|
||||
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)
|
||||
flog_err(EC_LIB_ZAPI_SOCKET, "%s(%s): zclient_send_rnh() failed",
|
||||
__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)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0 || !ospf)
|
||||
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
|
||||
return;
|
||||
|
||||
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__,
|
||||
ospf_vrf_id_to_name(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)
|
||||
{
|
||||
if (!zclient || zclient->sock < 0 || !ospf)
|
||||
if (!ospf_zclient || ospf_zclient->sock < 0 || !ospf)
|
||||
return;
|
||||
|
||||
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);
|
||||
/* Deregister for router-id, interfaces,
|
||||
* 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,
|
||||
};
|
||||
|
||||
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. */
|
||||
zclient = zclient_new(master, &zclient_options_default, ospf_handlers,
|
||||
array_size(ospf_handlers));
|
||||
zclient_init(zclient, ZEBRA_ROUTE_OSPF, instance, &ospfd_privs);
|
||||
zclient->zebra_connected = ospf_zebra_connected;
|
||||
zclient->nexthop_update = ospf_zebra_import_check_update;
|
||||
ospf_zclient = zclient_new(mst, &zclient_options_default, ospf_handlers,
|
||||
array_size(ospf_handlers));
|
||||
zclient_init(ospf_zclient, ZEBRA_ROUTE_OSPF, instance, &ospfd_privs);
|
||||
ospf_zclient->zebra_connected = ospf_zebra_connected;
|
||||
ospf_zclient->nexthop_update = ospf_zebra_import_check_update;
|
||||
|
||||
/* 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->redist_default = ZEBRA_ROUTE_OSPF;
|
||||
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)
|
||||
{
|
||||
zclient_send_neigh_discovery_req(zclient, ifp, p);
|
||||
zclient_send_neigh_discovery_req(ospf_zclient, ifp, p);
|
||||
}
|
||||
|
|
|
@ -59,9 +59,6 @@ struct ospf_master *om;
|
|||
|
||||
unsigned short ospf_instance;
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *zclient_sync;
|
||||
|
||||
/* OSPF config processing timer thread */
|
||||
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
|
||||
* thread
|
||||
*/
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient_stop(ospf_zclient);
|
||||
zclient_free(ospf_zclient);
|
||||
zclient_stop(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);
|
||||
}
|
||||
|
||||
void ospf_master_init(struct event_loop *master)
|
||||
void ospf_master_init(struct event_loop *mst)
|
||||
{
|
||||
memset(&ospf_master, 0, sizeof(ospf_master));
|
||||
|
||||
om = &ospf_master;
|
||||
om->ospf = list_new();
|
||||
om->master = master;
|
||||
om->master = mst;
|
||||
}
|
||||
|
||||
/* 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",
|
||||
__func__, ospf->vrf_id, type);
|
||||
if (set)
|
||||
vrf_bitmap_set(&zclient->redist[AFI_IP][type],
|
||||
vrf_bitmap_set(&ospf_zclient->redist[AFI_IP][type],
|
||||
ospf->vrf_id);
|
||||
else
|
||||
vrf_bitmap_unset(&zclient->redist[AFI_IP][type],
|
||||
vrf_bitmap_unset(&ospf_zclient->redist[AFI_IP][type],
|
||||
ospf->vrf_id);
|
||||
}
|
||||
|
||||
red_list = ospf->redist[DEFAULT_ROUTE];
|
||||
if (red_list) {
|
||||
if (set)
|
||||
vrf_bitmap_set(&zclient->default_information[AFI_IP],
|
||||
vrf_bitmap_set(&ospf_zclient->default_information[AFI_IP],
|
||||
ospf->vrf_id);
|
||||
else
|
||||
vrf_bitmap_unset(&zclient->default_information[AFI_IP],
|
||||
vrf_bitmap_unset(&ospf_zclient->default_information[AFI_IP],
|
||||
ospf->vrf_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -695,7 +695,8 @@ struct ospf_nbr_nbma {
|
|||
extern struct ospf_master *om;
|
||||
extern unsigned short ospf_instance;
|
||||
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 int ospf_zlog;
|
||||
extern struct zebra_privs_t ospfd_privs;
|
||||
|
|
|
@ -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_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",
|
||||
.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
|
||||
*/
|
||||
|
||||
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.segment_list_refresh_interval = TIMER_RETRY_DELAY;
|
||||
path_ted_register_vty();
|
||||
|
@ -82,7 +82,7 @@ uint32_t path_ted_start_importing_igp(const char *daemon_str)
|
|||
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",
|
||||
__func__);
|
||||
ted_state_g.import = IMPORT_UNKNOWN;
|
||||
|
@ -113,7 +113,7 @@ uint32_t path_ted_stop_importing_igp(void)
|
|||
uint32_t status = 0;
|
||||
|
||||
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(
|
||||
"%s: PATHD-TED: Unable to unregister Link State",
|
||||
__func__);
|
||||
|
@ -382,7 +382,7 @@ DEFUN (no_path_ted,
|
|||
ted_state_g.enabled = false;
|
||||
PATH_TED_DEBUG("%s: PATHD-TED: ON -> OFF", __func__);
|
||||
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");
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ enum zclient_send_status path_ted_link_state_sync(void)
|
|||
{
|
||||
enum zclient_send_status status;
|
||||
|
||||
status = ls_request_sync(zclient);
|
||||
status = ls_request_sync(pathd_zclient);
|
||||
if (status == -1) {
|
||||
PATH_TED_ERROR(
|
||||
"%s: PATHD-TED: Opaque error asking for TED sync ",
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
static int path_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS);
|
||||
|
||||
struct zclient *zclient;
|
||||
struct zclient *pathd_zclient;
|
||||
static struct zclient *zclient_sync;
|
||||
|
||||
/* 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;
|
||||
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;
|
||||
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
|
||||
*/
|
||||
void path_zebra_init(struct event_loop *master)
|
||||
void path_zebra_init(struct event_loop *loop)
|
||||
{
|
||||
/* Initialize asynchronous zclient. */
|
||||
zclient = zclient_new(master, &zclient_options_default, path_handlers,
|
||||
array_size(path_handlers));
|
||||
zclient_init(zclient, ZEBRA_ROUTE_SRTE, 0, &pathd_privs);
|
||||
zclient->zebra_connected = path_zebra_connected;
|
||||
pathd_zclient = zclient_new(loop, &zclient_options_default, path_handlers,
|
||||
array_size(path_handlers));
|
||||
zclient_init(pathd_zclient, ZEBRA_ROUTE_SRTE, 0, &pathd_privs);
|
||||
pathd_zclient->zebra_connected = path_zebra_connected;
|
||||
|
||||
/* Initialize special zclient for synchronous message exchanges. */
|
||||
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)
|
||||
{
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient_stop(pathd_zclient);
|
||||
zclient_free(pathd_zclient);
|
||||
event_cancel(&t_sync_connect);
|
||||
zclient_stop(zclient_sync);
|
||||
zclient_free(zclient_sync);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
DEFINE_MTYPE_STATIC(PBRD, PBR_INTERFACE, "PBR Interface");
|
||||
|
||||
/* Zebra structure to hold current status. */
|
||||
struct zclient *zclient;
|
||||
struct zclient *pbr_zclient;
|
||||
|
||||
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;
|
||||
|
||||
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) {
|
||||
case AFI_IP:
|
||||
api.prefix.family = AF_INET;
|
||||
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
||||
zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
|
||||
break;
|
||||
case AFI_IP6:
|
||||
api.prefix.family = AF_INET6;
|
||||
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
||||
zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
|
||||
break;
|
||||
case AFI_MAX:
|
||||
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;
|
||||
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
||||
zclient_route_send(ZEBRA_ROUTE_DELETE, pbr_zclient, &api);
|
||||
break;
|
||||
case AFI_L2VPN:
|
||||
DEBUGD(&pbr_dbg_zebra,
|
||||
|
@ -403,22 +403,22 @@ static zclient_handler *const pbr_handlers[] = {
|
|||
|
||||
void pbr_zebra_init(void)
|
||||
{
|
||||
zclient = zclient_new(master, &zclient_options_default, pbr_handlers,
|
||||
array_size(pbr_handlers));
|
||||
pbr_zclient = zclient_new(master, &zclient_options_default, pbr_handlers,
|
||||
array_size(pbr_handlers));
|
||||
|
||||
zclient_init(zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
|
||||
zclient->zebra_connected = zebra_connected;
|
||||
zclient->nexthop_update = pbr_zebra_nexthop_update;
|
||||
zclient_init(pbr_zclient, ZEBRA_ROUTE_PBR, 0, &pbr_privs);
|
||||
pbr_zclient->zebra_connected = zebra_connected;
|
||||
pbr_zclient->nexthop_update = pbr_zebra_nexthop_update;
|
||||
}
|
||||
|
||||
void pbr_zebra_destroy(void)
|
||||
{
|
||||
if (zclient == NULL)
|
||||
if (pbr_zclient == NULL)
|
||||
return;
|
||||
|
||||
zclient_stop(zclient);
|
||||
zclient_free(zclient);
|
||||
zclient = NULL;
|
||||
zclient_stop(pbr_zclient);
|
||||
zclient_free(pbr_zclient);
|
||||
pbr_zclient = NULL;
|
||||
}
|
||||
|
||||
void pbr_send_rnh(struct nexthop *nhop, bool reg)
|
||||
|
@ -454,7 +454,7 @@ void pbr_send_rnh(struct nexthop *nhop, bool reg)
|
|||
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)
|
||||
== ZCLIENT_SEND_FAILURE) {
|
||||
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)
|
||||
return false;
|
||||
|
||||
s = zclient->obuf;
|
||||
s = pbr_zclient->obuf;
|
||||
stream_reset(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)) {
|
||||
stream_putw_at(s, 0, stream_get_endp(s));
|
||||
zclient_send_message(zclient);
|
||||
zclient_send_message(pbr_zclient);
|
||||
} else {
|
||||
DEBUGD(&pbr_dbg_zebra, "%s: %s seq %u encode failed, skipped",
|
||||
__func__, pbrm->name, pbrms->seqno);
|
||||
|
|
|
@ -47,11 +47,11 @@ struct cmd_line_args {
|
|||
};
|
||||
|
||||
bool pcc_active_ = true;
|
||||
pcep_session *session = NULL;
|
||||
struct cmd_line_args *cmd_line_args = NULL;
|
||||
pcep_session *g_session = NULL;
|
||||
struct cmd_line_args *g_cmd_line_args = NULL;
|
||||
/* pcep_event callback variables */
|
||||
bool pcep_event_condition = false;
|
||||
struct pcep_event *event = NULL;
|
||||
struct pcep_event *g_event = NULL;
|
||||
pthread_mutex_t pcep_event_mutex;
|
||||
pthread_cond_t pcep_event_cond_var;
|
||||
|
||||
|
@ -180,7 +180,7 @@ void handle_signal_action(int sig_number)
|
|||
if (sig_number == SIGINT) {
|
||||
pcep_log(LOG_INFO, "%s: SIGINT was caught!", __func__);
|
||||
pcc_active_ = false;
|
||||
if (cmd_line_args->eventpoll == false) {
|
||||
if (g_cmd_line_args->eventpoll == false) {
|
||||
pthread_mutex_lock(&pcep_event_mutex);
|
||||
pcep_event_condition = true;
|
||||
pthread_cond_signal(&pcep_event_cond_var);
|
||||
|
@ -189,12 +189,12 @@ void handle_signal_action(int sig_number)
|
|||
} else if (sig_number == SIGUSR1) {
|
||||
pcep_log(LOG_INFO, "%s: SIGUSR1 was caught, dumping counters",
|
||||
__func__);
|
||||
dump_pcep_session_counters(session);
|
||||
dump_pcep_session_counters(g_session);
|
||||
pceplib_memory_dump();
|
||||
} else if (sig_number == SIGUSR2) {
|
||||
pcep_log(LOG_INFO, "%s: SIGUSR2 was caught, reseting counters",
|
||||
__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__,
|
||||
time(NULL), pthread_self());
|
||||
pthread_mutex_lock(&pcep_event_mutex);
|
||||
event = e;
|
||||
g_event = e;
|
||||
pcep_event_condition = true;
|
||||
pthread_cond_signal(&pcep_event_cond_var);
|
||||
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",
|
||||
__func__, time(NULL), pthread_self());
|
||||
|
||||
cmd_line_args = get_cmdline_args(argc, argv);
|
||||
if (cmd_line_args == NULL) {
|
||||
g_cmd_line_args = get_cmdline_args(argc, argv);
|
||||
if (g_cmd_line_args == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
setup_signals();
|
||||
|
||||
if (cmd_line_args->eventpoll == false) {
|
||||
if (g_cmd_line_args->eventpoll == false) {
|
||||
struct pceplib_infra_config infra_config;
|
||||
memset(&infra_config, 0, sizeof(infra_config));
|
||||
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();
|
||||
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;
|
||||
|
||||
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));
|
||||
|
||||
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 =
|
||||
gethostbyname2(cmd_line_args->dest_ip_str, af);
|
||||
gethostbyname2(g_cmd_line_args->dest_ip_str, af);
|
||||
if (host_info == NULL) {
|
||||
pcep_log(LOG_ERR, "%s: Error getting IP address.", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cmd_line_args->is_ipv6) {
|
||||
if (g_cmd_line_args->is_ipv6) {
|
||||
struct in6_addr host_address;
|
||||
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 {
|
||||
struct in_addr host_address;
|
||||
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__);
|
||||
destroy_pcep_configuration(config);
|
||||
return -1;
|
||||
|
@ -447,12 +447,12 @@ int main(int argc, char **argv)
|
|||
|
||||
sleep(2);
|
||||
|
||||
send_pce_report_message(session);
|
||||
send_pce_report_message(g_session);
|
||||
/*send_pce_path_request_message(session);*/
|
||||
|
||||
/* Wait for pcep_event's either by polling the event queue or by
|
||||
* callback */
|
||||
if (cmd_line_args->eventpoll == true) {
|
||||
if (g_cmd_line_args->eventpoll == true) {
|
||||
/* Poll the pcep_event queue*/
|
||||
while (pcc_active_) {
|
||||
if (event_queue_is_empty() == false) {
|
||||
|
@ -479,8 +479,8 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Check if we have been interrupted by SIGINT */
|
||||
if (pcc_active_) {
|
||||
print_queue_event(event);
|
||||
destroy_pcep_event(event);
|
||||
print_queue_event(g_event);
|
||||
destroy_pcep_event(g_event);
|
||||
}
|
||||
|
||||
pcep_event_condition = false;
|
||||
|
@ -492,9 +492,9 @@ int main(int argc, char **argv)
|
|||
}
|
||||
|
||||
pcep_log(LOG_NOTICE, "%s: Disconnecting from PCE", __func__);
|
||||
disconnect_pce(session);
|
||||
disconnect_pce(g_session);
|
||||
destroy_pcep_configuration(config);
|
||||
free(cmd_line_args);
|
||||
free(g_cmd_line_args);
|
||||
|
||||
if (!destroy_pcc()) {
|
||||
pcep_log(LOG_NOTICE, "%s: Error stopping PCC.", __func__);
|
||||
|
|
|
@ -44,15 +44,15 @@ void *PCEPLIB_INFRA = &pceplib_infra_mt;
|
|||
void *PCEPLIB_MESSAGES = &pceplib_messages_mt;
|
||||
|
||||
/* Initialize memory function pointers and memory type pointers */
|
||||
bool pceplib_memory_initialize(void *pceplib_infra_mt,
|
||||
void *pceplib_messages_mt,
|
||||
bool pceplib_memory_initialize(void *infra_mt,
|
||||
void *messages_mt,
|
||||
pceplib_malloc_func mf, pceplib_calloc_func cf,
|
||||
pceplib_realloc_func rf, pceplib_strdup_func sf,
|
||||
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_mt ? pceplib_messages_mt : PCEPLIB_MESSAGES);
|
||||
(messages_mt ? messages_mt : PCEPLIB_MESSAGES);
|
||||
|
||||
mfunc = (mf ? mf : mfunc);
|
||||
cfunc = (cf ? cf : cfunc);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "pim_upstream.h"
|
||||
#include "pim_vxlan.h"
|
||||
|
||||
extern struct zclient *zclient;
|
||||
extern struct zclient *pim_zclient;
|
||||
|
||||
#define PIM_MLAG_METADATA_LEN 4
|
||||
|
||||
|
@ -925,7 +925,7 @@ static void pim_mlag_register_handler(struct event *thread)
|
|||
{
|
||||
uint32_t bit_mask = 0;
|
||||
|
||||
if (!zclient)
|
||||
if (!pim_zclient)
|
||||
return;
|
||||
|
||||
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",
|
||||
__func__, bit_mask);
|
||||
|
||||
zclient_send_mlag_register(zclient, bit_mask);
|
||||
zclient_send_mlag_register(pim_zclient, bit_mask);
|
||||
}
|
||||
|
||||
void pim_mlag_register(void)
|
||||
|
@ -958,14 +958,14 @@ void pim_mlag_register(void)
|
|||
|
||||
static void pim_mlag_deregister_handler(struct event *thread)
|
||||
{
|
||||
if (!zclient)
|
||||
if (!pim_zclient)
|
||||
return;
|
||||
|
||||
if (PIM_DEBUG_MLAG)
|
||||
zlog_debug("%s: Posting Client De-Register to MLAG from PIM",
|
||||
__func__);
|
||||
router->connected_to_mlag = false;
|
||||
zclient_send_mlag_deregister(zclient);
|
||||
zclient_send_mlag_deregister(pim_zclient);
|
||||
}
|
||||
|
||||
void pim_mlag_deregister(void)
|
||||
|
|
|
@ -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];
|
||||
ifindex_t i;
|
||||
struct interface *ifp = NULL;
|
||||
int num_ifindex;
|
||||
|
||||
memset(nexthop_tab, 0, sizeof(nexthop_tab));
|
||||
|
|
|
@ -1624,8 +1624,7 @@ void pim_upstream_set_sptbit(struct pim_upstream *up,
|
|||
if (!starup
|
||||
|| up->rpf.source_nexthop
|
||||
.interface != starup->rpf.source_nexthop.interface) {
|
||||
struct pim_upstream *starup = up->parent;
|
||||
|
||||
starup = up->parent;
|
||||
if (PIM_DEBUG_PIM_TRACE)
|
||||
zlog_debug(
|
||||
"%s: %s RPF_interface(S) != RPF_interface(RP(G))",
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#undef PIM_DEBUG_IFADDR_DUMP
|
||||
#define PIM_DEBUG_IFADDR_DUMP
|
||||
|
||||
struct zclient *zclient;
|
||||
struct zclient *pim_zclient;
|
||||
|
||||
|
||||
/* Router-id update message from zebra. */
|
||||
|
@ -349,16 +349,16 @@ static void pim_zebra_vxlan_replay(void)
|
|||
struct stream *s = NULL;
|
||||
|
||||
/* Check socket. */
|
||||
if (!zclient || zclient->sock < 0)
|
||||
if (!pim_zclient || pim_zclient->sock < 0)
|
||||
return;
|
||||
|
||||
s = zclient->obuf;
|
||||
s = pim_zclient->obuf;
|
||||
stream_reset(s);
|
||||
|
||||
zclient_create_header(s, ZEBRA_VXLAN_SG_REPLAY, VRF_DEFAULT);
|
||||
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)
|
||||
|
@ -448,14 +448,14 @@ static zclient_handler *const pim_handlers[] = {
|
|||
void pim_zebra_init(void)
|
||||
{
|
||||
/* Socket for receiving updates from Zebra daemon */
|
||||
zclient = zclient_new(router->master, &zclient_options_default,
|
||||
pim_handlers, array_size(pim_handlers));
|
||||
pim_zclient = zclient_new(router->master, &zclient_options_default,
|
||||
pim_handlers, array_size(pim_handlers));
|
||||
|
||||
zclient->zebra_capabilities = pim_zebra_capabilities;
|
||||
zclient->zebra_connected = pim_zebra_connected;
|
||||
zclient->nexthop_update = pim_nexthop_update;
|
||||
pim_zclient->zebra_capabilities = pim_zebra_capabilities;
|
||||
pim_zclient->zebra_connected = pim_zebra_connected;
|
||||
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) {
|
||||
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: ");
|
||||
|
||||
if (zclient) {
|
||||
vty_out(vty, "%d failures=%d\n", zclient->sock, zclient->fail);
|
||||
if (pim_zclient) {
|
||||
vty_out(vty, "%d failures=%d\n", pim_zclient->sock, pim_zclient->fail);
|
||||
} else {
|
||||
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)
|
||||
{
|
||||
if (zclient)
|
||||
return zclient;
|
||||
if (pim_zclient)
|
||||
return pim_zclient;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
@ -526,5 +526,5 @@ struct zclient *pim_zebra_zclient_get(void)
|
|||
void pim_zebra_interface_set_master(struct interface *vrf,
|
||||
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
Loading…
Reference in a new issue