diff options
author | Christian Hopps <chopps@labn.net> | 2023-02-28 05:57:17 +0100 |
---|---|---|
committer | Christian Hopps <chopps@gmail.com> | 2023-03-22 06:22:56 +0100 |
commit | 1462450eaa75476d63313bbab4377614fb0d7998 (patch) | |
tree | 2feef686c6f219cb4b9ffc1cb22b20cfa2a0aa8e /staticd | |
parent | tests: Add topotests for MGMT daemon (diff) | |
download | frr-1462450eaa75476d63313bbab4377614fb0d7998.tar.xz frr-1462450eaa75476d63313bbab4377614fb0d7998.zip |
staticd: handle `distance` value
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'staticd')
-rw-r--r-- | staticd/static_vty.c | 68 |
1 files changed, 47 insertions, 21 deletions
diff --git a/staticd/static_vty.c b/staticd/static_vty.c index bfffbe6a6..2761b63e8 100644 --- a/staticd/static_vty.c +++ b/staticd/static_vty.c @@ -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) { |