Netdev List
 help / color / mirror / Atom feed
* [PATCH net v3 0/3] rtnetlink: fix truncation of dump entry
@ 2026-11-17 22:13 Stephen Hemminger
  2026-11-17 22:13 ` [PATCH net-next v3 1/3] rtnetlink: return EMSGSIZE when first dump entry does not fit Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-11-17 22:13 UTC (permalink / raw)
  To: netdev; +Cc: dsahern, Stephen Hemminger

While going through an OSS Scanner dump report for iproute2, I found a
bug in the netlink route dump.

If the first entry of a route dump is too big for the dump skb, the dump
ends with NLMSG_DONE and status 0. That route, and everything after it,
is quietly dropped: "ip route show table 100" prints nothing and exits 0.
It takes something well outside normal use to get there, such as a 500
way multipath route.

Two separate paths get it wrong, so there are two fixes.

Patch 1 covers the generic RTNL_FLAG_DUMP_SPLIT_NLM_DONE path in
rtnl_dumpit(), which drops -EMSGSIZE and returns skb->len. On an empty
skb that is 0. This is the IPv4 FIB case.

Patch 2 covers inet6_dump_fib(), which doesn't use -EMSGSIZE at all; it
suspends the walker and returns a positive value. That one goes back
further, to when IPv6 multipath routes started being dumped as a single
RTA_MULTIPATH message. It has to come after patch 1, since it relies on
rtnl_dumpit() no longer swallowing the error.

Patch 3 adds a selftest: IPv4 and IPv6 multipath routes wide enough to
miss the first dump skb of a fresh socket. The dump has to either return
the route or fail with -EMSGSIZE.

v3 - move to net-next and resolve conflicts
     incorporate Sashiko suggestions
v2 - drop Assisted-by
   - correct commit message about "ip route get"

Stephen Hemminger (3):
  rtnetlink: return EMSGSIZE when first dump entry does not fit
  ipv6: return EMSGSIZE when first route in dump does not fit
  selftests: net: netlink-dumps: test dump of route larger than skb

 net/core/rtnetlink.c                        |   5 +-
 net/ipv6/ip6_fib.c                          |   6 +
 tools/testing/selftests/net/config          |   3 +
 tools/testing/selftests/net/netlink-dumps.c | 297 +++++++++++++++++++++++++++-
 4 files changed, 306 insertions(+), 5 deletions(-)

-- 
2.53.0

Stephen Hemminger (3):
  rtnetlink: return EMSGSIZE when first dump entry does not fit
  ipv6: return EMSGSIZE when first route in dump does not fit
  selftests: net: netlink-dumps: test dump of route larger than skb

 net/core/rtnetlink.c                        |   5 +-
 net/ipv6/ip6_fib.c                          |   4 +
 tools/testing/selftests/net/config          |   3 +
 tools/testing/selftests/net/netlink-dumps.c | 297 +++++++++++++++++++-
 4 files changed, 304 insertions(+), 5 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-17 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 22:13 [PATCH net v3 0/3] rtnetlink: fix truncation of dump entry Stephen Hemminger
2026-11-17 22:13 ` [PATCH net-next v3 1/3] rtnetlink: return EMSGSIZE when first dump entry does not fit Stephen Hemminger
2026-11-17 22:13 ` [PATCH net-next v3 2/3] ipv6: return EMSGSIZE when first route in dump " Stephen Hemminger
2026-11-17 22:13 ` [PATCH net-next v3 3/3] selftests: net: netlink-dumps: test dump of route larger than skb Stephen Hemminger

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