aliases: Add support to assign aliases to multiple RED interfaces

This is a little patch which will extend the aliases page to offer an
interface selection if there are more than one RED interfaces.

This is a little hack to make configuration easier for users who have
manually set up more than one RED interface (e.g. for load balancing or
fail-over) and want to use the UI to configure firewall rules.

As a little benefit on the side, I had to rewrite setaliases.c to use
ip(8) instead of ifconfig(8).

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Acked-by: Peter Müller <peter.mueller@ipfire.org>
This commit is contained in:
Michael Tremer
2022-06-29 18:27:23 +00:00
committed by Peter Müller
parent f704d76e08
commit 6395bed8a4
4 changed files with 99 additions and 23 deletions

View File

@@ -332,6 +332,26 @@ sub setup_upstream_proxy() {
}
}
sub get_red_interfaces() {
my $default = &General::get_red_interface();
my @intfs = (
$default,
);
opendir(INTERFACES, "/sys/class/net");
while (my $intf = readdir(INTERFACES)) {
if ($intf =~ m/^red[0-9]+$/) {
push(@intfs, $intf);
}
}
closedir(INTERFACES);
return &General::uniq(@intfs);
}
sub list_wireless_interfaces() {
my %interfaces = ();