summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yang/frr-zebra.yang11
-rw-r--r--zebra/rtadv.c33
-rw-r--r--zebra/zebra_nb.c6
-rw-r--r--zebra/zebra_nb.h2
-rw-r--r--zebra/zebra_nb_config.c23
5 files changed, 53 insertions, 22 deletions
diff --git a/yang/frr-zebra.yang b/yang/frr-zebra.yang
index 04f4023da6..1a00b84ed3 100644
--- a/yang/frr-zebra.yang
+++ b/yang/frr-zebra.yang
@@ -2342,6 +2342,17 @@ module frr-zebra {
"RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
- AdvOtherConfigFlag";
}
+ leaf link-mtu {
+ type uint32;
+ default "0";
+ description
+ "The value to be placed in MTU options sent by the
+ router. A value of zero indicates that no MTU options
+ are sent.";
+ reference
+ "RFC 4861: Neighbor Discovery for IP version 6 (IPv6)
+ - AdvLinkMTU";
+ }
leaf reachable-time {
type uint32 {
range "0..3600000";
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index fed6db4ddf..6bc1d5aded 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -2090,34 +2090,24 @@ DEFUN (no_ipv6_nd_router_preference,
return CMD_SUCCESS;
}
-DEFUN (ipv6_nd_mtu,
+DEFPY_YANG (ipv6_nd_mtu,
ipv6_nd_mtu_cmd,
- "ipv6 nd mtu (1-65535)",
- "Interface IPv6 config commands\n"
- "Neighbor discovery\n"
- "Advertised MTU\n"
- "MTU in bytes\n")
-{
- int idx_number = 3;
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct zebra_if *zif = ifp->info;
- zif->rtadv.AdvLinkMTU = strtoul(argv[idx_number]->arg, NULL, 10);
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ipv6_nd_mtu,
- no_ipv6_nd_mtu_cmd,
- "no ipv6 nd mtu [(1-65535)]",
+ "[no] ipv6 nd mtu ![(1-65535)]",
NO_STR
"Interface IPv6 config commands\n"
"Neighbor discovery\n"
"Advertised MTU\n"
"MTU in bytes\n")
{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct zebra_if *zif = ifp->info;
- zif->rtadv.AdvLinkMTU = 0;
- return CMD_SUCCESS;
+ if (!no)
+ nb_cli_enqueue_change(vty,
+ "./frr-zebra:zebra/ipv6-router-advertisements/link-mtu",
+ NB_OP_MODIFY, mtu_str);
+ else
+ nb_cli_enqueue_change(vty,
+ "./frr-zebra:zebra/ipv6-router-advertisements/link-mtu",
+ NB_OP_DESTROY, NULL);
+ return nb_cli_apply_changes(vty, NULL);
}
static struct rtadv_rdnss *rtadv_rdnss_new(void)
@@ -2798,7 +2788,6 @@ void rtadv_cmd_init(void)
install_element(INTERFACE_NODE, &ipv6_nd_router_preference_cmd);
install_element(INTERFACE_NODE, &no_ipv6_nd_router_preference_cmd);
install_element(INTERFACE_NODE, &ipv6_nd_mtu_cmd);
- install_element(INTERFACE_NODE, &no_ipv6_nd_mtu_cmd);
install_element(INTERFACE_NODE, &ipv6_nd_rdnss_cmd);
install_element(INTERFACE_NODE, &no_ipv6_nd_rdnss_cmd);
install_element(INTERFACE_NODE, &ipv6_nd_dnssl_cmd);
diff --git a/zebra/zebra_nb.c b/zebra/zebra_nb.c
index f3f7d4b8f5..380f239b36 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/link-mtu",
+ .cbs = {
+ .modify = lib_interface_zebra_ipv6_router_advertisements_link_mtu_modify,
+ }
+ },
+ {
.xpath = "/frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/reachable-time",
.cbs = {
.modify = lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify,
diff --git a/zebra/zebra_nb.h b/zebra/zebra_nb.h
index 65a7a4b7a1..f1efa99f73 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_link_mtu_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(
diff --git a/zebra/zebra_nb_config.c b/zebra/zebra_nb_config.c
index ef6ea012df..91ed6f5e1e 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/link-mtu
+ */
+int lib_interface_zebra_ipv6_router_advertisements_link_mtu_modify(
+ struct nb_cb_modify_args *args)
+{
+ struct interface *ifp;
+ struct zebra_if *zif;
+ uint32_t mtu;
+
+ if (args->event != NB_EV_APPLY)
+ return NB_OK;
+
+ ifp = nb_running_get_entry(args->dnode, NULL, true);
+ zif = ifp->info;
+
+ mtu = yang_dnode_get_uint32(args->dnode, NULL);
+
+ zif->rtadv.AdvLinkMTU = mtu;
+
+ return NB_OK;
+}
+
+/*
* XPath: /frr-interface:lib/interface/frr-zebra:zebra/ipv6-router-advertisements/reachable-time
*/
int lib_interface_zebra_ipv6_router_advertisements_reachable_time_modify(