Thread (7 messages) read the whole thread 7 messages, 3 authors, 2021-08-13

Re: [PATCH net-next v3] ipv6: add IFLA_INET6_RA_MTU to expose mtu value in the RA message

From: David Ahern <hidden>
Date: 2021-08-11 13:57:11
Also in: linux-mediatek, lkml, netdev

On 8/10/21 6:33 AM, Rocco Yue wrote:
On Mon, 2021-08-09 at 16:43 -0600, David Ahern wrote:
quoted
On 8/9/21 8:01 AM, Rocco Yue wrote:
quoted
+
quoted
 #ifdef CONFIG_SYSCTL
 
 static int addrconf_sysctl_forward(struct ctl_table *ctl, int write,
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index c467c6419893..a04164cbd77f 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1496,6 +1496,12 @@ static void ndisc_router_discovery(struct sk_buff *skb)
 		memcpy(&n, ((u8 *)(ndopts.nd_opts_mtu+1))+2, sizeof(mtu));
 		mtu = ntohl(n);
 
+		if (in6_dev->ra_mtu != mtu) {
+			in6_dev->ra_mtu = mtu;
+			inet6_iframtu_notify(in6_dev);
+			ND_PRINTK(2, info, "update ra_mtu to %d\n", in6_dev->ra_mtu);
+		}
+
 		if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu) {
 			ND_PRINTK(2, warn, "RA: invalid mtu: %d\n", mtu);
 		} else if (in6_dev->cnf.mtu6 != mtu) {
Since this MTU is getting reported via af_info infrastructure,
rtmsg_ifinfo should be sufficient.

From there use 'ip monitor' to make sure you are not generating multiple
notifications; you may only need this on the error path.
Hi David,

To avoid generating multiple notifications, I added a separate ramtu notify
function in this patch, and I added RTNLGRP_IPV6_IFINFO nl_mgrp to the ipmonitor.c
to verify this patch was as expected.

I look at the rtmsg_ifinfo code, it should be appropriate and I will use it and
verify it.

But there's one thing, I'm sorry I didn't fully understand the meaning of this
sentence "you may only need this on the error path". Honestly, I'm not sure what
the error patch refers to, do you mean "if (mtu < IPV6_MIN_MTU || mtu > skb->dev->mtu)" ?
looks like nothing under:
    if (ndopts.nd_opts_mtu && in6_dev->cnf.accept_ra_mtu) {

    }

is going to send a link notification so you can just replace
inet6_iframtu_notify with rtmsg_ifinfo in your proposed change.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help