mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: liamsmith827 <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, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	liamsmith827 <liamsmith827@proton.me>
Subject: [RFC net-next 0/2] ipv4: Honor prohibit when oif specified
Date: Mon, 19 Oct 2026 03:24:04 +0000	[thread overview]
Message-ID: <20261019032406.88874-1-liamsmith827@grapheneos.org> (raw)

From: liamsmith827 <liamsmith827@proton.me>

This RFC proposes honoring prohibit rules and routes when an output
interface is specified.

When flowi4_oif is set (SO_BINDTODEVICE, IP_PKTINFO, IP_UNICAST_IF,
etc), prohibit rules and routes cause fib_lookup() to return -EACCES,
but still allow the packet (and any necessary ARP) to be transmitted.
This is documented as the expected behavior in the tests, but is
confusing for route and rule maintainers.

Android uses prohibit rules as the basis for its VPN "kill switch", with
the expectation that any packet encountering such a rule will not be
allowed out. Due to this interface binding exemption, apps can trivially
bypass the kill switch. This is most serious on cellular networks, where
a connection to an arbitrary IPv4 address can be established without
requiring ARP resolution.

The first patch preserves -EACCES from fib_lookup() instead of
constructing an on-link route when an output interface is specified.
This honors prohibit rules and routes while retaining the existing
fallback for other lookup errors.

The second patch enables the existing test that expects an
interface-bound ping to fail.

I would appreciate feedback on compatibility implications and whether
this change is acceptable given the longstanding behavior.

liamsmith827 (2):
  ipv4: Honor prohibit when oif specified
  selftests: net: Test prohibit when oif specified

 net/ipv4/route.c                          | 11 ++++++-----
 tools/testing/selftests/net/fcnal-test.sh |  7 +++----
 2 files changed, 9 insertions(+), 9 deletions(-)

-- 
2.47.3


             reply	other threads:[~2026-10-19  3:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  3:24 liamsmith827 [this message]
2026-10-19  3:24 ` [RFC net-next 1/2] " liamsmith827
2026-10-25 17:13   ` Ido Schimmel
2026-10-19  3:24 ` [RFC net-next 2/2] selftests: net: Test " liamsmith827

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=20261019032406.88874-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=liamsmith827@proton.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /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

all inboxes | Powered by JetHome®