diff options
| -rw-r--r-- | yang/frr-zebra.yang | 14 | ||||
| -rw-r--r-- | zebra/rtadv.c | 35 | ||||
| -rw-r--r-- | zebra/zebra_nb.c | 6 | ||||
| -rw-r--r-- | zebra/zebra_nb.h | 2 | ||||
| -rw-r--r-- | zebra/zebra_nb_config.c | 22 |
5 files changed, 55 insertions, 24 deletions
diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang index 054192bb16..c105836a06 100644 --- a/yang/frr-zebra.yang +++ b/yang/frr-zebra.yang @@ -2321,6 +2321,20 @@ module frr-zebra { RFC 6275: Mobility Support in IPv6"; } */ + leaf reachable-time { + type uint32 { + range "0..3600000"; + } + units "milliseconds"; + default "0"; + description + "The value to be placed in the Reachable Time field in + the Router Advertisement messages sent by the router. + A value of zero means unspecified (by this router)."; + reference + "RFC 4861: Neighbor Discovery for IP version 6 (IPv6) + - AdvReachableTime"; + } leaf default-lifetime { type uint16 { range "0..9000"; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index fb8ebae550..a726a2f03a 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1732,36 +1732,24 @@ DEFPY_YANG (ipv6_nd_ra_lifetime, return nb_cli_apply_changes(vty, NULL); } -DEFUN (ipv6_nd_reachable_time, +DEFPY_YANG (ipv6_nd_reachable_time, ipv6_nd_reachable_time_cmd, - "ipv6 nd reachable-time (1-3600000)", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Reachable time\n" - "Reachable time in milliseconds\n") -{ - int idx_number = 3; - VTY_DECLVAR_CONTEXT(interface, ifp); - struct zebra_if *zif = ifp->info; - zif->rtadv.AdvReachableTime = strtoul(argv[idx_number]->arg, NULL, 10); - return CMD_SUCCESS; -} - -DEFUN (no_ipv6_nd_reachable_time, - no_ipv6_nd_reachable_time_cmd, - "no ipv6 nd reachable-time [(1-3600000)]", + "[no] ipv6 nd reachable-time ![(1-3600000)$msec]", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" "Reachable time\n" "Reachable time in milliseconds\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct zebra_if *zif = ifp->info; - - zif->rtadv.AdvReachableTime = 0; - - return CMD_SUCCESS; + if (!no) + nb_cli_enqueue_change(vty, + "./frr-zebra:zebra/ipv6-router-advertisements/reachable-time", + NB_OP_MODIFY, msec_str); + else + nb_cli_enqueue_change(vty, + "./frr-zebra:zebra/ipv6-router-advertisements/reachable-time", + NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); } DEFUN (ipv6_nd_homeagent_preference, @@ -2817,7 +2805,6 @@ void rtadv_cmd_init(void) install_element(INTERFACE_NODE, &ipv6_nd_ra_interval_cmd); install_element(INTERFACE_NODE, &ipv6_nd_ra_lifetime_cmd); install_element(INTERFACE_NODE, &ipv6_nd_reachable_time_cmd); - install_element(INTERFACE_NODE, &no_ipv6_nd_reachable_time_cmd); install_element(INTERFACE_NODE, &ipv6_nd_managed_config_flag_cmd); install_element(INTERFACE_NODE, &no_ipv6_nd_managed_config_flag_cmd); install_element(INTERFACE_NODE, &ipv6_nd_other_config_flag_cmd); diff --git a/zebra/zebra_nb.c b/zebra/zebra_nb.c index 82aebda8ae..4b3f27db59 100644 --- a/zebra/zebra_nb.c +++ b/zebra/zebra_nb.c @@ -559,6 +559,12 @@ const struct frr_yang_module_info frr_zebra_info = { } }, { + .xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/reachable-time", + .cbs = { + .modify = lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify, + } + }, + { .xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/default-lifetime", .cbs = { .modify = lib_interface_zebra_ipv6_router_advertisements_default_lifetime_modify, diff --git a/zebra/zebra_nb.h b/zebra/zebra_nb.h index a7b6797b63..f4f66516de 100644 --- a/zebra/zebra_nb.h +++ b/zebra/zebra_nb.h @@ -185,6 +185,8 @@ int lib_interface_zebra_ipv6_router_advertisements_send_advertisements_modify( struct nb_cb_modify_args *args); int lib_interface_zebra_ipv6_router_advertisements_max_rtr_adv_interval_modify( struct nb_cb_modify_args *args); +int lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify( + struct nb_cb_modify_args *args); int lib_interface_zebra_ipv6_router_advertisements_default_lifetime_modify( struct nb_cb_modify_args *args); int lib_interface_zebra_ipv6_router_advertisements_default_lifetime_destroy( diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c index f0d4faaf84..5cd293e38f 100644 --- a/zebra/zebra_nb_config.c +++ b/zebra/zebra_nb_config.c @@ -2506,6 +2506,28 @@ int lib_interface_zebra_ipv6_router_advertisements_max_rtr_adv_interval_modify( } /* + * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/reachable-time + */ +int lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify( + struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct zebra_if *zif; + uint32_t time; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + ifp = nb_running_get_entry(args->dnode, NULL, true); + zif = ifp->info; + time = yang_dnode_get_uint32(args->dnode, NULL); + + zif->rtadv.AdvReachableTime = time; + + return NB_OK; +} + +/* * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/default-lifetime */ int lib_interface_zebra_ipv6_router_advertisements_default_lifetime_modify( |
