Skip to content

Fix listing (IPv4, IPv6) and flushing (IPv6) of cached route exceptions

Stefano Brivio netdev 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest11 patches 3 repliesIn review
  2. v611 patches 11 repliesSuperseded
  3. v56 patches 9 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v48 patches13 repliesSuperseded
v32 patches10 repliesSuperseded
v22 patches2 repliesSuperseded
v12 patches22 repliesSuperseded

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11fib_frontend, ip6_fib: Select routes or exceptions dump from RTM_F_CLONEDinclude/net/ip_fib.h net/ipv4/fib_frontend.c net/ipv6/ip6_fib.c+11 -20 replies
2/11ipv4/fib_frontend: Allow RTM_F_CLONED flag to be used for filteringnet/ipv4/fib_frontend.c+2 -20 replies
3/11ipv4/route: Allow NULL flowinfo in rt_fill_info()net/ipv4/route.c+30 -260 replies
4/11ipv4: Dump route exceptions if requestedinclude/net/route.h net/ipv4/fib_trie.c net/ipv4/route.c+108 -131 reply
5/11Revert "net/ipv6: Bail early if user only wants cloned entries"net/ipv6/ip6_fib.c+2 -50 replies
6/11ipv6/route: Don't match on fc_nh_id if not set in ip6_route_del()net/ipv6/route.c+2 -10 replies
7/11ipv6/route: Change return code of rt6_dump_route() for partial node dumpsnet/ipv6/ip6_fib.c net/ipv6/route.c+11 -70 replies
8/11ipv6: Dump route exceptions if requestedinclude/net/ip6_fib.h include/net/ip6_route.h net/ipv6/ip6_fib.c +1 more+116 -131 reply
9/11ip6_fib: Don't discard nodes with valid routing information in fib6_locate_1()net/ipv6/ip6_fib.c+2 -10 replies
10/11selftests: pmtu: Introduce list_flush_ipv4_exception test casetools/testing/selftests/net/pmtu.sh+60 -00 replies
11/11selftests: pmtu: Make list_flush_ipv6_exception test more demandingtools/testing/selftests/net/pmtu.sh+14 -80 replies

Reviews trailers per patch

8 of 11 patches have a Reviewed-by or Acked-by.

PatchDavid Ahern
1/11R-b
2/11R-b
3/11R-b
4/11R-b
5/11R-b
6/11R-b
7/11R-b
8/11R-b
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH net-next v7 00/11] Fix listing (IPv4, IPv6) and flushing (IPv6) of cached route exceptions

For IPv6 cached routes, the commands 'ip -6 route list cache' and 'ip -6 route flush cache' don't work at all after route exceptions have been moved to a separate hash table in commit 2b760fcf5cfb ("ipv6: hook up exception table to store dst cache").

For IPv4 cached routes, the command 'ip route list cache' has also stopped working in kernel 3.5 after commit 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.") introduced storage for route exceptions as a separate entity.

Fix this by allowing userspace to clearly request cached routes with the RTM_F_CLONED flag used as a filter (in conjuction with strict checking) and by retrieving and dumping cached routes if requested.

If strict checking is not requested (iproute2 < 5.0.0), we don't have a way to consistently filter results on other selectors (e.g. on tables), so skip filtering entirely and dump both regular routes and exceptions.

For IPv4, cache flushing uses a completely different mechanism, so it wasn't affected. Listing of exception routes (modified routes pre-3.5) was tested against these versions of kernel and iproute2:

iproute2
kernel 4.14.0 4.15.0 4.19.0 5.0.0 5.1.0
3.5-rc4 + + + + +
4.4
4.9
4.14
4.15
4.19
5.0
5.1
fixed + + + + +

For IPv6, a separate iproute2 patch is required. Versions of iproute2 and kernel tested:

iproute2
kernel 4.14.0 4.15.0 4.19.0 5.0.0 5.1.0 5.1.0, patched

 3.18    list        +        +        +        +       +            +
         flush       +        +        +        +       +            +
 4.4     list        +        +        +        +       +            +
         flush       +        +        +        +       +            +
 4.9     list        +        +        +        +       +            +
         flush       +        +        +        +       +            +
 4.14    list        +        +        +        +       +            +
         flush       +        +        +        +       +            +
 4.15    list
         flush
 4.19    list
         flush
 5.0     list
         flush
 5.1     list
         flush
 with    list        +        +        +        +       +            +
 fix     flush       +        +        +                             +

v7: Make sure r->rtm_tos is initialised in 3/11, move loop over nexthop
objects in 4/11, add comments about usage of "skip" counters in commit messages of 4/11 and 8/11

v6: Target for net-next, rebase and adapt to nexthop objects for IPv6 paths.
Merge selftests into this series (as they were addressed for net-next). A number of minor changes detailed in logs of single patches.

v5: Skip filtering altogether if no strict checking is requested: selecting
routes or exceptions only would be inconsistent with the fact we can't filter on tables. Drop 1/8 (non-strict dump filter function no longer needed), replace 2/8 (don't use NLM_F_MATCH, decide to skip routes or exceptions in filter function), drop 6/8 (2/8 is enough for IPv6 too). Introduce dump_routes and dump_exceptions flags in filter, adapt other patches to that.

v4: Fix the listing issue also for IPv4, making the behaviour consistent
with IPv6. Honour NLM_F_MATCH as per RFC 3549 and allow usage of RTM_F_CLONED filter. Split patches into smaller logical changes.

v3: Drop check on RTM_F_CLONED and rework logic of return values of

    rt6_dump_route()

v2: Add count of routes handled in partial dumps, and skip them, in patch 1/2.

Stefano Brivio (11):
fib_frontend, ip6_fib: Select routes or exceptions dump from
RTM_F_CLONED
ipv4/fib_frontend: Allow RTM_F_CLONED flag to be used for filtering ipv4/route: Allow NULL flowinfo in rt_fill_info()
ipv4: Dump route exceptions if requested
Revert "net/ipv6: Bail early if user only wants cloned entries" ipv6/route: Don't match on fc_nh_id if not set in ip6_route_del() ipv6/route: Change return code of rt6_dump_route() for partial node
dumps
ipv6: Dump route exceptions if requested
ip6_fib: Don't discard nodes with valid routing information in

    fib6_locate_1()

selftests: pmtu: Introduce list_flush_ipv4_exception test case
selftests: pmtu: Make list_flush_ipv6_exception test more demanding

 include/net/ip6_fib.h               |   1 +
 include/net/ip6_route.h             |   2 +-
 include/net/ip_fib.h                |   2 +
 include/net/route.h                 |   4 +
 net/ipv4/fib_frontend.c             |  12 ++-
 net/ipv4/fib_trie.c                 |  44 +++++++---
 net/ipv4/route.c                    | 129 ++++++++++++++++++++++------
 net/ipv6/ip6_fib.c                  |  27 ++++--
 net/ipv6/route.c                    | 123 +++++++++++++++++++++++---
 tools/testing/selftests/net/pmtu.sh |  82 ++++++++++++++++--
 10 files changed, 353 insertions(+), 73 deletions(-)
Signature · 1 line
2.20.1