]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
* Add rib_<add|del|change>_route() functions to manipulate the routing table.
authorAlexander V. Chernikov <melifaro@FreeBSD.org>
Mon, 1 Jun 2020 20:49:42 +0000 (20:49 +0000)
committerAlexander V. Chernikov <melifaro@FreeBSD.org>
Mon, 1 Jun 2020 20:49:42 +0000 (20:49 +0000)
commitda187ddb3d23836e0e079b6f7172a778a29a5732
treef923fdedd2b62c22a4919626eca4890fd0fd5a64
parente7403d0230f21b9edcc3f64c877a1d619049483e
* Add rib_<add|del|change>_route() functions to manipulate the routing table.

The main driver for the change is the need to improve notification mechanism.
Currently callers guess the operation data based on the rtentry structure
 returned in case of successful operation result. There are two problems with
 this appoach. First is that it doesn't provide enough information for the
 upcoming multipath changes, where rtentry refers to a new nexthop group,
 and there is no way of guessing which paths were added during the change.
 Second is that some rtentry fields can change during notification and
 protecting from it by requiring customers to unlock rtentry is not desired.

Additionally, as the consumers such as rtsock do know which operation they
 request in advance, making explicit add/change/del versions of the functions
 makes sense, especially given the functions don't share a lot of code.

With that in mind, introduce rib_cmd_info notification structure and
 rib_<add|del|change>_route() functions, with mandatory rib_cmd_info pointer.
 It will be used in upcoming generalized notifications.

* Move definitions of the new functions and some other functions/structures
 used for the routing table manipulation to a separate header file,
 net/route/route_ctl.h. net/route.h is a frequently used file included in
 ~140 places in kernel, and 90% of the users don't need these definitions.

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D25067
14 files changed:
sys/net/if_llatbl.c
sys/net/route.c
sys/net/route.h
sys/net/route/nhop_ctl.c
sys/net/route/route_ctl.c
sys/net/route/route_ddb.c
sys/net/route/route_helpers.c
sys/net/route/route_temporal.c
sys/net/route/route_var.h
sys/netinet/in_rmx.c
sys/netinet/ip_icmp.c
sys/netinet6/icmp6.c
sys/netinet6/in6_rmx.c
sys/netinet6/nd6_rtr.c