interfaces: remove _defaultgw use altogether
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- [x] I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md
- [x] I am convinced that my issue is new after having checked both open and closed issues at https://github.com/opnsense/core/issues?q=is%3Aissue
Is your feature request related to a problem? Please describe.
system_default_route() is the authoritative source of _defaultgw files, but for historical reasons the following spots seem to be injecting the file leading to multiple files in multi-WAN setup.
src/etc/inc/interfaces.inc: file_put_contents("/tmp/{$stfiface}_defaultgwv6", "{$rd6brgw}\n"); /* XXX omit in the future */
src/etc/inc/interfaces.inc: file_put_contents("/tmp/{$stfiface}_defaultgwv6", "{$stfbrgw}\n"); /* XXX omit in the future */
src/etc/inc/interfaces.inc: echo \${2} > /tmp/\${1}_defaultgwv6
Plus some other manual use of the file should be audited.
~~If there is still time also see if this can be removed:~~ (removed)
src/etc/inc/interfaces.inc: if (!empty(trim(@file_get_contents("/tmp/{$realif}_router")))) {
src/etc/inc/interfaces.inc: if (!empty(trim(@file_get_contents("/tmp/{$realifv6}_routerv6")))) {
Describe the solution you like
Remove manual spots for file write and maybe even file read.
Describe alternatives you considered
Need to get this done to make the interface handling more robust.
Additional context
#5862
Just ditch all of it as evidence suggests it isn't used anywhere except pppoe and dhclient where it may have been MIA since d7b3d61 anyway.