Netdev List
 help / color / mirror / Atom feed
* [RFC net-next] ipv4: route lookup shortcuts bypass FIB
@ 2026-12-03  0:52 liamsmith827
  0 siblings, 0 replies; only message in thread
From: liamsmith827 @ 2026-12-03  0:52 UTC (permalink / raw)
  To: netdev
  Cc: dsahern, idosch, davem, edumazet, kuba, pabeni, horms, willemb,
	liamsmith827

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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03  0:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  0:52 [RFC net-next] ipv4: route lookup shortcuts bypass FIB liamsmith827

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox