HomeFreeBSD

Fix the design problem with delayed algorithm sync.

Description

Fix the design problem with delayed algorithm sync.

Currently, if the immutable algorithm like bsearch or radix_lockless
receives rtable update notification, it schedules algorithm rebuild.
This rebuild is executed by the callout after ~50 milliseconds.

It is possible that a script adding an interface address and than route
with the gateway bound to that address will fail. It can happen due
to the fact that fib is not updated by the time the route addition
request arrives.

Fix this by allowing synchronous algorithm rebuilds based on certain
conditions. By default, these conditions assume:

  1. less than net.route.algo.fib_sync_limit=100 routes
  2. routes without gateway.
  • Move algo instance build entirely under rib WLOCK. Rib lock is only used for control plane (except radix algo, but there are no rebuilds).
  • Add rib_walk_ext_locked() function to allow RIB iteration with rib lock already held.
  • Fix rare potential callout use-after-free for fds by binding fd callout to the relevant rib rmlock. In that case, callout_stop() under rib WLOCK guarantees no callout will be executed afterwards.

MFC after: 3 days

Details

Provenance
melifaroAuthored on Jan 30 2021, 10:45 PM
Parents
rGdd9163003cb1: Add rib_subscribe_locked() and rib_unsubsribe_locked() to support
Branches
Unknown
Tags
Unknown