Re: [PATCH net v3 1/2] ipv6: fix cached route reuse for control messages

From
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date
2026-11-10 02:33:56
Also in
linux-kselftest, lkml, stable
Reply to
Xia Yan, 2026-11-09
Xia Yan wrote:
A connected IPv6 UDP or ping socket can reuse its cached route when an
SO_MARK cmsg requests another mark. A packet can then bypass a prohibit
rule instead of failing with EACCES.

ip6_sk_dst_lookup_flow() reads the cache even when connected is false.
UDP clears connected after parsing IP or socket control messages. Ping
always passes false.

Only read the cache when connected is true. Ordinary connected UDP
sends keep using the cache. Ping sends do a fresh lookup.

Found during code review of IPv6 UDP route caching. On UML, the same
connected-socket selftest fails four IPv6 cases before the fix and
passes all 54 with it.

Fixes: c6af0c227a22 ("ip: support SO_MARK cmsg")
Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Link: https://lore.kernel.org/netdev/willemdebruijn.kernel.1e0038bcc3ef8@gmail.com/ (local)
Cc: <redacted>
Signed-off-by: Xia Yan <redacted>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Thread (5 messages) 5 messages, 3 authors, last reply 3d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help