summaryrefslogtreecommitdiff
path: root/staticd/static_bfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'staticd/static_bfd.c')
-rw-r--r--staticd/static_bfd.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/staticd/static_bfd.c b/staticd/static_bfd.c
index 78d8c05807..c35751f397 100644
--- a/staticd/static_bfd.c
+++ b/staticd/static_bfd.c
@@ -88,14 +88,15 @@ void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
bool mhop;
int family;
struct ipaddr source;
+ struct vrf *vrf = NULL;
use_interface = false;
- use_source = yang_dnode_exists(dnode, "./source");
- use_profile = yang_dnode_exists(dnode, "./profile");
+ use_source = yang_dnode_exists(dnode, "source");
+ use_profile = yang_dnode_exists(dnode, "profile");
onlink = yang_dnode_exists(dnode, "../onlink") &&
yang_dnode_get_bool(dnode, "../onlink");
- mhop = yang_dnode_get_bool(dnode, "./multi-hop");
-
+ mhop = yang_dnode_get_bool(dnode, "multi-hop");
+ vrf = vrf_lookup_by_name(yang_dnode_get_string(dnode, "../vrf"));
family = static_next_hop_type_to_family(sn);
if (family == AF_UNSPEC)
@@ -111,7 +112,7 @@ void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
/* Configure the session. */
if (use_source)
- yang_dnode_get_ip(&source, dnode, "./source");
+ yang_dnode_get_ip(&source, dnode, "source");
if (onlink || mhop == false)
bfd_sess_set_auto_source(sn->bsp, false);
@@ -133,6 +134,8 @@ void static_next_hop_bfd_monitor_enable(struct static_nexthop *sn,
bfd_sess_set_profile(sn->bsp, use_profile ? yang_dnode_get_string(
dnode, "./profile")
: NULL);
+ if (vrf && vrf->vrf_id != VRF_UNKNOWN)
+ bfd_sess_set_vrf(sn->bsp, vrf->vrf_id);
bfd_sess_set_hop_count(sn->bsp, (onlink || mhop == false) ? 1 : 254);
@@ -260,14 +263,13 @@ static void static_bfd_show_path_json(struct vty *vty, struct json_object *jo,
static void static_bfd_show_json(struct vty *vty)
{
struct json_object *jo, *jo_path, *jo_afi_safi;
- struct vrf *vrf;
+ struct static_vrf *svrf;
jo = json_object_new_object();
jo_path = json_object_new_object();
json_object_object_add(jo, "path-list", jo_path);
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- const struct static_vrf *svrf = vrf->info;
+ RB_FOREACH (svrf, svrf_name_head, &svrfs) {
struct route_table *rt;
jo_afi_safi = json_object_new_array();
@@ -343,7 +345,7 @@ static void static_bfd_show_path(struct vty *vty, struct route_table *rt)
void static_bfd_show(struct vty *vty, bool json)
{
- struct vrf *vrf;
+ struct static_vrf *svrf;
if (json) {
static_bfd_show_json(vty);
@@ -352,21 +354,20 @@ void static_bfd_show(struct vty *vty, bool json)
vty_out(vty, "Showing BFD monitored static routes:\n");
vty_out(vty, "\n Next hops:\n");
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- const struct static_vrf *svrf = vrf->info;
+ RB_FOREACH (svrf, svrf_name_head, &svrfs) {
struct route_table *rt;
- vty_out(vty, " VRF %s IPv4 Unicast:\n", vrf->name);
+ vty_out(vty, " VRF %s IPv4 Unicast:\n", svrf->name);
rt = svrf->stable[AFI_IP][SAFI_UNICAST];
if (rt)
static_bfd_show_path(vty, rt);
- vty_out(vty, "\n VRF %s IPv4 Multicast:\n", vrf->name);
+ vty_out(vty, "\n VRF %s IPv4 Multicast:\n", svrf->name);
rt = svrf->stable[AFI_IP][SAFI_MULTICAST];
if (rt)
static_bfd_show_path(vty, rt);
- vty_out(vty, "\n VRF %s IPv6 Unicast:\n", vrf->name);
+ vty_out(vty, "\n VRF %s IPv6 Unicast:\n", svrf->name);
rt = svrf->stable[AFI_IP6][SAFI_UNICAST];
if (rt)
static_bfd_show_path(vty, rt);