Skip to content

Commit

Permalink
[FRR]: Bring PR FRRouting/frr#16151 from FRR mainline
Browse files Browse the repository at this point in the history
This commit brings PR FRRouting/frr#16151 from FRR mainline to SONiC

zebra: display srv6 encapsulation source-address when configured
FRRouting/frr#16151

Signed-off-by: cscarpitta <cscarpit@cisco.com>
  • Loading branch information
cscarpitta committed Dec 16, 2024
1 parent a94b916 commit bd8afa0
Show file tree
Hide file tree
Showing 5 changed files with 5,689 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From 890b67d7a9eb6ee9cbb6b5623934ad4d0b781232 Mon Sep 17 00:00:00 2001

From: Philippe Guibert <philippe.guibert@6wind.com>

Subject: [PATCH] zebra: display srv6 encapsulation source-address when
configured

The 'show running-config' does not display the ipv6 source address
when a locator is not configured. Fix this by systematically displaying
the ipv6 source address.

Fixes: 6a0956169b31 ("zebra: Add encap source address to SRv6 config write function")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
---
zebra/zebra_srv6_vty.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/zebra/zebra_srv6_vty.c b/zebra/zebra_srv6_vty.c
index c5b850599..d5cd30e64 100644
--- a/zebra/zebra_srv6_vty.c
+++ b/zebra/zebra_srv6_vty.c
@@ -475,16 +475,24 @@ static int zebra_sr_config(struct vty *vty)
struct listnode *node;
struct srv6_locator *locator;
char str[256];
+ bool display_source_srv6 = false;
+
+ if (srv6 && !IPV6_ADDR_SAME(&srv6->encap_src_addr, &in6addr_any))
+ display_source_srv6 = true;

vty_out(vty, "!\n");
- if (zebra_srv6_is_enable()) {
+ if (display_source_srv6 || zebra_srv6_is_enable()) {
vty_out(vty, "segment-routing\n");
vty_out(vty, " srv6\n");
+ }
+ if (display_source_srv6) {
if (!IPV6_ADDR_SAME(&srv6->encap_src_addr, &in6addr_any)) {
vty_out(vty, " encapsulation\n");
vty_out(vty, " source-address %pI6\n",
&srv6->encap_src_addr);
}
+ }
+ if (zebra_srv6_is_enable()) {
vty_out(vty, " locators\n");
for (ALL_LIST_ELEMENTS_RO(srv6->locators, node, locator)) {
inet_ntop(AF_INET6, &locator->prefix.prefix,
@@ -514,6 +522,8 @@ static int zebra_sr_config(struct vty *vty)
vty_out(vty, " !\n");
vty_out(vty, " exit\n");
vty_out(vty, " !\n");
+ }
+ if (display_source_srv6 || zebra_srv6_is_enable()) {
vty_out(vty, "exit\n");
vty_out(vty, "!\n");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 03d2ad01a4fd4aa6df4b1ec64249fb391405a61f Mon Sep 17 00:00:00 2001

From: Philippe Guibert <philippe.guibert@6wind.com>

Subject: [PATCH] lib: fix srv6 locator flags propagated to isis

When usid is not used, the isis_srv6_topo1 test does not work.
The SID prefix allocated by isis is different when the usid
flags is set or not. When the flags is not transmitted to isis,
the SID allocated is supposed to be a 128 bit mask length SID,
which is not what the isis_srv6_topo1 test is supposed to obtain.

Fix this by exchanging the flags locator value in the zclient api.

Fixes: 9b7491e1fc04 ("lib: Add support for flags to the SRv6 locator")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
---
lib/zclient.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/zclient.c b/lib/zclient.c
index 64515c754..269c3e9ba 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -1125,6 +1125,7 @@ int zapi_srv6_locator_encode(struct stream *s, const struct srv6_locator *l)
stream_put(s, l->name, strlen(l->name));
stream_putw(s, l->prefix.prefixlen);
stream_put(s, &l->prefix.prefix, sizeof(l->prefix.prefix));
+ stream_putc(s, l->flags);
return 0;
}

@@ -1140,6 +1141,7 @@ int zapi_srv6_locator_decode(struct stream *s, struct srv6_locator *l)
STREAM_GETW(s, l->prefix.prefixlen);
STREAM_GET(&l->prefix.prefix, s, sizeof(l->prefix.prefix));
l->prefix.family = AF_INET6;
+ STREAM_GETC(s, l->flags);
return 0;

stream_failure:
Loading

0 comments on commit bd8afa0

Please sign in to comment.