5351 Commits

Author SHA1 Message Date
Ad Schellevis
70df688a9b VPN: WireGuard - hook wireguard empty devices during bootup, using wireguard_devices() plugin system. This should make sure services and components, such as the firewall, are able to use the device before being setup. closes https://github.com/opnsense/core/issues/6909
A minor modification was needed in wg-service-control.php to make sure a configure would be executed if wgX exists without configuration
2023-10-04 18:13:15 +02:00
Franco Fichtner
0942687097 system: fix monitor services disappearing after 1c890b8cce666 2023-10-04 07:26:02 +02:00
Franco Fichtner
1fe5395d6a system: refactor dpinger_status() 2023-10-03 21:46:51 +02:00
Franco Fichtner
c7320df459 system: fix former mishap, better to copy required values for later 2023-10-03 16:29:26 +02:00
Ad Schellevis
1c890b8cce Gateways: Single: Migrate to MVC - Import first part of https://github.com/opnsense/core/pull/6808
This commit imports part of the changes from @swhite2 which will keep the legacy handling intact for the first stage of the migration. It should be backwards compatible with the previous (23.7.x) code.

Changes new in this commit which where not in the original PR:

1) dpinger_status() missed $gwitem which rendered gateways statusses down
2) Model version number set to 0.0.1 so we can use the migration later to step into 1.0.0
3) Gateways->gatewayIterator() do not yield MVC records ensuring we are still using legacy config data when being called.
2023-10-03 15:06:22 +02:00
Csaba Kos
1f3311f5dd interfaces: allow multiple IP addresses in dhcp reject from; closes #6683 2023-09-30 13:34:28 +02:00
Franco Fichtner
871182c4f2 wireguard: merge net/wireguard as of version 2.2 #6827
Omit the dependency on wireguard-kmod as we will be targeting the kernel
module with 24.1.  Some people may run into this but it's safer than
trying to rely on a package that won't be available going from 23.7 to
24.1.
2023-09-29 08:32:12 +02:00
Franco Fichtner
40955ddaee dhcp: looks like a refactor gone wrong #6853 2023-09-28 17:42:24 +02:00
Stephan de Wit
7a2f3f62d9 interfaces: drop PPP default route handling
the relevant route is configured later in the chain using getDefaultGW(),
no need to instruct mpd5 to set it for us.
2023-09-27 15:59:17 +02:00
Franco Fichtner
7e3c63a3ab firewall: do not reference automatic rule that is hardcoded 2023-09-27 14:01:49 +02:00
Franco Fichtner
d9fcc0bbbf firewall: wrong link to VIP page 2023-09-26 08:41:16 +02:00
Franco Fichtner
f63fd66472 interfaces: for consistency bootstrap the implicit 'none' value 2023-09-25 09:09:25 +02:00
Franco Fichtner
0bd1280a45 interfaces: prevent reading config.xml garbage
The no prefix is only applicable when 'dhcp6' IPv6 mode is set.

PR: https://forum.opnsense.org/index.php?topic=35848.0
2023-09-24 20:54:31 +02:00
Franco Fichtner
7fcbb22094 dhcp: merge_ipv6_address() was too intrusive
Testing 3582242d0fe10 it appeared that link-local addresses were
rewritten as GUAs in the dhcpd configuration.  The static map part
does this right, but all the other callers are not.  Flip this
around as it was intended.  The DHCPv6 page will now throw an out
of range error when it previously adjusted the explit prefix anyway.

