Page MenuHomeFreeBSD

Split rtinit() into multiple functions.
ClosedPublic

Authored by melifaro on Jan 15 2021, 9:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 23 2024, 10:25 AM
Unknown Object (File)
Feb 23 2024, 10:25 AM
Unknown Object (File)
Feb 23 2024, 10:25 AM
Unknown Object (File)
Feb 23 2024, 10:25 AM
Unknown Object (File)
Feb 23 2024, 10:25 AM
Unknown Object (File)
Feb 23 2024, 10:11 AM
Unknown Object (File)
Feb 21 2024, 10:51 AM
Unknown Object (File)
Jan 27 2024, 5:44 AM
Subscribers

Details

Summary

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.
  1. 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.
  1. 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.
  1. rtinit() is the last customer passing non-masked prefixes to rib_action(), complicating rib_action() implementation.
  1. rtinit() coupled ifa announce/withdrawal notifications, producing "false positive" ifa messages in certain corner cases.

To address all these points, the following split has been done:

  • Route attribute construction were moved to the per-address-family functions, dealing with (2), (3) and (4).
  • function providing net.add_addr_allfibs handling and route rtsock notifications is the new routing table interface.
  • rtsock ifa notificaion has been moved out as well. The resulting set of functions are only responsible for the actual route notifications.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 36248
Build 33137: arc lint + arc unit