Skip to content

ipv6: fib6: socket dst_entry improvments and cleanups

Hannes Frederic Sowa netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest9 patches 4 repliesIn review
  2. v18 patches 6 repliesSuperseded

Changes in v2 from the cover letter

* fixed changelog in patch #2
* added patch to rename rt_genid_bump_ipv6 etc.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9ipv6: support for fib6_clean_* to update fn_sernuminclude/net/ip6_fib.h net/ipv6/ip6_fib.c+21 -120 replies
2/9ipv6: a bit more typesafetyinclude/net/ip6_fib.h net/ipv6/ip6_fib.c+16 -150 replies
3/9ipv6: only generate one new serial number during fib6_add()net/ipv6/ip6_fib.c+9 -100 replies
4/9ipv6: if no function for cleaner is specified only visit fib6_nodesnet/ipv6/ip6_fib.c+6 -00 replies
5/9ipv6: new function fib6_flush_trees and use it instead of bumping removed rt6_genidinclude/net/net_namespace.h include/net/netns/ipv6.h net/ipv6/addrconf_core.c +3 more+26 -210 replies
6/9ipv6: no need to bump rt_genid_ipv6 on address additionnet/ipv6/addrconf.c+2 -10 replies
7/9ipv6: keep rt_sernum per namespace to reduce number of flushesinclude/net/netns/ipv6.h net/ipv6/af_inet6.c net/ipv6/ip6_fib.c+12 -90 replies
8/9ipv6: switch rt_sernum to atomic_t and clean up typesinclude/net/ip6_fib.h include/net/netns/ipv6.h net/ipv6/af_inet6.c +1 more+18 -170 replies
9/9ipv6: rename rt_genid_bump_ipv6 to rt6_inval_dst_cachesinclude/net/net_namespace.h net/ipv6/addrconf.c net/xfrm/xfrm_policy.c +1 more+7 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 net-next 0/9] ipv6: fib6: socket dst_entry improvments and cleanups

Eric Dumazet noticed that rt6_nodes wich are neither RTF_NONEXTHOP nor RTF_GATEWAY but DST_HOST ones cause major routing lookup churn because their rt6_genid is never renewed, thus ip6_dst_check always considers them outdated. This is a major problem, because these kind of routes are normally used to in input handling.

Thus it does not make sense to use rt6i_genid anymore. This series removes it.

The address deletion path is already covered and does not depend on rt6i_genid. When we add a new address, we update the fn_sernums while traversing the tree.

Because inet6_connect_socket depend on dst_check returning NULL also for source address invalidation, we currently have to walk the whole tree and update the fn_sernums manually when an address gets deleted. This is a fairly expensive operation we currenlty have to do for address deletion and xfrm policy changes. We currently do that for interface mtu changes already.

I dropped the patch for updating the fn_sernum on deletion as it showed some side effects with /proc/net/ipv6_route and we currently don't need it. I stashed it away.

Thanks to Eric Dumazet for noticing the problem with rt6i_genid!

v2 (addressed YOSHIFUJI Hideaki's feedback, thanks!):
* fixed changelog in patch #2
* added patch to rename rt_genid_bump_ipv6 etc.

Regarding the __u32 to u32 conversion, I didn't see anything problematic or left over, if I missed something there I am happy to fix it up in a next version.

Hannes Frederic Sowa (9):
ipv6: support for fib6_clean_* to update fn_sernum
ipv6: a bit more typesafety
ipv6: only generate one new serial number during fib6_add()
ipv6: if no function for cleaner is specified only visit fib6_nodes
ipv6: new function fib6_flush_trees and use it instead of bumping
removed rt6_genid
ipv6: no need to bump rt_genid_ipv6 on address addition
ipv6: keep rt_sernum per namespace to reduce number of flushes
ipv6: switch rt_sernum to atomic_t and clean up types
ipv6: rename rt_genid_bump_ipv6 to rt6_inval_dst_caches

 include/net/ip6_fib.h           | 16 ++++++--
 include/net/net_namespace.h     | 22 ++++------
 include/net/netns/ipv6.h        |  2 +-
 net/ipv6/addrconf.c             |  3 +-
 net/ipv6/addrconf_core.c        |  6 +++
 net/ipv6/af_inet6.c             |  2 +-
 net/ipv6/ip6_fib.c              | 90 +++++++++++++++++++++++++----------------
 net/ipv6/route.c                |  4 --
 net/xfrm/xfrm_policy.c          |  2 +-
 security/selinux/include/xfrm.h |  2 +-
 10 files changed, 87 insertions(+), 62 deletions(-)
Signature · 1 line
1.9.3