mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 10:46:22 +00:00
ldpd: defer register for info until configured
Instead of registering to receive default-VRF information and routes when first connected to zebra, defer the registration until some ldp configuration is entered. This avoids redistributing IPv4/IPv6 routes to ldpd when not needed. Signed-off-by: Fredi Raspall <fredi@voltanet.io> Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
22a8c40f2a
commit
ce510d2e0e
@ -429,6 +429,9 @@ ldp_vty_mpls_ldp(struct vty *vty, const char *negate)
|
|||||||
vty_conf->flags |= F_LDPD_ENABLED;
|
vty_conf->flags |= F_LDPD_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* register / de-register to recv info from zebra */
|
||||||
|
ldp_zebra_regdereg_zebra_info(!negate);
|
||||||
|
|
||||||
ldp_config_apply(vty, vty_conf);
|
ldp_config_apply(vty, vty_conf);
|
||||||
|
|
||||||
return (CMD_SUCCESS);
|
return (CMD_SUCCESS);
|
||||||
|
@ -54,6 +54,7 @@ static int ldp_zebra_opaque_msg_handler(ZAPI_CALLBACK_ARGS);
|
|||||||
static void ldp_sync_zebra_init(void);
|
static void ldp_sync_zebra_init(void);
|
||||||
|
|
||||||
static struct zclient *zclient;
|
static struct zclient *zclient;
|
||||||
|
static bool zebra_registered = false;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ifp2kif(struct interface *ifp, struct kif *kif)
|
ifp2kif(struct interface *ifp, struct kif *kif)
|
||||||
@ -629,14 +630,42 @@ ldp_zebra_read_pw_status_update(ZAPI_CALLBACK_ARGS)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ldp_zebra_regdereg_zebra_info(bool want_register)
|
||||||
|
{
|
||||||
|
if (zebra_registered == want_register)
|
||||||
|
return;
|
||||||
|
|
||||||
|
log_debug("%s to receive default VRF information",
|
||||||
|
want_register ? "Register" : "De-register");
|
||||||
|
|
||||||
|
if (want_register) {
|
||||||
|
zclient_send_reg_requests(zclient, VRF_DEFAULT);
|
||||||
|
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
|
||||||
|
ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT);
|
||||||
|
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient,
|
||||||
|
AFI_IP6, ZEBRA_ROUTE_ALL, 0,
|
||||||
|
VRF_DEFAULT);
|
||||||
|
} else {
|
||||||
|
zclient_send_dereg_requests(zclient, VRF_DEFAULT);
|
||||||
|
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
|
||||||
|
AFI_IP, ZEBRA_ROUTE_ALL, 0,
|
||||||
|
VRF_DEFAULT);
|
||||||
|
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
|
||||||
|
AFI_IP6, ZEBRA_ROUTE_ALL, 0,
|
||||||
|
VRF_DEFAULT);
|
||||||
|
}
|
||||||
|
zebra_registered = want_register;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ldp_zebra_connected(struct zclient *zclient)
|
ldp_zebra_connected(struct zclient *zclient)
|
||||||
{
|
{
|
||||||
zclient_send_reg_requests(zclient, VRF_DEFAULT);
|
zebra_registered = false;
|
||||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP,
|
|
||||||
ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT);
|
/* if MPLS was already enabled and we are re-connecting, register again
|
||||||
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP6,
|
*/
|
||||||
ZEBRA_ROUTE_ALL, 0, VRF_DEFAULT);
|
if (vty_conf->flags & F_LDPD_ENABLED)
|
||||||
|
ldp_zebra_regdereg_zebra_info(true);
|
||||||
|
|
||||||
ldp_zebra_opaque_register();
|
ldp_zebra_opaque_register();
|
||||||
|
|
||||||
|
@ -906,6 +906,8 @@ int ldp_sync_zebra_send_state_update(struct ldp_igp_sync_if_state *);
|
|||||||
int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response *
|
int ldp_zebra_send_rlfa_labels(struct zapi_rlfa_response *
|
||||||
rlfa_labels);
|
rlfa_labels);
|
||||||
|
|
||||||
|
void ldp_zebra_regdereg_zebra_info(bool want_register);
|
||||||
|
|
||||||
/* compatibility */
|
/* compatibility */
|
||||||
#ifndef __OpenBSD__
|
#ifndef __OpenBSD__
|
||||||
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
|
#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
|
||||||
|
Loading…
Reference in New Issue
Block a user