10 Commits

Author SHA1 Message Date
Ilia Ross
0dbb5d2f89 Fix to share ifupdown parser with network detection
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
2026-06-23 15:00:32 +02:00
Ilia Ross
8ba6a02122 Merge branch 'master' into dev/add-deb-dhcpcd-support-1607 2026-06-21 00:00:06 +02:00
Ilia Ross
c08468ec48 Fix network config spacing preservation
- Preserve existing spacing and inline comments when rewriting `/etc/nsswitch.conf` `hosts:` lines.

- Preserve indentation, comment prefix, inline comments, and field separators when rewriting `/etc/hosts` rows.

- Add tests for the `nsswitch.conf` spacing/comment behavior.
2026-06-20 15:27:28 +02:00
Ilia Ross
cb4a322042 Fix active virtual interface handling
ⓘ Treat Linux active virtual interfaces as secondary IP addresses instead of independent links, fixing alias parsing, hiding invalid status controls, rejecting down-state creation, and removing existing aliases with ip addr del when needed.

Reproduce path:

Example repro before this fix:

1. Go to **Network Configuration → Network Interfaces → Active Now**.
2. Click **Add a new interface**.
3. Enter:

```text
Name: enp0s5:1
IPv4 address: 10.211.55.21
Netmask: 255.255.255.0
Status: Down
```

4. Click **Create**.

Before the fix, Webmin could still create the alias or handle it inconsistently, because `enp0s5:1` is not a real link that can be “down”. It is just an extra IP address on `enp0s5`.

Expected after the fix:

- The UI should not offer `Status` for active virtual aliases.
- If someone submits `up=0` manually anyway, Webmin rejects it with:
  `Virtual interfaces cannot be created with down status`
- If an existing active virtual alias is saved as down through lower-level code, Webmin removes the IP using something like:

```bash
ip addr del 10.211.55.21/24 dev enp0s5
```
2026-06-20 15:23:09 +02:00
Ilia Ross
f2782073ce Fix to remove factored-out virtual alias changes 2026-06-20 15:09:31 +02:00
Ilia Ross
090aed60df Fix to remove unrelated network formatting cleanups 2026-06-20 14:44:51 +02:00
Ilia Ross
7ebe3f7dfa Add dhcpcd network backend for Debian and Raspberry Pi OS
This PR adds dhcpcd backend support for Debian and Raspberry Pi OS network configuration. It detects dhcpcd only as a final fallback after Netplan, NetworkManager, and ifupdown, preventing Webmin from incorrectly falling back to `/etc/network/interfaces` on dhcpcd-managed systems.

The new backend reads and writes `/etc/dhcpcd.conf`, including DHCP and static IPv4/IPv6 configuration, gateways, static routes, DNS servers, search domains, MTU, and virtual IPv4 aliases. It also supports implicit DHCP-managed interfaces for default dhcpcd setups with no explicit interface blocks, and handles `allowinterfaces` / `denyinterfaces` behavior.

This PR also fixes apply/delete flows for dhcpcd-managed interfaces and virtual aliases, avoids rewriting generated `/etc/resolv.conf`, preserves spacing/comments in touched hosts and nsswitch files, and tightens Active Now handling so virtual aliases are treated as IP addresses rather than independent links.

https://github.com/webmin/webmin/issues/1607
2026-06-20 01:57:50 +02:00
Ilia Ross
6574373761 Fix to detect NetworkManager networking on Debian
ⓘ Prefer Netplan when Debian has Netplan YAML config, otherwise select the existing NetworkManager backend for Debian systems with saved NM connection profiles, with regression tests for backend selection.

https://github.com/webmin/webmin/issues/2559
2026-06-02 01:33:59 +02:00
Ilia Ross
7f63875c42 Drop unnes quotemeta for params to be used 2026-05-19 11:25:34 +02:00
Ilia Ross
846bbb8252 Fix to preserve Netplan YAML when saving DNS
* Note: Preserve existing Netplan indentation when updating DNS settings, validate with netplan generate before applying, and surface apply errors to avoid network loss from malformed YAML.
2026-05-19 00:31:34 +02:00