29 Commits

Author SHA1 Message Date
Franco Fichtner
4950460715 interfaces: force newip calls through DHCP/PPP/OVPN on IPv4
In case addresses are removed and reapplied the routes are gone
and other related interface configuration is missing.  In these
cases do a full recycle even though the address did not change
visibly (which is good that we can detect it).

Also address the "miss" of the cached address clean now that we
know DHCP should not force-update us into a missing address
scenario during a renew.

PR: https://github.com/opnsense/core/issues/6338
2023-02-21 10:50:43 +01:00
Franco Fichtner
26ccc7839f system: remove _defaultgw(v6) file handling; closes #5900
Try to avoid touching default routes in dhclient-script which we
already partially do now.  PPPoE linkdown certainly doesn't need
to handle the file as well to remove the default route then.
2022-10-06 09:29:12 +02:00
Franco Fichtner
489ae2f3c6 interfaces: DHCP is our problem child #5933 2022-08-15 13:20:41 +02:00
Franco Fichtner
e6ef454fa8 interfaces: signal address flush through rc.newwanip #5933 2022-08-15 12:14:48 +02:00
Franco Fichtner
bb4743a732 interfaces: stop DHCP from calling rc.newwanip when no changes are being done
This is a partial revert of 797c1864194 which has good intentions but rc.newwanip(v6)
isn't equipped with being called a lot of times yet.  We want to improve this for 23.1.
2022-08-02 09:04:12 +02:00
Franco Fichtner
e9298024c1 interfaces: DHCP router to ifctl #5862 2022-07-25 12:03:23 +02:00
Franco Fichtner
96039560ad interfaces: detach newwanip call as discussed 2022-03-18 08:28:04 +01:00
Ad Schellevis
797c186419 dhclient-script: prevent the removal of default routes as rc.newwanip is responsible for calculating the correct active default.
Ideally rc.newwanip should be as lightweight as possible, with 8c49c7bfdd in place normal execution doesn't take much time, but it likely doesn't make sense to hook gif|gre interfaces either when nothing has changed.

closes https://github.com/opnsense/core/issues/5624
2022-03-16 20:44:37 +01:00
Franco Fichtner
c39ef68e58 interfaces: add ifctl -r and -p for router and prefix files
We add this here to ensure consistency between the functionalities
of these interface helper files.  Not all instances have been
converted, but they can be as time permits.  Tested on IPv6.

While here settle on "prefix" for pdinfo as a thing since we
renamed it already anyway.
2022-03-11 15:39:45 +01:00
Franco Fichtner
6446a4ccfa interfaces: ifctl link for nameserver.sh
Not sure about nameserver.sh name and scope yet so try to
hide it under a link.  We can always change the name later
although having .sh suffix helps us lint the script more easily.
2022-03-11 10:50:04 +01:00
Franco Fichtner
b8bdb8deb7 interfaces: add proper argument parsing, simplify invokes #5565 2022-02-25 10:49:51 +01:00
Franco Fichtner
652ae0881c interfaces: add nameserver script to contain the situation #5565
Routes only get added in system_resolvconf_generate() now where
the DNS override is properly checked.  The nameservers are added
through the new script for convenience and removed from there as
well.  As a bonus we still scrub the routes from the nameserver
file removal to avoid creating "state" about what was done elsewhere.

This is still subject to a lot of funky races for overlapping host
routes either by ISP, manual DNS, gateway monitors or static routes.
2022-02-24 15:00:05 +01:00
Franco Fichtner
481c6f943f interfaces: PATH is not complete in dhclient-script
PR: https://forum.opnsense.org/index.php?topic=26995.0
2022-02-16 16:21:01 +01:00
Franco Fichtner
02dc1ebd93 interfaces: prevent DHCP from installing nameservers when not allowed
This was refactored previously and all the logic should live outside
dhclient-script but it seems it's only loosely handled over there.
For now put a check back in the old way and rework this later correctly
from the system.inc point of view: we do want to register nameserver
and searchdomain in the cache files, but should not add a route if
those are not required.  It would be helpful to show them in the overview
regardless (as for DNS servers) but with a hint that they are not being
used.

PR: https://forum.opnsense.org/index.php?topic=26765.0
2022-02-05 08:16:43 +01:00
Franco Fichtner
61720fe233 scripts: tabs vs. spaces 2022-01-11 11:22:03 +01:00
Franco Fichtner
6704426c19 interfaces: repair getenv() breakage in ea6b5bda52409 the right way #5367
Moral of the story: don't try to call backend scripts to grab env
variables that you could easily read using the acual nameserver
script sort of like dhclient-script is doing it.

ALLOWOVERRIDE is silly as we guard against that in get_nameservers().
2021-11-29 10:57:40 +01:00
Franco Fichtner
b28fa22d69 interfaces: nameserver can use same file format as others #5367
Also decouple searchdomain write from nameserver write in dhclient-script
and clear files properly.
2021-11-28 13:52:52 +01:00
Franco Fichtner
c6c7e9854d interfaces: searchdomain can use same file format as others #5367
Other directory was slightly confusing, other name even more so.
2021-11-28 13:42:38 +01:00
Franco Fichtner
99a0f1a164 interfaces: move nameserver files to /tmp #5367 2021-11-28 13:37:41 +01:00
Franco Fichtner
cc0b1b3be9 interfaces: move searchdomain files to /tmp #5367 2021-11-28 13:25:37 +01:00
Franco Fichtner
49210b3da8 interfaces: rc.newwanip(v6) changes related to #5367
o Only operate the /var/db IP files via rc.newwanip(v6)
o Consistenly flush a cache IP on a triggered reload
o Remove IPv6 address removal workaround from https://redmine.pfsense.org/issues/2627
o Assume that IP is properly checked making $cacheip != $ip a valid assumption when $cacheip is empty
o Remove creation from dhclient script
2021-11-27 13:54:06 +01:00
Ad Schellevis
57f0575dcc interfaces: newwanip, clear states when address changes. for https://github.com/opnsense/core/pull/4726 2021-03-02 15:55:46 +01:00
Franco Fichtner
90c0c395a5 interfaces: check for valid alias IP #3197
Suggested by: @tbandixen
2019-02-15 11:26:14 +01:00
Franco Fichtner
8e9ae38fdc Revert "interfaces: remove arp flush from dhclient-script #3197"
This reverts commit a1dbbb5ef132487c88b2b144ac67eeedb00a576c.
2019-02-15 11:22:07 +01:00
Franco Fichtner
b20f71b19e interfaces: our dhclient-script doesn't clobber resolv.conf #3197
The FreeBSD one does, but we have different code that is "safe"
for multiple DHCP connections.
2019-02-08 22:23:18 +01:00
Franco Fichtner
a1dbbb5ef1 interfaces: remove arp flush from dhclient-script #3197
PR: https://forum.opnsense.org/index.php?topic=11037.0
2019-02-08 22:21:54 +01:00
Franco Fichtner
cae5ec3f69 system: remove apinger, dpinger takes over 2018-11-10 23:42:17 +01:00
Franco Fichtner
19b832f6c8 interfaces: try to sync dhclient-script #2542 2018-08-08 18:15:32 +02:00
Franco Fichtner
00838b49ce src: move dhclient-script to proper location
".ext" came to be because dhclient-script from BSD is also under sbin/,
but since we always explicity use this one just move it to a neutral
location and point to it.
2018-05-06 14:32:06 +02:00