summaryrefslogtreecommitdiff
path: root/zebra/zebra_srv6.c
diff options
context:
space:
mode:
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>2022-11-03 08:40:23 +0100
committerCarmine Scarpitta <cscarpit@cisco.com>2023-12-14 14:58:33 +0100
commit69bff19c43c8f263aeb0fb3211ee0e3faf37ec5c (patch)
treeedf4dc0473e770e6927e27db93c1168326678caa /zebra/zebra_srv6.c
parent8d0b4745a1acd5e363159a1b9732a0fd596413e5 (diff)
zebra, lib, vtysh: Add CLI cmd to set/unset SRv6 encap source address
- Add a new node `SRV6_ENCAP_NODE` to the CLI graph. This node allows users to configure encapsulation parameters for SRv6, including the source address of the outer encapsulating IPv6 header. - Install a new CLI command `source-address` under the `SRV6_ENCAP_NODE` node. This command is used to configure the source address of the outer encapsulating IPv6 header. - Install a new CLI command `no source-address` under the `SRV6_ENCAP_NODE` node. This command is used to unset the source address of the outer encapsulating IPv6 header and restore the default source address. Examples: ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# source-address fc00:0:1::1 ``` ``` router# segment-routing router(sr)# srv6 router(srv6)# encapsulation router(srv6-encap)# no source-address ``` Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
Diffstat (limited to 'zebra/zebra_srv6.c')
-rw-r--r--zebra/zebra_srv6.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/zebra/zebra_srv6.c b/zebra/zebra_srv6.c
index ee463c76a8..adc7d32aae 100644
--- a/zebra/zebra_srv6.c
+++ b/zebra/zebra_srv6.c
@@ -409,6 +409,23 @@ 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;