From: Rafael Zalamena Date: Mon, 8 Jul 2019 18:56:56 +0000 (-0300) Subject: bfdd: keep source information for single hop X-Git-Tag: base_7.2~144^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F4437%2Fhead;p=mirror%2Ffrr.git 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 --- 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);