dhcpd config with link local seems fine too, but more testing is
always good.
2023-09-22 14:22:56 +02:00
Franco Fichtner
2d36853da4 interfaces: add interface return feature for use on bridges/assignment page 2023-09-22 09:49:00 +02:00
Daggolin
79355e3641
system: start gateway monitors after firewall rules are in place (#6874)
During bootup the gateway monitors were started before the firewall rules
were finished setting up. Under some circumstances this could lead to
incorrect data being reported by dpinger instances.
2023-09-21 14:38:23 +02:00
Alejandro Criado-Pérez
e25ef6774b
Corrected some typos (#6778) 2023-09-20 13:44:39 +02:00
Franco Fichtner
9c1342dac9 interfaces: missing default returns (although the same) 2023-09-20 09:20:55 +02:00
Franco Fichtner
29d5a1b129 interfaces: style update 2023-09-19 08:06:56 +02:00
Franco Fichtner
2a6845a6fb interfaces: tried keys before but list() is too dense 2023-09-18 10:52:40 +02:00
Franco Fichtner
db5c43d106 interfaces: allow clean MVC acces to primary address
POC for IPv4.  Acme-client is being naughtly.
2023-09-18 10:18:34 +02:00
Franco Fichtner
6a4d6a6f5a interfaces: sync up gre code with IPv6 changes in gif
And fix a typo in previous gif code and restructure slightly.
2023-09-18 09:47:22 +02:00
Franco Fichtner
a10c1b5a36 system: remove unused 2023-09-18 09:32:13 +02:00
Franco Fichtner
2f3dd72d77 interfaces: change "realifxyz" vars to more sensible names 2023-09-18 09:32:01 +02:00
Franco Fichtner
2340751540 interfaces: special treatment of IPv6 remote address cases
PR: https://forum.opnsense.org/index.php?topic=35876.0
2023-09-18 08:47:13 +02:00
Franco Fichtner
cbaf7cee1f interfaces: use interfaces_restart_by_device() where appropriate 2023-09-15 14:50:23 +02:00
Franco Fichtner
6ea9d216e2 interfaces: 0e2751d2d means default gateway switching no longer requires this #6852
The change is not immediate but the watcher will take care of it.
2023-09-15 14:23:21 +02:00
Franco Fichtner
22a2cc9836 system: clear a few legacy DynDNS leftovers 2023-09-15 13:21:49 +02:00
Franco Fichtner
496c1c787d openvpn: emit device name upon creation 2023-09-15 08:50:39 +02:00
Franco Fichtner
fa1efd0506 interfaces: signal wlan device creation success/failure 2023-09-15 08:46:20 +02:00
Franco Fichtner
a086f40b0a unbound: bring back 4a1bc9f8b5e to avoid dynamic reloads when possible; closes #6802 2023-09-14 14:00:29 +02:00
Franco Fichtner
2306449329 interfaces: fix typo 2023-09-13 13:00:47 +02:00
Franco Fichtner
c4285c9937 interfaces: if members for bridge could not be added change return code 2023-09-13 11:26:55 +02:00
Franco Fichtner
189e3af29e interfaces: improve bridge code a bit
* Allow the bridge to come up without members.  While the GUI made sure
  to avoid empty bridges there is no reason for it and underneath if the
  interface was disabled the GUI made the interface disappear from the
  selection.  So now allow an empty bridge (may be nice for migration)
  and show disabled interfaces in the edit page.  Fix all callers to not
  assume the member property is always set.  Can probably go away once
  bridges are moved to MVC.
* Inline interface_bridge_add_member() since link_interface_to_bridge()
  is the only caller.  Improve the parameter passing a bit too.
* Add bridge interface return code to (_)interfaces_bridge_configure().
* Improve device resolution and a few mwexecf() replacements.
* Log the reason why a device could not be attached to bridge when one
  device is not there as expected.
2023-09-13 10:39:49 +02:00
Franco Fichtner
818f729379 system: avoid picking up an empty default route
GIF/GRE might do this when assigned so extend the check.
2023-09-12 11:38:58 +02:00
Franco Fichtner
da4144180b interfaces: refactor link_interface_to_bridge() slightly 2023-09-12 11:15:17 +02:00
Franco Fichtner
58b45cd533 interfaces: kill the ancient OpenVPN-tap-on-a-bridge magic on IPv4 reload
This brings IPv4 and IPv6 closer together as both now support GIF/GRE
exclusively.  OpenVPN devices are created on boot since 44cd7aee8e.
2023-09-12 11:01:53 +02:00
Franco Fichtner
a744327574 interfaces: improve GIF/GRE configuration robustness
Now that we fail if we can't get the tunnel up improve this a bit more:

1. First order of business is adding removing/adding the device.

2. Return the device name when configuration was successful.

3. Use device name return to avoid "linking" failed devices.  This
   helps us to bring it up later when it is likely ready.

4. Remove the system_routing_configure() madness from device creation.

5. We may have static routes which were not adhered to previously.  So now
   use the same interfaces_restart_by_device() hook but omit the
   interface_configure() to void unwantend recusion in that function.
   This has the addded benefit of system_routing_configure() only being
   called once for that interface by rc.newwanip(v6).
2023-09-12 10:41:17 +02:00
Franco Fichtner
cfff4f2482 interfaces: split IPv4/IPv6 for GRE 2023-09-12 09:52:49 +02:00
Franco Fichtner
315153a07b interfaces: restructure GIF for split IPv4/IPv6 use
Formerly devices like GIF only worked on IPv4 dynamic links,
but with DS-Lite IPv6 is the only dynamic link so split the
execution on dynamic events according to what remote address
the tunnel requires.  This should allow DS-Lite to work out
of the box (functional after bootup).

While here restructure link_interface_to_gif() to better fit
the caller's needs.  Also feeling lucky about the stray
interfaces_bring_up() because if we check if the local address
is there we can be pretty sure the parent device is up.

PR: https://forum.opnsense.org/index.php?topic=35876.0
2023-09-12 09:01:29 +02:00
Franco Fichtner
252870b6c0 dhcp: style 2023-09-08 13:36:08 +02:00
Franco Fichtner
ff0b85f7e5 dhcp: clean up the messages in the radvd config header #6819 2023-09-07 20:32:49 +02:00
Franco Fichtner
2e0f00b603 system: style change 2023-09-07 16:55:47 +02:00
Franco Fichtner
2f87d58f9a system: /usr/sbin/nologin seems to be the authoritative one 2023-09-07 14:31:12 +02:00
Franco Fichtner
97b08eec0c system: kill the unused "alert" "interval"
The terminology is confusing -- it's just a poll interval in
dpinger's alert thread like we have in gateway watcher (also
defaulting to 1 second).  Since we do not want to expose
such values to the GUI without a pressing reason we better
do it this way than add more knobs that make support harder
and expectations less clear (reaction time suffers quickly when
increasing this value).

While here disable the alert thread completely in dpinger which
seems to be steered by passing the loss and delay.  Also adjust
the default for the loss interval which is calculated by dpinger
as 4 times the probe interval, so the default was wrong also.
2023-09-07 09:28:04 +02:00
Franco Fichtner
ea2f63bddd system: fix pid kill regression in #6825 2023-09-07 09:24:09 +02:00
Franco Fichtner
4b153a375a system: performance part 2; closes #6825
Under ideal circumstances (non-SIGKILL) the PID file and socket
are removed cleanly so they don't show up as readabe sockets in
dpinger_status().  When we kill the process the socket is there
but the open fails immediately.  That only leaves a stuck process
not reacting to open, but we can deal with that by decreating the
timeout a bit more (from 3 to 1 seconds per socket).  We still
want a sort of sensible timeout here that isn't too short and
assume that a system not being able to respond in time is having
other (and more criticial) issues to cope with.
2023-09-07 08:56:55 +02:00
Franco Fichtner
cb584cc171 system: gateway bindings cleanup
return_gateway_groups_array() is not used anymore, but leave it
in 23.7 so that 24.1 picks this up automatically.
2023-09-07 08:45:44 +02:00
Franco Fichtner
943b3fcf2c system: tweak previous also skipping unusable gateways 2023-09-07 08:45:44 +02:00
Franco Fichtner
5e9f114ea0 dhcp: make dhcrelay code use the Gateways class
Stop using the opportunistic "wan" gateway and emit a
log entry on failing to derive a viable interface name.
It's already somewhat questionable if we should use a
default gateway, but the code is what it is.
2023-09-06 16:10:27 +02:00