diff options
| -rw-r--r-- | yang/frr-zebra.yang | 9 | ||||
| -rw-r--r-- | zebra/rtadv.c | 39 | ||||
| -rw-r--r-- | zebra/zebra_nb.c | 6 | ||||
| -rw-r--r-- | zebra/zebra_nb.h | 2 | ||||
| -rw-r--r-- | zebra/zebra_nb_config.c | 23 |
5 files changed, 52 insertions, 27 deletions
diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang index 0e4b5a129f..f60b325d1e 100644 --- a/yang/frr-zebra.yang +++ b/yang/frr-zebra.yang @@ -2440,6 +2440,15 @@ module frr-zebra { more frequently than once every 3 seconds as required by RFC 4861."; } + leaf advertisement-interval-option { + type boolean; + default "false"; + description + "Enable sending the Advertisement Interval Option in + Router Advertisements."; + reference + "RFC 6275: Mobility Support in IPv6"; + } } container state { config false; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 38e4a38209..96c7773b6a 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1781,35 +1781,23 @@ DEFPY_YANG (ipv6_nd_homeagent_config_flag, return nb_cli_apply_changes(vty, NULL); } -DEFUN (ipv6_nd_adv_interval_config_option, +DEFPY_YANG (ipv6_nd_adv_interval_config_option, ipv6_nd_adv_interval_config_option_cmd, - "ipv6 nd adv-interval-option", - "Interface IPv6 config commands\n" - "Neighbor discovery\n" - "Advertisement Interval Option\n") -{ - VTY_DECLVAR_CONTEXT(interface, ifp); - struct zebra_if *zif = ifp->info; - - zif->rtadv.AdvIntervalOption = 1; - - return CMD_SUCCESS; -} - -DEFUN (no_ipv6_nd_adv_interval_config_option, - no_ipv6_nd_adv_interval_config_option_cmd, - "no ipv6 nd adv-interval-option", + "[no] ipv6 nd adv-interval-option", NO_STR "Interface IPv6 config commands\n" "Neighbor discovery\n" "Advertisement Interval Option\n") { - VTY_DECLVAR_CONTEXT(interface, ifp); - struct zebra_if *zif = ifp->info; - - zif->rtadv.AdvIntervalOption = 0; - - return CMD_SUCCESS; + if (!no) + nb_cli_enqueue_change(vty, + "./frr-zebra:zebra/ipv6-router-advertisements/advertisement-interval-option", + NB_OP_MODIFY, "true"); + else + nb_cli_enqueue_change(vty, + "./frr-zebra:zebra/ipv6-router-advertisements/advertisement-interval-option", + NB_OP_DESTROY, NULL); + return nb_cli_apply_changes(vty, NULL); } DEFPY_YANG (ipv6_nd_other_config_flag, @@ -2689,10 +2677,7 @@ void rtadv_cmd_init(void) install_element(INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_cmd); install_element(INTERFACE_NODE, &ipv6_nd_homeagent_lifetime_cmd); install_element(INTERFACE_NODE, &no_ipv6_nd_homeagent_lifetime_cmd); - install_element(INTERFACE_NODE, - &ipv6_nd_adv_interval_config_option_cmd); - install_element(INTERFACE_NODE, - &no_ipv6_nd_adv_interval_config_option_cmd); + install_element(INTERFACE_NODE, &ipv6_nd_adv_interval_config_option_cmd); install_element(INTERFACE_NODE, &ipv6_nd_prefix_cmd); install_element(INTERFACE_NODE, &no_ipv6_nd_prefix_cmd); install_element(INTERFACE_NODE, &ipv6_nd_router_preference_cmd); diff --git a/zebra/zebra_nb.c b/zebra/zebra_nb.c index 53a7fae6be..748c791f8e 100644 --- a/zebra/zebra_nb.c +++ b/zebra/zebra_nb.c @@ -615,6 +615,12 @@ const struct frr_yang_module_info frr_zebra_info = { } }, { + .xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/advertisement-interval-option", + .cbs = { + .modify = lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_modify, + } + }, + { .xpath = "/frr-interface:lib/interface/frr-zebra:zebra/state/up-count", .cbs = { .get_elem = lib_interface_zebra_state_up_count_get_elem, diff --git a/zebra/zebra_nb.h b/zebra/zebra_nb.h index f5c70b0887..aaddfaac36 100644 --- a/zebra/zebra_nb.h +++ b/zebra/zebra_nb.h @@ -207,6 +207,8 @@ int lib_interface_zebra_ipv6_router_advertisements_default_lifetime_destroy( struct nb_cb_destroy_args *args); int lib_interface_zebra_ipv6_router_advertisements_fast_retransmit_modify( struct nb_cb_modify_args *args); +int lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_modify( + struct nb_cb_modify_args *args); struct yang_data * lib_interface_zebra_state_up_count_get_elem(struct nb_cb_get_elem_args *args); struct yang_data * diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c index edd2e68881..07cdf7f239 100644 --- a/zebra/zebra_nb_config.c +++ b/zebra/zebra_nb_config.c @@ -2744,6 +2744,29 @@ int lib_interface_zebra_ipv6_router_advertisements_fast_retransmit_modify( } /* + * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/advertisement-interval-option + */ +int lib_interface_zebra_ipv6_router_advertisements_advertisement_interval_option_modify( + struct nb_cb_modify_args *args) +{ + struct interface *ifp; + struct zebra_if *zif; + bool option; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + ifp = nb_running_get_entry(args->dnode, NULL, true); + zif = ifp->info; + + option = yang_dnode_get_bool(args->dnode, NULL); + + zif->rtadv.AdvIntervalOption = !!option; + + return NB_OK; +} + +/* * XPath: /frr-vrf:lib/vrf/frr-zebra:zebra/l3vni-id */ int lib_vrf_zebra_l3vni_id_modify(struct nb_cb_modify_args *args) |
