mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 11:18:43 +00:00
Merge pull request #14996 from donaldsharp/srv6_shutdown_zebra_deletion
zebra: On shutdown, free up srv6 list data
This commit is contained in:
commit
5bdf2e5962
@ -236,6 +236,8 @@ void zebra_finalize(struct event *dummy)
|
|||||||
|
|
||||||
zebra_pw_terminate();
|
zebra_pw_terminate();
|
||||||
|
|
||||||
|
zebra_srv6_terminate();
|
||||||
|
|
||||||
label_manager_terminate();
|
label_manager_terminate();
|
||||||
|
|
||||||
ns_terminate();
|
ns_terminate();
|
||||||
@ -430,6 +432,8 @@ int main(int argc, char **argv)
|
|||||||
zebra_vty_init();
|
zebra_vty_init();
|
||||||
access_list_init();
|
access_list_init();
|
||||||
prefix_list_init();
|
prefix_list_init();
|
||||||
|
|
||||||
|
rtadv_init();
|
||||||
rtadv_cmd_init();
|
rtadv_cmd_init();
|
||||||
/* PTM socket */
|
/* PTM socket */
|
||||||
#ifdef ZEBRA_PTM_SUPPORT
|
#ifdef ZEBRA_PTM_SUPPORT
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
extern struct zebra_privs_t zserv_privs;
|
extern struct zebra_privs_t zserv_privs;
|
||||||
|
|
||||||
static uint32_t interfaces_configured_for_ra_from_bgp;
|
static uint32_t interfaces_configured_for_ra_from_bgp;
|
||||||
|
#define RTADV_ADATA_SIZE 1024
|
||||||
|
|
||||||
#if defined(HAVE_RTADV)
|
#if defined(HAVE_RTADV)
|
||||||
|
|
||||||
@ -187,8 +188,9 @@ static void rtadv_send_packet(int sock, struct interface *ifp,
|
|||||||
struct cmsghdr *cmsgptr;
|
struct cmsghdr *cmsgptr;
|
||||||
struct in6_pktinfo *pkt;
|
struct in6_pktinfo *pkt;
|
||||||
struct sockaddr_in6 addr;
|
struct sockaddr_in6 addr;
|
||||||
static void *adata = NULL;
|
|
||||||
unsigned char buf[RTADV_MSG_SIZE];
|
unsigned char buf[RTADV_MSG_SIZE];
|
||||||
|
char adata[RTADV_ADATA_SIZE];
|
||||||
|
|
||||||
struct nd_router_advert *rtadv;
|
struct nd_router_advert *rtadv;
|
||||||
int ret;
|
int ret;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@ -199,22 +201,6 @@ static void rtadv_send_packet(int sock, struct interface *ifp,
|
|||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
uint16_t pkt_RouterLifetime;
|
uint16_t pkt_RouterLifetime;
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate control message bufffer. This is dynamic because
|
|
||||||
* CMSG_SPACE is not guaranteed not to call a function. Note that
|
|
||||||
* the size will be different on different architectures due to
|
|
||||||
* differing alignment rules.
|
|
||||||
*/
|
|
||||||
if (adata == NULL) {
|
|
||||||
/* XXX Free on shutdown. */
|
|
||||||
adata = calloc(1, CMSG_SPACE(sizeof(struct in6_pktinfo)));
|
|
||||||
|
|
||||||
if (adata == NULL) {
|
|
||||||
zlog_debug("%s: can't malloc control data", __func__);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Logging of packet. */
|
/* Logging of packet. */
|
||||||
if (IS_ZEBRA_DEBUG_PACKET)
|
if (IS_ZEBRA_DEBUG_PACKET)
|
||||||
zlog_debug("%s(%s:%u): Tx RA, socket %u", ifp->name,
|
zlog_debug("%s(%s:%u): Tx RA, socket %u", ifp->name,
|
||||||
@ -3069,3 +3055,13 @@ uint32_t rtadv_get_interfaces_configured_from_bgp(void)
|
|||||||
{
|
{
|
||||||
return interfaces_configured_for_ra_from_bgp;
|
return interfaces_configured_for_ra_from_bgp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rtadv_init(void)
|
||||||
|
{
|
||||||
|
if (CMSG_SPACE(sizeof(struct in6_pktinfo)) > RTADV_ADATA_SIZE) {
|
||||||
|
zlog_debug("%s: RTADV_ADATA_SIZE choosen will not work on this platform, please use a larger size",
|
||||||
|
__func__);
|
||||||
|
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -435,6 +435,7 @@ extern void zebra_interface_radv_enable(ZAPI_HANDLER_ARGS);
|
|||||||
|
|
||||||
extern uint32_t rtadv_get_interfaces_configured_from_bgp(void);
|
extern uint32_t rtadv_get_interfaces_configured_from_bgp(void);
|
||||||
extern bool rtadv_compiled_in(void);
|
extern bool rtadv_compiled_in(void);
|
||||||
|
extern void rtadv_init(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -216,9 +216,10 @@ void zebra_notify_srv6_locator_delete(struct srv6_locator *locator)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct zebra_srv6 srv6;
|
||||||
|
|
||||||
struct zebra_srv6 *zebra_srv6_get_default(void)
|
struct zebra_srv6 *zebra_srv6_get_default(void)
|
||||||
{
|
{
|
||||||
static struct zebra_srv6 srv6;
|
|
||||||
static bool first_execution = true;
|
static bool first_execution = true;
|
||||||
|
|
||||||
if (first_execution) {
|
if (first_execution) {
|
||||||
@ -408,6 +409,23 @@ int release_daemon_srv6_locator_chunks(struct zserv *client)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void zebra_srv6_terminate(void)
|
||||||
|
{
|
||||||
|
struct srv6_locator *locator;
|
||||||
|
|
||||||
|
if (!srv6.locators)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (listcount(srv6.locators)) {
|
||||||
|
locator = listnode_head(srv6.locators);
|
||||||
|
|
||||||
|
listnode_delete(srv6.locators, locator);
|
||||||
|
srv6_locator_free(locator);
|
||||||
|
}
|
||||||
|
|
||||||
|
list_delete(&srv6.locators);
|
||||||
|
}
|
||||||
|
|
||||||
void zebra_srv6_init(void)
|
void zebra_srv6_init(void)
|
||||||
{
|
{
|
||||||
hook_register(zserv_client_close, zebra_srv6_cleanup);
|
hook_register(zserv_client_close, zebra_srv6_cleanup);
|
||||||
|
@ -52,6 +52,7 @@ void zebra_notify_srv6_locator_add(struct srv6_locator *locator);
|
|||||||
void zebra_notify_srv6_locator_delete(struct srv6_locator *locator);
|
void zebra_notify_srv6_locator_delete(struct srv6_locator *locator);
|
||||||
|
|
||||||
extern void zebra_srv6_init(void);
|
extern void zebra_srv6_init(void);
|
||||||
|
extern void zebra_srv6_terminate(void);
|
||||||
extern struct zebra_srv6 *zebra_srv6_get_default(void);
|
extern struct zebra_srv6 *zebra_srv6_get_default(void);
|
||||||
extern bool zebra_srv6_is_enable(void);
|
extern bool zebra_srv6_is_enable(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user