Age | Commit message (Collapse) | Author |
|
reference count.
rtable_iterate() frees the passed ``rt'' and returns the next one on the
multipath list or NULL if there's none.
ok dlg@
|
|
taking the kernel lock.
ok mpi@ dlg@
|
|
function has been fixed.
Functions passed to rtable_walk() must return EAGAIN if they delete an
entry from the tree, no matter if it is a leaf or not.
|
|
prevent an off-by-one when removing entries from the mpath list.
Fix a regression introduced by the refactoring needed to serialize
rtable_walk() with create/delete.
ok jca@
|
|
art_walk now explicitly takes the same lock used to serialise change
made via rtable_insert and _delete, so it can safely adjust the
refcnts on tables while it recurses into them. they need to still
exist when returning out of the recursion.
it uses srps to access nodes and drops the lock before calling the
callback function. this is because some callbacks sleep (eg, copyout
in the sysctl code that dumps an rtable to userland), which you
shouldnt hold a lock accross. other callbacks attempt to modify
the rtable (eg, marking routes as down when then interface theyre
on goes down), which tries to take the lock again, which probably
wont work in the future.
ok jmatthew@ mpi@
|
|
art_lookup and art_match now return an active srp_ref, which the caller must
leave when it's done with the returned route (if any). This allows lookups
to be done without holding any locks.
The art_table and art_node garbage collectors are still responsible for
freeing items removed from the routing table, so they now use srp_finalize
to wait out any active references, and updates are done using srp_swap
operations.
ok dlg@ mpi@
|
|
ok mglocker
|
|
this makes the node usable as soon as it is in the tree, rather
than after it inserts the rtentry on the node.
ok mpi@
|
|
operations cant drop the refcount to 0.
ok mpi@
|
|
ok mpi@
|
|
the srp_ref struct is used to track the location of the callers
hazard pointer so later calls to srp_follow and srp_enter already
know what to clear. this in turn means most of the caveats around
using srps go away. specifically, you can now:
- switch cpus while holding an srp ref
- ie, you can sleep while holding an srp ref
- you can take and release srp refs in any order
the original intent was to simplify use of the api when dealing
with complicated data structures. the caller now no longer has to
track the location of the srp a value was fetched from, the srp_ref
effectively does that for you.
srp lists have been refactored to use srp_refs instead of srpl_iter
structs.
this is in preparation of using srps inside the ART code. ART is a
complicated data structure, and lookups require overlapping holds
of srp references.
ok mpi@ jmatthew@
|
|
callbacks return EAGAIN if they modify the routing table. While we're here,
simplify life for rtable_walk callers by moving the loop that restarts the
walk on EAGAIN into rtable_walk itself.
Flushing cloned routes on interface state changes becomes a bit more
inefficient, but this can be improved later.
ok mpi@ dlg@
|
|
ok jmatthew@
|
|
hash routine.
Bug reported and fix analysed by Jean-Daniel Dupas <jddupas AT xooloo DOT net>
ok deraadt@
|
|
offset of the address in the sockaddr to initialize the stride lengths.
|
|
entry.
This pointer hasn't been used for some time and without it no external
reference count is needed to turn art_lookup() mpsafe.
|
|
use ``rt_node'' with ART.
|
|
This allow us to get rid of one more "rt_node" usage with ART.
ok jmatthew@
|
|
Reported by bluhm@, ok jmatthew@
|
|
ok claudio@
|
|
route entry in ART.
rt_plen() now represents the prefix length of a route entry and should
be used instead.
For now use a "struct sockaddr_in6" to represent the mask when needed,
this should be then replaced by the prefix length and RTA_NETMASK only
used for compatibility with userland.
ok claudio@
|
|
OK mpi@
|
|
|
|
This will helps for unlocking the routing table and will prevent further
mistake by keeping the multipath logic inside the rtable_* API.
ok dlg@, claudio@
|
|
to a SRP list.
This turns the rtable_* layer mpsafe. We now only need to protect the
ART implementation itself.
Note that route(8) regress tests will now fail due to a supplementary
reference taken by the SRPL_INIT(9) API.
ok dlg@
|
|
and kill rtable_put() because we're not going to use it.
The overhead of keeping a "struct art_root/radix_node_head" around is
very small compared to the added complexity needed to reference count
such structures.
|
|
with SRPs.
This is a simplified version of the dynamically sizeable array of
pointers used by if_get() because routing table heads are never
freed.
ok dlg@
|
|
While here initialize pools in art_init().
|
|
pool(9) to not waste most of the memory allocated.
This reduces the memory overhead of our ART routing table from 80M
to 70M compared to the existing radix-tree when loading ~550K IPv4
routes.
ART can now be used for huge tables without exhausting malloc(9)'s
limit.
claudio@ agrees with the direction, inputs from and ok dlg@
|
|
exhaustion.
Reported by benno@ and found thanks to his bgpd(8) test setup.
|
|
implementation for ART based on the singly-linked list of route
entries.
|
|
|
|
does not find a matching node.
This currently never happens because we always do a route lookup before
calling rtable_delete(). Yes this is odd & due to the way multipath is
implemented in the radix tree.
|
|
|
|
Needed by the regression tests.
|
|
rtable_get().
|
|
ok bluhm@
|
|
ok claudio@
|
|
ok bluhm@, dlg@, claudio@
|
|
|
|
turning rtable_get(9) MP-safe.
Use only one per-AF array, as suggested by claudio@, pointing to an
array of pointers to the routing table heads.
Routing tables are now allocated/initialized per-AF. This will let
us allocate routing table on-demand instead of always having an
AF_INET, AF_MPLS and AF_INET table as soon as a new rtableID is used.
This also get rid of the "void ***" madness.
ok dlg@, jmatthew@
|
|
net/rtable.c. This will ease the introduction of rtable_put().
Routing tables are mapped to a tuple (idx, af) so the public API
should as much as possible require these two keys.
ok dlg@
|
|
The routing table is not an optional component of the network stack
and initializing it inside the "routing domain" requires some ugly
introspection in the domain interface.
This put the rtable* layer at the same level of the if* level. These
two subsystem are organized around the two global data structure used
in the network stack:
- the global &ifnet list, to be used in process context only, and
- the routing table which can be read in interrupt context.
This change makes the rtable_* layer domain-aware and extends the
"struct domain" such that INET, INET6 and MPLS can specify the length
of the binary key used in lookups. This allows us to keep, or move
towards, AF-free route and rtable layers.
While here stop the madness and pass the size of the maximum key length
in *byte* to rn_inithead0().
ok claudio@, mikeb@
|
|
rtable_insert().
inputs and ok bluhm@
|
|
|
|
for ART.
While here sync the two remaining mix() macros.
ok chris@, dlg@
|
|
ok bluhm@, claudio@
|
|
entry.
ok bluhm@, claudio@
|
|
length of the key as argument.
This way every consumer of the radix tree has a chance to explicitly
initialize the shared data structures and no longer rely on another
subsystem to do the initialization.
As a bonus ``dom_maxrtkey'' is no longer used an die.
ART kernels should now be fully usable because pf(4) and IPSEC properly
initialized the radix tree.
ok chris@, reyk@
|
|
Keep route entry/BSD compatibility goos in the rtable layer. The way
addresses and masks (prefix-lengths) are encoded is really tied to the
radix-tree implementation.
Since we decided to no longer support non-contiguous masks, we could get
rid of some extra "sockaddr" allocations and reduce the memory grows
related to the use of a multibit-trie.
|