diff options
| -rw-r--r-- | yang/frr-zebra.yang | 9 | ||||
| -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 | 23 | 
5 files changed, 51 insertions, 24 deletions
diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang index df8439d118..0e4b5a129f 100644 --- a/yang/frr-zebra.yang +++ b/yang/frr-zebra.yang @@ -2342,6 +2342,15 @@ module frr-zebra {              "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)                         - AdvOtherConfigFlag";          } +        leaf home-agent-flag { +          type boolean; +          default "false"; +          description +            "The value to be placed in the 'Home Agent' +            flag field in the Router Advertisement."; +          reference +            "RFC 6275: Mobility Support in IPv6"; +        }          leaf link-mtu {            type uint32;            default "0"; diff --git a/zebra/rtadv.c b/zebra/rtadv.c index ee19c19aa5..38e4a38209 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -1762,35 +1762,23 @@ DEFPY_YANG (ipv6_nd_managed_config_flag,  	return nb_cli_apply_changes(vty, NULL);  } -DEFUN (ipv6_nd_homeagent_config_flag, +DEFPY_YANG (ipv6_nd_homeagent_config_flag,         ipv6_nd_homeagent_config_flag_cmd, -       "ipv6 nd home-agent-config-flag", -       "Interface IPv6 config commands\n" -       "Neighbor discovery\n" -       "Home Agent configuration flag\n") -{ -	VTY_DECLVAR_CONTEXT(interface, ifp); -	struct zebra_if *zif = ifp->info; - -	zif->rtadv.AdvHomeAgentFlag = 1; - -	return CMD_SUCCESS; -} - -DEFUN (no_ipv6_nd_homeagent_config_flag, -       no_ipv6_nd_homeagent_config_flag_cmd, -       "no ipv6 nd home-agent-config-flag", +       "[no] ipv6 nd home-agent-config-flag",         NO_STR         "Interface IPv6 config commands\n"         "Neighbor discovery\n"         "Home Agent configuration flag\n")  { -	VTY_DECLVAR_CONTEXT(interface, ifp); -	struct zebra_if *zif = ifp->info; - -	zif->rtadv.AdvHomeAgentFlag = 0; - -	return CMD_SUCCESS; +	if (!no) +		nb_cli_enqueue_change(vty, +				      "./frr-zebra:zebra/ipv6-router-advertisements/home-agent-flag", +				      NB_OP_MODIFY, "true"); +	else +		nb_cli_enqueue_change(vty, +				      "./frr-zebra:zebra/ipv6-router-advertisements/home-agent-flag", +				      NB_OP_DESTROY, NULL); +	return nb_cli_apply_changes(vty, NULL);  }  DEFUN (ipv6_nd_adv_interval_config_option, @@ -2697,7 +2685,6 @@ void rtadv_cmd_init(void)  	install_element(INTERFACE_NODE, &ipv6_nd_managed_config_flag_cmd);  	install_element(INTERFACE_NODE, &ipv6_nd_other_config_flag_cmd);  	install_element(INTERFACE_NODE, &ipv6_nd_homeagent_config_flag_cmd); -	install_element(INTERFACE_NODE, &no_ipv6_nd_homeagent_config_flag_cmd);  	install_element(INTERFACE_NODE, &ipv6_nd_homeagent_preference_cmd);  	install_element(INTERFACE_NODE, &no_ipv6_nd_homeagent_preference_cmd);  	install_element(INTERFACE_NODE, &ipv6_nd_homeagent_lifetime_cmd); diff --git a/zebra/zebra_nb.c b/zebra/zebra_nb.c index 7fb8d03d52..53a7fae6be 100644 --- a/zebra/zebra_nb.c +++ b/zebra/zebra_nb.c @@ -571,6 +571,12 @@ const struct frr_yang_module_info frr_zebra_info = {  			}  		},  		{ +			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/home-agent-flag", +			.cbs = { +				.modify = lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_modify, +			} +		}, +		{  			.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/link-mtu",  			.cbs = {  				.modify = lib_interface_zebra_ipv6_router_advertisements_link_mtu_modify, diff --git a/zebra/zebra_nb.h b/zebra/zebra_nb.h index e3735245b9..f5c70b0887 100644 --- a/zebra/zebra_nb.h +++ b/zebra/zebra_nb.h @@ -189,6 +189,8 @@ int lib_interface_zebra_ipv6_router_advertisements_managed_flag_modify(  	struct nb_cb_modify_args *args);  int lib_interface_zebra_ipv6_router_advertisements_other_config_flag_modify(  	struct nb_cb_modify_args *args); +int lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_modify( +	struct nb_cb_modify_args *args);  int lib_interface_zebra_ipv6_router_advertisements_link_mtu_modify(  	struct nb_cb_modify_args *args);  int lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify( diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c index 7d765728ce..edd2e68881 100644 --- a/zebra/zebra_nb_config.c +++ b/zebra/zebra_nb_config.c @@ -2552,6 +2552,29 @@ int lib_interface_zebra_ipv6_router_advertisements_other_config_flag_modify(  }  /* + * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/home-agent-flag + */ +int lib_interface_zebra_ipv6_router_advertisements_home_agent_flag_modify( +	struct nb_cb_modify_args *args) +{ +	struct interface *ifp; +	struct zebra_if *zif; +	bool home_agent_flag; + +	if (args->event != NB_EV_APPLY) +		return NB_OK; + +	ifp = nb_running_get_entry(args->dnode, NULL, true); +	zif = ifp->info; + +	home_agent_flag = yang_dnode_get_bool(args->dnode, NULL); + +	zif->rtadv.AdvHomeAgentFlag = !!home_agent_flag; + +	return NB_OK; +} + +/*   * XPath: /frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/link-mtu   */  int lib_interface_zebra_ipv6_router_advertisements_link_mtu_modify(  | 
