From: netdev-bot+sashiko@kernel.org
To: omar@blockcast.net
Cc: ap420073@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
shuah@kernel.org, horms@kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 10/13] amt: add netlink attributes for an IPv6 outer transport
Date: Sat, 10 Oct 2026 12:41:34 +0000 [thread overview]
Message-ID: <179163609435.434549.4433701408065399687@kernel.org> (raw)
In-Reply-To: <20261009122426.551178-11-omar@blockcast.net>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] This patch makes amt_validate() reject a 16-byte
IFLA_AMT_LOCAL_IP for every device, and a 16-byte…
--
amt: add netlink attributes for an IPv6 outer transport
This adds IFLA_AMT_LOCAL_IP6, IFLA_AMT_DISCOVERY_IP6 and
IFLA_AMT_REMOTE_IP6, so a device with an IPv6 outer transport can be
created and reported. It also makes amt_validate() refuse a 16-byte
IFLA_AMT_LOCAL_IP, and a 16-byte IFLA_AMT_DISCOVERY_IP on a gateway.
Until now the IPv4 policy accepted such values and truncated them.
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 86f168cb222c5..fb199d98d29d4 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -3524,8 +3525,25 @@ static const struct nla_policy amt_policy[IFLA_AMT_MAX + 1] = {
> [IFLA_AMT_REMOTE_IP] = { .len = sizeof_field(struct iphdr, daddr) },
> [IFLA_AMT_DISCOVERY_IP] = { .len = sizeof_field(struct iphdr, daddr) },
> [IFLA_AMT_MAX_TUNNELS] = { .type = NLA_U32 },
[ ... ]
> };
>
> +/* The policy of the IPv4 address attributes only sets a minimum length,
> + * and an iproute2 without IPv6 AMT support puts an IPv6 literal in them,
> + * so the device would take the first four bytes of it as its address.
> + */
> +static bool amt_ip6_in_ip4_attr(const struct nlattr *attr,
> + struct netlink_ext_ack *extack)
> +{
> + if (!attr || nla_len(attr) != sizeof(struct in6_addr))
> + return false;
> + NL_SET_ERR_MSG_ATTR(extack, attr, "IPv6 address in an IPv4 attribute");
> + return true;
> +}
> +
> static int amt_validate(struct nlattr *tb[], struct nlattr *data[],
> struct netlink_ext_ack *extack)
> {
> @@ -3550,16 +3568,63 @@ static int amt_validate(struct nlattr *tb[], struct nlattr *data[],
> return -EINVAL;
> }
>
> - if (!data[IFLA_AMT_LOCAL_IP]) {
> + if (amt_ip6_in_ip4_attr(data[IFLA_AMT_LOCAL_IP], extack))
> + return -EINVAL;
[Severity: Low]
The new code itself looks fine. Could this check, and the matching
IFLA_AMT_DISCOVERY_IP one further down in amt_validate(), be split out
into a separate patch for net with a Fixes: tag?
The truncation this check guards against does not depend on IPv6 outer
transport support. Since b9022b53adad ("amt: add control plane of amt
interface"), amt_policy has had this entry:
[IFLA_AMT_LOCAL_IP] = { .len = sizeof_field(struct iphdr, daddr) },
The type is left at NLA_UNSPEC, so this length is only a minimum and a
16-byte payload gets through. amt_newlink() then does:
amt->local_ip = nla_get_in_addr(data[IFLA_AMT_LOCAL_IP]);
This reads only the first four bytes, giving 32.1.13.184 for 2001:db8::.
That address passes the loopback, zeronet and multicast checks, so the
device is created with the wrong address. The same thing happens with
IFLA_AMT_DISCOVERY_IP on a gateway.
This fix is part of a net-next feature patch and has no Fixes: tag. As a
result, stable kernels will keep creating the wrong device without
reporting an error.
The series already handles a similar case as separate net work. The
commit "amt: key relay tunnels on a union amt_addr endpoint" calls the
change to the IPv4 Advertisement source a fix of its own for net.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261009122426.551178-1-omar%40blockcast.net
next prev parent reply other threads:[~2026-10-10 12:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 12:24 [PATCH net-next 00/13] amt: add an IPv6 outer transport Omar Ramadan
2026-10-09 12:24 ` [PATCH net-next 01/13] amt: create an AF_INET6 encapsulation socket for an IPv6 outer address Omar Ramadan
2026-10-09 12:24 ` [PATCH net-next 02/13] amt: send the Relay Advertisement over IPv6 Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 03/13] amt: key relay tunnels on a union amt_addr endpoint Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 04/13] amt: send the Membership Query over IPv6 Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 05/13] amt: match the Membership Update tunnel by outer family Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 06/13] amt: forward multicast data over IPv6 Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 07/13] amt: size the encapsulation headroom by the outer IP version Omar Ramadan
2026-10-09 12:24 ` [PATCH net-next 08/13] amt: send the AMT gateway control plane over IPv6 Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 09/13] amt: receive " Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 10/13] amt: add netlink attributes for an IPv6 outer transport Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko [this message]
2026-10-09 12:24 ` [PATCH net-next 11/13] MAINTAINERS: amt: cover the amt headers and selftests Omar Ramadan
2026-10-09 12:24 ` [PATCH net-next 12/13] selftests: net: add amt_v6.sh for an IPv6 outer transport Omar Ramadan
2026-10-10 12:41 ` netdev-bot+sashiko
2026-10-09 12:24 ` [PATCH net-next 13/13] selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes Omar Ramadan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179163609435.434549.4433701408065399687@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=omar@blockcast.net \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox