mirror of
https://github.com/webmin/webmin.git
synced 2026-06-28 15:00:25 +01:00
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
31 lines
745 B
Perl
Executable File
31 lines
745 B
Perl
Executable File
#!/usr/local/bin/perl
|
|
# De-activate a bunch of active interfaces
|
|
|
|
require './net-lib.pl';
|
|
|
|
&ReadParse();
|
|
|
|
&error_setup($text{'daifcs_err'});
|
|
|
|
@d = split(/\0/, $in{'d'});
|
|
@d || &error($text{'daifcs_enone'});
|
|
|
|
# Do the deletion, one by one
|
|
@acts = &active_interfaces();
|
|
foreach $d (@d) {
|
|
($a) = grep { $_->{'fullname'} eq $d } @acts;
|
|
$a || &error($text{'daifcs_egone'});
|
|
&can_iface($a) || &error($text{'ifcs_ecannot_this'});
|
|
if (defined(&delete_active_interface)) {
|
|
# Config-driven backends may need to remove persistent state too.
|
|
$err = &delete_active_interface($a);
|
|
$err && &error("<pre>$err</pre>");
|
|
}
|
|
else {
|
|
&deactivate_interface($a);
|
|
}
|
|
}
|
|
|
|
&webmin_log("delete", "aifcs", scalar(@d));
|
|
&redirect("list_ifcs.cgi?mode=active");
|