freebsd-dev/sys/net/route
Alexander V. Chernikov 81728a538d 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
2021-01-16 22:42:41 +00:00
..
fib_algo.c Use static initializers for fib algo to shift initialization 2021-01-11 00:16:54 +00:00
fib_algo.h Add modular fib lookup framework. 2020-12-25 11:33:17 +00:00
mpath_ctl.c Implement flowid calculation for outbound connections to balance 2020-10-18 17:15:47 +00:00
nhgrp_ctl.c Add nhop_ref_any() to unify referencing nhop or nexthop group. 2020-11-29 13:52:06 +00:00
nhgrp_var.h Introduce scalable route multipath. 2020-10-03 10:47:17 +00:00
nhgrp.c Introduce scalable route multipath. 2020-10-03 10:47:17 +00:00
nhop_ctl.c Use light-weight versions of routing lookup functions in ng_netflow. 2020-12-26 11:27:38 +00:00
nhop_utils.c Remove unused nhop_ref_any() function. 2020-09-20 21:32:52 +00:00
nhop_utils.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
nhop_var.h Fix route flags update during RTM_CHANGE. 2020-10-04 13:24:58 +00:00
nhop.c Introduce scalable route multipath. 2020-10-03 10:47:17 +00:00
nhop.h Remove now-unused RT_GATEWAY* definitions. 2021-01-04 21:45:46 +00:00
route_ctl.c Refactor rt_addrmsg() and rt_routemsg(). 2021-01-07 19:38:19 +00:00
route_ctl.h Split rtinit() into multiple functions. 2021-01-16 22:42:41 +00:00
route_ddb.c Rename rt_flags to rte_flags && reduce number of rt_nhop accesses. 2020-08-22 19:30:56 +00:00
route_helpers.c Introduce rib_walk_ext_internal() to allow iteration with rnh pointer. 2020-11-29 13:54:49 +00:00
route_ifaddrs.c Split rtinit() into multiple functions. 2021-01-16 22:42:41 +00:00
route_tables.c Add modular fib lookup framework. 2020-12-25 11:33:17 +00:00
route_temporal.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
route_var.h Refactor rt_addrmsg() and rt_routemsg(). 2021-01-07 19:38:19 +00:00