opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.36k stars 754 forks source link

system: pull all host route creation into system_routing_configure() #5989

Closed fichtner closed 2 years ago

fichtner commented 2 years ago

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

Host routes are created by DNS global server settings, ISP provided DNS servers, Dpinger routes as well as static routes. Now that Dpinger is called inside system_routing_configure() we should start adding the other ones here as well.

Describe the solution you like

Make a deterministic creation of host routes and associated duties. Inspect for system_host_route() callers and ifctl(8) handling of routes flush. Luckily DHCP no longer creates host routes for DNS "on the fly" and we can access this data even after renewal.

# pluginctl -r host_routes

Describe alternatives you considered

For the sake of deterministic behaviour this needs to be done.

Additional context

https://github.com/opnsense/core/issues/5956

fichtner commented 2 years ago

In total there is only so much host route creation:

src/etc/inc/interfaces.inc: system_host_route($gif['remote-addr'], $realifgw); src/etc/inc/interfaces.inc: system_host_route($wancfg['gateway-6rd'], $ip4gateway); src/etc/inc/interfaces.inc: system_host_route('192.88.99.1', $ip4gateway); src/etc/inc/plugins.inc.d/dpinger.inc: system_host_route($gateway['monitor'], $gateway['gateway']); src/etc/inc/system.inc: system_host_route($host, $gateway);

dpinger and dns are visible now, for interfaces I'm unsure how to proceed

while we could pull things into system_routing_configure() it certainly doesn't make any sense at this point since the work is carried out already. I assume this can be closed for the time being.