Skip to content

Commit 890b67d

Browse files
committed
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: 6a09561 ("zebra: Add encap source address to SRv6 config write function") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
1 parent 41eb068 commit 890b67d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

zebra/zebra_srv6_vty.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,16 +475,24 @@ static int zebra_sr_config(struct vty *vty)
475475
struct listnode *node;
476476
struct srv6_locator *locator;
477477
char str[256];
478+
bool display_source_srv6 = false;
479+
480+
if (srv6 && !IPV6_ADDR_SAME(&srv6->encap_src_addr, &in6addr_any))
481+
display_source_srv6 = true;
478482

479483
vty_out(vty, "!\n");
480-
if (zebra_srv6_is_enable()) {
484+
if (display_source_srv6 || zebra_srv6_is_enable()) {
481485
vty_out(vty, "segment-routing\n");
482486
vty_out(vty, " srv6\n");
487+
}
488+
if (display_source_srv6) {
483489
if (!IPV6_ADDR_SAME(&srv6->encap_src_addr, &in6addr_any)) {
484490
vty_out(vty, " encapsulation\n");
485491
vty_out(vty, " source-address %pI6\n",
486492
&srv6->encap_src_addr);
487493
}
494+
}
495+
if (zebra_srv6_is_enable()) {
488496
vty_out(vty, " locators\n");
489497
for (ALL_LIST_ELEMENTS_RO(srv6->locators, node, locator)) {
490498
inet_ntop(AF_INET6, &locator->prefix.prefix,
@@ -514,6 +522,8 @@ static int zebra_sr_config(struct vty *vty)
514522
vty_out(vty, " !\n");
515523
vty_out(vty, " exit\n");
516524
vty_out(vty, " !\n");
525+
}
526+
if (display_source_srv6 || zebra_srv6_is_enable()) {
517527
vty_out(vty, "exit\n");
518528
vty_out(vty, "!\n");
519529
}

0 commit comments

Comments
 (0)