[PATCH net-next v6] ipv6: add IFLA_INET6_RA_MTU to expose mtu value
David Ahern
dsahern at gmail.com
Fri Aug 27 09:41:53 PDT 2021
On 8/27/21 8:04 AM, Rocco Yue wrote:
> The kernel provides a "/proc/sys/net/ipv6/conf/<iface>/mtu"
> file, which can temporarily record the mtu value of the last
> received RA message when the RA mtu value is lower than the
> interface mtu, but this proc has following limitations:
>
> (1) when the interface mtu (/sys/class/net/<iface>/mtu) is
> updeated, mtu6 (/proc/sys/net/ipv6/conf/<iface>/mtu) will
> be updated to the value of interface mtu;
> (2) mtu6 (/proc/sys/net/ipv6/conf/<iface>/mtu) only affect
> ipv6 connection, and not affect ipv4.
>
> Therefore, when the mtu option is carried in the RA message,
> there will be a problem that the user sometimes cannot obtain
> RA mtu value correctly by reading mtu6.
>
> After this patch set, if a RA message carries the mtu option,
> you can send a netlink msg which nlmsg_type is RTM_GETLINK,
> and then by parsing the attribute of IFLA_INET6_RA_MTU to
> get the mtu value carried in the RA message received on the
> inet6 device. In addition, you can also get a link notification
> when ra_mtu is updated so it doesn't have to poll.
>
> In this way, if the MTU values that the device receives from
> the network in the PCO IPv4 and the RA IPv6 procedures are
> different, the user can obtain the correct ipv6 ra_mtu value
> and compare the value of ra_mtu and ipv4 mtu, then the device
> can use the lower MTU value for both IPv4 and IPv6.
>
> Signed-off-by: Rocco Yue <rocco.yue at mediatek.com>
> ---
> include/net/if_inet6.h | 2 ++
> include/uapi/linux/if_link.h | 1 +
> net/ipv6/addrconf.c | 10 ++++++++++
> net/ipv6/ndisc.c | 17 +++++++++++------
> tools/include/uapi/linux/if_link.h | 1 +
> 5 files changed, 25 insertions(+), 6 deletions(-)
>
Reviewed-by: David Ahern <dsahern at kernel.org>
More information about the linux-arm-kernel
mailing list