From: Igor Ryzhov Date: Thu, 24 Sep 2020 17:43:38 +0000 (+0300) Subject: bfdd: use * as a placeholder for an empty interface name in northbound X-Git-Tag: base_7.6~492^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=4ec8e74bd97e577fdc524088797acf94cbcb15fd;p=mirror%2Ffrr.git bfdd: use * as a placeholder for an empty interface name in northbound Signed-off-by: Igor Ryzhov --- diff --git a/bfdd/bfd.c b/bfdd/bfd.c index c16912060c..b5c029aedf 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -2178,7 +2178,7 @@ void bfd_session_update_vrf_name(struct bfd_session *bs, struct vrf *vrf) "[interface='%s']", bs->key.ifname); else slen += snprintf(xpath + slen, sizeof(xpath) - slen, - "[interface='']"); + "[interface='*']"); snprintf(xpath + slen, sizeof(xpath) - slen, "[vrf='%s']/vrf", bs->key.vrfname); diff --git a/bfdd/bfdd_cli.c b/bfdd/bfdd_cli.c index d115684b1c..ddec83397d 100644 --- a/bfdd/bfdd_cli.c +++ b/bfdd/bfdd_cli.c @@ -127,7 +127,7 @@ DEFPY_YANG_NOSH( "[interface='%s']", ifname); else slen += snprintf(xpath + slen, sizeof(xpath) - slen, - "[interface='']"); + "[interface='*']"); if (vrf) snprintf(xpath + slen, sizeof(xpath) - slen, "[vrf='%s']", vrf); else @@ -185,7 +185,7 @@ DEFPY_YANG( "[interface='%s']", ifname); else slen += snprintf(xpath + slen, sizeof(xpath) - slen, - "[interface='']"); + "[interface='*']"); if (vrf) snprintf(xpath + slen, sizeof(xpath) - slen, "[vrf='%s']", vrf); else @@ -218,7 +218,7 @@ static void _bfd_cli_show_peer(struct vty *vty, struct lyd_node *dnode, if (strcmp(vrf, VRF_DEFAULT_NAME)) vty_out(vty, " vrf %s", vrf); - if (ifname[0]) + if (strcmp(ifname, "*")) vty_out(vty, " interface %s", ifname); vty_out(vty, "\n"); diff --git a/bfdd/bfdd_nb_config.c b/bfdd/bfdd_nb_config.c index b34e06d230..fe6a0b7905 100644 --- a/bfdd/bfdd_nb_config.c +++ b/bfdd/bfdd_nb_config.c @@ -48,6 +48,9 @@ static void bfd_session_get_key(bool mhop, const struct lyd_node *dnode, ifname = yang_dnode_get_string(dnode, "./interface"); vrfname = yang_dnode_get_string(dnode, "./vrf"); + if (strcmp(ifname, "*") == 0) + ifname = NULL; + /* Generate the corresponding key. */ gen_bfd_key(bk, &psa, &lsa, mhop, ifname, vrfname); } @@ -72,7 +75,7 @@ static int bfd_session_create(enum nb_event event, const struct lyd_node *dnode, ifname = yang_dnode_get_string(dnode, "./interface"); if (p.family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&p.u.prefix6) - && strlen(ifname) == 0) { + && strcmp(ifname, "*") == 0) { zlog_warn( "%s: when using link-local you must specify an interface.", __func__);