Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new gateway IPv6 control path never counts transmit
failures that happen after routing.
--
amt: send the AMT gateway control plane over IPv6
This commit lets an AMT gateway send its Discovery, Request and Membership
Update messages with an IPv6 outer header. Discovery and Request are built
on the stack and sent via amt_send_ctrl_v6(). The Membership Update goes
through amt_udp_xmit().
> diff --git a/drivers/net/amt.c b/drivers/net/amt.c
> index 79702b002d14f..40481b0f9d5ef 100644
> --- a/drivers/net/amt.c
> +++ b/drivers/net/amt.c
[ ... ]
> @@ -824,10 +825,36 @@ static int amt_send_ctrl_v6(struct amt_dev *amt, const struct in6_addr *saddr,
> ip6_dst_hoplimit(dst), 0, sport, dport, false, 0);
> err = 0;
> out:
> - rcu_read_unlock();
> + rcu_read_unlock_bh();
> return err;
> }
>
> +static void amt_send_discovery_v6(struct amt_dev *amt)
> +{
> + struct amt_header_discovery amtd = {
> + .type = AMT_MSG_DISCOVERY,
> + .nonce = amt->nonce,
> + };
> +
> + if (!amt_send_ctrl_v6(amt, &amt->local_ipv6, &amt->discovery_ipv6,
> + amt->gw_port, amt->relay_port,
> + &amtd, sizeof(amtd)))
> + amt_update_gw_status(amt, AMT_STATUS_SENT_DISCOVERY, true);
> +}
> +
> +/* The inner family @v6 sets the P bit, independent of the outer one. */
> +static void amt_send_request_v6(struct amt_dev *amt, bool v6)
> +{
> + struct amt_header_request amtrh = {
> + .type = AMT_MSG_REQUEST,
> + .p = v6,
> + .nonce = amt->nonce,
> + };
> +
> + amt_send_ctrl_v6(amt, &amt->local_ipv6, &amt->remote_ipv6,
> + amt->gw_port, amt->relay_port, &amtrh, sizeof(amtrh));
> +}
[Severity: Medium]
Does the IPv6 Discovery and Request path stop counting tx_errors on
amt->dev when a send fails after routing?
amt_send_ctrl_v6() passes a NULL net_device to udp_tunnel6_xmit_skb() and
then sets err = 0 unconditionally:
udp_tunnel6_xmit_skb(dst, sk, skb, NULL, saddr, daddr, AMT_TOS,
ip6_dst_hoplimit(dst), 0, sport, dport, false, 0);
err = 0;
In ip6tunnel_xmit(), all of the error accounting sits behind a dev check.
That covers both the recursion-limit drop and the ip6_local_out() failure:
include/net/ip6_tunnel.h:ip6tunnel_xmit() {
...
if (unlikely(dev_recursion_level() > IP_TUNNEL_RECURSION_LIMIT)) {
if (dev) {
...
DEV_STATS_INC(dev, tx_errors);
}
...
err = ip6_local_out(skb_dst_dev_net(skb), sk, skb);
if (dev) {
if (unlikely(net_xmit_eval(err)))
pkt_len = -1;
iptunnel_xmit_stats(dev, pkt_len);
}
...
}
So a Discovery or Request that netfilter drops, that fails in the
neighbour or xmit path, or that hits the recursion limit will not be
counted in amt->dev tx_errors.
The IPv4 code paths that these functions replace, amt_send_discovery() and
amt_send_request(), do count these failures:
err = ip_local_out(amt->net, sk, skb);
if (unlikely(net_xmit_eval(err)))
DEV_STATS_INC(amt->dev, tx_errors);
The IPv6 Membership Update path in amt_udp_xmit() passes amt->dev to the
same udp_tunnel6_xmit_skb(). On one device, IPv6 Update failures are
counted but IPv6 Discovery/Request failures are not.
amt_v6() is always false at this commit. Later in the series, "amt: add
netlink attributes for an IPv6 outer transport" sets local_ipv6 from
IFLA_AMT_LOCAL_IP6, which makes this path reachable. The final state of the
series still passes NULL here.
Passing amt->dev directly would also add tx_packets and tx_bytes for
control messages, which the IPv4 control path does not count. Would it
make sense to count tx_errors in amt_send_ctrl_v6() itself, so that it
matches the IPv4 behaviour?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40blockcast.net