<commit_before># net-lib.pl
# Common local networking functions

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
%access = &get_module_acl();
$access{'ipnodes'} = $access{'hosts'};

# XXX detect this automatically rather than using a bunch of links?
if (-r "$module_root_directory/$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl") {
	do "$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl";
	}
elsif ($gconfig{'os_type'} eq 'suse-linux' &&
       $gconfig{'os_version'} >= 9.2) {
	# Special case for SuSE 9.2+
	do "$gconfig{'os_type'}-9.2-ALL-lib.pl";
	}
elsif ($gconfig{'os_type'} eq 'slackware-linux' &&
       $gconfig{'os_version'} >= 9.1) {
	# Special case for Slackware 9.1+
	do "$gconfig{'os_type'}-9.1-ALL-lib.pl";
	}
elsif ($gconfig{'os_type'} eq 'debian-linux' && 
       &has_command("netplan") &&
       -d "/etc/netplan" &&
       glob("/etc/netplan/*")) {
	# Special case for newer Ubuntu versions
	do "netplan-lib.pl";
	}
else {
	do "$gconfig{'os_type'}-lib.pl";
	}

# list_hosts()
# Parse hosts from /etc/hosts into a data structure
sub list_hosts
{
local @rv;
local $lnum = 0;
local $line="";

&open_readfile(HOSTS, $config{'hosts_file'});
while($line=<HOSTS>) {
	local $comment = 0;
	$line =~ s/\r|\n//g;
	if ($line =~ s/^\s*#+\s*//) {
		$comment = 1;
		}
	$line =~ s/#.*$//g;
	$line =~ s/\s+$//g;
	local @f = split(/\s+/, $line);
	local $ipaddr = shift(@f);
	if (check_ipaddress_any($ipaddr)) {
		push(@rv, { 'address' => $ipaddr,
			    'hosts' => [ @f ],
			    'active' => !$comment,
			    'line', $lnum,<commit_msg>User may be on netplan but have no configs yet<commit_after># net-lib.pl
# Common local networking functions

BEGIN { push(@INC, ".."); };
use WebminCore;
&init_config();
%access = &get_module_acl();
$access{'ipnodes'} = $access{'hosts'};

# XXX detect this automatically rather than using a bunch of links?
if (-r "$module_root_directory/$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl") {
	do "$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl";
	}
elsif ($gconfig{'os_type'} eq 'suse-linux' &&
       $gconfig{'os_version'} >= 9.2) {
	# Special case for SuSE 9.2+
	do "$gconfig{'os_type'}-9.2-ALL-lib.pl";
	}
elsif ($gconfig{'os_type'} eq 'slackware-linux' &&
       $gconfig{'os_version'} >= 9.1) {
	# Special case for Slackware 9.1+
	do "$gconfig{'os_type'}-9.1-ALL-lib.pl";
	}
elsif ($gconfig{'os_type'} eq 'debian-linux' && 
       &has_command("netplan") &&
       -d "/etc/netplan") {
	# Special case for newer Ubuntu versions
	do "netplan-lib.pl";
	}
else {
	do "$gconfig{'os_type'}-lib.pl";
	}

# list_hosts()
# Parse hosts from /etc/hosts into a data structure
sub list_hosts
{
local @rv;
local $lnum = 0;
local $line="";

&open_readfile(HOSTS, $config{'hosts_file'});
while($line=<HOSTS>) {
	local $comment = 0;
	$line =~ s/\r|\n//g;
	if ($line =~ s/^\s*#+\s*//) {
		$comment = 1;
		}
	$line =~ s/#.*$//g;
	$line =~ s/\s+$//g;
	local @f = split(/\s+/, $line);
	local $ipaddr = shift(@f);
	if (check_ipaddress_any($ipaddr)) {
		push(@rv, { 'address' => $ipaddr,
			    'hosts' => [ @f ],
			    'active' => !$comment,
			    'line', $lnum,
{'fraction_non_alphanumeric': 0.2240824211204121, 'fraction_numerical': 0.009658725048293626, 'mean_word_length': 3.7653374233128836, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3657032', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1246, 'n_words': 265}