Page MenuHomeFreeBSD

Allow address lookups in rn_match().
AbandonedPublic

Authored by melifaro on Jan 6 2020, 9:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 4:08 AM
Unknown Object (File)
Dec 10 2023, 6:26 PM
Unknown Object (File)
Nov 25 2023, 8:59 PM
Unknown Object (File)
Nov 21 2023, 6:44 AM
Unknown Object (File)
Nov 21 2023, 3:18 AM
Unknown Object (File)
Nov 13 2023, 5:01 PM
Unknown Object (File)
Nov 10 2023, 4:04 PM
Unknown Object (File)
Nov 9 2023, 9:24 PM

Details

Reviewers
bz
Group Reviewers
network
Summary

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.

Proposal

As the key length is fixed per address family, store it inside radix structure, similar to the key offset.

To continue allowing support for variable-length keys, 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; offset + key_length] interval.
This allows passing adjusted pointer to the IPv4/IPv6 address without filling the sockaddr structure.
Finally, convert the existing parts of fib(9) api to leverage these changes.

Test Plan

New tests (icmp-based, so raw ip, so ip[6]_output() uses fib46 functions for the lookup):

lpm:lpm_test1_success  ->  passed  [0.186s]
lpm:lpm_test2_success  ->  passed  [0.198s]
lpm6:lpm6_test1_success  ->  passed  [2.188s]
lpm6:lpm6_test2_success  ->  passed  [2.037s]

Common tests:

forward:fwd_ip_icmp_gw_fast_success  ->  passed  [0.344s]
forward:fwd_ip_icmp_gw_slow_success  ->  passed  [0.364s]
forward:fwd_ip_icmp_iface_fast_success  ->  passed  [0.363s]
forward:fwd_ip_icmp_iface_slow_success  ->  passed  [0.410s]
ip_reass_test:ip_reass__large_fragment  ->  passed  [0.013s]
ip_reass_test:ip_reass__multiple_last_fragments  ->  passed  [0.029s]
ip_reass_test:ip_reass__zero_length_fragment  ->  passed  [0.013s]
output:output_raw_flowid_mpath_success  ->  skipped: This test requires ROUTE_MPATH enabled  [0.013s]
output:output_raw_success  ->  passed  [0.059s]
output:output_tcp_flowid_mpath_success  ->  skipped: This test requires ROUTE_MPATH enabled  [0.013s]
output:output_tcp_setup_success  ->  passed  [0.089s]
output:output_udp_flowid_mpath_success  ->  skipped: This test requires ROUTE_MPATH enabled  [0.013s]
output:output_udp_setup_success  ->  passed  [1.114s]
redirect:valid_redirect  ->  passed  [0.346s]
so_reuseport_lb_test:basic_ipv4  ->  passed  [0.495s]
so_reuseport_lb_test:basic_ipv6  ->  passed  [0.502s]
socket_afinet:socket_afinet  ->  passed  [0.002s]
socket_afinet:socket_afinet_bind_ok  ->  passed  [0.002s]

forward6:fwd_ip6_gu_icmp_gw_gu_fast_success  ->  passed  [2.371s]
forward6:fwd_ip6_gu_icmp_gw_gu_slow_success  ->  passed  [1.582s]
forward6:fwd_ip6_gu_icmp_gw_ll_fast_success  ->  passed  [2.333s]
forward6:fwd_ip6_gu_icmp_gw_ll_slow_success  ->  passed  [2.381s]
forward6:fwd_ip6_gu_icmp_iface_fast_success  ->  passed  [2.471s]
forward6:fwd_ip6_gu_icmp_iface_slow_success  ->  passed  [1.845s]
mld:mldraw01  ->  passed  [3.341s]
output6:output6_raw_flowid_mpath_success  ->  skipped: This test requires ROUTE_MPATH enabled  [0.013s]
output6:output6_raw_success  ->  passed  [1.785s]
output6:output6_tcp_flowid_mpath_success  ->  skipped: This test requires ROUTE_MPATH enabled  [0.013s]
output6:output6_tcp_setup_success  ->  passed  [1.972s]
output6:output6_udp_flowid_mpath_success  ->  skipped: This test requires ROUTE_MPATH enabled  [0.013s]
output6:output6_udp_setup_success  ->  passed  [3.019s]
redirect:valid_redirect  ->  passed  [2.397s]
scapyi386:scapyi386  ->  passed  [3.387s]

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 30409
Build 28169: arc lint + arc unit

Event Timeline

melifaro added a reviewer: network.

Use internal __containerof() macro.

I'll be happy to have a look (probably next week and once the redirect stuff is in)

I'm going to commit this on Friday 3 April if there are no objections.

Use less invasive approach by configuring lookup key length in

rn_setkeylen() and using special rn_match_fixed() function.

While here, constantify lookup key.

Add forgotten inline to rn_match_internal.

Update arguments for rn_setkeylen().