summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_srv6.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_srv6.c')
-rw-r--r--zebra/zebra_srv6.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/zebra/zebra_srv6.c b/zebra/zebra_srv6.c
index 94b93e5..bb872ef 100644
--- a/zebra/zebra_srv6.c
+++ b/zebra/zebra_srv6.c
@@ -17,6 +17,7 @@
#include "zebra/zebra_router.h"
#include "zebra/zebra_srv6.h"
#include "zebra/zebra_errors.h"
+#include "zebra/ge_netlink.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -216,9 +217,10 @@ void zebra_notify_srv6_locator_delete(struct srv6_locator *locator)
}
}
+struct zebra_srv6 srv6;
+
struct zebra_srv6 *zebra_srv6_get_default(void)
{
- static struct zebra_srv6 srv6;
static bool first_execution = true;
if (first_execution) {
@@ -408,6 +410,40 @@ int release_daemon_srv6_locator_chunks(struct zserv *client)
return count;
}
+void zebra_srv6_encap_src_addr_set(struct in6_addr *encap_src_addr)
+{
+ struct zebra_srv6 *srv6 = zebra_srv6_get_default();
+
+ if (!encap_src_addr)
+ return;
+
+ memcpy(&srv6->encap_src_addr, encap_src_addr, sizeof(struct in6_addr));
+}
+
+void zebra_srv6_encap_src_addr_unset(void)
+{
+ struct zebra_srv6 *srv6 = zebra_srv6_get_default();
+
+ memset(&srv6->encap_src_addr, 0, sizeof(struct in6_addr));
+}
+
+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)
{
hook_register(zserv_client_close, zebra_srv6_cleanup);