From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795924016; b=OsJQjzmn/NBMRu+1H1xe7x1jkp4tdHqTxVbFApGgIiGgW4dfxhvoqloZY0P2jkG+d9Zy C8YcIUsXEclGXG2t3ifNWLNyLnzJc1gBtMqtemtp5DolXziqeF3Pxqk/OKc1Mbyy8rqm2 LWTzgnqmMqycUtg/Ch9FWrKFat8yljui48YqlKPNsefPqiEtCM8K2qMuNMaZWeY3ziavf YLTxU9fdmcTMI2puScCS/cQ213UXxwXO2BNALgDbMpeXAsL9LG30RuKyjTUXqhk7DQRJ8 tKPezn0lLMtcyodpjMM96leMtzdgO4Guf2g90Ziq7G7yTFSomT0lAi4NfcPNsYRp50w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795924016; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=OR7Sw3AV7oADXcElVjEBFg9775gWfpbKwMn8AcRPoBQ=; b=FeAqSEpR226CGgWJBC86i/RCP9xmW/+mPn4z8p3RcuwNpzVE46FQQ52bMY5Epw543KqV iZuSU991YaJ+WNZHXVP2/dSZ2XA+FtQOzFSSNfwv1UYhdVKFBiEhwn6Ckgsew66Z1PeaG ZK9gtIELQ5viarhWpIHX9VSYXDRJPmoyY7+QEyi1BRL3LA9jtho2HMjvBtRn140buxetm 6u9oAXuJA59mlLvVbYOu8tUJ7NsPsHR5ibl1S6T03tU2IuagdneU7L7TMDJLSeBcevKA2 LbqkYJnhYa1igroCAZLnN5vkubVepx8xD16nz/k6k+c21uy4HGsFiNxqZTLSDUXS1mA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=blockcast.net; spf=pass smtp.mailfrom=blockcast.net; dkim=pass header.d=blockcast.net header.i=@blockcast.net header.a=rsa-sha256 header.s=google header.b=dAKVBq2C; arc=none smtp.remote-ip=74.125.82.42 Received: from mail-dl1-f42.google.com (mail-dl1-f42.google.com [74.125.82.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A146606A31C for ; Sun, 29 Nov 2026 03:46:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2A146606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=blockcast.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=blockcast.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=blockcast.net header.i=@blockcast.net header.a=rsa-sha256 header.s=google header.b=dAKVBq2C Received: by mail-dl1-f42.google.com with SMTP id a92af1059eb24-1a3c08d6928so13952117c88.0 for ; Sat, 28 Nov 2026 19:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blockcast.net; s=google; t=1795924015; x=1796528815; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=OR7Sw3AV7oADXcElVjEBFg9775gWfpbKwMn8AcRPoBQ=; b=dAKVBq2CbY+v9Q8RyVYgtXmGFTFY31K6UinPx4XqYdkqZ0CIkAMD4TytDjg8TK6sJX ePLjGl6dhHjoHvKgq4Sq3JRKObWdse1MEWujhMYapLjuZvux3F/JK5u4PeHADNsZ5rFf CODGbWGCV+N7Zn4tV99M1QQksXtX+VhXg742Vg5zUwpzOfIr23X9emu3BdKbFzCkDjBK /QOH1GuEHfO5I513PzjnlM/SWV9uz8rjQ0ShFgL92YxMd4DfpgdL4oHmJ3k86Ae/5DNA bGmUIsqaAISrUGDgNslLSgyYjQmNz8m9rbMyXeSAzQW5M9b80cssKWrFa34yCLbLhSJO ug9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795924015; x=1796528815; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=OR7Sw3AV7oADXcElVjEBFg9775gWfpbKwMn8AcRPoBQ=; b=OoVay6LHyvBFv2y6x79jOMy57QvaiFSFPvvuKz248Pc4X5bCcSZdKidYkFGq1j7Nmy 18kftUF0nFclZyjZQFq7IdvDGE56QTq+VycWeI3KyO451EC7IMHBq6kxmnNKT7eHLpWz jcQqg1Pl9sFCt8EtAZ5klr7aFVabMQ22yZQMT506N08EaGyptfnEKf1VFnbZKYd7yC62 XG0jAZevg2Gdu2wuli1FTQRh/GkBfVnafeHlJQfcfFkLCzyjhFl/P2riuEVq0eKNHdjx qBln28U8OZCG4KK1Fw58vGhxrooi6xEa45kHTnRq0vAF1kFodrYbGdganIZqMY0u+5Nv HlaA== X-Forwarded-Encrypted: i=1; AL+hErEB4TVy0XVjJirUbhhptrBgEVGteK1H1iOncGci6qr17z2ST0/7RmBWMoPlX3recbCCuHlWCJY=@vger.kernel.org X-Gm-Message-State: APuU4Z/70ffzi+uyzyiGwh6EIqmImPCDWySxDfHu25xXcS6nV3AvGw1P YtlZEn1N+qui5kWbqhmeUr6QiLtl6Qwg9+104kkm6AjTDercpX3wn0ldeXQNWTpt+V0= X-Gm-Gg: AZFdTZeJ/u2KyyLJaAUvsJV85J8yQW7qs8q7ldjGBCy49Oif2dJdMZtf5VI1iUSOo97 C475X2BMVXuiudO+ji9zhYQq2y3+BUgnFX95Bo42pH1cfd83/63UTqAPrpof5rrRnZuPY/9daAG 0SrPueolAb0S37ujng9oIqUzS6oK+N7dOqbSTJinfjsadfVTHxXcwTJJr1hJPnHiT81fnGQtje0 5REOifAretf/JOSOckunZVfhzy2WMXOx/pn5TEZaUw0WoGofEGrDZNzZLBABUsyb/+NLMEp7LKa lidPnMHkKnkCOJfnok3LXTrbXXEwFREg/ZG3CvWw8TjF0AKA5l+8cv0HvcuFGjoXbAGa2Dquv+w dJz+s83EcY684gAIV7fdMJfJBJTgemeIfPzOTGc/fhlJBLan0vKAyUzgKlBGAP3qrwt2G4pkhvz tUvle5dCgKSetsKcFT+866DZn7LeFD4zR3UrOL7UWWD2e7vRF2Tz+1q1rSS/G1F6ezgOi+5kGdZ d40TZIhZPZ6dzcgI+ciorunZLaWGjejek0pcPb19Kn2nusjCTWA4kjodXfPOWyI8Qs8nce+B9HJ okH3lJmAc8LNlmvU4HiCHTqpFILZi1a2eZ6en6JldANkkMANBz7ysKJphLAuQLCLC6SGCaD+NGk H+KRGNlXqxSGvJPNS8WBF0Q9bSHo= X-Received: by 2002:a05:701a:cccb:20b0:1b2:3448:840f with SMTP id a92af1059eb24-1b55686ffd7mr25360810c88.7.1795924015118; Sat, 28 Nov 2026 19:46:55 -0800 (PST) Received: from devbox.ts.blockcast.net ([2602:f74d:1::32]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b56ef9fd16sm61119077c88.4.2026.11.28.19.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Nov 2026 19:46:54 -0800 (PST) From: Omar Ramadan To: Taehee Yoo , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: Simon Horman , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Willem de Bruijn Subject: [PATCH net-next v4 00/12] amt: add an IPv6 outer transport Date: Sun, 29 Nov 2026 03:46:40 +0000 Message-ID: <20261129034652.1853485-1-omar@blockcast.net> X-Mailer: git-send-email 2.43.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The amt driver runs AMT (RFC 7450) only over IPv4: the relay and the gateway bind one AF_INET UDP socket and every message is routed and sent with the IPv4 helpers. RFC 7450 defines the protocol over either IP version, with an IPv6 form of the Relay Advertisement, so a gateway on an IPv6-only access network cannot reach an amt relay today. This series adds an IPv6 outer transport to both modes. The outer family is fixed when the link is created: an IPv6 local address (IFLA_AMT_LOCAL_IP6) selects IPv6, and the inner multicast family stays independent, so an IPv6 tunnel carries IGMP/IPv4 and MLD/IPv6 alike. Use case, which Jakub asked about on v1: Blockcast runs amt relays and gateways to deliver multicast video over networks that do not carry multicast natively, and some of those access networks are IPv6-only. The gateway side has to reach a relay from such a network, and the relay has to answer it, so both ends need the IPv6 form. Patches 1-5 convert the relay: the AF_INET6 socket, the IPv6 Relay Advertisement, tunnel state keyed on a union amt_addr, and the Membership Query, Membership Update and Multicast Data paths, which share one amt_udp_xmit() instead of IPv6 twins of each sender. Multicast Data over IPv6 is checked against the tunnel MTU and never fragmented. Patch 6 sizes headroom and MTU for the 40-byte outer header. Patches 7-8 convert the gateway; the learned IPv6 relay address is published under a seqlock because, unlike the IPv4 one, it cannot be stored in one access. Patch 9 adds the netlink attributes, last, so that no intermediate commit can create a half-working IPv6 device. Patch 10 adds the AMT headers and selftests to MAINTAINERS, and patches 11-12 add selftests. amt_v6.sh needs the same tools as amt.sh (smcroute, socat, nc, jq, tc), and tcpdump for one check that it skips without it. The series is based on net-next ccb81d5e317b, which carries the six-patch "amt: relay tunnel lifetime, validation and request-path hardening" series (net v7, merged in 24630ff92eff). It depends on that series: the tunnel creation, MAC and per-source cap that patch 3 re-keys are the ones it introduced. The IPv6 Relay Advertisement is sent from the address the Discovery was sent to, as RFC 7450 s5.1.2 requires, so a gateway can discover the relay through an anycast or secondary address. A Discovery sent to a multicast group, or from ::, is not answered, since neither can be used as an address. The IPv4 Advertisement has always been sent from local_ip, which breaks the same case for an IPv4 gateway. This series leaves that alone: it changes the behaviour of existing IPv4 relays and is not needed by the IPv6 code. The IPv4 control senders also look the route up with a zero TOS while the packet carries AMT_TOS, which is the mismatch that patch 2 avoids for IPv6; that is a possible separate fix for net. The IPv6 socket is bound to the underlying link. That makes the IPv6 route lookups strict about the output interface, as the IPv4 ones already are, and keeps link-local peers on other links out of the tunnel table. An IPv6 gateway accepts a zero UDP checksum on Multicast Data only, as RFC 7450 s5.2.3.3 requires; a relay requires the checksum on everything. The IPv6 tunnel MTU follows the route's path MTU, as on every IPv6 UDP tunnel in the tree. RFC 7450 s5.3.3.6.1 and s6.1 want a relay to offer a switch that turns dynamic tunnel MTU adjustment off. The IPv6 stack gives a tunnel no way to do that: it records every Packet Too Big in a route exception before it looks up the socket, and "mtu lock" does not apply to IPv6. So this series does not offer the switch. Patch 5 explains this in detail. Received headers are handled as commit 3656a79f94c4 ("amt: re-read skb header pointers after every pull") requires. amt_rcv(), amt_request_handler() and amt_update_handler() copy the outer source address by value before any pull, or after the last one. The discovery and advertisement handlers take header pointers only after their last pskb_may_pull(), and the send paths never pull the received skb. The iproute2 support is a separate iproute2-next patch, now at v2: https://lore.kernel.org/netdev/20261126004258.2133805-iproute2-omar@blockcast.net/ The selftests skip when iproute2 or the kernel lacks the attributes. IFLA_AMT_LOCAL_IP6, IFLA_AMT_DISCOVERY_IP6 and IFLA_AMT_REMOTE_IP6 are the next three values after IFLA_AMT_MAX_TUNNELS in this series. The net-next amt limits series appends IFLA_AMT_MAX_GROUPS and IFLA_AMT_MAX_SOURCES at the same position, so whichever of the two lands second renumbers its attributes after the other's. Changes in v4 (netdev's Sashiko review of v3): - 5/12 (Medium): the message says what a forged Packet Too Big does: it lowers the tunnel MTU to 1230, so every multicast payload above that, IPv4 or IPv6, is dropped toward that gateway and its source is told nothing, until the route exception expires. The design is unchanged, as that is what path MTU discovery does to any IPv6 UDP tunnel that must not fragment. Two drops that were not counted are counted in tx_dropped, and two header comments say when no Packet Too Big is sent. - 12/12 (Medium): the probe skips only on the readback an iproute2 that truncates the literal gives, 32.1.13.184; any other readback without a colon is a FAIL. The nodad comment and the header's list of what is not covered are corrected. - 11/12: a listener that must get nothing has to be alive at the end, the Discovery capture waits until tcpdump is listening, and the comments on DAD and on the IGMP egress counter are corrected. - 3/12, 4/12: the messages describe the old read of the source address, the Request handler and the first patch of the series correctly, and the comments that still said per address say source. - 8/12: the comment and the message no longer say IPv4 input never delivers a 0.0.0.0 source, and amt_route6() refuses ::, which a transmit can read just after a gateway forgot its relay. - 5/12, 8/12: the messages cite RFC 7450 s5.3.3.6.2.2 with its SSM condition and s5.1.6 as it reads, and describe the old read of the outer source on an IPv6 header correctly. Changes in v3 (netdev's Sashiko review of v2): - The base is net-next ccb81d5e317b. Only MAINTAINERS and the net selftests Makefile changed under the series, so 10/12 to 12/12 are rebased and nothing else is. - 3/12 (Medium): the per-source tunnel cap counts the tunnels of one IPv6 /64, not of one address, as one host usually owns a whole /64 and could otherwise open the cap's worth of tunnels from each of its addresses and keep the table full. A tunnel is still found by its full endpoint, so gateways in one /64 each keep their own tunnel and share the cap. The message no longer says that amt_request_handler() snapshots the source before a pull (Low). - 5/12 (Medium, Low): amt_dev_xmit() puts the transport header of a data packet back after ipv6_mc_check_mld(), which leaves it just past the fixed IPv6 header, so the per-segment length of an inner IPv6 GSO skb counts any extension headers. amt_tmtu() returns zero, not a wrapped value, for a route MTU below the outer headers. - 2/12 (Low): the message says that a drop after the hand-off to IPv6 output is not counted in tx_errors, as the sender passes no netdev. - 4/12 (Low): the comment of amt_send_membership_query() says that the endpoint is passed by pointer. - 6/12 (Low): the message names the right drop site, the tunnel MTU check, and no longer claims that ip6_fragment() drops the packet. - 8/12 (Low): the exact-length check of an Advertisement applies to an IPv6 gateway only, so an IPv4 gateway behaves as it always did. The message says so. - 11/12 (Medium, Medium, Low): the probe skips on "binary attribute size out of range", which is what this kernel says to an iproute2 that packs an IPv6 literal into the IPv4 attribute, and on an iproute2 or kernel without amt, instead of failing; the egress check of amt.sh is ported, and a third gateway in the first gateways' /64 is checked to get no tunnel while one in another /64 does. The message no longer says "plus jq" and names the checks that are not carried over. - 12/12 (Medium, Medium, Low): the same probe fixes; a readback that is not an IPv6 address is a skip, as four truncated bytes cannot be told from an IPv4 address. - Not changed: the IPv4 Advertisement is still sent from local_ip, and the IPv6 tunnel MTU still follows the route's path MTU. Changes in v2 (netdev's Sashiko review of v1, and net v7): - The base is net-next 24630ff92eff. The three net prerequisites of v1 are now in net, as v7 of the hardening series. v1's "amt: send the relay General Query directly" is not needed any more, and the GSO fix was done differently: the device still offers software GSO, so the tunnel MTU check in 5/12 is made per segment with skb_gso_validate_network_len() instead of assuming a single packet. - v1 3/13 and 5/13 are one patch now (3/12). v7 made the Request handler stateless and moved tunnel creation to the authenticated Membership Update, so the endpoint key is carried through amt_tunnel_lookup(), amt_tunnel_get_or_create(), amt_update_tunnel() and the new amt_relay_mac(), which both handlers use for the MAC. The ICMPv6 Destination Unreachable for a full tunnel table is gone, as v7 drops such a Request silently. - 2/12: route on AMT_TOS through the flow label (Medium on 4/13, Low on 2/13); count route and allocation failures with DEV_STATS_INC(); drop a Discovery from ::. A failure of ip6_local_out() is still not counted, as udp_tunnel6_xmit_skb() returns void and passing a device would add control messages to the tunnel's byte counters. - 4/12: the Membership Query and the relay's General Query take the gateway endpoint as a union amt_addr, for v7's stateless Request. - 5/12: at most one Packet Too Big per multicast packet (High on 6/13), not one per tunnel; the inner family comes from the parsed version, not skb->protocol (Low); a tunnel MTU below IPV6_MIN_MTU, which a source would ignore, only drops the payload. - 7/12 (8/13): the message says that none of the new sender code can run yet and that the amt_send_membership_update() conversion changes no IPv4 behaviour (Low). - 8/12 (9/13): an Advertisement is accepted only if its UDP length is that of the device's family (Low); the deferred Query check in amt_membership_query_handler() uses amt_from_relay(); the IPv4 half of the 0.0.0.0 fix is net v7 3/6 (Medium). - 9/12 (10/13): the policy of the existing IPv4 attributes is net v7 4/6, so the hunk that refused a 16-byte value is dropped (Low). - 11/12 (12/13): disc_answer() reports a harness failure separately, so the ff02::1 check cannot pass because the capture never ran (Medium); the script skips without CONFIG_IPV6 before creating any link (Low). CONFIG_IP_MROUTE is already in the net selftests config. - Fixed by net v7 and inherited: the Update handler use-after-free (High, 5/13), the duplicate-tunnel race and the zero-key MAC (Medium, 3/13). Assisted-by: LLM Omar Ramadan (12): amt: create an AF_INET6 encapsulation socket for an IPv6 outer address amt: send the Relay Advertisement over IPv6 amt: key relay tunnels on a union amt_addr endpoint amt: send the Membership Query over IPv6 amt: forward multicast data over IPv6 amt: size the encapsulation headroom by the outer IP version amt: send the AMT gateway control plane over IPv6 amt: receive the AMT gateway control plane over IPv6 amt: add netlink attributes for an IPv6 outer transport MAINTAINERS: amt: cover the amt headers and selftests selftests: net: add amt_v6.sh for an IPv6 outer transport selftests: net: add amt_gw_v6.sh for the IPv6 netlink attributes MAINTAINERS | 3 + drivers/net/amt.c | 926 ++++++++++++++++++----- include/net/amt.h | 62 +- include/uapi/linux/amt.h | 13 + tools/testing/selftests/net/Makefile | 2 + tools/testing/selftests/net/amt_gw_v6.sh | 219 ++++++ tools/testing/selftests/net/amt_v6.sh | 469 ++++++++++++ 7 files changed, 1483 insertions(+), 211 deletions(-) create mode 100755 tools/testing/selftests/net/amt_gw_v6.sh create mode 100755 tools/testing/selftests/net/amt_v6.sh base-commit: ccb81d5e317b0ae2cc66ca1c628c0ca907928f94