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 [thread overview]
Message-ID: <20261203005235.52847-1-liamsmith827@grapheneos.org> (raw)
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/
reply other threads:[~2026-12-03 0:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261203005235.52847-1-liamsmith827@grapheneos.org \
--to=liamsmith827@grapheneos.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/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