use Proxmox::Log;
use Proxmox::Sys::File qw(file_read_firstline);
use Proxmox::Sys::Block;
+use Proxmox::Sys::Net;
my sub fromjs : prototype($) {
return from_json($_[0], { utf8 => 1 });
routes => $routes,
dns => query_dns(),
};
+ # FIXME: move whatever makes sense over to Proxmox::Sys::Net:: and keep that as single source,
+ # it can then use some different structure just fine (after adapting the GTK GUI to that) but
+ # **never** to (slightly different!) things for the same stuff...
+ $output->{ipconf} = Proxmox::Sys::Net::get_ip_config();
$output->{kernel_cmdline} = file_read_firstline("/proc/cmdline");
$output->{total_memory} = query_total_memory();
# GUI global variables
my $gtk_state = {};
-my $ipconf;
my $target_hds; # only for the summary view
my $autoreboot_seconds = 5;
"\tgateway $gateway\n";
}
+ my $ipconf = $run_env->{ipconf};
foreach my $iface (sort keys %{$ipconf->{ifaces}}) {
my $name = $ipconf->{ifaces}->{$iface}->{name};
next if $name eq $ethdev;
return "$iface->{name} - $iface->{mac} ($iface->{driver})";
};
- my $device_active_map = {};
- my $device_active_reverse_map = {};
+ my $ipconf = $run_env->{ipconf};
+
+ my ($device_active_map, $device_active_reverse_map) = ({}, {});
my $device_change_handler = sub {
my $current = shift;
};
my $i = 0;
- foreach my $index (sort keys %{$ipconf->{ifaces}}) {
- $device_cb->append_text(&$get_device_desc($ipconf->{ifaces}->{$index}));
+ for my $index (sort keys $ipconf->{ifaces}->%*) {
+ my $iface = $ipconf->{ifaces}->{$index};
+ $device_cb->append_text($get_device_desc->($iface));
$device_active_map->{$i} = $index;
- $device_active_reverse_map->{$ipconf->{ifaces}->{$index}->{name}} = $i;
+ $device_active_reverse_map->{$iface->{name}} = $i;
if ($ipconf_first_view && $index == $ipconf->{default}) {
$device_cb->set_active($i);
&$device_change_handler($device_cb);
set_next("I a_gree", \&create_hdsel_view);
}
-$ipconf = Proxmox::Sys::Net::get_ip_config();
-
Gtk3::init();
create_main_window ();
}
}
-if (!$initial_error && (scalar keys %{ $ipconf->{ifaces} } == 0)) {
+if (!$initial_error && (scalar keys $run_env->{ipconf}->{ifaces}->%* == 0)) {
print STDERR "no network interfaces found\n";
$initial_error = 1;
Proxmox::UI::display_html("nonics.htm");