From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=206.220.120.4 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796259172; b=JumOSo9/6AoVrmCBfKuuCFi8y98Fnoq9ClpU8ltMG0BjZm6UA6VqZAIHxT8TH80NJdkR I4LWQw+7Yt2DdfGKSpAM7qazm6bw59bPUNlrNWfpVIHJB6F6EWF6V2PGkiFUhydSkgDjX 893JGuBldj4m2ZrUVw8P5hVB83LUMnWTY+JZ54JCF/zazNM9z5oYbZ5QPGA68z+n6OLWW /L0cGsHFT6jWDlSqaC6Cuvc9Mv/74JyyUdOhRWu2LwDRxyZ53V0MlULOOO7G7upb6HWL9 8a8YG1vcdLqj0c/Yo+hpXZvfnnCAT1UNUG13dPj3PPiCTPGbEDnY2h2X8/iIs1rgwfA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796259172; h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date: Message-ID:MIME-Version:Content-Transfer-Encoding; bh=Fuwegc8vn6jFjh3qZOaAJtTOQZJXE/Jjp+75X9QjZ1U=; b=YaI8W1LTwy90xa98N85HH4df/dW/XelztMmCfpyY7fPhH2mILp461wTK9e5TUpbiUecw e9LTFTq8cGFKeBHUeld76WZeG28jNQk8d4FpOvHhzhZ9R/qaYnn24PrAs4BKyepwjfZbm lpUj0Uij983KndJZSGxgbiNE64Hva1COcsrm87rN3CigdXHbaNcUXPp8bPGpSxYIuHWM1 lkv5osDGylEzTi1H9ldsr66+fqdlb+55SARY/xyG9TUDMzq9gOQ8aenJSYxOWZKGz/xoa 8o8W07l8o4o93MIptRJcX4SRzccwOEcYLp5KY8pqwL7EPPihHlzZfzgeL1JfTt1XdIg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=grapheneos.org; spf=pass smtp.mailfrom=grapheneos.org; dkim=pass header.d=grapheneos.org header.i=@grapheneos.org header.a=rsa-sha256 header.s=default header.b=FKbESTp+; arc=none smtp.remote-ip=206.220.120.4 Received: from mail.grapheneos.org (mail.grapheneos.org [206.220.120.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A22CD606A32C for ; Thu, 3 Dec 2026 00:52:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A22CD606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=grapheneos.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=grapheneos.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=grapheneos.org header.i=@grapheneos.org header.a=rsa-sha256 header.s=default header.b=FKbESTp+ Received: by mail.grapheneos.org (Postfix) id ED9B33C08EE9D; Thu, 03 Dec 2026 00:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grapheneos.org; s=default; t=1796259165; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Fuwegc8vn6jFjh3qZOaAJtTOQZJXE/Jjp+75X9QjZ1U=; b=FKbESTp+6W049llz/QPuTpqZUrHjJ1EY7HgYJaFaR+R+ryMep5ZdvH6kVtx6ut1mG+GwWM kq6Xeq7JjeriscdJaH/89+m3EOaNFLvhNiggQqwC2jMDpS9BsctjGrABaoXDBNXHdjNr0X dcUwETsPkTJ1hfZibJjcmG3uG7Z4QqEW5E2qmtpx+GgFN5oxAGlTjjqgSK0eccDJ1bL4A5 CAuJmOmQlQRIJDfae3fYBGeL7/2llRDfPGcFVoPn6VUmbLeD+hzveS4vKlBCcl75wa8u/o nhSb17tuZmQPJozRvTH2Ueb1eIpOySMitz4RRyXdiyB1cqrYoXsjbOLUDanDQw== From: liamsmith827@grapheneos.org To: netdev@vger.kernel.org Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, willemb@google.com, liamsmith827@grapheneos.org Subject: [RFC net-next] ipv4: route lookup shortcuts bypass FIB Date: Thu, 3 Dec 2026 00:52:35 +0000 Message-ID: <20261203005235.52847-1-liamsmith827@grapheneos.org> 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 With "ipv4: restrict on-link fallback to lookup misses" [1] merged, oif-bound unicast now honors restrictive routes and rules. We'd like to fix the remaining IPv4 routing gaps affecting Android, whose VPN lockdown ("kill switch") relies on prohibit rules. Problem ------- ip_route_output_key_hash_rcu() builds some output routes without consulting the FIB, or ignores lookup errors: 1. With an oif, traffic to 224.0.0.0/24 or 255.255.255.255, and all IGMP, is sent straight through the oif without a lookup. 2. Without an oif, multicast and limited broadcast with a local source address are sent through the device that owns the address, without a lookup. 3. With an oif, multicast outside 224.0.0.0/24 is looked up, but any lookup error (prohibit, unreachable, blackhole or no route) is ignored and the packet is sent on-link through the oif. As a result, ip rules can't restrict IPv4 multicast and broadcast. An unprivileged app can choose the oif (IP_MULTICAST_IF, IP_UNICAST_IF, IP_PKTINFO) or bind() to an interface's address, and send multicast or broadcast out of a non-VPN interface during lockdown. This is the same class of bypass that [1] fixed for unicast. IPv6 has none of these shortcuts. Output routes come from fib6_rule_lookup(), and per-device ff00::/8 routes in the local table keep multicast reachable. There are a few exceptions, such as kernel-generated MLD and NDP, and some VRF lookups that consult the VRF table directly without traversing the rules. None of these cause issues for Android. Options ------- A. Make IPv4 output route lookups behave like IPv6's, by always calling fib_lookup() and adding per-interface multicast and broadcast routes to the local table. This can't be a drop-in replacement for the existing behavior, as it changes routing for existing configurations, such as those with their own multicast routes. Much of the implementation is managing the local-table routes, which Android wouldn't use, since we need to manage those routes ourselves. B. Since we intend to manage the routes ourselves, a simpler approach is to always call fib_lookup() in ip_route_output_key_hash_rcu(), but leave the routes entirely to userspace. This would break existing setups, so it would need a configuration parameter, although the implementation is much simpler than A. We'd appreciate your input on these approaches, and on whether either is likely to be accepted. [1] https://lore.kernel.org/all/20261116202741.13106-1-liamsmith827@grapheneos.org/