From 284062bf1776cf544749c36a57096a138fe4bffb Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 8 Jul 2019 15:56:56 -0300 Subject: [PATCH] bfdd: keep source information for single hop Add source address to northbound when creating sessions with this information. It is not possible to change source address after the session was created, but we should be able to set it to make IPv6 work. Spotted by Philippe Guibert. Signed-off-by: Rafael Zalamena --- bfdd/bfdd_cli.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bfdd/bfdd_cli.c b/bfdd/bfdd_cli.c index c2c3040ebc..acb1801cc4 100644 --- a/bfdd/bfdd_cli.c +++ b/bfdd/bfdd_cli.c @@ -108,8 +108,8 @@ DEFPY_NOSH( VRF_NAME_STR) { int ret, slen; - char xpath[XPATH_MAXLEN]; char source_str[INET6_ADDRSTRLEN]; + char xpath[XPATH_MAXLEN], xpath_srcaddr[XPATH_MAXLEN + 32]; if (multihop) snprintf(source_str, sizeof(source_str), "[source-addr='%s']", @@ -134,6 +134,12 @@ DEFPY_NOSH( VRF_DEFAULT_NAME); nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL); + if (multihop == NULL && local_address_str != NULL) { + snprintf(xpath_srcaddr, sizeof(xpath_srcaddr), + "%s/source-addr", xpath); + nb_cli_enqueue_change(vty, xpath_srcaddr, NB_OP_MODIFY, + local_address_str); + } /* Apply settings immediately. */ ret = nb_cli_apply_changes(vty, NULL); -- 2.39.5