aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/net
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2021-01-09 00:19:25 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2021-01-16 22:42:41 +0000
commit81728a538d24f483d0986850fa3f51d5d84d8f26 (patch)
treed9912fcca45eb86fc9d1347191ca485fb03ad049 /tests/sys/net
parentbce5d6aa2485925c37240289a5479812a5bb46ff (diff)
downloadsrc-81728a538d24f483d0986850fa3f51d5d84d8f26.tar.gz
src-81728a538d24f483d0986850fa3f51d5d84d8f26.zip
Split rtinit() into multiple functions.
rtinit[1]() is a function used to add or remove interface address prefix routes, similar to ifa_maintain_loopback_route(). It was intended to be family-agnostic. There is a problem with this approach in reality. 1) IPv6 code does not use it for the ifa routes. There is a separate layer, nd6_prelist_(), providing interface for maintaining interface routes. Its part, responsible for the actual route table interaction, mimics rtenty() code. 2) rtinit tries to combine multiple actions in the same function: constructing proper route attributes and handling iterations over multiple fibs, for the non-zero net.add_addr_allfibs use case. It notably increases the code complexity. 3) dstaddr handling. flags parameter re-uses RTF_ flags. As there is no special flag for p2p connections, host routes and p2p routes are handled in the same way. Additionally, mapping IFA flags to RTF flags makes the interface pretty messy. It make rtinit() to clash with ifa_mainain_loopback_route() for IPV4 interface aliases. 4) rtinit() is the last customer passing non-masked prefixes to rib_action(), complicating rib_action() implementation. 5) rtinit() coupled ifa announce/withdrawal notifications, producing "false positive" ifa messages in certain corner cases. To address all these points, the following has been done: * rtinit() has been split into multiple functions: - Route attribute construction were moved to the per-address-family functions, dealing with (2), (3) and (4). - funnction providing net.add_addr_allfibs handling and route rtsock notificaions is the new routing table inteface. - rtsock ifa notificaion has been moved out as well. resulting set of funcion are only responsible for the actual route notifications. Side effects: * /32 alias does not result in interface routes (/32 route and "host" route) * RTF_PINNED is now set for IPv6 prefixes corresponding to the interface addresses Differential revision: https://reviews.freebsd.org/D28186
Diffstat (limited to 'tests/sys/net')
-rw-r--r--tests/sys/net/routing/test_rtsock_l3.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/tests/sys/net/routing/test_rtsock_l3.c b/tests/sys/net/routing/test_rtsock_l3.c
index daba6e5013e6..9486ac466965 100644
--- a/tests/sys/net/routing/test_rtsock_l3.c
+++ b/tests/sys/net/routing/test_rtsock_l3.c
@@ -1127,8 +1127,7 @@ ATF_TC_BODY(rtm_add_v6_gu_ifa_prefixroute_success, tc)
/* gateway should be link sdl with ifindex of an address interface */
verify_link_gateway(rtm, c->ifindex);
- /* TODO: PINNED? */
- int expected_rt_flags = RTF_UP | RTF_DONE;
+ int expected_rt_flags = RTF_UP | RTF_DONE | RTF_PINNED;
verify_route_message_extra(rtm, c->ifindex, expected_rt_flags);
}
@@ -1257,7 +1256,7 @@ ATF_TC_BODY(rtm_del_v6_gu_ifa_prefixroute_success, tc)
/* gateway should be link sdl with ifindex of an address interface */
verify_link_gateway(rtm, c->ifindex);
- int expected_rt_flags = RTF_DONE;
+ int expected_rt_flags = RTF_DONE | RTF_PINNED;
verify_route_message_extra(rtm, c->ifindex, expected_rt_flags);
}