=== Allow lookups by address in addition to sockaddr-lookups in system radix. ===
==== Problem statement ===
Radix is build around using "sockaddr-like structures", which requires callers to fill in these structures during lookups. This, in turn, leads to the next-order function signatures build around sockaddrs. Sometimes this is useful, however in many cases sockaddrs are not used by the certain subsystem internally.
Lastly, there are quite a lot of alternative data structures providing LPM, that typically do not require using sockaddrs.
With that in mind==== Proposal ====
As the key length is fixed per address family, restructure `rn_match()` to accept both addresses and sockaddr-likestore it inside radix structures as the lookup key.e, Convert the existing parts of fib(9) apisimilar to leverage these changesthe key offset.
Once all customers of a routing are converted, `rn_match()` can be changed to accept key addresses as is.
Currently radix allows to use variable-length keys (such as phone numbers) by specifying the key (actually, the total SA) length in the first byte. However, all current uses of the radix by pf, ipfwTo continue allowing support for variable-length keys, nfs and routing,add special `rn_match_fixed()` function that uses the in-radix stored offset and does *not* access any fields in the provided key beyond [offset; rely on constant-sizedoffset + keys where _length is known in advance] interval.
With that in mind:This allows passing adjusted pointer to the IPv4/IPv6 address without filling the sockaddr structure.
* split `int rn_Off` byte offset field of `radix_node` into `int16_t rn_Off` and `int16_t rn_Salen`, where the latter indicates total structure lengthFinally, similar to `sa_len` field in `struct sockaddr`.
* Fill in this field for root node by using additional argument in `rn_inithead()`
* Convert `rn_match()` and its helper functions to use the total len value from the tree root node instead of a key.
* Provide per-AF macro to pass a proper pointer to `rn_match`convert the existing parts of fib(9) api to leverage these changes.