staticd: handle distance value

Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
Christian Hopps 2023-02-27 23:57:17 -05:00 committed by Christian Hopps
parent f637ac0170
commit 1462450eaa

View File

@ -285,8 +285,7 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
nb_cli_enqueue_change(vty, ab_xpath,
NB_OP_MODIFY, "false");
}
if (type == STATIC_IPV4_GATEWAY
|| type == STATIC_IPV6_GATEWAY
if (type == STATIC_IPV4_GATEWAY || type == STATIC_IPV6_GATEWAY
|| type == STATIC_IPV4_GATEWAY_IFNAME
|| type == STATIC_IPV6_GATEWAY_IFNAME) {
strlcpy(ab_xpath, xpath_nexthop, sizeof(ab_xpath));
@ -368,25 +367,52 @@ static int static_route_nb_run(struct vty *vty, struct static_route_args *args)
ret = nb_cli_apply_changes(vty, "%s", xpath_prefix);
} else {
if (args->source)
snprintf(ab_xpath, sizeof(ab_xpath),
FRR_DEL_S_ROUTE_SRC_NH_KEY_NO_DISTANCE_XPATH,
"frr-staticd:staticd", "staticd", args->vrf,
buf_prefix,
yang_afi_safi_value2identity(args->afi,
args->safi),
buf_src_prefix, table_id, buf_nh_type,
args->nexthop_vrf, buf_gate_str,
args->interface_name);
else
snprintf(ab_xpath, sizeof(ab_xpath),
FRR_DEL_S_ROUTE_NH_KEY_NO_DISTANCE_XPATH,
"frr-staticd:staticd", "staticd", args->vrf,
buf_prefix,
yang_afi_safi_value2identity(args->afi,
args->safi),
table_id, buf_nh_type, args->nexthop_vrf,
buf_gate_str, args->interface_name);
if (args->source) {
if (args->distance)
snprintf(
ab_xpath, sizeof(ab_xpath),
FRR_DEL_S_ROUTE_SRC_NH_KEY_XPATH,
"frr-staticd:staticd", "staticd", args->vrf,
buf_prefix,
yang_afi_safi_value2identity(args->afi,
args->safi),
buf_src_prefix, table_id, distance,
buf_nh_type, args->nexthop_vrf, buf_gate_str,
args->interface_name);
else
snprintf(
ab_xpath, sizeof(ab_xpath),
FRR_DEL_S_ROUTE_SRC_NH_KEY_NO_DISTANCE_XPATH,
"frr-staticd:staticd", "staticd", args->vrf,
buf_prefix,
yang_afi_safi_value2identity(args->afi,
args->safi),
buf_src_prefix, table_id, buf_nh_type,
args->nexthop_vrf, buf_gate_str,
args->interface_name);
} else {
if (args->distance)
snprintf(
ab_xpath, sizeof(ab_xpath),
FRR_DEL_S_ROUTE_NH_KEY_XPATH,
"frr-staticd:staticd", "staticd",
args->vrf, buf_prefix,
yang_afi_safi_value2identity(args->afi,
args->safi),
table_id, distance, buf_nh_type,
args->nexthop_vrf, buf_gate_str,
args->interface_name);
else
snprintf(
ab_xpath, sizeof(ab_xpath),
FRR_DEL_S_ROUTE_NH_KEY_NO_DISTANCE_XPATH,
"frr-staticd:staticd", "staticd",
args->vrf, buf_prefix,
yang_afi_safi_value2identity(args->afi,
args->safi),
table_id, buf_nh_type, args->nexthop_vrf,
buf_gate_str, args->interface_name);
}
dnode = yang_dnode_get(vty->candidate_config->dnode, ab_xpath);
if (!dnode) {