net/0040755000567100000120000000000010656003102011321 5ustar jcameronwheelnet/save_aifc.cgi0100755000567100000120000001035410656003101013727 0ustar jcameronwheel#!/usr/local/bin/perl # save_aifc.cgi # Save, create or delete an active interface require './net-lib.pl'; &ReadParse(); @acts = &active_interfaces(); if ($in{'delete'}) { # delete an interface &error_setup($text{'aifc_err1'}); $a = $acts[$in{'idx'}]; &can_iface($a) || &error($text{'ifcs_ecannot_this'}); &deactivate_interface($a); &webmin_log("delete", "aifc", $a->{'fullname'}, $a); } else { # Validate and save inputs &error_setup($text{'aifc_err2'}); if (!$in{'new'}) { $olda = $acts[$in{'idx'}]; &can_iface($olda) || &error($text{'ifcs_ecannot_this'}); $a->{'name'} = $olda->{'name'}; $a->{'virtual'} = $olda->{'virtual'} if (defined($olda->{'virtual'})); } elsif (defined($in{'virtual'})) { # creating a virtual interface $in{'virtual'} =~ /^\d+$/ || &error($text{'aifc_evirt'}); $in{'virtual'} >= $min_virtual_number || &error(&text('aifc_evirtmin', $min_virtual_number)); foreach $ea (@acts) { if ($ea->{'name'} eq $in{'name'} && $ea->{'virtual'} eq $in{'virtual'}) { &error(&text('aifc_evirtdup', "$in{'name'}:$in{'virtual'}")); } } $a->{'name'} = $in{'name'}; $a->{'virtual'} = $in{'virtual'}; &can_create_iface() || &error($text{'ifcs_ecannot'}); &can_iface($a) || &error($text{'ifcs_ecannot'}); } elsif ($in{'name'} =~ /^([a-z]+\d*(\.\d+)?):(\d+)$/) { # also creating a virtual interface foreach $ea (@acts) { if ($ea->{'name'} eq $1 && $ea->{'virtual'} eq $3) { &error(&text('aifc_evirtdup', $in{'name'})); } } $3 >= $min_virtual_number || &error(&text('aifc_evirtmin', $min_virtual_number)); $a->{'name'} = $1; $a->{'virtual'} = $3; &can_create_iface() || &error($text{'ifcs_ecannot'}); &can_iface($a) || &error($text{'ifcs_ecannot'}); } elsif ($in{'name'} =~ /^[a-z]+\d*(\.\d+)?$/) { # creating a real interface foreach $ea (@acts) { if ($ea->{'name'} eq $in{'name'}) { &error(&text('aifc_edup', $in{'name'})); } } $a->{'name'} = $in{'name'}; &can_create_iface() || &error($text{'ifcs_ecannot'}); &can_iface($a) || &error($text{'ifcs_ecannot'}); } else { &error($text{'aifc_ename'}); } # Check for address clash $allow_clash = defined(&allow_interface_clash) ? &allow_interface_clash($a, 0) : 1; if (!$allow_clash && ($in{'new'} || $olda->{'address'} ne $a->{'address'})) { ($clash) = grep { $_->{'address'} eq $a->{'address'} } @acts; $clash && &error(&text('aifc_eclash', $clash->{'fullname'})); } # Validate and store inputs &check_ipaddress($in{'address'}) || &error(&text('aifc_eip', $in{'address'})); $a->{'address'} = $in{'address'}; if ($virtual_netmask && $a->{'virtual'} ne "") { # Always use this netmask for virtuals $a->{'netmask'} = $virtual_netmask; } elsif (!$access{'netmask'}) { # Use default netmask $a->{'netmask'} = $in{'new'} ? $config{'def_netmask'} || "255.255.255.0" : $olda->{'netmask'}; } elsif (!$in{'netmask_def'}) { &check_ipaddress($in{'netmask'}) || &error(&text('aifc_emask', $in{'netmask'})); $a->{'netmask'} = $in{'netmask'}; } if (!$access{'broadcast'}) { # Compute broadcast $a->{'netmask'} = $in{'new'} ? &compute_broadcast($a->{'address'}, $a->{'netmask'}) : $olda->{'broadcast'}; } elsif (!$in{'broadcast_def'}) { &check_ipaddress($in{'broadcast'}) || &error(&text('aifc_ebroad', $in{'broadcast'})); $a->{'broadcast'} = $in{'broadcast'}; } if (!$access{'mtu'}) { # Use default MTU $a->{'mtu'} = $in{'new'} ? $config{'def_mtu'} : $olda->{'mtu'}; } elsif (!$in{'mtu_def'}) { $in{'mtu'} =~ /^\d+$/ || &error(&text('aifc_emtu', $in{'mtu'})); $a->{'mtu'} = $in{'mtu'} if ($olda->{'mtu'} ne $in{'mtu'}); } if (!$access{'up'}) { $a->{'up'} = $in{'new'} ? 1 : $olda->{'up'}; } elsif ($in{'up'}) { $a->{'up'}++; } if (!$in{'ether_def'} && $a->{'virtual'} eq "" && &iface_hardware($a->{'name'})) { $in{'ether'} =~ /^[A-Fa-f0-9:]+$/ || &error(&text('aifc_ehard', $in{'ether'})); $a->{'ether'} = $in{'ether'} if ($olda->{'ether'} ne $in{'ether'}); } $a->{'fullname'} = $a->{'name'}. ($a->{'virtual'} eq '' ? '' : ':'.$a->{'virtual'}); # Bring it up &activate_interface($a); &webmin_log($in{'new'} ? 'create' : 'modify', "aifc", $a->{'fullname'}, $a); } &redirect("list_ifcs.cgi"); net/CHANGELOG0100664000567100000120000000412210656003101012530 0ustar jcameronwheel---- Changes since 1.130 ---- Added support for Slackware Linux. ---- Changes since 1.140 ---- Fixed support for Slackware Linu 9.1, which uses a different configuration file. Added an option to update /etc/hosts when changing the system's hostname. Fixed virtual interface numbering on Solaris. Added links from ppp* interfaces to the actual modules that handle them, like PPPP Dialin Client or ADSL Client. Added support for boot-time address range interfaces on Redhat and similar Linux distributions. ---- Changes since 1.150 ---- Added checks on Linux to prevent interfaces with IPs that are already in use from being added, as this is not allowed by the OS. ---- Changes since 1.160 ---- Added the ability to configure static routes on Debian systems. Fixed bugs that prevented the module from working on SuSE 9.0+, and made it visible on those distributions again. ---- Changes since 1.170 ---- Added display of currently active routes on routing page. ---- Changes since 1.190 ---- Added some access control options to limit what features of an interface can be edited, and to force both boot-time and active interfaces to be edited at once. Improved support for virtual interfaces on FreeBSD, where the interface ordering is inconsistent. ---- Changes since 1.200 ---- Interfaces used by Solaris zones are now recognized, and cannot be editing using this module (the Zones module must be used instead). On Solaris systems, interfaces configured using DHCP can now be properly activated. ---- Changes since 1.250 ---- Added support for the new config file format in SuSE 10.0. Added support for editing the IPv6 host addresses file on Solaris (/etc/inet/ipnodes). ---- Changes since 1.270 ---- Added checkboxes and buttons for deleting multiple interfaces and host addresses at once. Active routes can be added and deleted on Linux and Solaris systems. ---- Changes since 1.290 ---- Added a button for activating several boot-time interfaces at once. ---- Changes since 1.340 ---- Fixed broken SuSE 10.2+ support. ---- Changes since 1.350 ---- Re-wrote Gentoo networking support code to work with 2006 and later versions. net/suse-linux-lib.pl0100755000567100000120000002225310656003101014541 0ustar jcameronwheel# suse-linux-lib.pl # Networking functions for SuSE linux $rc_config = "/etc/rc.config"; $route_conf = "/etc/route.conf"; $use_suse_dns = 1; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local $rc = &parse_rc_config(); local @rv; push(@rv, { 'fullname' => 'lo', 'name' => 'lo', 'up' => $rc->{'START_LOOPBACK'}->{'value'} =~ /yes/, 'address' => '127.0.0.1', 'netmask' => '255.0.0.0', 'broadcast' => '127.255.255.255', 'edit' => 0, 'file' => $rc_config, 'index' => scalar(@rv) }); local @nc = split(/\s+/, $rc->{'NETCONFIG'}->{'value'}); foreach $nc (@nc) { local $ip = $rc->{"IPADDR$nc"}->{'value'}; local $dev = $rc->{"NETDEV$nc"}->{'value'}; local $conf = $rc->{"IFCONFIG$nc"}->{'value'}; if ($dev) { local $b; $b->{'fullname'} = $dev; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } if ($conf =~ /^([0-9\.]+)/) { $b->{'address'} = $1; if ($conf =~ /broadcast\s+(\S+)/) { $b->{'broadcast'} = $1; } if ($conf =~ /netmask\s+(\S+)/) { $b->{'netmask'} = $1; } if ($conf =~ /\s+up/ || $gconfig{'os_version'} >= 7.1) { $b->{'up'} = 1; } } elsif ($conf =~ /bootp/) { $b->{'bootp'} = 1; $b->{'netmask'} = 'Automatic'; $b->{'broadcast'} = 'Automatic'; $b->{'up'}++; } elsif ($conf =~ /dhcpclient/) { $b->{'dhcp'} = 1; $b->{'netmask'} = 'Automatic'; $b->{'broadcast'} = 'Automatic'; $b->{'up'}++; } $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'nc'} = $nc; $b->{'file'} => $rc_config, push(@rv, $b); } } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { # Find existing interface, if any &lock_file($rc_config); local $rc = &parse_rc_config(); local @boot = &boot_interfaces(); local ($o, $old, $found); foreach $o (@boot) { if ($o->{'name'} eq $_[0]->{'name'} && $o->{'virtual'} eq $_[0]->{'virtual'}) { $found++; $old = $o; last; } } # build interface detail strings local $fullname = $_[0]->{'name'}; $fullname .= ":".$_[0]->{'virtual'} if (defined($_[0]->{'virtual'})); local $ifconfig; if ($_[0]->{'bootp'}) { $ifconfig = 'bootp'; } elsif ($_[0]->{'dhcp'}) { $ifconfig = 'dhcpclient'; } else { $ifconfig = $_[0]->{'address'}; $ifconfig .= " broadcast $_[0]->{'broadcast'}" if ($_[0]->{'broadcast'}); $ifconfig .= " netmask $_[0]->{'netmask'}" if ($_[0]->{'netmask'}); $ifconfig .= " up" if ($_[0]->{'up'}); } if ($found) { # Updating an existing interface local $nnc = $old->{'nc'}; &save_rc_config($rc, "IPADDR$nnc", $_[0]->{'address'}); &save_rc_config($rc, "NETDEV$nnc", $fullname); &save_rc_config($rc, "IFCONFIG$nnc", $ifconfig); } else { # Adding a new interface local @nc = split(/\s+/, $rc->{'NETCONFIG'}->{'value'}); local $nnc = $nc[@nc-1] =~ /_(\d+)/ ? "_".($1+1) : "_0"; &save_rc_config($rc, "NETCONFIG", join(" ", @nc, $nnc)); &save_rc_config($rc, "IPADDR$nnc", $_[0]->{'address'}); &save_rc_config($rc, "NETDEV$nnc", $fullname); &save_rc_config($rc, "IFCONFIG$nnc", $ifconfig); } &unlock_file($rc_config); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { &lock_file($rc_config); local $rc = &parse_rc_config(); local @boot = &boot_interfaces(); local $old; foreach $old (@boot) { if ($old->{'name'} eq $_[0]->{'name'} && $old->{'virtual'} eq $_[0]->{'virtual'}) { # found it .. remove local $nnc = $old->{'nc'}; local @nc = split(/\s+/, $rc->{'NETCONFIG'}->{'value'}); @nc = grep { $_ ne $nnc } @nc; &save_rc_config($rc, "NETCONFIG", join(" ", @nc)); &save_rc_config($rc, "IPADDR$nnc", ""); &save_rc_config($rc, "NETDEV$nnc", ""); &save_rc_config($rc, "IFCONFIG$nnc", ""); } } &unlock_file($rc_config); } # can_edit(what, &details) # Can some boot-time interface parameter be edited? sub can_edit { if ($gconfig{'os_version'} >= 7.1) { if ($_[1] && ($_[1]->{'bootp'} || $_[1]->{'dhcp'})) { return $_[0] ne "mtu" && $_[0] ne "netmask" && $_[0] ne "broadcast" && $_[0] ne "up"; } return $_[0] ne "mtu" && $_[0] ne "up"; } else { if ($_[1] && $_[1]->{'bootp'}) { return $_[0] ne "mtu" && $_[0] ne "dhcp" && $_[0] ne "netmask" && $_[0] ne "broadcast" && $_[0] ne "up"; } return $_[0] ne "mtu" && $_[0] ne "dhcp"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { local $rc = &parse_rc_config(); return $rc->{'FQHOSTNAME'}->{'value'}; } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); &lock_file($rc_config); local $rc = &parse_rc_config(); &save_rc_config($rc, "FQHOSTNAME", $_[0]); &unlock_file($rc_config); # run SuSEconfig, as this function is called last &system_logged("SuSEconfig -quick >/dev/null 2>&1"); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( $route_conf, $rc_config ); } sub routing_input { # read route.conf local ($default, @sr, @lr); &open_readfile(ROUTE, $route_conf); while() { s/\r|\n//g; s/#.*$//g; local @r = split(/\s+/, $_); if ($r[0] eq 'default' || $r[0] eq '0.0.0.0') { $default = $r[1]; } elsif (@r == 4) { push(@lr, \@r); } elsif (@r == 3) { push(@sr, \@r); } } close(ROUTE); # input for routing local $rc = &parse_rc_config(); local $ipf = $rc->{'IP_FORWARD'}->{'value'}; print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $ipf eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $ipf eq "yes" ? "" : "checked"; # input for default route print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $default ? "" : "checked"; printf "\n", $default ? "checked" : ""; printf " \n", $default; # table for local routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@lr; $i++) { local $lr = $lr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; # table for static routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@sr; $i++) { local $sr = $sr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_net'}$text{'routes_gateway'}$text{'routes_mask'}
\n"; } sub parse_routing { &lock_file($rc_config); local $rc = &parse_rc_config(); &save_rc_config($rc, IP_FORWARD, $in{'forward'}); &unlock_file($rc_config); &lock_file($route_conf); local $route = "# Generated by Webmin\n"; for($i=0; defined($dev = $in{"lr_dev_$i"}); $i++) { $net = $in{"lr_net_$i"}; $mask = $in{"lr_mask_$i"}; next if (!$dev && !$net && !$mask); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($mask) || &error(&text('routes_emask', $mask)); $route .= "$net\t\t0.0.0.0\t\t$mask\t\t$dev\n"; } for($i=0; defined($gw = $in{"sr_gw_$i"}); $i++) { $net = $in{"sr_net_$i"}; $mask = $in{"sr_mask_$i"}; next if (!$gw && !$net && !$mask); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($mask) || &error(&text('routes_emask', $mask)); $route .= "$net\t\t$gw\t\t$mask\n"; } if (!$in{'default_def'}) { gethostbyname($in{'default'}) || &error(&text('routes_edefault', $in{'default'})); $route .= "default\t\t$in{'default'}\n"; } &open_tempfile(ROUTE, ">$route_conf"); &print_tempfile(ROUTE, $route); &close_tempfile(ROUTE); &unlock_file($route_conf); } # parse_rc_config() sub parse_rc_config { local $rc; local $lnum = 0; &open_readfile(CONF, $rc_config); while() { s/\r|\n//g; s/#.*$//g; if (/([^=\s]+)="(.*)"/) { $rc->{$1} = { 'value' => $2, 'line' => $lnum }; } elsif (/([^=\s]+)=(\S+)/) { $rc->{$1} = { 'value' => $2, 'line' => $lnum }; } $lnum++; } close(CONF); return $rc; } # save_rc_config(&config, directive, value) sub save_rc_config { local $old = $_[0]->{$_[1]}; local $line = "$_[1]=\"$_[2]\"\n"; if ($old) { &replace_file_line($rc_config, $old->{'line'}, $line); } else { &open_tempfile(RC, ">>$rc_config"); &print_tempfile(RC, $line); &close_tempfile(RC); } } sub os_feedback_files { return ( $rc_config, $route_conf, "/etc/resolv.conf", "/etc/nsswitch.conf" ); } 1; net/config.info.ru_SU0100644000567100000120000000006510656003101014474 0ustar jcameronwheelhosts_file= ,0 net/trustix-linux-lib.pl0100755000567100000120000005516610656003101015315 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/networking/devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifcfg-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifcfg-$name", "$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &unlink_file("$net_scripts_dir/ifcfg-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifcfg-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/config.info.zh_CN0100644000567100000120000000004210656003101014433 0ustar jcameronwheelhosts_file=IPַӳ,0 net/rc.inet10100664000567100000120000000371110656003101012667 0ustar jcameronwheel#! /bin/sh # # rc.inet1 This shell script boots up the base INET system. # # Version: @(#)/etc/rc.d/rc.inet1 1.01 05/27/93 # HOSTNAME=`cat /etc/HOSTNAME` # Attach the loopback device. /sbin/ifconfig lo 127.0.0.1 /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo # IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the # eth0 interface. If you're only using loopback or SLIP, don't include the # rest of the lines in this file. # Edit for your setup. IPADDR="10.2.6.2" # REPLACE with YOUR IP address! NETMASK="255.255.0.0" # REPLACE with YOUR netmask! NETWORK="10.2.0.0" # REPLACE with YOUR network address! BROADCAST="10.2.255.255" # REPLACE with YOUR broadcast address, if you # have one. If not, leave blank and edit below. GATEWAY="10.2.5.111" # REPLACE with YOUR gateway address! # Uncomment the line below to configure your ethernet card. /sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK} # If the line above is uncommented, the code below can also be uncommented. # It sees if the ethernet was properly initialized, and gives the admin some # hints about what to do if it wasn't. if [ ! $? = 0 ]; then cat << END Your ethernet card was not initialized properly. Here are some reasons why this may have happened, and the solutions: 1. Your kernel does not contain support for your card. Including all the network drivers in a Linux kernel can make it too large to even boot, and sometimes including extra drivers can cause system hangs. To support your ethernet, either edit /etc/rc.d/rc.modules to load the support at boottime, or compile and install a kernel that contains support. 2. You don't have an ethernet card, in which case you should comment out this section of /etc/rc.d/rc.inet1. (Unless you don't mind seeing this error...) END fi # Uncomment this to set up your gateway route: if [ ! "$GATEWAY" = "" ]; then /sbin/route add default gw ${GATEWAY} netmask 0.0.0.0 metric 1 fi # End of rc.inet1 net/save_dns.cgi0100755000567100000120000000362610656003101013615 0ustar jcameronwheel#!/usr/local/bin/perl # save_dns.cgi # Save DNS client configuration require './net-lib.pl'; $access{'dns'} == 2 || &error($text{'dns_ecannot'}); &error_setup($text{'dns_err'}); &ReadParse(); $old_hostname = &get_system_hostname(); $in{'hostname'} =~ /^[A-z0-9\.\-]+$/ || &error(&text('dns_ehost', $in{'hostname'})); $dns = { }; for($i=0; $i<$max_dns_servers; $i++) { $ns = $in{"nameserver_$i"}; $ns =~ s/^\s+//; $ns =~ s/\s+$//; if ($ns) { &check_ipaddress($ns) || &error(&text('dns_ens', $ns)); push(@{$dns->{'nameserver'}}, $ns); } } if ($in{'name0'}) { my $i = 0 ; my $namekey="name$i"; while ($in{$namekey}) { $dns->{'name'}[$i] = $in{$namekey}; my $nskey = "nameserver$i"; my $j = -1; while (++$j < $max_dns_servers) { $ns = $in{"${nskey}_$j"}; $ns =~ s/^\s+//; $ns =~ s/\s+$//; if ($ns) { &check_ipaddress($ns) || &error(&text('dns_ens', $ns)); push(@{$dns->{$nskey}}, $ns); } } $i++; $namekey="name$i"; } } if (!$in{'domain_def'}) { @dlist = split(/\s+/, $in{'domain'}); foreach $d (@dlist) { $d =~ /^[A-z0-9\.\-]+$/ || &error(&text('dns_edomain', $d)); push(@{$dns->{'domain'}}, $d); } @dlist>0 || &error($text{'dns_esearch'}); } &parse_order($dns); &save_dns_config($dns); &save_hostname($in{'hostname'}); if ($in{'hosts'} && $in{'hostname'} ne $old_hostname) { # Update hostname in /etc/hosts too @hosts = &list_hosts(); foreach $h (@hosts) { local $found = 0; foreach $n (@{$h->{'hosts'}}) { if (lc($n) eq lc($old_hostname)) { $n = $in{'hostname'}; $found++; } } &modify_host($h) if ($found); } # Update in ipnodes too @ipnodes = &list_ipnodes(); foreach $h (@ipnodes) { local $found = 0; foreach $n (@{$h->{'ipnodes'}}) { if (lc($n) eq lc($old_hostname)) { $n = $in{'hostname'}; $found++; } } &modify_ipnode($h) if ($found); } } &webmin_log("dns", undef, undef, \%in); &redirect(""); net/config.info.es0100644000567100000120000000027310656003101014047 0ustar jcameronwheelhosts_file=Archivo que contiene las máquinas y direcciones,0 def_netmask=Máscara por defecto,0 def_broadcast=Dirección de broadcast por defecto,0 def_mtu=MTU por defecto,0 net/images/0040755000567100000120000000000010656003102012566 5ustar jcameronwheelnet/images/dns.gif0100644000567100000120000000056610656003101014044 0ustar jcameronwheelGIF89a00fff!,00ԅ`.h}_ezኘ/z䞢z:L6Cj @@3+ܮ d^;K^,FñG(7 wx$ h8`GRx(7G88(j Yң0ZyZ%xKq ; [;욛w*y\I`2ʱXy* |Ҙԣݹ.)h/*V|J:xEGT؄I; 5QqEH5;z2ȂU,)*2QZRiIܖ*rh 'ߐYJq Qvf!ZA;net/images/ifcs.gif0100644000567100000120000000055210656003101014177 0ustar jcameronwheelGIF89a00 ߽@fff\!,00I8ͻ`(dihl({lx|K@0,/x8OaZ !t@*Z- Oax\SyzoBx %<0{NwyXsFzPj_TdFbkɜ (*luz t@.1lwMw&agS{rtvxMu-o~{n#jf o} K Ƞ )mIaM@L=KB0]F.[@EM,al0fk ƪ;net/images/.xvpics/0040755000567100000120000000000010656003102014160 5ustar jcameronwheelnet/images/.xvpics/ifcs.gif0100664000567100000120000000450110656003101015571 0ustar jcameronwheelP7 332 #IMGINFO:48x48 RGB (362 bytes) #END_OF_COMMENTS 48 48 255 I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$I۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$I۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$I۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$II$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶H%۶ڶ0 100-001,10,100-01,010,10-001,010 1ֺ%HEI0vTQ0T-0-001,01,100-001 010,100-ֺE(IE0rMM rT-qTqip5qP,010,10-0uQ, ,Qq$I)I01zP10-001,010 ,)0nD)IE01upQmlUq01,00,100-0mri)۶ֺ01001,010 100-001,10quI׺01001,tv ߶T 010DI׶01001,M)i($I)i(%010q-qP%H۶0)Im($)Im,1,1010,1TNMtֻ$ID)0 100-001,10,1001,01,1r׺$IID0 100-001,10,1001,0nq׺$IEH0QUuQ0-uQ01,0100-00qrֶ)DII010qt 101,0ۖ%Iڷ0100}01001,0VP( ,(UQ)Iֻ0100}01001,010 100-0mIEڻ0uqۺ,up04-00-t 0u,10$I׺0QUuQ0-uQ0qP-0010 1q00q1,)DI)0QUuQ0-uQ0qQ,0M)iE(Ii $0100-t 0q00ͷ$IID010,10-001,010 100-001,U,0u,0׶$IIH010,10-001,010 100-001,U,0u,0$I)I010,10-001,010 100-001,T-q0-u$I۶ڷ0uqۺ,010 100-001,10,100-01,010,$Iڷ0QUuQ0-uQ01,010,10-000-00,010,100 00D)׶uuvqUVuuquvuuuMQQPQQQQQPQQMQPRPQQQPvuQE(۶۶۶I$II۶%H%r$II$I(I۶I$II۶%H%r$II$I(I۶I$II۶%H%ֺڶֺ$IE%H)I۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$II$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶I$II۶IH%I۶%HI%۶ڶ%HIIڶ%HII۶I$II۶۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$I۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$I۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$I۶I$II۶%H%I۶ڶ%HI%۶ڶ%HIIڶI$II۶HI$Inet/images/smallicon.gif0100664000567100000120000000037110656003101015235 0ustar jcameronwheelGIF87a榙sssffffٳ,p98kL?FLWXׂb20Ed- 0\I* ,nr(XZi`7Lrj"7fN; f).XWMEF9JO-@*}*dniq]bpq5'XIaBF.5"`5@ P;^/K9S.#7= KA=2 ""= ;net/images/ipnodes.gif0100644000567100000120000000046310656003101014715 0ustar jcameronwheelGIF89a00!,00 ޼`8~I(jf(6Ě,o:l=v<_p3Ec,aUXdX[KRiL6(virV\, 9ͧgW'uX'&ɩ*6JjvicC5H4'q;8Kh,ɇ;ȹyf*}F\jYwE;N( HNIˎ lLmk9hmBoC'JޯYP+.;net/turbo-linux-lib.pl0100755000567100000120000005516610656003101014726 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/networking/devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifcfg-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifcfg-$name", "$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &unlink_file("$net_scripts_dir/ifcfg-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifcfg-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/edit_bifc.cgi0100755000567100000120000001244210656003101013717 0ustar jcameronwheel#!/usr/local/bin/perl # edit_bifc.cgi # Edit or create a bootup interface require './net-lib.pl'; &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'bifc_create'}, ""); &can_create_iface() || &error($text{'ifcs_ecannot'}); } else { @boot = &boot_interfaces(); $b = $boot[$in{'idx'}]; &can_iface($b) || &error($text{'ifcs_ecannot_this'}); &ui_print_header(undef, $text{'bifc_edit'}, ""); } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
", $in{'virtual'} || $b && $b->{'virtual'} ne "" ? $text{'bifc_desc2'} : $text{'bifc_desc1'}, "
\n"; print "\n"; print "\n", $b && !$b->{'bootp'} && !$b->{'dhcp'} ? $b->{'address'} : ""; print "\n"; if ($in{'virtual'} && $in{'new'} && $virtual_netmask) { # Virtual netmask cannot be edited print "\n"; } elsif (&can_edit("netmask", $b) && $access{'netmask'}) { printf "\n", $b ? $b->{'netmask'} : $config{'def_netmask'}; } else { printf "\n", $b ? $b->{'netmask'} : $text{'ifcs_auto'}; } print "\n"; if (&can_edit("broadcast", $b) && $access{'broadcast'}) { printf "\n", $b ? $b->{'broadcast'} : $config{'def_broadcast'}; } else { printf "\n", $b ? $b->{'broadcast'} : $text{'ifcs_auto'}; } print "\n"; if (&can_edit("mtu", $b) && $access{'mtu'}) { printf "\n", $b ? $b->{'mtu'} : $config{'def_mtu'}; } else { printf "\n", $b && $b->{'mtu'} ? $b->{'mtu'} : $text{'ifcs_auto'}; } print "\n"; if (&can_edit("up", $b) && $access{'up'}) { printf "\n", $b && !$b->{'up'} ? "checked" : ""; } else { printf "\n", !$b ? $text{'yes'} : $b->{'up'} ? $text{'yes'} : $text{'no'}; } print "\n"; if ($b && $b->{'virtual'} eq "") { print "\n"; $vcount = 0; foreach $vb (@boot) { if ($vb->{'virtual'} ne "" && $vb->{'name'} eq $b->{'name'}) { $vcount++; } } print "\n"; } print "\n"; print "
$text{'ifcs_name'} \n"; if ($in{'new'} && $in{'virtual'}) { print "\n"; print "$in{'virtual'}:\n"; } elsif ($in{'new'}) { print "\n"; } else { print "$b->{'fullname'}\n"; } print "$text{'ifcs_ip'} \n"; $virtual = (!$b && $in{'virtual'}) || ($b && $b->{'virtual'} ne ""); $dhcp = &can_edit("dhcp") && !$virtual; $bootp = &can_edit("bootp") && !$virtual; if ($dhcp) { printf " %s\n", $b && $b->{'dhcp'} ? "checked" : "", $text{'ifcs_dhcp'}; } if ($bootp) { printf " %s\n", $b && $b->{'bootp'} ? "checked" : "", $text{'ifcs_bootp'}; } if ($dhcp || $bootp) { printf " %s\n", !$b || (!$b->{'bootp'} && !$b->{'dhcp'}) ? "checked" : "", $text{'ifcs_static'}; } else { print "\n"; } printf "
$text{'ifcs_mask'}$virtual_netmask%s$text{'ifcs_broad'}%s
$text{'ifcs_mtu'}%s$text{'ifcs_act'} $text{'yes'}\n", !$b || $b->{'up'} ? "checked" : ""; printf " $text{'no'}%s
$text{'ifcs_virts'}$vcount\n"; if ($access{'virt'} && !$noos_support_add_virtifcs) { print "(", "$text{'ifcs_addvirt'})\n"; } print "
\n"; print "\n"; if ($access{'bootonly'}) { # Can only save both boot-time and active if ($in{'new'}) { print "\n"; } else { print "\n"; if ($access{'delete'}) { print "\n"; } } } else { # Show buttons to save both boot-time and/or active if ($in{'new'}) { print "\n"; print "\n"; } else { print "\n" unless $always_apply_ifcs; if (!($b->{'bootp'} || $b->{'dhcp'}) || defined(&apply_interface)) { print "\n"; } if ($access{'delete'}) { print "\n"; print "\n" unless $noos_support_delete_ifcs; } } } print "
\n"; &ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'}); net/config-freebsd0100644000567100000120000000006010656003101014111 0ustar jcameronwheelhosts_file=/etc/hosts def_netmask=255.255.255.0 net/list_routes.cgi0100755000567100000120000000524710656003101014370 0ustar jcameronwheel#!/usr/local/bin/perl # list_routes.cgi # List boot-time routing configuration require './net-lib.pl'; $access{'routes'} || &error($text{'routes_ecannot'}); &ReadParse(); &ui_print_header(undef, $text{'routes_title'}, ""); # Show boot-time routes print "
\n"; print "\n"; print "\n"; print "
", $routes_active_now? $text{'routes_now'} : $text{'routes_boot'}, "
\n"; &routing_input(); print "
\n"; printf "\n", ($routes_active_now? $text{'bifc_apply'} : $text{'save'}) if ($access{'routes'} == 2); print "
\n"; # Show routes active now print "
\n"; if (defined(&list_routes)) { if (defined(&delete_route)) { # With deletion button print &ui_form_start("delete_routes.cgi", "post"); } print &ui_subheading($text{'routes_active'}); local @tds = defined(&delete_route) ? ( "width=5" ) : ( ); print &ui_columns_start([ defined(&delete_route) ? ( "" ) : ( ), $text{'routes_dest'}, $text{'routes_gw'}, $text{'routes_mask'}, $text{'routes_iface'} ], undef, 0, \@tds); $i = 0; foreach $route (&list_routes()) { local @cols = ( $route->{'dest'} eq "0.0.0.0" ? $text{'routes_def'} : $route->{'dest'}, $route->{'gateway'} eq "0.0.0.0" ? $text{'routes_nogw'} : $route->{'gateway'}, $route->{'netmask'} eq "0.0.0.0" ? "" : $route->{'netmask'}, $route->{'iface'} || $text{'routes_any'}, ); if (defined(&delete_route)) { print &ui_checked_columns_row(\@cols, \@tds, "d", $i++); } else { print &ui_columns_row(\@cols, \@tds); } } print &ui_columns_end(); if (defined(&delete_route)) { print &ui_form_end([ [ "delete", $text{'routes_delete'} ] ]); } } # Show form to add a route if (defined(&create_route)) { print &ui_form_start("create_route.cgi", "post"); print &ui_table_start($text{'routes_cheader'}, undef, 2); print &ui_table_row($text{'routes_cdest'}, &ui_opt_textbox("dest", undef, 30, $text{'routes_cdef'})); print &ui_table_row($text{'routes_cnetmask'}, &ui_opt_textbox("netmask", "255.255.255.255", 30, $text{'default'})); $ciface = &ui_select("iface", undef, [ map { [ $_->{'fullname'} ] } grep { $_->{'virtual'} eq '' } &boot_interfaces() ]); $cgateway = &ui_textbox("gateway", undef, 30); print &ui_table_row($text{'routes_cvia'}, &ui_radio("via", 0, [ [ 0, &text('routes_ciface', $ciface) ], [ 1, &text('routes_cgw', $cgateway) ] ])); print &ui_table_end(); print &ui_form_end([ [ "create", $text{'create'} ] ]); } &ui_print_footer("", $text{'index_return'}); net/config.info.zh_TW.Big50100644000567100000120000000004210656003101015252 0ustar jcameronwheelhosts_file=DP}Cɮ,0 net/module.info0100644000567100000120000000205410656003101013460 0ustar jcameronwheeldesc_nl=Netwerk Configuratie desc_ko_KR.euc=Ʈũ risk=low medium high desc_ru_SU= desc_zh_TW.Big5=պA desc_pl=Konfiguracja sieci desc_de=Netzwerkkonfiguration name=Networking desc_zh_CN= desc_pt=Configurao de Rede category=net desc_tr=A Yaplandrmas os_support=solaris coherent-linux redhat-linux/5.0-* mandrake-linux united-linux suse-linux/6.0-* open-linux unixware turbo-linux/4.0 freebsd/3.2-* openbsd debian-linux/2.2-* cobalt-linux/2.2-* msc-linux gentoo-linux macos/1.5-* trustix-linux slackware-linux/8.0-* openmamba-linux cygwin windows desc=Network Configuration desc_es=Configuracin de Red desc_sv=Ntverkskonfigurering desc_fr=Configuration Rseau desc_ja_JP.euc=ͥåȥ desc_ru_RU= desc_ca=Configuraci de Xarxa desc_cz=Konfigurace site desc_it=Configurazione Rete longdesc=Configure boot time and active interfaces, DNS, routing and /etc/hosts. readonly=1 desc_zh_TW.UTF-8=網路組態 desc_zh_CN.UTF-8=网络配置 desc_ja_JP.UTF-8=ネットワーク設定 desc_ko_KR.UTF-8=네트워크 구성 version=1.361 net/config-solaris0100644000567100000120000000011710656003101014156 0ustar jcameronwheelhosts_file=/etc/hosts ipnodes_file=/etc/inet/ipnodes def_netmask=255.255.255.0 net/redhat-linux-lib.pl0100755000567100000120000005516610656003101015042 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/networking/devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifcfg-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifcfg-$name", "$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &unlink_file("$net_scripts_dir/ifcfg-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifcfg-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/list_ifcs.cgi0100755000567100000120000001250210656003101013763 0ustar jcameronwheel#!/usr/local/bin/perl # list_ifcs.cgi # List active and boot-time interfaces require './net-lib.pl'; &ReadParse(); $access{'ifcs'} || &error($text{'ifcs_ecannot'}); $allow_add = &can_create_iface() && !$noos_support_add_ifcs; &ui_print_header(undef, $text{'ifcs_title'}, ""); # Show interfaces that are currently active @act = &active_interfaces(); if (!$access{'bootonly'}) { # Table heading and links print &ui_subheading($text{'ifcs_now'}); local @tds; @links = ( ); if ($access{'ifcs'} >= 2) { print &ui_form_start("delete_aifcs.cgi", "post"); push(@links, &select_all_link("d"), &select_invert_link("d") ); push(@tds, "width=5"); } push(@tds, "width=20%", "width=20%", "width=20%", "width=20%"); if ($allow_add) { push(@links, "$text{'ifcs_add'}"); } print &ui_links_row(\@links); print &ui_columns_start([ $access{'ifcs'} >= 2 ? ( "" ) : ( ), $text{'ifcs_name'}, $text{'ifcs_type'}, $text{'ifcs_ip'}, $text{'ifcs_mask'}, $text{'ifcs_status'} ], 100, 0, \@tds); # Show table of interfaces @act = sort iface_sort @act; foreach $a (@act) { next if ($access{'hide'} && # skip hidden (!$a->{'edit'} || !&can_iface($a))); local $mod = &module_for_interface($a); local %minfo = $mod ? &get_module_info($mod->{'module'}) : ( ); local @cols; if ($a->{'edit'} && &can_iface($a)) { push(@cols, "{'index'}\">". &html_escape($a->{'fullname'}).""); } elsif (!$a->{'edit'} && $mod) { push(@cols, "{'index'}\">". &html_escape($a->{'fullname'}).""); } else { push(@cols, &html_escape($a->{'fullname'})); } if ($a->{'virtual'} ne "") { $cols[0] = "  ".$cols[0]; } push(@cols, &iface_type($a->{'name'}). ($a->{'virtual'} eq "" || $mod ? "" : " ($text{'ifcs_virtual'})"). (%minfo ? " ($minfo{'desc'})" : "")); push(@cols, &html_escape($a->{'address'})); push(@cols, &html_escape($a->{'netmask'})); push(@cols, $a->{'up'} ? $text{'ifcs_up'} : "$text{'ifcs_down'}"); if ($a->{'edit'} && &can_iface($a)) { print &ui_checked_columns_row(\@cols, \@tds, "d", $a->{'fullname'}); } else { print &ui_columns_row([ "", @cols ], \@tds); } } print &ui_columns_end(); print &ui_links_row(\@links); if ($access{'ifcs'} >= 2) { print &ui_form_end([ [ "delete", $text{'index_delete1'} ] ]); } print "
\n"; } # Show interfaces that get activated at boot print &ui_subheading($text{'ifcs_boot'}); print &ui_form_start("delete_bifcs.cgi", "post"); @links = ( &select_all_link("b", 1), &select_invert_link("b", 1) ); if ($allow_add) { push(@links, "$text{'ifcs_add'}"); } if ($allow_add && defined(&supports_ranges) && &supports_ranges()) { push(@links, "$text{'ifcs_radd'}"); } print &ui_links_row(\@links); @tds = ( "width=5", "width=20%", "width=20%", "width=20%", "width=20%", "width=20%"); print &ui_columns_start([ "", $text{'ifcs_name'}, $text{'ifcs_type'}, $text{'ifcs_ip'}, $text{'ifcs_mask'}, $text{'ifcs_act'} ], 100, 0, \@tds); @boot = &boot_interfaces(); @boot = sort iface_sort @boot; foreach $a (@boot) { local $can = $a->{'edit'} && &can_iface($a); next if ($access{'hide'} && !$can); # skip hidden local @cols; local @mytds = @tds; if ($a->{'range'} ne "") { # A range of addresses local $rng = &text('ifcs_range', $a->{'range'}); if ($can) { push(@cols, "{'index'}\">".&html_escape($rng).""); } else { push(@cols, &html_escape($rng)); } push(@cols, &iface_type($a->{'name'})); push(@cols, "$a->{'start'} - $a->{'end'}"); splice(@mytds, 3, 2, "colspan=2 width=40%"); } else { # A normal single interface local $mod = &module_for_interface($a); local %minfo = $mod ? &get_module_info($mod->{'module'}) : ( ); if ($can) { push(@cols, "" .&html_escape($a->{'fullname'}).""); } else { push(@cols, &html_escape($a->{'fullname'})); } if ($a->{'virtual'} ne "") { $cols[0] = "  ".$cols[0]; } push(@cols, &iface_type($a->{'name'}). ($a->{'virtual'} eq "" || $mod ? "" : " ($text{'ifcs_virtual'})"). (%minfo ? " ($minfo{'desc'})" : "")); push(@cols, $a->{'bootp'} ? $text{'ifcs_bootp'} : $a->{'dhcp'} ? $text{'ifcs_dhcp'} : $a->{'address'} ? &html_escape($a->{'address'}) : $text{'ifcs_auto'}); push(@cols, $a->{'netmask'} ? &html_escape($a->{'netmask'}) : $text{'ifcs_auto'}); } push(@cols, $a->{'up'} ? $text{'yes'} : $text{'no'}); if ($can) { print &ui_checked_columns_row(\@cols, \@mytds, "b", $a->{'fullname'}); } else { print &ui_columns_row([ "", @cols ], \@tds); } } print &ui_columns_end(); print &ui_links_row(\@links); print &ui_form_end([ [ "delete", $text{'index_delete2'} ], [ "deleteapply", $text{'index_delete3'} ], undef, [ "apply", $text{'index_apply2'} ] ]); &ui_print_footer("", $text{'index_return'}); 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'}; } net/unixware-lib.pl0100755000567100000120000002533210656003101014270 0ustar jcameronwheel# unixware-lib.pl # Networking functions for UnixWare # active_interfaces() # Returns a list of currently ifconfig'd interfaces sub active_interfaces { local(@rv, @lines, $l); &open_execute_command(IFC, "ifconfig -a", 1, 1); while() { s/\r|\n//g; if (/^\S+:/) { push(@lines, $_); } else { $lines[$#lines] .= $_; } } close(IFC); foreach $l (@lines) { local %ifc; $l =~ /^([^:\s]+):/; $ifc{'name'} = $1; $l =~ /^(\S+):/; $ifc{'fullname'} = $1; if ($l =~ /^(\S+):(\d+):\s/) { $ifc{'virtual'} = $2; } if ($l =~ /inet\s+(\S+)/) { $ifc{'address'} = $1; } if ($l =~ /netmask\s+(\S+)/) { $ifc{'netmask'} = &parse_hex($1); } if ($l =~ /broadcast\s+(\S+)/) { $ifc{'broadcast'} = $1; } if ($l =~ /ether\s+(\S+)/) { $ifc{'ether'} = $1; } if ($l =~ /mtu\s+(\S+)/) { $ifc{'mtu'} = $1; } $ifc{'up'}++ if ($l =~ /\{'virtual'} eq "") { local $out = &backquote_logged("ifconfig $a->{'name'} plumb 2>&1"); if ($out) { &error("Interface '$a->{'name'}' does not exist"); } } local $cmd = "ifconfig $a->{'name'}"; if ($a->{'virtual'} ne "") { $cmd .= ":$a->{'virtual'}"; } $cmd .= " $a->{'address'}"; if ($a->{'netmask'}) { $cmd .= " netmask $a->{'netmask'}"; } else { $cmd .= " netmask +"; } if ($a->{'broadcast'}) { $cmd .= " broadcast $a->{'broadcast'}"; } else { $cmd .= " broadcast +"; } if ($a->{'mtu'}) { $cmd .= " mtu $a->{'mtu'}"; } if ($a->{'up'}) { $cmd .= " up"; } else { $cmd .= " down"; } local $out = &backquote_logged("$cmd 2>&1"); if ($?) { &error($out); } if ($a->{'ether'}) { $out = &backquote_logged( "ifconfig $a->{'name'} ether $a->{'ether'} 2>&1"); if ($? && $out !~ /Device busy/) { &error($out); } } } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { local $cmd; if ($a->{'virtual'} eq "") { $cmd = "ifconfig $a->{'name'} unplumb"; } else { $cmd = "ifconfig $a->{'name'}:$a->{'virtual'} 0.0.0.0 down"; } local $out = &backquote_logged("$cmd 2>&1"); if ($?) { &error($out); } } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local (@rv, $f, %mask); push(@rv, { 'name' => 'lo0', 'fullname' => 'lo0', 'address' => '127.0.0.1', 'netmask' => '255.0.0.0', 'up' => 1, 'edit' => 0 }); open(MASK, "/etc/netmasks"); while() { s/\r|\n//g; s/#.*$//g; if (/([0-9\.]+)\s+([0-9\.]+)/) { $mask{$1} = $2; } } close(MASK); opendir(ETC, "/etc"); while($f = readdir(ETC)) { if ($f =~ /^hostname.(\S+):(\d+)$/ || $f =~ /^hostname.(\S+)/) { local %ifc; $ifc{'fullname'} = $ifc{'name'} = $1; $ifc{'virtual'} = $2 if (defined($2)); $ifc{'fullname'} .= ":$2" if (defined($2)); $ifc{'index'} = scalar(@rv); $ifc{'edit'}++; $ifc{'file'} = "/etc/$f"; open(FILE, "/etc/$f"); chop($ifc{'address'} = ); close(FILE); if ($ifc{'address'}) { &to_ipaddress($ifc{'address'}) =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; if ($mask{"$1.$2.$3.0"}) { $ifc{'netmask'} = $mask{"$1.$2.$3.0"}; } elsif ($mask{"$1.$2.0.0"}) { $ifc{'netmask'} = $mask{"$1.$2.0.0"}; } elsif ($mask{"$1.0.0.0"}) { $ifc{'netmask'} = $mask{"$1.0.0.0"}; } else { $ifc{'netmask'} = "255.255.255.0"; } local ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4); $ifc{'netmask'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; $ifc{'broadcast'} = sprintf "%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff; } else { $ifc{'netmask'} = "Automatic"; $ifc{'broadcast'} = "Automatic"; $ifc{'dhcp'}++; } $ifc{'up'}++; push(@rv, \%ifc); } } closedir(ETC); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &open_lock_tempfile(IFACE, ">/etc/hostname.$name"); if (!$_[0]->{'dhcp'}) { &print_tempfile(IFACE, $_[0]->{'address'},"\n"); } &close_tempfile(IFACE); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &unlink_logged("/etc/hostname.$name"); } # iface_type(name) # Returns a human-readable interface type name sub iface_type { return "Fast Ethernet" if ($_[0] =~ /^hme/); return "Loopback" if ($_[0] =~ /^lo/); return "Token Ring" if ($_[0] =~ /^tr/); return "PPP" if ($_[0] =~ /^ipdptp/ || $_[0] =~ /^ppp/); return "Ethernet"; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { return $_[0] !~ /^(lo|ipdptp|ppp)/; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] eq "dhcp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return 1 if (&check_ipaddress($_[0])); return gethostbyname($_[0]) ? 1 : 0; } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, search & order sub get_dns_config { local $dns; open(RESOLV, "/etc/resolv.conf"); while() { s/\r|\n//g; s/#.*$//g; if (/nameserver\s+(.*)/) { push(@{$dns->{'nameserver'}}, split(/\s+/, $1)); } elsif (/domain\s+(\S+)/) { $dns->{'domain'} = [ $1 ]; } elsif (/search\s+(.*)/) { $dns->{'domain'} = [ split(/\s+/, $1) ]; } } close(RESOLV); open(SWITCH, "/etc/nsswitch.conf"); while() { s/\r|\n//g; if (/hosts:\s+(.*)/) { $dns->{'order'} = $1; } } close(SWITCH); $dns->{'files'} = [ "/etc/resolv.conf", "/etc/nsswitch.conf" ]; return $dns; } # save_dns_config(&config) # Writes out the resolv.conf and nsswitch.conf files sub save_dns_config { &lock_file("/etc/resolv.conf"); open(RESOLV, "/etc/resolv.conf"); local @resolv = ; close(RESOLV); &open_tempfile(RESOLV, ">/etc/resolv.conf"); foreach (@{$_[0]->{'nameserver'}}) { &print_tempfile(RESOLV, "nameserver $_\n"); } if ($_[0]->{'domain'}) { if ($_[0]->{'domain'}->[1]) { &print_tempfile(RESOLV, "search ",join(" ", @{$_[0]->{'domain'}}),"\n"); } else { &print_tempfile(RESOLV, "domain $_[0]->{'domain'}->[0]\n"); } } foreach (@resolv) { &print_tempfile(RESOLV, $_) if (!/^\s*(nameserver|domain|search)\s+/); } &close_tempfile(RESOLV); &unlock_file("/etc/resolv.conf"); &lock_file("/etc/nsswitch.conf"); open(SWITCH, "/etc/nsswitch.conf"); local @switch = ; close(SWITCH); &open_tempfile(SWITCH, ">/etc/nsswitch.conf"); foreach (@switch) { if (/hosts:\s+/) { &print_tempfile(SWITCH, "hosts:\t$_[0]->{'order'}\n"); } else { &print_tempfile(SWITCH, $_); } } &close_tempfile(SWITCH); &unlock_file("/etc/nsswitch.conf"); } $max_dns_servers = 3; # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { if ($_[0]->{'order'} =~ /\[/) { # Using a complex resolve list return "{'order'}\">\n"; } else { # Can select by menus local @o = split(/\s+/, $_[0]->{'order'}); local ($rv, $i, $j); local @srcs = ( "", "files", "dns", "nis", "nisplus" ); local @srcn = ( "", "Hosts", "DNS", "NIS", "NIS+" ); for($i=1; $i<@srcs; $i++) { local $ii = $i-1; $rv .= "\n"; } return $rv; } } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { if (defined($in{'order'})) { $in{'order'} =~ /\S/ || &error($text{'dns_eorder'}); $_[0]->{'order'} = $in{'order'}; } else { local($i, @order); for($i=0; defined($in{"order_$i"}); $i++) { push(@order, $in{"order_$i"}) if ($in{"order_$i"}); } $_[0]->{'order'} = join(" ", @order); } } sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { &system_logged("domainname ".quotemeta($_[0])); &lock_file("/etc/defaultdomain"); if ($_[0]) { &open_tempfile(DOMAIN, ">/etc/defaultdomain"); &print_tempfile(DOMAIN, $_[0],"\n"); &close_tempfile(DOMAIN); } else { &unlink_file("/etc/defaultdomain"); } &unlock_file("/etc/defaultdomain"); } sub routing_config_files { return ( "/etc/defaultrouter", "/etc/notrouter", "/etc/gateways" ); } sub routing_input { # show default router(s) input local(@defrt); &open_readfile(DEFRT, "/etc/defaultrouter"); while() { s/#.*$//g; if (/(\S+)/) { push(@defrt, $1); } } close(DEFRT); print " $text{'routes_defaults'}\n"; print " \n"; # show router input local $notrt = (-r "/etc/notrouter"); local $gatew = (-r "/etc/gateways"); print " Act as router? \n"; printf " $text{'yes'}\n", $gatew && !$notrt ? "checked" : ""; printf " $text{'routes_possible'}\n", !$gatew && !$notrt ? "checked" : ""; printf " $text{'no'}\n", $notrt ? "checked" : ""; print " \n"; } sub parse_routing { local @defrt = split(/\s+/, $in{'defrt'}); foreach $d (@defrt) { gethostbyname($d) || &error(&text('routes_edefault', $d)); } &lock_file("/etc/defaultrouter"); if (@defrt) { &open_tempfile(DEFRT, ">/etc/defaultrouter"); foreach $d (@defrt) { &print_tempfile(DEFRT, $d,"\n"); } &close_tempfile(DEFRT); } else { &unlink_file("/etc/defaultrouter"); } &unlock_file("/etc/defaultrouter"); &lock_file("/etc/gateways"); &lock_file("/etc/notrouter"); if ($in{'router'} == 0) { &create_empty_file("/etc/gateways"); &unlink_file("/etc/notrouter"); } elsif ($in{'router'} == 2) { &create_empty_file("/etc/notrouter"); &unlink_file("/etc/gateways"); } else { &unlink_file("/etc/gateways"); &unlink_file("/etc/notrouter"); } &unlock_file("/etc/gateways"); &unlock_file("/etc/notrouter"); } # create_empty_file(filename) sub create_empty_file { if (!-r $_[0]) { &open_tempfile(EMPTY,">$_[0]"); &close_tempfile(EMPTY); } } sub os_feedback_files { opendir(DIR, "/etc"); local @f = map { "/etc/$_" } grep { /^hostname\./ } readdir(DIR); closedir(DIR); return ( @f, "/etc/netmasks", "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/defaultrouter", "/etc/notrouter", "/etc/gateways" ); } 1; net/lang/0040755000567100000120000000000010656003102012242 5ustar jcameronwheelnet/lang/zh_TW.Big50100644000567100000120000001224110656003101014001 0ustar jcameronwheelacl_apply=iHMβպA? acl_dns=iHsDNSȤݳ]w? acl_hosts=iHsDm? acl_ifcs=iHs? acl_ifcs_only=u acl_routes=iHsѻPhD? acl_view=u˵ aifc_create=إ߹B@ aifc_default=w] aifc_desc1=B@Ѽ aifc_desc2=B@Ѽ aifc_ebroad='$1' O@ӦĪs} aifc_edit=sB@ aifc_edup= $1 wgsb aifc_eexist= '$1' sb aifc_ehard='$1' O@ӦĪw} aifc_eip='$1' O@ӦĪ IP } aifc_emask='$1' O@ӦĪlBn aifc_emtu='$1' O@ӦĪ MTU aifc_ename=򥢩ο~W aifc_err1=LkR aifc_err2=Lkxs aifc_evirt=򥢩ο~s aifc_evirtdup= $1 wgsb aifc_evirtmin=ƶqܤ֭n$1 aifc_hard=w} apply_ecannot=zQ\MβպA bifc_apply=xsîM bifc_capply=إ߻PM bifc_create=إ Bootup bifc_dapply=RPM bifc_desc1=ҰʮɴѼ bifc_desc2=ҰʮɴѼ bifc_eapply=zDHCPBOOTP覡Ұʤ bifc_ebroad='$1' O@ӦĪs} bifc_edhcpmain=DHCPuҥΩDn bifc_edit=s Bootup bifc_edup= $1 wgsb bifc_eip='$1' O@ӦĪ IP } bifc_emask='$1' O@ӦĪlBn bifc_emtu='$1' O@ӦĪ MTU bifc_ename=򥢩ο~W bifc_err1=LkR bifc_err2=Lkxs bifc_err3=LkҰʺ bifc_err4=~ bifc_evirt=򥢩ο~s bifc_evirtdup= $1 wgsb dns_ecannot=zQ\sDNSȤݿﶵ dns_edomain='$1'OĪW dns_ehost='$1'OĪDW dns_ens='$1'OĪW٦AIPm dns_eorder=򥢸ѪR dns_err=xsDNSպA dns_esearch=jM dns_hostname=DW dns_hoststoo=DmܮɧsDW? dns_listed=CX... dns_none=L dns_options=DNS Ȥݿﶵ dns_order=ѪR dns_search=jM dns_servers=DNS A dns_title=DNS Ȥ hosts_add=[J@ӷsD} hosts_create=إߥD} hosts_detail=DP} hosts_ecannot=zQ\sDm hosts_edit=sD} hosts_host=DW hosts_ip=IP } hosts_return=D}C hosts_title=D} ifcs_act=O_b}ɱҰ? ifcs_add=W[s ifcs_addvirt=W[ ifcs_all=Ҧ ifcs_auto=۰ ifcs_boot=}ɱҰʪ ifcs_bootp=q BOOTP ifcs_broad=s} ifcs_dhcp=q DHCP ifcs_down= ifcs_ecannot=zQ\s ifcs_ecannot_this=zQ\s ifcs_ip=IP } ifcs_mask=lBn ifcs_mtu=MTU ifcs_name=W ifcs_now=ثeB@ ifcs_radd=W[sd ifcs_range=d$1 ifcs_return= ifcs_status=A ifcs_title= ifcs_type= ifcs_unknown= ifcs_up=Ұ ifcs_virts=ɭ ifcs_virtual= index_apply=MβպA index_applydesc=sӱҰʥثe}APѳ]wAq`|As}ͮġCĵioztεLkѺiJM_PWebminsu index_return=պA index_title=պA interfaces_all=Ҧ... interfaces_cancel= interfaces_clear=M interfaces_ok=Tw interfaces_sel= interfaces_title1=ܤ... interfaces_title2=ϥΪ log_create_aifc=Ұʤ$1m$2 log_create_bifc=sW$1m$2 log_create_host=sWDm$1 log_delete_aifc=$1m$2 log_delete_bifc=R$1m$2 log_delete_host=RDm$1 log_dns=ܧDNSȤݿﶵ log_dyn=ʺA log_modify_aifc=sҰʤ$1m$2 log_modify_bifc=ק虜$1m$2 log_modify_host=קDm$1 log_routes=ܧѻPhDﶵ mod_adsl=@ADSL PPPsu mod_desc=$1wg$2ϥΤFAҥHLkΦҲպ޲z mod_egone=AҰ! mod_link=MӡAziHϥ$2ҲըӥN޲z mod_ppp=PPPsu$1 mod_pptpc=PPTPsu$1 mod_pptps=qȤ$1 PTPsu mod_title=Ұʤ range_create=sWmd range_ebefore=mݤj}lm range_eclass=}lMmObP@Cź range_edit=smd range_eend=Lĩο~IPm range_ename=Lĩο~dW range_end=m range_enum=LĩΫDƦr}lX range_err=xsmd򥢱 range_estart=Lĩο~}lIPm range_header=mdɭﶵ range_iface=餶 range_name=dW range_num=}lX range_start=}lm routes_any= routes_auto=۰ routes_boot=bҰʮɴҰʪѲպA routes_default=w]Ѿ routes_default2=w] routes_defaults=w]Ѿ routes_device=] routes_device2=w]ѳ] routes_ecannot=zQ\sѻPhD routes_eclash=u@ӹw]ѱq󤶭iHQwq routes_eclash2=u@ӹw]ѱq$1iHQwq routes_edefault='$1' O@ӦĪw]Ѿ routes_edefault2=LĪw]Ѧms$1 routes_edevice='$1' O@ӦĪ] routes_egateway='$1' O@ӦĪhD routes_emask='$1' O@ӦĪlBn routes_enet='$1' O@ӦĦa routes_err=xsѥ routes_etype='$1'OT routes_forward=O_Ѿ? routes_gateway=hD routes_gwmetric=ѭ routes_ifc= routes_local=aݸ routes_mask=lBn routes_net= routes_none=L routes_none2=L routes_now={bѲպAҰ routes_possible=pGi routes_routed=O_ҰʸѧMu@{? routes_script=sWѫO routes_static=RA routes_title=ѻPhD routes_type= net/lang/zh_CN0100644000567100000120000000525010656003101013164 0ustar jcameronwheelindex_title= index_return= ifcs_title=ӿ ifcs_now=ӿڵǰ ifcs_name= ifcs_type= ifcs_ip=IP ַ ifcs_mask= ifcs_status=״̬ ifcs_virtual= ifcs_up= ifcs_down=ر ifcs_add=ӽӿ ifcs_boot=ʱýӿ ifcs_act=ʱã ifcs_bootp= BOOTP ifcs_dhcp= DHCP ifcs_broad=㲥 ifcs_auto=Զ ifcs_mtu=䵥Ԫ ifcs_virts=ӿ ifcs_addvirt=ӿ ifcs_return=ӿ aifc_create=ӿ aifc_edit=༭ӿ aifc_desc1=ӿڲ aifc_desc2=ӿڲ aifc_hard=Ӳַ aifc_default=ȱʡ aifc_err1=ɾӿʧ aifc_err2=ӿʧ aifc_evirt=ʧߴӿں aifc_evirtdup=ӿں $1 Ѿ aifc_edup=ӿ $1 Ѿ aifc_ename=ʧ߷Ƿӿ aifc_eip='$1' IPַ aifc_emask='$1' aifc_ebroad='$1' Ĺ㲥ַ aifc_emtu='$1' 䵥Ԫ aifc_ehard='$1' Ӳַ aifc_eexist=ӿ '$1' bifc_create=ʱӿ bifc_edit=༭ʱӿ bifc_desc1=ʱӿڲ bifc_desc2=ʱӿڲ bifc_apply=沢Ӧ bifc_err1=ɾӿʧ bifc_err2=ӿʧ bifc_evirt=ʧӿں bifc_evirtdup=ӿ $1 Ѿ bifc_edup=ӿ $1 Ѿ bifc_ename=ʧĽӿ bifc_eip='$1' IPַ bifc_emask='$1' bifc_ebroad='$1' Ĺ㲥ַ bifc_emtu='$1' 䵥Ԫ bifc_err3=ýӿʧ routes_title=·ɺ routes_boot=ʱõ· routes_default=ȱʡ· routes_none= routes_device=豸 routes_gateway= routes_forward=· routes_routed=·ɲػ routes_edefault='$1' ȱʡ· routes_edevice='$1'һЧ豸 routes_device2=ȱʡ·豸 routes_static=̬· routes_ifc=ӿ routes_net= routes_mask= routes_enet='$1' routes_emask='$1' routes_egateway='$1' routes_defaults=ȱʡ· routes_possible= routes_local=· routes_err=洢·ʧ dns_title=DNS ͻ dns_options=DNS ͻѡ dns_hostname= dns_order=˳ dns_servers=DNS dns_search= dns_none= dns_listed=б .. dns_eorder=ʧ hosts_title=ַ hosts_ip=IP ַ hosts_host= hosts_add=ַ hosts_edit=༭ַ hosts_create=ַ hosts_detail=͵ַ hosts_return=ַб log_create_host=Ѵͻַ $1 log_delete_host=ɾͻַ $1 log_modify_host=Ѹ¿ͻַ $1 log_dns=Ѹı DNS ͻѡ log_routes=Ѹı·ɺѡ log_create_aifc=õĽӿ $1 ַ $2 log_modify_aifc=õĽӿ $1 ַ $2 log_delete_aifc=õĽӿ $1 ַ $2 log_create_bifc=ѴĽӿ $1 ַ $2 log_modify_bifc=ѸµĽӿ $1 ַ $2 log_delete_bifc=ɾĽӿ $1 ַ $2 net/lang/en0100644000567100000120000002247110656003101012571 0ustar jcameronwheelindex_title=Network Configuration index_return=network configuration index_apply=Apply Configuration index_applydesc=Click this button to activate the current boot-time interface and routing settings, as they normally would be after a reboot. Warning - this may make your system inaccessible via the network, and cut off access to Webmin. index_delete1=De-Activate Selected Interfaces index_delete2=Delete Selected Interfaces index_delete3=Delete and Apply Selected Interfaces index_apply2=Apply Selected Interfaces ifcs_title=Network Interfaces ifcs_now=Interfaces Active Now ifcs_name=Name ifcs_type=Type ifcs_ip=IP Address ifcs_mask=Netmask ifcs_status=Status ifcs_virtual=Virtual ifcs_up=Up ifcs_down=Down ifcs_add=Add a new interface. ifcs_radd=Add a new address range. ifcs_boot=Interfaces Activated at Boot Time ifcs_act=Activate at boot? ifcs_bootp=From BOOTP ifcs_dhcp=From DHCP ifcs_broad=Broadcast ifcs_auto=Automatic ifcs_mtu=MTU ifcs_virts=Virtual interfaces ifcs_addvirt=Add virtual interface ifcs_return=network interfaces ifcs_unknown=Unknown ifcs_all=All interfaces ifcs_ecannot=You are not allowed to edit network interfaces ifcs_ecannot_this=You are not allowed to edit this network interface ifcs_range=Range $1 ifcs_static=Static aifc_create=Create Active Interface aifc_edit=Edit Active Interface aifc_desc1=Active Interface Parameters aifc_desc2=Active Virtual Interface Parameters aifc_hard=Hardware address aifc_default=Default aifc_err1=Failed to delete interface aifc_err2=Failed to save interface aifc_evirt=Missing or invalid virtual interface number aifc_evirtmin=Virtual interface number must be at least $1 aifc_evirtdup=The virtual interface $1 already exists aifc_edup=The interface $1 already exists aifc_ename=Missing or invalid interface name aifc_eip='$1' is not a valid IP address aifc_emask='$1' is not a valid netmask aifc_ebroad='$1' is not a valid broadcast address aifc_emtu='$1' is not a valid MTU aifc_ehard='$1' is not a valid hardware address aifc_eexist=Interface '$1' does not exist aifc_eclash=The interface $1 is already using this IP address bifc_create=Create Bootup Interface bifc_edit=Edit Bootup Interface bifc_desc1=Boot Time Interface Parameters bifc_desc2=Boot Time Virtual Interface Parameters bifc_apply=Save and Apply bifc_dapply=Delete and Apply bifc_err1=Failed to delete interface bifc_err2=Failed to save interface bifc_evirt=Missing or invalid virtual interface number bifc_evirtdup=The virtual interface $1 already exists bifc_edup=The interface $1 already exists bifc_ename=Missing or invalid interface name bifc_eip='$1' is not a valid IP address bifc_emask='$1' is not a valid netmask bifc_ebroad='$1' is not a valid broadcast address bifc_emtu='$1' is not a valid MTU bifc_err3=Failed to activate interface bifc_err4=Failed to deactivate interface bifc_capply=Create and Apply bifc_eapply=You cannot activate an interface that uses DHCP or BOOTP bifc_edhcpmain=DHCP can only be enabled on the primary network interface routes_title=Routing and Gateways routes_boot=Routing configuration activated at boot time routes_now=Routing configuration activated now routes_default=Default router routes_default2=Default routes routes_none=None (or from DHCP) routes_device=Device routes_gateway=Gateway routes_forward=Act as router? routes_routed=Start route discovery daemon? routes_edefault='$1' is not a valid default router routes_edevice='$1' is not a valid device routes_device2=Default route device routes_static=Static routes routes_ifc=Interface routes_net=Network routes_mask=Netmask routes_type=Type routes_enet='$1' is not a valid network routes_emask='$1' is not a valid netmask routes_egateway='$1' is not a valid gateway routes_defaults=Default routers routes_possible=If possible routes_local=Local routes routes_err=Failed to save routing routes_ecannot=You are not allowed to edit routing and gateways routes_script=Additional routing commands routes_etype='$1' is not a valid route type routes_any=Any routes_edefault2=Invalid default gateway address number $1 routes_eclash=Only one default route for any interface can be defined routes_eclash2=Only one default route for $1 can be defined routes_none2=None routes_auto=Automatic routes_gwmetric=Interface Metric routes_dest=Destination routes_gw=Gateway routes_iface=Interface routes_def=Default Route routes_active=Active Routes routes_nogw=None routes_delete=Delete Selected Routes routes_cheader=Create active route routes_cdest=Route destination routes_cdef=Default route routes_cnetmask=Netmask for destination routes_cvia=Route via routes_ciface=Network interface $1 routes_cgw=Gateway $1 routes_cerr=Failed to create active route routes_ecdest=Missing or invalid destination IP address or network routes_ecnetmask=Missing or invalid netmask routes_ecgw=Missing or invalid gateway address routes_derr=Failed to delete routes routes_denone=None selected routes_ecnetmask2=A netmask cannot be specified for the default route routes_ggw=Use router $1 via interface $2 dns_title=Hostname and DNS Client dns_options=DNS Client Options dns_hostname=Hostname dns_order=Resolution order dns_servers=DNS servers dns_search=Search domains dns_none=None dns_listed=Listed .. dns_eorder=Missing resolution order dns_ecannot=You are not allowed to edit DNS client settings dns_err=Failed to save DNS configuration dns_ehost='$1' is not a valid hostname dns_ens='$1' is not a valid nameserver IP address dns_edomain='$1' is not a valid domain name dns_esearch=No domains to search given dns_hoststoo=Update hostname in host addresses if changed? dns_dhcp=Hostname is set by DHCP server? hosts_title=Host Addresses hosts_ip=IP Address hosts_host=Hostnames hosts_add=Add a new host address. hosts_edit=Edit Host Address hosts_create=Create Host Address hosts_detail=Host and Addresses hosts_return=host addresses list hosts_ecannot=You are not allowed to edit host addresses hosts_delete=Delete Selected Host Addresses ipnodes_title=IPv6 Host Addresses ipnodes_ip=IPv6 Address ipnodes_host=Hostnames ipnodes_add=Add a new IPv6 host address. ipnodes_edit=Edit IPv6 Host Address ipnodes_create=Create IPv6 Host Address ipnodes_detail=Host and Addresses ipnodes_return=IPv6 host addresses list ipnodes_ecannot=You are not allowed to edit IPv6 host addresses log_create_host=Created host address $1 log_delete_host=Deleted host address $1 log_modify_host=Modified host address $1 log_create_ipnode=Created IPv6 host address $1 log_delete_ipnode=Deleted IPv6 host address $1 log_modify_ipnode=Modified IPv6 host address $1 log_dns=Changed DNS client options log_routes=Changed routing and gateways options log_create_aifc=Activated interface $1 address $2 log_modify_aifc=Reactivated interface $1 address $2 log_delete_aifc=Deactivated interface $1 address $2 log_create_bifc=Created interface $1 address $2 log_modify_bifc=Modified interface $1 address $2 log_delete_bifc=Deleted interface $1 address $2 log_dyn=dynamic log_delete_hosts=Deleted $1 host addresses log_delete_afics=Deleting $1 active interfaces log_delete_bfics=Deleting $1 boot-time interfaces log_apply_bfics=Activated $1 boot-time interfaces log_create_route=Created active route for $1 log_create_defroute=Created active default route log_delete_routes=Deleted $1 active routes acl_ifcs=Can edit network interfaces? acl_routes=Can edit routing and gateways? acl_dns=Can edit DNS client settings? acl_hosts=Can edit host addresses? acl_view=View only acl_ifcs_only=Only interfaces acl_ifcs_ex=Interfaces except acl_apply=Can apply configuration? acl_bootonly=Can edit active interfaces? acl_netmask=Can edit netmask? acl_broadcast=Can edit broadcast? acl_mtu=Can edit MTU? acl_up=Can edit active state? acl_virt=Can add virtual interfaces? acl_delete=Can delete interfaces? acl_hide=Hide non-editable interfaces? interfaces_title1=Choose Interfaces... interfaces_all=All Interfaces... interfaces_sel=Selected Interfaces interfaces_ok=OK interfaces_cancel=Cancel interfaces_clear=Clear interfaces_title2=Select User... apply_ecannot=You are not allowed to apply the configuration mod_egone=Interface is no longer active! mod_title=Active Interface mod_desc=The $1 interface is being used for $2, and so cannot be managed using this module. mod_link=However, you can use the $2 module to manage it instead. mod_ppp=a PPP dialup connection to $1 mod_adsl=an ADSL PPP connection mod_pptps=a PPTP connection from client $1 mod_pptpc=the PPTP connection $1 mod_zones=a virtual interface for zone $1 mod_virtualmin=the Virtualmin server $1 mod_reseller=the Virtualmin reseller $1 range_edit=Edit Address Range range_create=Create Address Range range_header=Address range interface options range_start=Starting address range_end=Ending address range_num=First virtual interface no. range_iface=Real interface range_name=Range name range_err=Failed to save address range range_ename=Missing or invalid range name range_estart=Missing or invalid starting IP address range_eend=Missing or invalid ending IP address range_enum=Missing or non-numeric first virtual interface number range_eclass=Starting and ending addresses must be within the same class C network range_ebefore=The ending address must be higher than the starting address chooser_any=<Any> chooser_other=Other.. dafics_err=Failed to de-activate interfaces daifcs_enone=None selected daifcs_egone=Interface no longer exists! dbifcs_err=Failed to delete interfaces dbifcs_err2=Failed to activate interfaces net/lang/pt0100644000567100000120000000635010656003101012610 0ustar jcameronwheelindex_title=Configurao de Rede index_return=configurao de rede ifcs_title=Interfaces de Rede ifcs_now=Interfaces Activas ifcs_name=Nome ifcs_type=Tipo ifcs_ip=Endereo IP ifcs_mask=Mscara de sub-rede ifcs_status=Estado ifcs_virtual=Virtual ifcs_up=Up ifcs_down=Down ifcs_add=Adicionar nova interface ifcs_boot=Interfaces Activadas no Arranque ifcs_act=Activar no arranque? ifcs_bootp=De BOOTP ifcs_dhcp=De DHCP ifcs_broad=Broadcast ifcs_auto=Automtico ifcs_mtu=MTU ifcs_virts=Interfaces Virtuais ifcs_addvirt=Adicionar interface virtual ifcs_return=interfaces de rede aifc_create=Criar Interface Activa aifc_edit=Editar Interface Activa aifc_desc1=Parmetros da Interface Activa aifc_desc2=Parmetros da Interface Activa Virtual aifc_hard=Endereo de hardware aifc_default=Predefinido aifc_err1=Falha ao apagar interface aifc_err2=Falha ao guardar interface aifc_evirt=Nmero da interface virtual em falta ou invlido aifc_evirtdup=A interface virtual $1 j existe aifc_edup=A interface $1 j existe aifc_ename=Nome da interface em falta ou invlido aifc_eip='$1' no um endereo IP vlido aifc_emask='$1' no uma mscara de sub-rede vlida aifc_ebroad='$1' no um endereo de broadcast vlido aifc_emtu='$1' no um MTU vlido aifc_ehard='$1' no um endereo de hardware vlido aifc_eexist=A interface '$1' no existe bifc_create=Criar Interface de Arranque bifc_edit=Editar Interface de Arranque bifc_desc1=Parmetros da Interface no Arranque bifc_desc2=Parmetros da Interface Virtual no Arranque bifc_apply=Guardar e Aplicar bifc_err1=Falha ao apagar interface bifc_err2=Falha ao guardar interface bifc_evirt=Nmero da interface virtual em falta ou invlido bifc_evirtdup=A interface virtual $1 j existe bifc_edup=A interface $1 j existe bifc_ename=Nome da interface em falta ou invlido bifc_eip='$1' no um endereo de IP vlido bifc_emask='$1' no uma mscara de sub-rede vlida bifc_ebroad='$1' no um endereo de broadcast vlido bifc_emtu='$1' no um MTU vlido bifc_err3=Falha ao activar interface routes_title=Routing e Gateways routes_boot=Configurao de routing activado no arranque routes_default=Router predefinido routes_none=Nenhum routes_device=Dispositivo routes_gateway=Gateway routes_forward=Actuar como um router? routes_edefault='$1' no um router predefinido vlido routes_edevice='$1' no um dispositivo vlido routes_device2=Dispositivo router predefinido routes_static=Routes Estticas routes_ifc=Interface routes_net=Rede routes_mask=Mscara de sub-rede routes_enet='$1' no uma rede vlida routes_emask='$1' no uma mscara de sub-rede vlida routes_egateway='$1' no um gateway vlido routes_defaults=Routers predefinidos routes_possible=Se possivel routes_local=Routes locais dns_title=Cliente DNS dns_options=Opes do Cliente DNS dns_hostname=Nome do Anfitrio dns_order=Ordem de resoluo dns_servers=Servidores DNS dns_search=Procurar domnios dns_none=Nenhum dns_listed=Listados .. dns_eorder=Ordem de resoluo em falta hosts_title=Endereos do Anfitrio hosts_ip=Endereo IP hosts_host=Nome do Anfitrio hosts_add=Adicionar novos endereos do anfitrio hosts_edit=Editar Endereos do Anfitrio hosts_create=Criar Endereos do Anfitrio hosts_detail=Anfitrio e Endereos hosts_return=lista de endereos do anfitrio net/lang/es0100664000567100000120000002162310656003101012576 0ustar jcameronwheelacl_apply=¿Puede aplicar configuración? acl_bootonly=¿Puede editar interfaces activas? acl_broadcast=¿Puede editar broadcast? acl_delete=¿Puede borrar interfaces? acl_dns=¿Puede editar configuración de cliente DNS? acl_hide=¿Ocultar interfaces no editables? acl_hosts=¿Poder editar direcciones de máquinas? acl_ifcs=¿Poder editar interfaces de red? acl_ifcs_ex=Interfaces excepto acl_ifcs_only=Sólo interfaces acl_mtu=¿Puede editar MTU? acl_netmask=¿Puede editar máscara de red? acl_routes=¿Puede editar ruteos y gateways? acl_up=¿Puede editar estado activo? acl_view=Sólo ver acl_virt=¿Puede añadir interfaces virtuales? aifc_create=Crear Interfaz Activa aifc_default=Defecto aifc_desc1=Activar Parámetros de Interfaz aifc_desc2=Activar Parámetros de Interfaz Virtual aifc_ebroad='$1' no es una dirección de broadcast válida aifc_eclash=El interfaz $1 ya está utilizando esta dirección IP aifc_edit=Editar Interfaz Activa aifc_edup=La interfaz $1 ya existe aifc_eexist=Interfaz '$1' no existe aifc_ehard='$1' no es una dirección de hardware válida aifc_eip='$1' no es una dirección IP válida aifc_emask='$1' no es una máscara de red válida aifc_emtu='$1' no es una MTU válida aifc_ename=Nombre de interfaz no ingresado o no válido aifc_err1=Fallo al borrar interfaz aifc_err2=Fallo al salvar interfaz aifc_evirt=Número de interfaz virtual no ingresado o no válido aifc_evirtdup=La interfaz virtual $1 ya existe aifc_evirtmin=El número de interfaz virtual debe ser al menos $1 aifc_hard=Dirección de Hardware apply_ecannot=No está autorizado a aplicar la configuración bifc_apply=Salvar y Aplicar bifc_capply=Crear y Aplicar bifc_create=Crear Interfaz de Arranque bifc_dapply=Borrar y Aplicar bifc_desc1=Parámetros de Interfaz de tiempo de arranque bifc_desc2=Parámetros de Interfaz virtual de tiempo de arranque bifc_eapply=No puede activar una interfaz que usa DHCP o BOOTP bifc_ebroad='$1' no es una dirección de broadcast válida bifc_edhcpmain=DHCP sólo puede habilitarse en el interfaz primario de red bifc_edit=Editar Interfaz de Arranque bifc_edup=La interfaz $1 ya existe bifc_eip='$1' no es una dirección IP válida bifc_emask='$1' no es una máscara de red válida bifc_emtu='$1' no es una MTU válida bifc_ename=Nombre de interfaz no ingresada o no válida bifc_err1=Fallo al borrar interfaz bifc_err2=Fallo al salvar interfaz bifc_err3=Fallo al activar interfaz bifc_err4=Fallo al desactivar interfaz bifc_evirt=Número de interfaz virtual no ingresado o no válido bifc_evirtdup=La interfaz virtual $1 ya existe chooser_any=<Cualquiera> chooser_other=Otro.. dns_dhcp=¿Nombre de máquina es dado por el servidor DHCP? dns_ecannot=No está autorizado a editar la configuración del cliente DNS dns_edomain='$1' no es un nombre de dominio válido dns_ehost='$1' no es un nombre de máquina válido dns_ens='$1' no es una dirección IP de servidor de nombres válida dns_eorder=Orden de resolución no ingresada dns_err=Fallo al salvar la configuración DNS dns_esearch=No se ingresaron dominios para buscar dns_hostname=Nombre de máquina dns_hoststoo=¿Actualizar nombre de máquina en las direcciones de la máquina si ha cambiado? dns_listed=Listado .. dns_none=Ninguno dns_options=Opciones de Cliente DNS dns_order=Orden de resolución dns_search=Buscar dominios dns_servers=Servidores DNS dns_title=Nombre de máquina y cliente DNS hosts_add=Agregar una nueva dirección de máquina hosts_create=Crear Dirección de Máquina hosts_detail=Máquina y direcciones hosts_ecannot=No está autorizado a editar direcciones de máquinas hosts_edit=Editar Dirección de Máquina hosts_host=Nombres de máquina hosts_ip=Dirección IP hosts_return=lista de direcciones de máquinas hosts_title=Direcciones de Máquina ifcs_act=¿Activar al arrancar? ifcs_add=Agregar una nueva interfaz ifcs_addvirt=Agregar interfaz virtual ifcs_all=Todas las interfaces ifcs_auto=Automático ifcs_boot=Interfaces Activadas en Tiempo de Arranque ifcs_bootp=De BOOTP ifcs_broad=Broadcast ifcs_dhcp=De DHCP ifcs_down=Abajo ifcs_ecannot=No está autorizado a editar interfaces de red ifcs_ecannot_this=No está autorizado a editar esta interfaz de red ifcs_ip=Dirección IP ifcs_mask=Máscara de red ifcs_mtu=MTU ifcs_name=Nombre ifcs_now=Interfaces Activas Ahora ifcs_radd=Añadir un nuevo rango de direcciones. ifcs_range=Rango $1 ifcs_return=interfaces de red ifcs_static=Estático ifcs_status=Estado ifcs_title=Interfaces de Red ifcs_type=Tipo ifcs_unknown=Desconocido ifcs_up=Arriba ifcs_virts=Interfaces virtuales ifcs_virtual=Virtual index_apply=Aplicar Configuración index_applydesc=Presione este botón para activar la interfase de tiempo de arranque y la configuración de ruteo actual, tal como serían después de un reinicio. Advertencia - esto podría dejar a su sistema inaccesible desde la red, y cortar el acceso a Webmin. index_return=configuración de red index_title=Configuración de Red interfaces_all=Todas las interfaces... interfaces_cancel=Cancelar interfaces_clear=Limpiar interfaces_ok=OK interfaces_sel=Interfaces Seleccionadas interfaces_title1=Seleccionar interfaces... interfaces_title2=Seleccionar Usuario... log_create_aifc=Activada interfaz $1 dirección $2 log_create_bifc=Creada interfaz $1 dirección $2 log_create_host=Creada dirección de máquina $1 log_delete_aifc=Desactivada interfaz $1 dirección $2 log_delete_bifc=Borrada interfaz $1 dirección $2 log_delete_host=Borrada dirección de máquina $1 log_dns=Cambiadas opciones de cliente DNS log_dyn=dinámica log_modify_aifc=Reactivada interfaz $1 dirección $2 log_modify_bifc=Modificada interfaz $1 dirección $2 log_modify_host=Modificada dirección de máquina $1 log_routes=Cambiadas opciones de ruteo y gateways mod_adsl=una conexión PPP ADSL mod_desc=El interfaz $1 está siendo utilizado para $2, y por tanto no puede ser gestionado utilizando este módulo. mod_egone=¡El interfaz ya no está activo! mod_link=Sin embargo, puede utilizar el módulo $2 para gestionarlo. mod_ppp=una conexión de marcación PPP a $1 mod_pptpc=la conexión PPTP $1 mod_pptps=una conexión PPTP desde el cliente $1 mod_title=Interfaz Activa mod_zones=una interfaz virtual para zona $1 range_create=Crear Rango de Direcciones range_ebefore=La dirección final ha de ser mayor que la inicial range_eclass=Las direcciones de inicio y fin deben pertenecer a la misma red de clase C range_edit=Editar Rango de Direcciones range_eend=Dirección IP de fin falta o no válida range_ename=Nombre de rango falta o no válido range_end=Dirección de fin range_enum=Número de primer interfaz virtual no numérico falta o no válido range_err=Fallo al salvar rango de direcciones range_estart=Dirección IP de inicio falta o no válida range_header=Opciones de rango de direcciones de interfaz range_iface=Interfaz real range_name=Nombre de rango range_num=Primer interfal virtual no. range_start=Dirección de inicio routes_active=Rutas Activas routes_any=Cualquiera routes_auto=Automática routes_boot=Configuración de ruteo activada en tiempo de arranque routes_def=Ruta Por Defecto routes_default=Router por defecto routes_default2=Rutas por defecto routes_defaults=Routers por defecto routes_dest=Destino routes_device=Dispositivo routes_device2=Dispositivo de ruteo por defecto routes_ecannot=No está autorizado a editar ruteos y gateways routes_eclash=Solo puede ser definida una ruta por defecto para una interfaz routes_eclash2=Solo puede ser definida una ruta por defecto para $1 routes_edefault='$1' no es un router por defecto válido routes_edefault2=Número de dirección de gateway por defecto $1 no válida routes_edevice='$1' no es un dispositivo válido routes_egateway='$1' no es un gateway válido routes_emask='$1' no es una máscara de red válida routes_enet='$1' no es una red válida routes_err=Fallo al salvar ruteos routes_etype='$1' no es un tipo de ruta válido routes_forward=¿Actuar como router? routes_gateway=Gateway routes_gw=Gateway routes_gwmetric=Interfaz Metric routes_iface=Interfaz routes_ifc=Interfaz routes_local=Rutas locales routes_mask=Máscara de red routes_net=Red routes_nogw=Ninguna routes_none=Ninguna (o desde DHCP) routes_none2=Ninguno routes_now=Configuración de ruteo activada ahora routes_possible=Si es posible routes_routed=¿Comenzar el demonio descubridor de rutas? routes_script=Comandos adicionales de ruteo routes_static=Rutas estáticas routes_title=Ruteo y Gateways routes_type=Tipo net/lang/fr0100644000567100000120000001221010656003101012564 0ustar jcameronwheelindex_title=Configuration Rseau index_return=configuration rseau index_applydesc=Cliquez sur ce bouton pour activer les configurations actuelles comme si vous aviez redemarre la machine.
ATTENTION: Cela peut rendre votre systeme inaccessible par le reseau et couper l'acces a Webmin. index_apply=Appliquer la Configuration ifcs_title=Interfaces Rseau ifcs_now=Interfaces Actives ifcs_name=Nom ifcs_type=Type ifcs_ip=IP Adresse ifcs_mask=Masque de sous-rseau ifcs_status=tat ifcs_virtual=Virtuel ifcs_up=Effectif ifcs_down=Arrt ifcs_add=Ajouter une nouvelle interface ifcs_boot=Interfaces Permanentes ifcs_act=Permanente? ifcs_bootp=Par BOOTP ifcs_dhcp=Par DHCP ifcs_broad=Adresse de diffusion ifcs_auto=Automatique ifcs_mtu=MTU (Unit de transfert maximal) ifcs_virts=Interfaces virtuelles ifcs_addvirt=Ajouter une interface virtuelle ifcs_return=interfaces rseau ifcs_unknown=Inconnu ifcs_ecannot=Vous n'avez pas le droit d'diter les interfaces rseau aifc_create=Crer une Interface Active aifc_edit=diter une Interface Active aifc_desc1=Paramtres d'une Interface Active aifc_desc2=Paramtres d'une Interface Virtuel Active aifc_hard=Adresse matrielle aifc_default=Dfaut aifc_err1=Impossible de supprimer l'interface aifc_err2=Impossible d'enregistrer l'interface aifc_evirt=Numro d'interface virtuel inconnu ou invalide aifc_evirtdup=L'interface virtuelle $1 existe dj aifc_edup=L'interface $1 existe dj aifc_ename=Nom d'interface inconnu ou invalide aifc_eip=$1 n'est pas une adresse IP valide aifc_emask=$1 n'est pas un masque de sous-rseau valide aifc_ebroad=$1 n'est pas une adresse de diffusion valide aifc_emtu=$1 n'est pas un MTU valide aifc_ehard=$1 n'est pas une adresse matrielle valide aifc_eexist=L'interface $1 n'existe pas bifc_create=Crer une Interface Permanente bifc_edit=diter une Interface Permanente bifc_desc1=Paramtre de l'Interface Permanente bifc_desc2=Paramtre de l'Interface Virtuel Permanente bifc_apply=Enregistrer et Appliquer bifc_err1=Impossible de supprimer l'interface bifc_err2=Impossible de sauvegarder l'interface bifc_evirt=Numro d'interface virtuel inconnu ou invalide bifc_evirtdup=L'interface virtuelle $1 existe dj bifc_edup=L'interface $1 existe dj bifc_ename=Nom d'interface inconnu ou invalide bifc_eip=$1 n'est pas une adresse IP valide bifc_emask=$1 n'est pas un masque de sous-rseau valide bifc_ebroad=$1 n'est pas une adresse de diffusion valide bifc_emtu=$1 n'est pas un MTU valide bifc_err3=Impossible d'activer l'interface routes_title=Passerelles et Routage routes_boot=Configuration de routage activ au dmarrage routes_default=Routeur par dfaut routes_none=Aucun routes_device=Priphrique routes_gateway=Passerelle routes_forward=Agir comme routeur? routes_routed=Dmarrer le dmon dcouvreur de route ? routes_edefault=$1 n'est pas un routeur par dfaut valide routes_edevice=$1 n'est pas un priphrique valide routes_device2=Priphrique par dfaut de routage routes_static=Routes statique routes_ifc=Interface routes_net=Rseau routes_mask=Masque de sous-rseau routes_enet=$1 n'est pas un rseau valide routes_emask=$1 n'est pas un masque de sous-rseau valide routes_egateway=$1 n'est pas une passerelle non valide routes_defaults=Routeur par dfaut routes_possible=Si possible routes_local=Routes locale routes_err=Echec de la sauvegarde du routage routes_ecannot=Vous n'avez pas le droit d'diter le routage et les passerelles dns_title=Client DNS dns_options=Options du Client DNS dns_hostname=Nom du poste dns_order=Ordre de rsolution dns_servers=Serveurs DNS dns_search=Domaines de recherche dns_none=Aucun dns_listed=List dns_eorder=Ordre de rsolution introuvable dns_ecannot=Vous n'avez pas le droit d'diter les paramtres de client DNS dns_err=Echec de la sauvegarde de configuration DNS dns_ehost='$1' n'est pas un nom de machine valide dns_ens='$1' n'est pas une adresse IP de serveur de noms valide dns_edomain='$1' n'est pas un nom de domaine valide dns_esearch=Aucun domaine donn chercher dns_hoststoo=Mettre a jour le " hostname" dans les adresses en cas de modification hosts_title=Adresses de la machine hosts_ip=Adresse IP hosts_host=Nom de machine hosts_add=Ajouter une nouvelle adresse de machine hosts_edit=diter l'adresse de machine hosts_create=Crer l'adresse de machine hosts_detail=Machine et adresse hosts_return=liste des adresses des machines hosts_ecannot=Vous n'avez pas le droit d'diter les adresses des machines log_create_host=Adresse de machine $1 cre log_delete_host=Adresse de machine $1 supprime log_modify_host=Adresse de machine $1 modifie log_dns=Options client DNS modifies log_routes=Options de routage et passerelles modifies log_create_aifc=Interface $1 adresse $2 active log_modify_aifc=Interface $1 adresse $2 ractive log_delete_aifc=Interface $1 adresse $2 dsactive log_create_bifc=Interface $1 adresse $2 cre log_modify_bifc=Created interface $1 address $2 modifie log_delete_bifc=Modified interface $1 address $2 efface log_dyn=dynamique acl_ifcs=Peut diter les interfaces rseau ? acl_routes=Peut diter le routage et les passerelles ? acl_dns=Peut diter les paramtres de client DNS ? acl_hosts=Peut diter les adresses de machine ? acl_view=Voir seulement net/lang/de0100644000567100000120000001620710656003101012557 0ustar jcameronwheel# webmin-1.00 net/lang/de # # created: ??-??-???? by: Dieter Huerten # last modified: 24-aug-2002 Rev.: 24-08-2002 # modified/translated by: Dieter Huerten # for changes, completions, ... mailto:dieter.huerten@telebel.de # # erzeugt: ??.??.???? durch: Dieter Hürten # letzte Änderung: 21.04.2004 Falk Hatzfeld hatzfeld.f@duerr.de # letzte Änderung: 24.08.2002 Rev.: 24.08.2002 # modifiziert/übersetzt durch: Dieter Hürten # für Änderungen, Ergänzungen, etc. mailto:dieter.huerten@telebel.de # index_title=Netzwerkkonfiguration index_return=Netzwerkkonfiguration index_apply=Konfiguration anwenden index_applydesc=Hier klicken um die aktuellen Netzwerkschnittstellen und Routing Einstellungen zu aktivieren, die beim Systemstart normalerweise gelten. Warnung - Dies könnte bewirken, dass das System nicht mehr über das Netzwerk erreichbar ist und so auch den Zugang zu Webmin verhindert. ifcs_title=Netzwerkschnittstellen ifcs_now=Jetzt aktive Schnittstellen ifcs_name=Name  ifcs_type=Typ ifcs_ip=IP-Adresse ifcs_mask=Netzmaske ifcs_status=Status  ifcs_virtual=Virtuell ifcs_up=Aktiv ifcs_down=Inaktiv ifcs_add=Eine neue Schnittstelle hinzufügen ifcs_boot=Schnittstellen, die beim Booten aktiviert werden ifcs_act=Aktiviere beim Booten? ifcs_bootp=Von BOOTP ifcs_dhcp=Von DHCP ifcs_broad=Broadcast  ifcs_auto=Automatisch ifcs_mtu=MTU  ifcs_virts=Virtuelle Schnittstellen ifcs_addvirt=Virtuelle Schnittstelle hinzufügen ifcs_return=Netzwerkschnittstellen ifcs_unknown=Unbekannt ifcs_all=Alle Schnittstellen ifcs_ecannot=Sie sind nicht berechtigt, Netzwerkschnittstellen zu bearbeiten ifcs_ecannot_this=Sie sind nicht berechtigt, diese Netzwerkschnittstelle zu bearbeiten aifc_create=Aktive Schnittstelle erstellen aifc_edit=Aktive Schnittstelle bearbeiten aifc_desc1=Parameter der aktiven Schnittstelle aifc_desc2=Parameter der aktiven virtuellen Schnittstelle aifc_hard=Hardware-Adresse aifc_default=Standard aifc_err1=Fehler beim Löschen der Schnittstelle aifc_err2=Fehler beim Speichern der Schnittstelle aifc_evirt=Fehlende oder ungültige Nummer der virtuellen Schnittstelle aifc_evirtdup=Die virtuelle Schnittstelle $1 existiert bereits aifc_edup=Die Schnittstelle $1 existiert bereits aifc_ename=Fehlender oder ungültiger Schnittstellenname aifc_eip='$1' ist keine gültige IP-Adresse aifc_emask='$1' ist keine gültige Netzmaske aifc_ebroad='$1' ist keine gültige Broadcast-Adresse aifc_emtu='$1' ist keine gültige MTU aifc_ehard='$1' ist keine gültige Hardware-Adresse aifc_eexist=Schnittstelle '$1' existiert nicht bifc_create=Bootup-Schnittstelle erstellen bifc_edit=Bootup-Schnittstelle bearbeiten bifc_desc1=Parameter für Schnittstelle zur Boot-Zeit bifc_desc2=Parameter für virtuelle Schnittstelle zur Boot-Zeit bifc_apply=Speichern und Anwenden bifc_dapply=Löschen und Anwenden bifc_err1=Fehler beim Löschen der Schnittstelle bifc_err2=Fehler beim Speichern der Schnittstelle bifc_evirt=Fehlende oder ungültige Nummer der virtuellen Schnittstelle bifc_evirtdup=Die virtuelle Schnittstelle $1 existiert bereits bifc_edup=Die Schnittstelle $1 existiert bereits bifc_ename=Fehlender oder ungültiger Schnittstellenname bifc_eip='$1' ist keine gültige IP-Adresse bifc_emask='$1' ist keine gültige Netzmaske bifc_ebroad='$1' ist keine gültige Broadcast-Adresse bifc_emtu='$1' ist keine gültige MTU bifc_err3=Fehler beim Aktivieren der Schnittstelle bifc_err4=Fehler beim Deaktivieren der Schnittstelle bifc_capply=Erstellen und Anwenden bifc_eapply=Eine Schnittstelle, die DHCP oder BOOTP verwendet, kann nicht aktiviert werden routes_title=Routing und Gateways routes_boot=Routing-Konfiguration, die zur Boot-Zeit aktiviert wird routes_default=Standard-Router routes_default2=Standard Routen routes_none=Keiner routes_device=Gerät routes_gateway=Gateway  routes_forward=Als Router arbeiten? routes_routed=Starte Dienst für 'Discovery'-Dämon? routes_edefault='$1' ist kein gültiger Standard-Router routes_edevice='$1' ist kein gültiges Gerät routes_device2=Standard-Router Gerät routes_static=Statische Routen routes_ifc=Schnittstelle routes_net=Netzwerk routes_mask=Netzmaske routes_type=Typ routes_enet='$1' ist kein gültiges Netzwerk routes_emask='$1' ist keine gültige Netzmaske routes_egateway='$1' ist kein gültiges Gateway routes_defaults=Standard-Router routes_possible=Wenn möglich routes_local=Lokale Routen routes_err=Fehler beim Speichern der Routen routes_ecannot=Sie sind nicht berechtigt, Routen und Gateways zu bearbeiten routes_script=Zusätzliche Routing-Befehle routes_etype='$1' ist kein gültiger Route-Typ routes_any=beliebig routes_edefault2=Ungültige Standard Gateway Adressnummer $1 routes_eclash=Für jede Schnittstelle kann nur eine standard Route definiert werden routes_eclash2=Für $1 kann nur eine standard Route definiert werden routes_none2=Keine routes_auto=Automatisch dns_title=DNS-Client dns_options=DNS-Client Optionen dns_hostname=Host-Name dns_order=Auflösungsreihenfolge dns_servers=DNS-Server dns_search=Suchdomänen dns_none=Keine dns_listed=Aufgelistet ... dns_eorder=Fehlende Auflösungsreihenfolge dns_ecannot=Sie sind nicht berechtigt, DNS-Client Einstellungen zu bearbeiten dns_err=Fehler beim Speichern der DNS-Konfiguration dns_ehost='$1' ist kein gültiger Host-Name dns_ens='$1' ist keine gültige IP-Adresse eines DNS-Servers dns_edomain='$1' ist kein gültiger Domänenname dns_esearch=Keine Suchdomänen angegeben hosts_title=Host-Adressen hosts_ip=IP-Adresse hosts_host=Host-Name hosts_add=Eine neue Host-Adresse hinzufügen hosts_edit=Host-Adresse bearbeiten hosts_create=Host-Adresse hinzufügen hosts_detail=Hosts und Adressen hosts_return=Host-Adressenliste hosts_ecannot=Sie sind nicht berechtigt, Host-Adressen zu bearbeiten log_create_host=Erzeugte Host-Adresse $1 log_delete_host=Gelöschte Host-Adresse $1 log_modify_host=Geänderte Host-Adresse $1 log_dns=Geänderte DNS-Client Einstellungen log_routes=Geänderte Routing und Gateway Einstellungen log_create_aifc=Aktivierte Schnittstelle $1 Adresse $2 log_modify_aifc=Reaktivierte Schnittstelle $1 Adresse $2 log_delete_aifc=Deaktivierte Schnittstelle $1 Adresse $2 log_create_bifc=Erzeugte Schnittstelle $1 Adresse $2 log_modify_bifc=Geänderte Schnittstelle $1 Adresse $2 log_delete_bifc=Gelöschte Schnittstelle $1 Adresse $2 log_dyn=dynamisch acl_ifcs=Darf Netzwerkschnittstellen bearbeiten? acl_routes=Darf Routen und Gateways bearbeiten? acl_dns=Darf DNS-Client Einstellungen bearbeiten? acl_hosts=Darf Host-Adressen bearbeiten? acl_view=Nur Anzeigen acl_ifcs_only=Nur Schnittstellen acl_apply=Darf Konfiguartion anwenden? interfaces_title1=Wähle Schnittstellen... interfaces_all=Alle Schnittstellen... interfaces_sel=ausgewählte Schnittstellen interfaces_ok=OK interfaces_cancel=Abbruch interfaces_clear=Löschen interfaces_title2=Wähle Benutzer... apply_ecannot=Berechtigung zur Anwendung der Konfiguration fehlt net/lang/sv0100644000567100000120000000753410656003101012622 0ustar jcameronwheelindex_title=Ntverksinstllningar index_return=ntverksinstllningar ifcs_title=Ntverksinterface ifcs_now=Aktiva interface ifcs_name=Namn ifcs_type=Typ ifcs_ip=IP-adress ifcs_mask=Ntmask ifcs_status=Status ifcs_virtual=Virtuellt ifcs_up=Aktivt ifcs_down=Inaktivt ifcs_add=Lgg till interface ifcs_boot=Interface som ska aktiveras vid start ifcs_act=Aktivera vid start? ifcs_bootp=Frn BOOTP ifcs_dhcp=Frn DHCP ifcs_broad=Broadcast ifcs_auto=Automatiskt ifcs_mtu=MTU ifcs_virts=Virtuella interface ifcs_addvirt=Lgg till virtuellt interface ifcs_return=ntverksinterface ifcs_unknown=Oknt aifc_create=Lgg till aktivt interface aifc_edit=ndra aktivt interface aifc_desc1=Parametrar fr aktivt interface aifc_desc2=Parametrar fr aktivt virtuellt interface aifc_hard=Hrdvaruadress aifc_default=Standard aifc_err1=Det gick inte att radera interface aifc_err2=Det gick inte att spara interface aifc_evirt=Numret fr det virtuella interfacet saknas eller r felaktigt angivet aifc_evirtdup=Det virtuella interfacet $1 finns redan aifc_edup=Interface $1 finns redan aifc_ename=Interface-namn saknas eller r felaktigt angivet aifc_eip='$1' r inte en giltig IP-adress aifc_emask='$1' r inte en giltig ntmask aifc_ebroad='$1' r inte en giltig broadcast-adress aifc_emtu='$1' r inte en giltig MTU aifc_ehard='$1' r inte en giltig hrdvaruadress aifc_eexist=Interface '$1' finns inte bifc_create=Lgg till start-interface bifc_edit=ndra start-interface bifc_desc1=Parametrar fr start-interface bifc_desc2=Parametrar fr virtuellt start-interface bifc_apply=Spara och genomfr ndringar bifc_err1=Det gick inte att ta bort interface bifc_err2=Det gick inte att spara interface bifc_evirt=Numret fr det virtuella interfacet saknas eller r felaktigt angivet bifc_evirtdup=Det virtuella interfacet $1 finns redan bifc_edup=Interface $1 finns redan bifc_ename=Interface-namn saknas eller r felaktigt angivet bifc_eip='$1' r inte en giltig IP-adress bifc_emask='$1' r inte en giltig ntmask bifc_ebroad='$1' r inte en giltig broadcast-adress bifc_emtu='$1' r inte en giltig MTU bifc_err3=Det gick inte att aktivera interface routes_title=Routing och routrar routes_boot=Routing-instllningar som aktiveras vid start routes_default=Standardrouter routes_none=Ingen routes_device=Enhet routes_gateway=Gateway routes_forward=Agera som router? routes_routed=Starta route-letardemonen? routes_edefault='$1' r inte en giltig standardrouter routes_edevice='$1' r inte en giltig enhet routes_device2=Standardrouteinterface routes_static=Statisk routing routes_ifc=Interface routes_net=Ntverk routes_mask=Ntmask routes_enet='$1' r inte ett giltigt ntverk routes_emask='$1' r inte en giltig ntmask routes_egateway='$1' r inte en giltig gateway routes_defaults=Standardroutrar routes_possible=Om mjligt routes_local=Lokal routing routes_err=Det gick inte att spara routing dns_title=DNS-klient dns_options=Instllningar fr DNS-klient dns_hostname=Datornamn dns_order=Uppslagsordning dns_servers=DNS-servrar dns_search=Domner att leta igenom dns_none=Inga dns_listed=Angivna ... dns_eorder=Du har inte angivit ngon uppslagsordning hosts_title=Datoradresser hosts_ip=IP-adress hosts_host=Datornamn hosts_add=Lgg till datoradress hosts_edit=ndra datoradress hosts_create=Lgg till datoradress hosts_detail=Dator och adresser hosts_return=lista ver datoradresser log_create_host=Lade till datoradress $1 log_delete_host=Tog bort datoradress $1 log_modify_host=Modifierade datoradress $1 log_dns=ndrade instllningar fr DNS-klient log_routes=ndrade instllningar fr routing och gateways log_create_aifc=Aktiverade interface $1 adress $2 log_modify_aifc=Aktiverade interface $1 adress $2 igen log_delete_aifc=Deaktiverade interface $1 adress $2 log_create_bifc=Lade till interface $1 adress $2 log_modify_bifc=Modifierade interface $1 adress $2 log_delete_bifc=Tog bort interface $1 adress $2 log_dyn=dynamisk net/lang/nl0100664000567100000120000001152510656003101012600 0ustar jcameronwheelindex_title=Netwerk Configuratie index_return=netwerk configuratie ifcs_title=Netwerk Interfaces ifcs_now=Interfaces nu geactiveerd ifcs_name=Naam ifcs_type=Type ifcs_ip=IP Adres ifcs_mask=Netmask ifcs_status=Status ifcs_virtual=Alias ifcs_up=Up ifcs_down=Down ifcs_add=Voeg interface toe ifcs_boot=Interfaces geactiveerd tijdens boot. ifcs_act=Activeer bij boot? ifcs_bootp=Met BOOTP ifcs_dhcp=Met DHCP ifcs_broad=Broadcast ifcs_auto=Automatisch ifcs_mtu=MTU ifcs_virts=Alias interfaces ifcs_addvirt=Voeg alias interface toe. ifcs_return=netwerk interfaces ifcs_unknown=Onbekend ifcs_ecannot=U heeft geen rechten on interfaces te bewerken ifcs_ecannot_this=U heeft geen recht om deze interface te bewerken aifc_create=Maak actieve interface. aifc_edit=Bewerk actieve interface aifc_desc1=Actieve interface instellingen aifc_desc2=Actieve alias interface instellingen aifc_hard=Hardware adres aifc_default=Standaard aifc_err1=Kan interface niet verwijderen aifc_err2=Kan interface niet opslaan aifc_evirt=Ontbrekend of onbekende alias interface nummer. aifc_evirtdup=Alias interface $1 bestaat reeds. aifc_edup=Interface $1 bestaat reeds. aifc_ename=Ontbrekende of onbekende interface naam. aifc_eip='$1' is is geen geldig IP adres. aifc_emask='$1' is geen geldig netmask. aifc_ebroad='$1' is geen geldig broadcast adres. aifc_emtu='$1' is geen geldige MTU. aifc_ehard='$1' is geen geldig hardware adres. aifc_eexist=Interface '$1' bestaat niet. bifc_create=Maak Bootup Interface bifc_edit=Bewerk Bootup Interface bifc_desc1=Boot Time interface instellingen bifc_desc2=Boot Time alias interface instellingen bifc_apply=Opslaan en Activeren bifc_err1=Kon interface niet verwijderen bifc_err2=Kon interface niet opslaan bifc_evirt=Ontbrekend of ongeldige alias interface nummer. bifc_evirtdup=Alias interface $1 bestaat reeds. bifc_edup=Interface $1 bestaat reeds. bifc_ename=Ontbrekende of ongeldige interface naam. bifc_eip='$1' is geen geldig IP adres. bifc_emask='$1' is geen geldig netmask. bifc_ebroad='$1' is geen geldig broadcast adres. bifc_emtu='$1' is geen geldige MTU. bifc_err3=Kon interface niet activeren. bifc_capply=Maak en Activeer. bifc_eapply=U kunt geen interface activeren die DHCP of BOOTP gebruikt. routes_title=Routing en Gateways routes_boot=Routing configuratie actief tijdens boot time routes_default=Default router routes_none=Geen (of van DHCP) routes_device=Device routes_gateway=Gateway routes_forward=Wees een router? routes_routed=Start route discovery daemon? routes_edefault='$1' is geen geldige default router routes_edevice='$1' is geen geldig device routes_device2=Default route device routes_static=Statische routes routes_ifc=Interface routes_net=Netwerk routes_mask=Netmask routes_type=Type routes_enet='$1' is geen geldig netwerk. routes_emask='$1' is geen geldig netmask. routes_egateway='$1' is geen geldige gateway. routes_defaults=Default routers routes_possible=Indien mogelijk routes_local=Lokale routes routes_err=Kon routes niet opslaan. routes_ecannot=U heeft geen rechten om routes en gateways te bewerken. routes_script=Extra route commando's routes_etype='$1' is geen geldig routetype. dns_title=DNS Client dns_options=DNS Client Opties dns_hostname=Hostnaam dns_order=Resolution volgorde dns_servers=DNS servers dns_search=Zoekdomeinen dns_none=Geen dns_listed=Uit lijst .. dns_eorder=Ontbrekende resolution volgorde dns_ecannot=U heeft geen rechten om DNS Client instellingen te wijzigen. dns_err=Kon DNS instellingen niet opslaan. dns_ehost='$1' is geen geldige hostnaam. dns_ens='$1' is geen geldig nameserver IP adres. dns_edomain='$1' is geen geldige domeinnaam. dns_esearch=Geen zoekdomeinen opgeveven. hosts_title=Host Adressen hosts_ip=IP Adres hosts_host=Hostnamen hosts_add=Voeg nieuw hostadres toe hosts_edit=Bewerk hostadres hosts_create=Maak hostadres hosts_detail=Host and Adressen hosts_return=host adressenlijst hosts_ecannot=U heeft geen rechten om hostadressen te bewerken. log_create_host=Hostadres $1 gemaakt. log_delete_host=Hostadres $1 verwijderd. log_modify_host=Hostadres $1 veranderd. log_dns=DNS client instelling gewijzigd. log_routes=Routing and gateways instellingen gewijzigd. log_create_aifc=Activeerd interface $1 adres $2. log_modify_aifc=Activeerde interface $1 adres $2 opnieuw. log_delete_aifc=Deactiveerde interface $1 adres $2. log_create_bifc=Maakte interface $1 adres $2 aan. log_modify_bifc=Wijzigde interface $1 adres $2 log_delete_bifc=Verwijderde interface $1 adres $2 log_dyn=dynamisch acl_ifcs=Kan netwerk interfaces bewerken? acl_routes=Kan routing en gateways bewerken? acl_dns=Kan DNS client instellingen bewerken? acl_hosts=Kan hostadressen bewerken? acl_view=Alleen bekijken acl_ifcs_only=Alleen interfaces interfaces_title1=Kies Interfaces... interfaces_all=Alle Interfaces... interfaces_sel=Geselecteerde Interfaces interfaces_ok=OK interfaces_cancel=Cancel interfaces_clear=Wissen interfaces_title2=Selecteer Gebruiker... net/lang/tr0100644000567100000120000001737710656003101012625 0ustar jcameronwheelacl_apply=Yaplandrmay uygulayabilir mi? acl_bootonly=Aktif arayzleri dzenleyebilir mi? acl_broadcast=Yayn adresini dzenleyebilir mi? acl_delete=Arayzleri silebilir mi? acl_dns=DNS istemci ayarlarn dzenleyebilir mi? acl_hosts=Makine adreslerini dzenleyebilir mi? acl_ifcs=A arayzlerini dzenleyebilir mi? acl_ifcs_ex=Bu arayzler haricindekileri acl_ifcs_only=Sadece bu arayzleri acl_mtu=MTU'yu dzenleyebilir mi? acl_netmask=A maskesini dzenleyebilir mi? acl_routes=Ynlendirmeyi ve a geidini dzenleyebilir mi? acl_up=Aktiflik durumunu dzenleyebilir mi? acl_view=Sadece grntle acl_virt=Sanal arayz ekleyebilir mi? aifc_create=Aktif Arayz Olutur aifc_default=ntanml aifc_desc1=Aktif Arayz Parametreleri aifc_desc2=Aktif Sanal Arayz Parametreleri aifc_ebroad='$1' geerli bir yayn adresi deil aifc_eclash=$1 arayz zaten bu IP adresini kullanyor aifc_edit=Aktif Arayzleri Dzenle aifc_edup=$1 arayz zaten mevcut aifc_eexist='$1' arayz mevcut deil aifc_ehard='$1' geerli bir donanm adresi deil aifc_eip='$1' geerli bir IP adresi deil aifc_emask='$1' geerli bir a maskesi deil aifc_emtu='$1' geerli bir MTU deil aifc_ename=Eksik ya da yanl arayz ismi aifc_err1=Arayzn silinmesinde hata olutu aifc_err2=Arayzn kaydedilmesinde hata olutu aifc_evirt=Eksik ya da yanl sanal arayz numaras aifc_evirtdup=Sanal arayz $1 zaten mevcut aifc_evirtmin=Sana arayz numaras en az $1 olmaldr aifc_hard=Donanm adresi apply_ecannot=Uygulamay uygulamak iin izininiz yoktur bifc_apply=Kaydet ve Uygula bifc_capply=Olutur ve Uygula bifc_create=Al Arayz Olutur bifc_dapply=Sil ve Uygula bifc_desc1=Al Arayz Parametreleri bifc_desc2=Al Sanal Arayz Parametreleri bifc_eapply=DHCP ya da BOOTP kullanan bir arayz aktive edemezsiniz bifc_ebroad='$1' geerli bir yayn adresi deil bifc_edhcpmain=DHCP sadece birincil a arayznde kullanlabilir bifc_edit=Al Arayzn Dzenle bifc_edup=$1 arayz zaten mevcut bifc_eip='$1' geerli bir IP adresi deil bifc_emask='$1' geerli bir a maskesi deil bifc_emtu='$1' geerli bir MTU deil bifc_ename=Eksik ya da yanl arayz ismi bifc_err1=Arayzn silinmesinde hata olutu bifc_err2=Arayzn kaydedilmesinde hata olutu bifc_err3=Arayzn aktif hale getirilmesinde hata olutu bifc_err4=Arayzn kapatlmasnda hata olutu bifc_evirt=Eksik ya da yanl sanal arayz numaras bifc_evirtdup=Sanal arayz $1 her zaman mevcut chooser_any=<Herhangi> chooser_other=Dier.. dns_ecannot=DNS istemci ayarlarn dzenlemek iin izininiz yoktur dns_edomain='$1' geerli bir alan ad deil dns_ehost='$1' geerli bir makine ad deildir dns_ens='$1' geerli bir isim sunucusu IP adresi deildir dns_eorder=Eksik isim zme sras dns_err=DNS yaplandrmasnn kaydedilmesinde hata olutu dns_esearch=Aranlacak alan ad girilmedi dns_hostname=Makine Ad dns_hoststoo=Deitirildiinde makine adreslerindeki makine ad da gncellensin dns_listed=Listelenenlerden Ara .. dns_none=Hibiri dns_options=DNS stemci Seenekleri dns_order=sim zme sras dns_search=Aranlacak alan adlar dns_servers=DNS sunucular dns_title=DNS stemcisi hosts_add=Yeni bir makine adresi ekle hosts_create=Makine Adresi Olutur hosts_detail=Makine ve Adresler hosts_ecannot=Makine adreslerini dzenlemek iin izininiz yoktur hosts_edit=Makine Adreslerini Dzenle hosts_host=Makine Adlar hosts_ip=IP Adresi hosts_return=makine adresleri listesi hosts_title=Makine Adresleri ifcs_act=Alta aktif hale getir? ifcs_add=Yeni arayz ekle ifcs_addvirt=Sanal arayz ekle ifcs_all=Btn arayzler ifcs_auto=Otomatik ifcs_boot=Alta Aktif Hale Getirilebilen Arayzler ifcs_bootp=BOOTP'den ifcs_broad=Yayn ifcs_dhcp=DHCP'den ifcs_down=Kapal ifcs_ecannot=A arayzlerini dzenlemek iin izininiz yoktur ifcs_ecannot_this=Bu a arayzn dzenlemek iin izininiz yoktur ifcs_ip=IP Adresi ifcs_mask=A maskesi ifcs_mtu=MTU ifcs_name=sim ifcs_now=Aktif Arayzler ifcs_radd=Yeni bir adres aral gir ifcs_range=Aralk $1 ifcs_return=a arayzleri ifcs_static=Statik ifcs_status=Durum ifcs_title=A Arayzleri ifcs_type=Tip ifcs_unknown=Bilinmeyen ifcs_up=Ak ifcs_virts=Sanal arayzler ifcs_virtual=Sanal index_apply=Yaplandrmay Uygula index_applydesc=Bu butonu tklayarak normalde sistemin yeniden balatlmasndan sonra uygulanacak olan IP ve ynlendirme ayarlarn aktive edebilirsiniz. Uyar - bu ilem sisteme a zerinde ulalmasn ve Webmin'e eriiminizi engelleyebilir. index_return=a yaplandrmas index_title=A Yaplandrmas interfaces_all=Btn Arayzler... interfaces_cancel=ptal interfaces_clear=Temizle interfaces_ok=Tamam interfaces_sel=Seili Arayzler interfaces_title1=Arayzleri Seiniz... interfaces_title2=Kullanc Seiniz... log_create_aifc=$1 arayznde $2 adresi aktif hale getirildi log_create_bifc=Arayz $1 'de adres $2 oluturuldu log_create_host=Makine adresi $1 oluturuldu log_delete_aifc=Arayz $1, adres $2 inaktif hale getirildi log_delete_bifc=Arayz $1 'de adres $2 silindi log_delete_host=Makine adresi $1 silindi log_dns=DNS istemci seenekleri deitirildi log_dyn=dinamik log_modify_aifc=Arayz $1, adres $2 yeniden aktif hale getirildi log_modify_bifc=Arayz $1, adres $2 deitirildi log_modify_host=Makine adresi $1 deitirildi log_routes=Ynlendirme ve a geidi seenekleri deitirildi mod_adsl=bir ADSL PPP balants mod_desc=$1 arayz $2 iin kullanldndan bu modl ile ynetilemez. mod_egone=Arayz artk aktif deil! mod_link=Ancak, bunun yerine $2 modln kullanabilirsiniz. mod_ppp=$1 iin bir PPP evirmeli a balants mod_pptpc=PPTP balants $1 mod_pptps=$1 istemcisinden PPTP balants mod_title=Aktif Arayz range_create=Adres Aral Olutur range_ebefore=Biti adresi balang adresinden daha yksek olmaldr range_eclass=Balama ve biti adresleri ayn C snf IP adreslerine sahip olmaldr range_edit=Adres Araln Dzenle range_eend=Eksik ya da geersiz biti IP adresi range_ename=Eksik ya da geersiz aralk ad range_end=Biti adresi range_enum=lk sanal arayz numaras girilmemi ya da numerik deil range_err=Adres aralnn kaydedilmesinde hata olutu range_estart=Eksik ya da geersiz balang IP adresi range_header=Adres aral arayz seenekleri range_iface=Gerek arayz range_name=Aralk ad range_num=lk sanal arayz no. range_start=Balama adresi routes_active=Aktif Ynlendirmeler routes_any=Herhangi routes_auto=Otomatik routes_boot=Alta aktif hale getirilebilecek ynlendirme ayarlar routes_def=ntanml Ynlendirme routes_default=ntanml ynlendirici routes_default2=ntanml ynlendirmeler routes_defaults=ntanml ynlendiriciler routes_dest=Hedef routes_device=Aygt routes_device2=ntanml ynlendirici aygt routes_ecannot=Ynlendirmeleri ve a geitlerini dzenlemek iin izininiz yoktur routes_eclash=Herhangi bir arayz iin sadece bir ntanml ynlendirme tanmlanabilir routes_eclash2=$1 iin sadece bir ntanml ynlendirme tanmlanabilir routes_edefault='$1' geerli bir ntanml ynlendirici deil routes_edefault2=Geersiz ntanml a geidi numaras $1 routes_edevice='$1' geerli bir aygt deil routes_egateway='$1' geerli bir a geidi deil routes_emask='$1' geerli bir a maskesi deil routes_enet='$1' geerli bir a deil routes_err=Ynlendirmenin kaydedilmesinde hata olutu routes_etype='$1' geerli bir ynlendirme tipi deil routes_forward=Ynlendirici olarak aktif? routes_gateway=A geiti routes_gw=A Geidi routes_gwmetric=Arayz Metrii routes_iface=Arayz routes_ifc=Arayz routes_local=Yerel ynlendiriciler routes_mask=A maskesi routes_net=A routes_none=Hibiri routes_none2=Yok routes_now=Ynlendirme yaplandrmas imdi aktive edildi routes_possible=Eer olumlu ise routes_routed=Ynlendirici arama program alsn? routes_script=Ek ynlendirme komutlar routes_static=Sabit ynlendiriciler routes_title=Ynlendirme ve A Geitleri routes_type=Tip net/lang/pl0100644000567100000120000001112510656003101012574 0ustar jcameronwheelindex_title=Konfiguracja sieci index_return=konfiguracji sieci ifcs_title=Interfejsy sieciowe ifcs_now=Interfejsy aktywne obecnie ifcs_name=Nazwa ifcs_type=Rodzaj ifcs_ip=Adres IP ifcs_mask=Maska sieci ifcs_status=Stan ifcs_virtual=wirtualny ifcs_up=Podniesiony ifcs_down=Wyczony ifcs_add=Dodaj nowy interfejs ifcs_boot=Interfejsy aktywne podczas startu ifcs_act=Podnie przy starcie? ifcs_bootp=BOOTP ifcs_dhcp=DHCP ifcs_broad=Broadcast ifcs_auto=Automatycznie ifcs_mtu=MTU ifcs_virts=Interfejsy wirtualne ifcs_addvirt=Dodaj interfejs wirtualny ifcs_return=interfejsw sieciowych ifcs_unknown=Nieznany ifcs_ecannot=Nie masz uprawnie do zmiany interfejsw sieciowych aifc_create=Utwrz interfejs aktywny aifc_edit=Zmie interfejs aktywny aifc_desc1=Dane interfejsu aktywnego aifc_desc2=Dane wirtualnego interfejsu aktywnego aifc_hard=Adres sprztowy aifc_default=Domylne aifc_err1=Nie udao si usun interfejsu aifc_err2=Nie udao si zachowa interfejsu aifc_evirt=Brak lub nieprawidowy numer interfejsu wirtualnego aifc_evirtdup=Interfejs wirtualny $1 ju istnieje aifc_edup=Interfejs $1 ju istnieje aifc_ename=Brak lub nieprawidowa nazwa interfejsu aifc_eip='$1' nie jest poprawnym adresem IP aifc_emask='$1' nie jest poprawn mask sieci aifc_ebroad='$1' nie jest poprawnym adresem broadcastu aifc_emtu='$1' nie jest poprawnym MTU aifc_ehard='$1' nie jest poprawnym adresem sprztowym aifc_eexist=Interfejs '$1' nie istnieje bifc_create=Utwrz interfejs startowy bifc_edit=Zmie interfejs startowy bifc_desc1=Dane interfejsu startowego bifc_desc2=Dane wirtualnego interfejsu startowego bifc_apply=Zachowaj i zastosuj bifc_err1=Nie udao si usun interfejsu bifc_err2=Nie udao si zachowa interfejsu bifc_evirt=Brak lub nieprawidowy numer interfejsu wirtualnego bifc_evirtdup=Interfejs wirtualny $1 ju istnieje bifc_edup=Interfejs $1 ju istnieje bifc_ename=Brak lub nieprawidowa nazwa interfejsu bifc_eip='$1' nie jest poprawnym adresem IP bifc_emask='$1' nie jest poprawn mask sieci bifc_ebroad='$1' nie jest poprawnym adresem broadcastu bifc_emtu='$1' nie jest poprawnym MTU bifc_err3=Nie udao si uaktywni interfejsu routes_title=Routing i bramki routes_boot=Konfiguracja routingu przy starcie systemu routes_default=Domylna bramka routes_none=Brak routes_device=Interfejs routes_gateway=Bramka routes_forward=Pracowa jako router? routes_routed=Uruchomi demona obsugi routingu? routes_edefault='$1' nie jest poprawn domyln bramk routes_edevice='$1' nie jest poprawnym urzdzeniem routes_device2=Urzdzenie domylnej bramki routes_static=Routing statyczny routes_ifc=Interfejs routes_net=Sie routes_mask=Maska sieci routes_enet='$1' nie jest poprawn sieci routes_emask='$1' nie jest poprawn mask sieci routes_egateway='$1' nie jest poprawn bramk routes_defaults=Domylne routery routes_possible=Jeli moliwe routes_local=Routing lokalny routes_err=Nie udao si zachowa routingu routes_ecannot=Nie masz uprawnie do zmiany routingu i bramek routes_script=Dodatkowe polecenia routingu dns_title=Klient DNS dns_options=Opcje klienta DNS dns_hostname=Nazwa hosta dns_order=Kolejno rozwizywania nazw dns_servers=Serwery DNS dns_search=Przeszukiwa domeny dns_none=adnej dns_listed=Wymienione .. dns_eorder=Brak kolejnoci rozwizywania nazw dns_ecannot=Nie masz uprawnie do zmiany ustawie klienta DNS dns_err=Nie udao si zachowa konfiguracji DNS dns_ehost='$1' nie jest poprawn nazw hosta dns_ens='$1' nie jest poprawnym adresem IP serwera DNS dns_edomain='$1' nie jest poprawn nazw domeny dns_esearch=Nie podano domen do szukania hosts_title=Adresy hostw hosts_ip=Adres IP hosts_host=Nazwy hosta hosts_add=Dodaj nowy adres hosta hosts_edit=Zmie adres hosta hosts_create=Utwrz adres hosta hosts_detail=Hosty i adresy hosts_return=listy adresw hostw hosts_ecannot=Nie masz uprawnie do zmiany adresw hostw log_create_host=Utworzono host o adresie $1 log_delete_host=Skasowano host o adresie $1 log_modify_host=Zmieniono host o adresie $1 log_dns=Zmieniono opcje klienta DNS log_routes=Zmieniono opcje routingu i bramek log_create_aifc=Aktywowano interfejs $1 o adresie $2 log_modify_aifc=Reaktywowano interfejs $1 o adresie $2 log_delete_aifc=Dezaktywowano interfejs $1 o adresie $2 log_create_bifc=Utworzono interfejs $1 o adresie $2 log_modify_bifc=Zmieniono interfejs $1 o adresie $2 log_delete_bifc=Usunito interfejs $1 o adresie $2 log_dyn=dynamicznie acl_ifcs=Moe zmienia interfejsy sieciowe? acl_routes=Moe zmienia routing i bramki? acl_dns=Moe zmienia ustawienia klienta DNS? acl_hosts=Moe zmienia adresy hostw? acl_view=Tylko podgld net/lang/ru_RU0100664000567100000120000001255310656003101013225 0ustar jcameronwheelifcs_broad= routes_ifc= ifcs_now=, bifc_emask='$1' ifcs_addvirt= aifc_evirt= ifcs_title= ifcs_up= routes_none= ( DHCP) bifc_edup= $1 routes_device2= hosts_return= aifc_ehard='$1' routes_mask= index_return= bifc_evirt= hosts_title= dns_servers= DNS hosts_detail= ifcs_virts= aifc_eip='$1' IP- dns_search= routes_title= bifc_apply= ifcs_return= aifc_ebroad='$1' aifc_ename= aifc_err1= aifc_err2= ifcs_mask= routes_static= ifcs_status= dns_none= routes_default= routes_enet='$1' bifc_ename= ifcs_auto= aifc_evirtdup= $1 bifc_err1= bifc_err2= bifc_err3= routes_boot= , routes_emask='$1' bifc_create= , routes_edefault='$1' hosts_host= ifcs_mtu=MTU routes_defaults= index_title= bifc_evirtdup= $1 routes_net= routes_forward= ? ifcs_bootp= BOOTP hosts_add= dns_order= dns_eorder= dns_title= DNS aifc_desc1= aifc_desc2= ifcs_boot=, aifc_emtu='$1' MTU aifc_edit= ifcs_virtual= routes_device= aifc_default= ifcs_name= routes_local= routes_edevice='$1' ifcs_ip=IP- bifc_desc1= , bifc_desc2= , bifc_eip='$1' IP- routes_gateway= aifc_emask='$1' aifc_eexist= '$1' bifc_emtu='$1' MTU aifc_create= hosts_edit= ifcs_act= ? dns_listed= .. ifcs_add= bifc_edit= , ifcs_dhcp= DHCP ifcs_type= hosts_create= hosts_ip=IP- bifc_ebroad='$1' dns_hostname= dns_options= DNS ifcs_down= aifc_hard= routes_egateway='$1' aifc_edup= $1 routes_possible= dns_ens='$1' IP- log_delete_host= $1 interfaces_ok= ifcs_unknown= log_modify_aifc= $1 $2 log_create_bifc= $1 $2 routes_script= routes_err= acl_ifcs= ? routes_ecannot= log_delete_bifc= $1 $2 dns_esearch= interfaces_clear= log_create_aifc= $1 $2 routes_type= ifcs_ecannot_this= log_dns= DNS acl_routes= ? dns_err= DNS log_delete_aifc= $1 $2 routes_routed= ? log_routes= log_modify_host= $1 ifcs_ecannot= interfaces_cancel= acl_view= interfaces_all= ... acl_ifcs_only= interfaces_sel= bifc_eapply= , DHCP BOOTP acl_hosts= ? routes_etype='$1' log_create_host= $1 acl_dns= DNS? log_modify_bifc= $1 $2 dns_ecannot= DNS interfaces_title1= ... interfaces_title2= ... log_dyn= dns_ehost='$1' hosts_ecannot= bifc_capply= dns_edomain='$1' net/lang/cz0100644000567100000120000000576510656003101012612 0ustar jcameronwheelindex_title=Konfigurace site index_return=sitova konfigurace ifcs_title=Sitove rozhrani ifcs_now=Nyni aktivni rozhrani ifcs_name=Jmeno ifcs_type=Typ ifcs_ip=IP Adresa ifcs_mask=Maska site ifcs_status=Stav ifcs_virtual=Virtualni ifcs_up=Nahoru ifcs_down=Dolu ifcs_add=Pridat nove rozhrani ifcs_boot=Rozhrani, aktivovane pri bootovani ifcs_act=Aktivovat pri bootovani? ifcs_bootp=Z BOOTP ifcs_dhcp=Z DHCP ifcs_broad=Vysilat ifcs_auto=Automaticky ifcs_mtu=MTU ifcs_virts=Virtualni rozhrani ifcs_addvirt=Pridat virtualni rozhrani ifcs_return=Sitova rozhrani aifc_create=Vytvorti aktivni rozhrani aifc_edit=Editovat aktivni rozhrani aifc_desc1=Parametry aktivniho rozhrani aifc_desc2=Parametry aktivniho virtualniho rozhrani aifc_hard=Hardwarova adresa aifc_default=Defaultni aifc_err1=Chyba pri mazani rozhrani aifc_err2=Chyba pri ukladani rozhrani aifc_evirt=Cislo virtualniho rozhrani je spatne nebo chybi aifc_evirtdup=Virtualni rozhrani $1 jiz existuje aifc_edup=Rozhrani $1 jiz existuje aifc_ename=Nazev rozhrani je spatny nebo chybi aifc_eip='$1' neni platnou IP adresou aifc_emask='$1' neni platnou maskou site aifc_ebroad='$1' neni platnou adresou aifc_emtu='$1' neni platnym MTU aifc_ehard='$1' neni platnou hardwarovou adresou aifc_eexist=Rozhrani '$1' neexistuje bifc_create=Vytvorit bootovaci rozhrani bifc_edit=Editovat bootovaci rozhrani bifc_desc1=Boot Time Interface Parameters bifc_desc2=Boot Time Virtual Interface Parameters bifc_apply=Pouzit a ulozit zmeny bifc_err1=Chyba pri mazani rozhrani bifc_err2=Chyba pri ukladani rozhrani bifc_evirt=Cislo virtualniho rozhrani je spatne nebo chybi bifc_evirtdup=Virtualni rozhrani $1 jiz existuje bifc_edup=Rozhrani $1 jiz existuje bifc_ename=Nazev rozhrani je spatne nebo chybi bifc_eip='$1' neni platnou IP adresou bifc_emask='$1' neni platnou maskou site bifc_ebroad='$1' neni platnou adresou bifc_emtu='$1' neni platnym MTU bifc_err3=Chyba pri aktivaci rozhrani routes_title=Routery a Brany routes_boot=Routing configuration activated at boot time routes_default=Defaultni router routes_none=Nic routes_device=Zarizeni routes_gateway=Brana routes_forward=Act as router? routes_routed=Start route discovery daemon? routes_edefault='$1' neni platny defaultni router routes_edevice='$1' neni platne zarizeni routes_device2=Default route device routes_static=Static routes routes_ifc=Rozhrani routes_net=Sit routes_mask=Maska site routes_enet='$1' neni platnou siti routes_emask='$1' neni platnou maskou site routes_egateway='$1' neni platnou branou routes_defaults=Defaultni routery routes_possible=If possible routes_local=Local routes dns_title=DNS klient dns_options=Moznosti DNS klienta dns_hostname=Hostname dns_order=Resolution order dns_servers=DNS servery dns_search=Search domains dns_none=Nic dns_listed=Listed .. dns_eorder=Missing resolution order hosts_title=Host Addresses hosts_ip=IP Adresy hosts_host=Hostnames hosts_add=Pridat novou host adresu hosts_edit=Edit Host Address hosts_create=Create Host Address hosts_detail=Host and Addresses hosts_return=host addresses list net/lang/ja_JP.euc0100664000567100000120000001664410656003101013734 0ustar jcameronwheelacl_apply=ŬѤĤޤ? acl_dns=DNS饤ԽĤޤ? acl_hosts=ۥȥɥ쥹ԽĤޤ? acl_ifcs=ͥåȥ󥿡եԽĤޤ? acl_ifcs_only=Υ󥿡եΤ acl_routes=롼ƥ󥰤ȥȥԽĤޤ? acl_view=ɽΤ aifc_create=ƥ 󥿡ե aifc_default=ǥե aifc_desc1=ƥ 󥿡ե ѥ᡼ aifc_desc2=ƥ ۥ󥿡ե ѥ᡼ aifc_ebroad='$1' ̵ʥ֥ɥ㥹 ɥ쥹Ǥ aifc_edit=ƥ 󥿡եԽ aifc_edup=󥿡ե $1 ϤǤ¸ߤޤ aifc_eexist=󥿡ե '$1' ¸ߤޤ aifc_ehard='$1' ̵ʥϡɥ ɥ쥹Ǥ aifc_eip='$1' ̵ IP ɥ쥹Ǥ aifc_emask='$1' ̵ʥͥåȥޥǤ aifc_emtu='$1' ̵ MTU Ǥ aifc_ename=󥿡ե̾ʤ̵Ǥ aifc_err1=󥿡եǤޤǤ aifc_err2=󥿡ե¸ǤޤǤ aifc_evirt=ۥ󥿡եֹ椬ʤ̵Ǥ aifc_evirtdup=ۥ󥿡ե $1 ϤǤ¸ߤƤޤ aifc_evirtmin=ۥ󥿡եֹ $1 ʾǤʤƤϤʤޤ aifc_hard=ϡɥ ɥ쥹 apply_ecannot=ŬѤ븢¤ޤ bifc_apply=¸Ŭ bifc_capply=Ŭ bifc_create=ư 󥿡ե bifc_dapply=Ŭ bifc_desc1=ư 󥿡ե ѥ᡼ bifc_desc2=ưβۥ󥿡ե ѥ᡼ bifc_eapply=DHCPޤBOOTPѤ륤󥿡եϥƥֲǤޤ bifc_ebroad='$1' ̵ʥ֥ɥ㥹 ɥ쥹Ǥ bifc_edhcpmain=DHCPͥåȥ󥿡եˤΤ߻ѤǤޤ bifc_edit=ư 󥿡եԽ bifc_edup=󥿡ե $1 ϤǤ¸ߤޤ bifc_eip='$1' ̵ IP ɥ쥹Ǥ bifc_emask='$1' ̵ʥͥåȥޥǤ bifc_emtu='$1' ̵ MTU Ǥ bifc_ename=󥿡ե̾ʤ̵Ǥ bifc_err1=󥿡եǤޤǤ bifc_err2=󥿡ե¸ǤޤǤ bifc_err3=󥿡ե򥢥ƥ֤ˤǤޤǤ bifc_err4=󥿡ե󥢥ƥֲ˼Ԥޤ bifc_evirt=ۥ󥿡եֹ椬ʤ̵Ǥ bifc_evirtdup=ۥ󥿡ե $1 ϤǤ¸ߤƤޤ dns_ecannot=DNS饤Խ븢¤ޤ dns_edomain='$1'ͭʥɥᥤ̾ǤϤޤ dns_ehost='$1' ͭʥۥ̾ǤϤޤ dns_ens='$1' ͭʥ͡ॵФIPɥ쥹ǤϤޤ dns_eorder=礬ޤ dns_err=DNS¸˼Ԥޤ dns_esearch=ɥᥤͿƤޤ dns_hostname=ۥ̾ dns_hoststoo=ۥȥɥ쥹ѹ줿 ۥ̾򹹿ޤ? dns_listed=ꥹ.. dns_none=ʤ dns_options=DNS 饤 ץ dns_order= dns_search=ɥᥤθ dns_servers=DNS dns_title=DNS 饤 hosts_add=Υۥ ɥ쥹ɲ hosts_create=ۥ ɥ쥹 hosts_detail=ۥȤȥɥ쥹 hosts_ecannot=ۥȥɥ쥹Խ븢¤ޤ hosts_edit=ۥ ɥ쥹Խ hosts_host=ۥ̾ hosts_ip=IP ɥ쥹 hosts_return=ۥ ɥ쥹 ꥹ hosts_title=ۥ ɥ쥹 ifcs_act=ư˥ƥ֤ˤޤ ifcs_add=Υ󥿡եɲ ifcs_addvirt=ۥ󥿡եɲ ifcs_all=ƤΥ󥿡ե ifcs_auto=ư ifcs_boot=ư˥󥿡ե򥢥ƥ ifcs_bootp=BOOTP ifcs_broad=֥ɥ㥹 ifcs_dhcp=DHCP ifcs_down= ifcs_ecannot=ͥåȥ󥿡եԽ븢¤ޤ ifcs_ecannot_this=Υͥåȥ󥿡եԽ븢¤ޤ ifcs_ip=IP ɥ쥹 ifcs_mask=ͥåȥޥ ifcs_mtu=MTU ifcs_name=ۥ̾ ifcs_now=󥿡ե ƥ ifcs_radd=ɥ쥹ϰ ifcs_range=ϰ $1 ifcs_return=ͥåȥ 󥿡ե ifcs_status=ơ ifcs_title=ͥåȥ 󥿡ե ifcs_type= ifcs_unknown= ifcs_up=ư ifcs_virts=ۥ󥿡ե ifcs_virtual= index_apply=ѹŬѤ index_applydesc=Υܥ򥯥åȡƵưѤ˸ߤεưΥ󥿡եڤӥ롼ƥ򥢥ƥ֤ˤޤ - ϥƥͥåȥ饢ǽˤǽޤWebminǤǽޤ index_return=ͥåȥ index_title=ͥåȥ interfaces_all=ƤΥ󥿡ե... interfaces_cancel=󥻥 interfaces_clear=ꥢ interfaces_ok=OK interfaces_sel=򤷤󥿡ե interfaces_title1=󥿡ե... interfaces_title2=桼... log_create_aifc=󥿡ե $1 ɥ쥹 $2 򥢥ƥ֤ˤޤ log_create_bifc=󥿡ե $1 ɥ쥹 $2 ޤ log_create_host=ۥ ɥ쥹 $1 ޤ log_delete_aifc=󥿡ե $1 ɥ쥹 $2 󥢥ƥ֤ˤޤ log_delete_bifc=󥿡ե $1 ɥ쥹 $2 ޤ log_delete_host=ۥȥɥ쥹 $1 ޤ log_dns=DNS 饤 ץѹޤ log_dyn=ưŪ log_modify_aifc=󥿡ե $1 ɥ쥹 $2 ٥ƥ֤ˤޤ log_modify_bifc=󥿡ե $1 ɥ쥹 $2 ѹޤ log_modify_host=ۥȥɥ쥹 $1 ѹޤ log_routes=롼ƥ󥰤ȥȥ ץ mod_adsl=ADSL PPP ³ mod_desc=$1 󥿡ե$2˻ѤƤ뤿ᡢΥ⥸塼ǤϴǤޤ mod_egone=󥿡եϥƥ֤ǤϤޤ! mod_link=ʤ顢ؤ$2⥸塼 ǴǤޤ mod_ppp=$1ؤPPP륢å³ mod_pptpc=$1ؤPPTP³ mod_pptps=饤$1PPTP³ mod_title=ƥ֥󥿡ե range_create=ɥ쥹ϰϤκ range_ebefore=ɥ쥹ϰϤνλͤϳͤ礭ʤФʤޤ range_eclass=ɥ쥹ϰϤγ͵ڤӽλͤƱ 饹Cͥåȥ°Ƥɬפޤ range_edit=ɥ쥹ϰϤԽ range_eend=λ̵ͤIPɥ쥹Ǥ range_ename=⤷̵ϰ̾Ǥ range_end=λɥ쥹 range_enum=Ϥβۥ󥿡եֹ椬ޤϿʳʸǤ range_err=ɥ쥹ϰϤ¸˼Ԥޤ range_estart=IPɥ쥹̵IPɥ쥹Ǥ range_header=ɥ쥹ϰ 󥿡եץ range_iface=¥󥿡ե range_name=ϰ̾ range_num=ǽβۥ󥿡եֹ range_start=ϥɥ쥹 routes_any= routes_auto=ư routes_boot=롼ƥư˥ƥ֤ˤʤޤ routes_default=ǥե 롼 routes_default2=ǥեȥ롼 routes_defaults=ǥե 롼 routes_device=ǥХ routes_device2=ǥե 롼 ǥХ routes_ecannot=롼ƥ󥰤ȥȥԽ븢¤ޤ routes_eclash=ƤΥ󥿡եФĤΥǥեȥ롼ȤǤޤ routes_eclash2=$1Υǥեȥ롼ȤϰĤǤޤ routes_edefault='$1' ̵ʥǥե 롼Ǥ routes_edefault2=ǥեȥȥɥ쥹 $1 ̵Ǥ routes_edevice='$1' ̵ʥǥХǤ routes_egateway='$1' ̵ʥȥǤ routes_emask='$1' ̵ʥͥåȥޥǤ routes_enet='$1' ̵ʥͥåȥǤ routes_err=롼ƥ󥰤¸ǤޤǤ routes_etype='$1' ͭʥ롼ȥפǤϤޤ routes_forward=롼Ȥưޤ routes_gateway=ȥ routes_gwmetric=󥿡եȥå routes_ifc=󥿡ե routes_local= 롼 routes_mask=ͥåȥޥ routes_net=ͥåȥ routes_none=ʤ routes_none2=̵ routes_now=롼ƥ꤬ͭˤʤޤ routes_possible=ǽʾ routes_routed=롼 ǥХ ǡưޤ routes_script=ɲäΥ롼ƥ󥰥ޥ routes_static=Ū롼 routes_title=롼ƥ󥰤ȥȥ routes_type= net/lang/ko_KR.euc0100664000567100000120000000715510656003101013753 0ustar jcameronwheelindex_title=Ʈũ index_return=Ʈũ ifcs_title=Ʈũ ̽ ifcs_now= Ȱ ̽ ifcs_name≠ ifcs_type= ifcs_ip=IP ּ ifcs_mask=ݸũ ifcs_status= ifcs_virtual= ifcs_up=ø ifcs_down= ifcs_add= ̽ ߰ ifcs_boot= ̽ Ȱȭ ifcs_act= Ȱȭմϱ? ifcs_bootp=BOOTP ifcs_dhcp=DHCP ifcs_broad=εijƮ ifcs_auto=ڵ ifcs_mtu=MTU ifcs_virts= ̽ ifcs_addvirt= ̽ ߰ ifcs_return=Ʈũ ̽ ifcs_unknown= aifc_create=Ȱ ̽ ۼ aifc_edit=Ȱ ̽ aifc_desc1=Ȱ ̽ Ű aifc_desc2=Ȱ ̽ Ű aifc_hard=ϵ ּ aifc_default=⺻ aifc_err1=̽ ߽ϴ aifc_err2=̽ ߽ϴ aifc_evirt=ų ߸ ̽ ȣ aifc_evirtdup= ̽ $1() ̹ ֽϴ aifc_edup=̽ $1() ̹ ֽϴ aifc_ename=ų ߸ ̽ ̸ aifc_eip='$1'() ȿ IP ּҰ ƴմϴ aifc_emask='$1'() ȿ ݸũ ƴմϴ aifc_ebroad='$1'() ȿ εijƮ ּҰ ƴմϴ aifc_emtu='$1'() ȿ MTU ƴմϴ aifc_ehard='$1'() ȿ ϵ ּҰ ƴմϴ aifc_eexist=̽ '$1'() ʽϴ bifc_create=Ʈ ̽ ۼ bifc_edit=Ʈ ̽ bifc_desc1= ̽ Ű bifc_desc2= ̽ Ű bifc_apply= bifc_err1=̽ ߽ϴ bifc_err2=̽ ߽ϴ bifc_evirt=ų ߸ ̽ ȣ bifc_evirtdup= ̽ $1() ̹ ֽϴ bifc_edup=̽ $1() ̹ ֽϴ bifc_ename=ų ߸ ̽ ̸ bifc_eip='$1'() ȿ IP ּҰ ƴմϴ bifc_emask='$1'() ȿ ݸũ ƴմϴ bifc_ebroad='$1'() ȿ εijƮ ּҰ ƴմϴ bifc_emtu='$1'() ȿ MUT ƴմϴ bifc_err3=̽ Ȱȭ ߽ϴ routes_title= Ʈ routes_boot= Ȱȭ routes_default=⺻ routes_none= routes_device=ġ routes_gateway=Ʈ routes_forward=ͷ մϱ? routes_routed=Ʈ ˻ մϱ? routes_edefault='$1'() ȿ ⺻ Ͱ ƴմϴ routes_edevice='$1'() ȿ ġ ƴմϴ routes_device2=⺻ Ʈ ġ routes_static= Ʈ routes_ifc=̽ routes_net=Ʈũ routes_mask=ݸũ routes_enet='$1'() ȿ Ʈũ ƴմϴ routes_emask='$1'() ȿ ݸũ ƴմϴ routes_egateway='$1'() ȿ Ʈ̰ ƴմϴ routes_defaults=⺻ routes_possible= routes_local= Ʈ routes_err= ߽ϴ dns_title=DNS Ŭ̾Ʈ dns_options=DNS Ŭ̾Ʈ ɼ dns_hostname=ȣƮ ̸ dns_order=ȸ dns_servers=DNS dns_search= ˻ dns_none= dns_listed= ׸.. dns_eorder=ȸ hosts_title=ȣƮ ּ hosts_ip=IP ּ hosts_host=ȣƮ ̸ hosts_add= ȣƮ ּ ߰ hosts_edit=ȣƮ ּ hosts_create=ȣƮ ּ ۼ hosts_detail=ȣƮ ּ hosts_return=ȣƮ ּ log_create_host=ȣƮ ּ $1 ۼ log_delete_host=ȣƮ ּ $1 log_modify_host=ȣƮ ּ $1 log_dns=DNS Ŭ̾Ʈ ɼ log_routes= Ʈ ɼ log_create_aifc=̽ $1 ּ $2 Ȱȭ log_modify_aifc=̽ $1 ּ $2 ٽ Ȱȭ log_delete_aifc=̽ $1 ּ $2 Ȱȭ log_create_bifc=̽ $1 ּ $2 ۼ log_modify_bifc=̽ $1 ּ $2 log_delete_bifc=̽ $1 ּ $2 log_dyn= net/lang/ca0100644000567100000120000002467110656003101012556 0ustar jcameronwheelindex_title=Configuraci de Xarxa index_return=a la configuraci de xarxa index_apply=Aplica la Configuraci index_applydesc=Fes clic sobre aquest bot per activar la interfcie actual i els valors d'encaminament, tal com ho farien desprs de reengegar el sistema. Atenci - aix pot fer el sistema inaccessible a travs de xarxa i tallar l'accs a Webmin. index_delete1=Desactiva les Interfcies Seleccionades index_delete2=Suprimeix les Interfcies Seleccionades index_delete3=Suprimeix i Aplica les Interfcies Seleccionades index_apply2=Aplica les Interfcies Seleccionades ifcs_title=Interfcies de Xarxa ifcs_now=Interfcies Actives ifcs_name=Nom ifcs_type=Tipus ifcs_ip=Adrea IP ifcs_mask=Mscara de subxarxa ifcs_status=Estat ifcs_virtual=Virtual ifcs_up=Activa ifcs_down=Inactiva ifcs_add=Afegeix una nova interfcie. ifcs_radd=Afegeix un nou rang d'adreces. ifcs_boot=Interfcies Activades en Engegar ifcs_act=Activa en engegar ifcs_bootp=Des de BOOTP ifcs_dhcp=Des de DHCP ifcs_broad=Retransmissi ifcs_auto=Automtica ifcs_mtu=MTU ifcs_virts=Interfcies virtuals ifcs_addvirt=Afegeix interfcie virtual ifcs_return=a les interfcies de xarxa ifcs_unknown=Desconeguda ifcs_all=Totes les interfcies ifcs_ecannot=No tens perms per editar interfcies de xarxa ifcs_ecannot_this=No tens perms per editar aquesta interfcie de xarxa ifcs_range=Rang $1 ifcs_static=Esttica aifc_create=Creaci d'Interfcie Activa aifc_edit=Edici d'Interfcie Activa aifc_desc1=Parmetres d'Interfcie Activa aifc_desc2=Parmetres d'Interfcie Virtual Activa aifc_hard=Adrea del maquinari aifc_default=Defecte aifc_err1=No he pogut suprimir la interfcie aifc_err2=No he pogut desar la interfcie aifc_evirt=Hi falta el nmero d'interfcie o b s invlid aifc_evirtmin=El nmero de la interfcie virtual ha de ser almenys $1 aifc_evirtdup=La interfcie virtual $1 ja existeix aifc_edup=La interfcie $1 ja existeix aifc_ename=Hi falta el nom de la interfcie o b s invlid aifc_eip='$1' no s una adrea IP vlida aifc_emask='$1' no s una mscara de xarxa vlida aifc_ebroad='$1' no s una adrea de retransmissi vlida aifc_emtu='$1' no s un MTU vlid aifc_ehard='$1' no s una adrea de maquinari vlida aifc_eexist=La interfcie '$1' no existeix aifc_eclash=La interfcie $1 ja est utilitzant aquesta adrea IP bifc_create=Creaci d'Interfcie d'Engegada bifc_edit=Edici d'Interfcie d'Engegada bifc_desc1=Parmetres d'Engegada de la Interfcie bifc_desc2=Parmetres d'Engegada de la Interfcie Virtual bifc_apply=Desa i Aplica bifc_dapply=Suprimeix i Aplica bifc_err1=No he pogut suprimir la interfcie bifc_err2=No he pogut desar la interfcie bifc_evirt=Hi falta el nmero de la interfcie o b s invlid bifc_evirtdup=La interfcie virtual $1 ja existeix bifc_edup=La interfcie $1 ja existeix bifc_ename=Hi falta el nom de la interfcie o b s invlid bifc_eip='$1' no s una adrea IP vlida bifc_emask='$1' no s una mscara de xarxa vlida bifc_ebroad='$1' no s una adrea de retransmissi vlida bifc_emtu='$1' no s un MTU vlid bifc_err3=No he pogut activar la interfcie bifc_err4=No he pogut desactivar la interfcie bifc_capply=Crea i Aplica bifc_eapply=No pots activar una interfcie que utilitza DHCP o BOOTP bifc_edhcpmain=DHCP noms es pot activar a la interfcie primria de xarxa routes_title=Encaminament i Portals routes_boot=Configuraci de l'encaminament activada en engegar routes_now=La configuraci de rutes ara est activada routes_default=Encaminador per defecte routes_default2=Rutes per defecte routes_none=Cap (o des de DHCP) routes_device=Dispositiu routes_gateway=Portal routes_forward=Actua com un encaminador routes_routed=Inicia el dimoni descobridor de rutes routes_edefault='$1' no s un encaminador per defecte vlid routes_edevice='$1' no s un dispositiu vlid routes_device2=Dispositiu encaminador per defecte routes_static=Rutes esttiques routes_ifc=Interfcie routes_net=Xarxa routes_mask=Mscara routes_type=Tipus routes_enet='$1' no s una xarxa vlida routes_emask='$1' no s una mscara de xarxa vlida routes_egateway='$1' no s un portal vlid routes_defaults=Encaminadors per defecte routes_possible=Si s possible routes_local=Rutes locals routes_err=No he pogut desar l'encaminament routes_ecannot=No tens perms per editar l'encaminament i els portals routes_script=Ordres d'encaminament addicionals routes_etype='$1' no s un tipus de ruta vlid routes_any=Qualsevol routes_edefault2=El nmero $1 d'adrea de portal per defecte s invlid routes_eclash=Noms es pot definir una ruta per defecte per interfcie routes_eclash2=Noms es pot definir una ruta per defecte per a $1 routes_none2=Cap routes_auto=Automtic routes_gwmetric=Mtrica de la Interfcie routes_dest=Destinaci routes_gw=Portal routes_iface=Interfcie routes_def=Ruta per Defecte routes_active=Rutes Actives routes_nogw=Cap routes_delete=Suprimeix les Rutes Seleccionades routes_cheader=Crea una ruta activa routes_cdest=Destinaci de la ruta routes_cdef=Ruta per defecte routes_cnetmask=Mscara de xarxa de la destinaci routes_cvia=Encarrila a travs de routes_ciface=La interfcie de xarxa $1 routes_cgw=El portal $1 routes_cerr=No he pogut crear la ruta activa routes_ecdest=Hi falta l'adrea IP o xarxa de destinaci o b s invlida routes_ecnetmask=Hi falta la mscara de xarxa o b s invlida routes_ecgw=Hi falta l'adrea del portal o b s invlida routes_derr=No he pogut suprimir les rutes routes_denone=No has seleccionat cap ruta routes_ecnetmask2=No es pot especificar una mscara de xarxa com a ruta per defecte dns_title=Nom de Host i Client DNS dns_options=Opcions de Client DNS dns_hostname=Nom de Host dns_order=Ordre de Resoluci dns_servers=Servidors DNS dns_search=Dominis de Recerca dns_none=Cap dns_listed=Llistats... dns_eorder=Hi falta l'ordre de resoluci dns_ecannot=No tens perms per editar els valors dels clients DNS dns_err=No he pogut desar la configuraci DNS dns_ehost='$1' no s un nom de host vlid dns_ens='$1' no s una adrea IP del servidor de noms vlida dns_edomain='$1' no s un nom de domini vlid dns_esearch=No has donat cap domini per buscar dns_hoststoo=Actualitza el nom de host a les adreces del host si es canvia dns_dhcp=El nom de host s establert pel servidor DHCP hosts_title=Adreces de Hosts hosts_ip=Adrea IP hosts_host=Noms de host hosts_add=Afegeix una nova adrea de host. hosts_edit=Edita Adrea de Host hosts_create=Crea Adrea de Host hosts_detail=Host i Adreces hosts_return=a la llista d'adreces de hosts hosts_ecannot=No tens perms per editar les adreces dels hosts hosts_delete=Suprimeix les Adreces de Host Seleccionades ipnodes_title=Adreces de Host IPv6 ipnodes_ip=Adrea IPv6 ipnodes_host=Noms de host ipnodes_add=Afegeix una nova adrea de host IPv6 ipnodes_edit=Edita una Adrea de Host IPv6 ipnodes_create=Crea una Adrea de Host IPv6 ipnodes_detail=Host i Adreces ipnodes_return=a la llista d'adreces de host IPv6 ipnodes_ecannot=No tens perms per editar adreces de host IPv6 log_create_host=He creat l'adrea de host $1 log_delete_host=He suprimit l'adrea de host $1 log_modify_host=He modificat l'adrea de host $1 log_create_ipnode=He creat l'adrea de host IPv6 $1 log_delete_ipnode=He suprimit l'adrea de host IPv6 $1 log_modify_ipnode=He modificat l'adrea de host IPv6 $1 log_dns=He canviat les opcions del client DNS log_routes=He canviat les opcions d'encaminament i portals log_create_aifc=He activat la interfcie $1 adrea $2 log_modify_aifc=He reactivat la interfcie $1 adrea $2 log_delete_aifc=He desactivat la interfcie $1 adrea $2 log_create_bifc=He creat la interfcie $1 adrea $2 log_modify_bifc=He modificat la interfcie $1 adrea $2 log_delete_bifc=He suprimit la interfcie $1 adrea $2 log_dyn=dinmic log_delete_hosts=He suprimit $1 adreces de host log_delete_afics=Suprimint $1 interfcies actives log_delete_bfics=Suprimint $1 interfcies de temps d'engegada log_apply_bfics=He activat $1 interfcies en temps d'engegada log_create_route=He creat la ruta activa de $1 log_create_defroute=He creat la ruta activa per defecte log_delete_routes=He suprimit $1 rutes actives acl_ifcs=Pot editar interfcies de xarxa acl_routes=Pot editar l'encaminament i els portals acl_dns=Pot editar els valors del client DNS acl_hosts=Pot editar les adreces dels hosts acl_view=Noms veure acl_ifcs_only=Noms les interfcies acl_ifcs_ex=Totes les interfcies excepte acl_apply=Pot aplicar la configuraci acl_bootonly=Pot editar interfcies actives acl_netmask=Pot editar la mscara de subxarxa acl_broadcast=Pot editar l'adrea de retransmissi acl_mtu=Pot editar el MTU acl_up=Pot editar l'estat actiu acl_virt=Pot afegir interfcies virtuals acl_delete=Pot suprimir interfcies acl_hide=Amaga les interfcies no editables interfaces_title1=Tria les interfcies... interfaces_all=Totes les Interfcies... interfaces_sel=Interfcies seleccionades interfaces_ok=B interfaces_cancel=Cancella interfaces_clear=Neteja interfaces_title2=Selecciona l'Usuari... apply_ecannot=No tens perms per aplicar la configuraci mod_egone=La interfcie ja no est activa! mod_title=Interfcie Activa mod_desc=La interfcie $1 s'est emprant per a $2, i per tant no es pot gestionar fent servir aquest mdul. mod_link=No obstant, en lloc d'aix, pots fer servir el mdul $2 per gestionar-la. mod_ppp=una connexi manual PPP a $1 mod_adsl=una connexi PPP ADSL mod_pptps=una connexi PPTP des del client $1 mod_pptpc=la connexi PPTP $1 mod_zones=una interfcie virtual per a la zona $1 mod_virtualmin=al servidor Virtualmin $1 mod_reseller=el revenedor de Virtualmin $1 range_edit=Edita el Rang d'Adreces range_create=Crea un Rang d'Adreces range_header=Opcions del rang d'adreces de la interfcie range_start=Adrea inicial range_end=Adrea final range_num=N de la primera interfcie virtual range_iface=Interfcie real range_name=Nom del rang range_err=No he pogut desar el rang d'adreces range_ename=Hi falta el nom del rang o b s invlid range_estart=Hi falta l'adrea IP inicial o b s invlida range_eend=Hi falta l'adrea IP final o b s invlida range_enum=Hi falta el nmero de la primera interfcie virtual o b no s numric range_eclass=Les adreces inicial i final han d'estar dins de la mateixa xarxa de classe C range_ebefore=L'adrea final ha de ser ms gran que l'adrea inicial chooser_any=<Qualsevol> chooser_other=Altres... dafics_err=No he pogut desactivar les interfcies daifcs_enone=No has seleccionat cap interfcie daifcs_egone=La interfcie ja no existeix! dbifcs_err=No he pogut suprimir les interfcies dbifcs_err2=No he pogut activar les interfcies net/lang/it0100664000567100000120000001212410656003101012577 0ustar jcameronwheelindex_title=Configurazione Rete index_return=configurazione rete ifcs_title=Interfacce di Rete ifcs_now=Interfacce Attive Adesso ifcs_name=Nome ifcs_type=Tipo ifcs_ip=Indirizzo IP ifcs_mask=Netmask ifcs_status=Stato ifcs_virtual=Virtuale ifcs_up=Su ifcs_down=Gi ifcs_add=Aggiungi una nuova interfaccia ifcs_boot=Interfacce attive all'avvio ifcs_act=Attiva all'avvio? ifcs_bootp=Da BOOTP ifcs_dhcp=Da DHCP ifcs_broad=Broadcast ifcs_auto=Automatico ifcs_mtu=MTU ifcs_virts=Interfacce virtuali ifcs_addvirt=Aggiungi interfaccia virtuale ifcs_return=interfacce di rete ifcs_unknown=Sconosciuto ifcs_ecannot=Non sei autorizzato a modificare le interfacce di rete ifcs_ecannot_this=Non sei autorizzato a modificare questa interfaccia di rete aifc_create=Crea Interfaccia Attiva aifc_edit=Modifica Interfaccia Attiva aifc_desc1=Parametri Interfacca Attiva aifc_desc2=Parametri Interfaccia Virtuale Attiva aifc_hard=Indirizzo Hardware aifc_default=Default aifc_err1=Errore nella cancellazione dell'interfaccia aifc_err2=Errore nes salvataggio dell'interfaccia aifc_evirt=Numero dell'interfaccia virtuale mancante o errato aifc_evirtdup=L'interfaccia virtuale $1 gi esistente aifc_edup=L'interfaccia $1 gi esistente aifc_ename=Nome dell'interfaccia mancante o invalido aifc_eip='$1' non un indirizzo IP valido aifc_emask='$1' non una netmask valida aifc_ebroad='$1' non un indirizzo di broadcast valido aifc_emtu='$1' non un MTU valido aifc_ehard='$1' non un indirizzo hardware valido aifc_eexist=L'interfaccia '$1' non esiste bifc_create=Creazione Interfaccia bifc_edit=Modifica Interfaccia bifc_desc1=Parametri dell'interfaccia all'avvio bifc_desc2=Parametri dell'interfaccia virtuale all'avvio bifc_apply=Salva e Applica bifc_err1=Errore nella cancellazione dell'interfaccia bifc_err2=Errore nel salvataggio dell'interfaccia bifc_evirt=Numero dell'interfaccia virtuale mancante o errato bifc_evirtdup=L'interfaccia virtuale $1 gi esistente bifc_edup=L'interfaccia $1 gi esistente bifc_ename=Nome dell'interfaccia mancante o invalido bifc_eip='$1' non un indirizzo IP valido bifc_emask='$1' non una netmask valida bifc_ebroad='$1' non un indirizzo di broadcast valido bifc_emtu='$1' non un MTU valido bifc_err3=Errore attivando l'interfaccia bifc_capply=Crea e Appllica bifc_eapply=Non puoi attivare un'interfaccia che usa DHCP o BOOTP routes_title=Routing e Gateways routes_boot=Configurazione Routing attivata all'avvio routes_default=Router di default routes_none=Nessuno (o da DHCP) routes_device=Interfaccia routes_gateway=Gateway routes_forward=Router? routes_routed=Avvio il route discovery daemon? routes_edefault='$1' non un default router valido routes_edevice='$1' non una interfaccia valida routes_device2=Interfaccia della default route routes_static=Route statiche routes_ifc=Interfaccia routes_net=Rete routes_mask=Netmask routes_type=Tipo routes_enet='$1' non una rete valida routes_emask='$1' non una netmask valida routes_egateway='$1' non un gateway valido routes_defaults=Default routers routes_possible=Se possibile routes_local=Route locali routes_err=Errore salvando le informazioni di routing routes_ecannot=Non sei autorizzato a modificare i routing e gateways routes_script=Comandi di routing addizionali routes_etype='$1' non un tipo di routing valido dns_title=DNS Client dns_options=DNS Client Options dns_hostname=Hostname dns_order=Resolution order dns_servers=DNS servers dns_search=Search domains dns_none=None dns_listed=Listed .. dns_eorder=Missing resolution order dns_ecannot=You are not allowed to edit DNS client settings dns_err=Failed to save DNS configuration dns_ehost='$1' is not a valid hostname dns_ens='$1' is not a valid nameserver IP address dns_edomain='$1' is not a valid domain name dns_esearch=No domains to search given hosts_title=Host Addresses hosts_ip=IP Address hosts_host=Hostnames hosts_add=Add a new host address hosts_edit=Edit Host Address hosts_create=Create Host Address hosts_detail=Host and Addresses hosts_return=host addresses list hosts_ecannot=You are not allowed to edit host addresses log_create_host=Created host address $1 log_delete_host=Deleted host address $1 log_modify_host=Modified host address $1 log_dns=Changed DNS client options log_routes=Changed routing and gateways options log_create_aifc=Activated interface $1 address $2 log_modify_aifc=Reactivated interface $1 address $2 log_delete_aifc=Deactivated interface $1 address $2 log_create_bifc=Created interface $1 address $2 log_modify_bifc=Modified interface $1 address $2 log_delete_bifc=Deleted interface $1 address $2 log_dyn=dynamic acl_ifcs=Can edit network interfaces? acl_routes=Can edit routing and gateways? acl_dns=Can edit DNS client settings? acl_hosts=Can edit host addresses? acl_view=View only acl_ifcs_only=Only interfaces interfaces_title1=Scegli le interfacce... interfaces_all=Tutte le interfacce... interfaces_sel=Interfacce selezionate interfaces_ok=OK interfaces_cancel=Cancella interfaces_clear=Azzera interfaces_title2=Seleziona Utente... net/lang/ru_SU0100644000567100000120000001256510656003101013227 0ustar jcameronwheelindex_title= index_return= ifcs_title= ifcs_now=, ifcs_name= ifcs_type= ifcs_ip=IP- ifcs_mask= ifcs_status= ifcs_virtual= ifcs_up= ifcs_down= ifcs_add= ifcs_boot=, ifcs_act= ? ifcs_bootp= BOOTP ifcs_dhcp= DHCP ifcs_broad= ifcs_auto= ifcs_mtu=MTU ifcs_virts= ifcs_addvirt= ifcs_return= ifcs_unknown= ifcs_ecannot= ifcs_ecannot_this= aifc_create= aifc_edit= aifc_desc1= aifc_desc2= aifc_hard= aifc_default= aifc_err1= aifc_err2= aifc_evirt= aifc_evirtdup= $1 aifc_edup= $1 aifc_ename= aifc_eip='$1' IP- aifc_emask='$1' aifc_ebroad='$1' aifc_emtu='$1' MTU aifc_ehard='$1' aifc_eexist= '$1' bifc_create= , bifc_edit= , bifc_desc1= , bifc_desc2= , bifc_apply= bifc_err1= bifc_err2= bifc_evirt= bifc_evirtdup= $1 bifc_edup= $1 bifc_ename= bifc_eip='$1' IP- bifc_emask='$1' bifc_ebroad='$1' bifc_emtu='$1' MTU bifc_err3= bifc_capply= bifc_eapply= , DHCP BOOTP routes_title= routes_boot= , routes_default= routes_none= ( DHCP) routes_device= routes_gateway= routes_forward= ? routes_routed= ? routes_edefault='$1' routes_edevice='$1' routes_device2= routes_static= routes_ifc= routes_net= routes_mask= routes_type= routes_enet='$1' routes_emask='$1' routes_egateway='$1' routes_defaults= routes_possible= routes_local= routes_err= routes_ecannot= routes_script= routes_etype='$1' dns_title= DNS dns_options= DNS dns_hostname= dns_order= dns_servers= DNS dns_search= dns_none= dns_listed= .. dns_eorder= dns_ecannot= DNS dns_err= DNS dns_ehost='$1' dns_ens='$1' IP- dns_edomain='$1' dns_esearch= hosts_title= hosts_ip=IP- hosts_host= hosts_add= hosts_edit= hosts_create= hosts_detail= hosts_return= hosts_ecannot= log_create_host= $1 log_delete_host= $1 log_modify_host= $1 log_dns= DNS log_routes= log_create_aifc= $1 $2 log_modify_aifc= $1 $2 log_delete_aifc= $1 $2 log_create_bifc= $1 $2 log_modify_bifc= $1 $2 log_delete_bifc= $1 $2 log_dyn= acl_ifcs= ? acl_routes= ? acl_dns= DNS? acl_hosts= ? acl_view= acl_ifcs_only= interfaces_title1= ... interfaces_all= ... interfaces_sel= interfaces_ok= interfaces_cancel= interfaces_clear= interfaces_title2= ... net/lang/fa0100644000567100000120000002646110656003101012560 0ustar jcameronwheel index_title=پيکربندي شبکه index_return=پيکربندي شبکه index_apply=به کاربستن پيکربندي index_applydesc=براي فعال شدن تنظيمات مسيريابي و واسط زمان راه‌اندازي جاري اين دگمه را فشار دهيد، مانند اجراي معمولي آن پس از يک بازآغازي خواهد بود. اخطارممکن است سيستم شما را از طريق شبکه غيرقابل دسترس نموده و ارتباط با وب‌مين را قطع نمايد. ifcs_title=واسطهاي شبکه ifcs_now=واسطهاي فعال کنوني ifcs_name=نام ifcs_type=نوع ifcs_ip=نشاني IP ifcs_mask=نقابي شبکه ifcs_status=وضعيت IFCS_VIRTUAL=مجازي ifcs_up=فعال(بالا) ifcs_down=از کار افتاده ifcs_add=.اضافه کردن يک واسط جديد ifcs_radd=.اضافه کردن يک گستره جديد ifcs_boot=واسطهايي که در زمان راه‌اندازي فعال شدند ifcs_act=آيا به هنگام راه‌اندازي فعال شود؟ ifcs_bootp=از BOOTP ifcs_dhcp=از DHCP ifcs_broad=نشاني انتشار ifcs_auto=خودکار ifcs_mtu=MTU ifcs_virts=واسطهاي مجازي ifcs_addvirt=اضافه کردن واسط مجازي ifcs_return=واسطهاي شبکه ifcs_unknown=ناشناخته ifcs_all=همه واسطها ifcs_ecannot=شما مجاز به ويرايش واسطهاي شبکه نيستيد ifcs_ecannot_this=شما مجاز به ويرايش اين واسط شبکه نيستيد ifcs_range=گستره $1 ifcs_static=ايستا aifc_create=ايجاد واسط فعال aifc_edit=ويرايش کردن واسط فعال aifc_desc1=پارامترهاي واسط فعال aifc_desc2=پارامترهاي واسط مجازي فعال aifc_hard=نشاني سخت افزار aifc_default=پيش‌گزيده aifc_err1=عدم موفقيت در حذف کردن واسط aifc_err2=عدم موفقيت در حفظ کردن واسط aifc_evirt=شماره واسط مجازي نامعتبر است و يا يافت نشد aifc_evirtmin=شماره واسط مجازي حداقل بايد $1 باشد aifc_evirtdup=واسط مجازي $1 از قبل وجود دارد aifc_edup=واسط $1 از قبل وجود دارد aifc_ename=نام واسط نامعتبر است و يا يافت نشد aifc_eip='$1'نشاني IP معتبري نيست aifc_emask='$1'نقابي شبکه معتبري نيست aifc_ebroad='$1' نشاني انتشار معتبري نيست aifc_emtu='$1' MTU معتبري نيست aifc_ehard='$1' نشاني سخت افزار معتبري نيست aifc_eexist=واسط '$1' وجود ندارد aifc_eclash=واسط $1 از اين نشاني IP استفاده مي‌نمايد bifc_create=ايجاد واسط زمان راه‌اندازي bifc_edit=ويرايش کردن واسط زمان راه‌اندازي bifc_desc1=پارامترهاي واسط زمان راه‌اندازي bifc_desc2=پارامترهاي واسط مجازي زمان راه‌اندازي bifc_apply=حفظ و به کاربستن bifc_dapply=حذف و به کاربستن bifc_err1=عدم موفقيت در حذف کردن واسط bifc_err2=عدم موفقيت در حفظ کردن واسط bifc_evirt=شماره واسط مجازي نامعتبر است و يا يافت نشد bifc_evirtdup=واسط مجازي $1 از قبل وجود دارد bifc_edup=واسط $1 از قبل وجود دارد bifc_ename=نام واسط نامعتبر است و يا يافت نشد bifc_eip='$1'نشاني IP معتبري نيست bifc_emask='$1'نقابي شبکه معتبري نيست bifc_ebroad='$1' نشاني انتشار معتبري نيست bifc_emtu='$1' MTU معتبري نيست bifc_err3=عدم موفقيت در فعال کردن واسط bifc_err4=عدم موفقيت در غيرفعال کردن واسط bifc_capply=ايجاد و به کاربستن bifc_eapply=شما نمي‌توانيد واسطي را که از DHCP يا BOOTP استفاده مي‌کند، فعال کنيد. bifc_edhcpmain=DHCP تنها مي‌تواند بر روي واسط شبکه اصلي فعال باشد routes_title=مسيريابي و دروازه routes_boot=پيکربندي مسيريابي درزمان راه‌اندازي فعال شد routes_now=پيکربندي مسيريابي فعال شد routes_default=مسيرياب پيش‌گزيده routes_default2=مسيرهاي پيش‌گزيده routes_none=هيچ کدام (يا از DHCP) routes_device=دستگاه routes_gateway=دروازه ارتباطي routes_forward=آيا مانند يک مسيرياب عمل نمايد؟ routes_routed=آيا شبح کشف مسير آغاز شود؟ routes_edefault='$1'مسيرياب پيش‌گزيده معتبري نيست routes_edevice='$1'دستگاه معتبري نيست routes_device2=دستگاه مسير پيش‌گزيده routes_static=مسيرهاي ايستا routes_ifc=واسط routes_net=شبکه routes_mask=نقابي شبکه routes_type=نوع routes_enet='$1'شبکه معتبري نيست routes_emask='$1'نقابي شبکه معتبري نيست routes_egateway='$1'دروازه ارتباطي معتبري نيست routes_defaults=مسيريابهاي پيش‌گزيده routes_possible=درصورت امکان routes_local=مسيرهاي محلي routes_err=عدم موفقيت در حفظ مسيريابي routes_ecannot=شما مجاز به ويرايش مسيريابي و دروازه‌ها نيستيد routes_script=فرمانات اضافي مسيريابي routes_etype='$1'نوع مسير معتبري نيست routes_any=هر routes_edefault2=شماره نشاني دروازه ارتباطي پيش‌گزيده $1 نامعتبر است routes_eclash=براي هر واسط تنها يک مسير پيش‌گزيده مي‌توان تعريف کرد routes_eclash2=براي $1 تنها يک مسير پيش‌گزيده مي‌توان تعريف کرد routes_none2=هيچ کدام routes_auto=خودکار routes_gwmetric=واسط Metric routes_dest=مقصد routes_gw=دروازه ارتباطي routes_iface=واسط routes_def=مسير پيش‌گزيده routes_active=مسيرهاي فعال routes_nogw=هيچ کدام dns_title=کارخواه DNS dns_options=گزينه‌هاي کارخواه DNS dns_hostname=نام ميزبان dns_order=ترتيب تفکيک پذيري dns_servers=کارساز‌هاي DNS dns_search=جستجوي دامنه‌ها dns_none=هيچ کدام dns_listed=فهرست شده .. dns_eorder=ترتيب تفکيک پذيري يافت نشد dns_ecannot=شما مجاز به ويرايش تنظيمات کارخواه DNS نيستيد dns_err=عدم موفقيت در حفظ پيکربندي DNS dns_ehost='$1'نام ميزبان معتبري نيست dns_ens='$1'نشاني IP کارساز نام معتبري نيست dns_edomain='$1'نام دامنه معتبري نيست dns_esearch=دامنه‌اي جهت جستجو تعيين نشده‌است dns_hoststoo=آيا نام ميزبان به هنگام تغيير نشاني ميزبان به‌روز شود؟ hosts_title=نشاني ميزبانها hosts_ip=نشاني IP hosts_host=نام ميزبانها hosts_add=اضافه کردن يک نشاني ميزبان جديد hosts_edit=ويرايش کردن نشاني ميزبان hosts_create=ايجاد کردن نشاني ميزبان hosts_detail=ميزبان و نشانيها hosts_return=فهرست نشانيهاي ميزبان hosts_ecannot=شما مجاز به ويرايش نشانيهاي ميزبان نيستيد log_create_host=نشاني ميزبان $1 ايجاد شد log_delete_host=نشاني ميزبان $1 حذف شد log_modify_host=نشاني ميزبان $1 تغيير کرد log_dns=گزينه‌هاي کارخواه DNS تغيير کرد log_routes=گزينه‌هاي مسيريابي و دروازه ارتباطي تغيير کرد log_create_aifc=واسط $1 با نشاني $2 فعال شد log_modify_aifc=واسط $1 با نشاني $2 دوباره فعال شد log_delete_aifc=واسط $1 با نشاني $2 غيرفعال شد log_create_bifc=واسط $1 با نشاني $2 ايجاد شد log_modify_bifc=واسط $1 با نشاني$2 تغيير کرد log_delete_bifc=واسط $1 با نشاني $2 حذف شد log_dyn=پويا acl_ifcs=آيا مي‌خواهيد واسطهاي شبکه را ويرايش کنيد؟ acl_routes=آيا مي‌خواهيد مسيريابي و دروازه‌هاي ارتباطي را ويرايش کنيد؟ acl_dns=آيا مي‌خواهيد تنظيمات کارخواه DNS را ويرايش کنيد؟ acl_hosts=آيا مي‌خواهيد نشانيهاي ميزبان را ويرايش کنيد؟ acl_view=فقط نما acl_ifcs_only=فقط واسط (ها) acl_ifcs_ex=بجز واسط (ها) acl_apply=آيا مي‌خواهيد پيکربندي را اعمال کنيد؟ acl_bootonly=آيا مي‌خواهيد واسطهاي فعال را ويرايش کنيد؟ acl_netmask=آيا مي‌خواهيد نقابي شبکه را ويرايش کنيد؟ acl_broadcast=آيا مي‌خواهيد نشاني انتشار را ويرايش کنيد؟ acl_mtu=آيا مي‌خواهيد MTU را ويرايش کنيد؟ acl_up=آيا مي‌خواهيد وضعيت فعال را ويرايش کنيد؟ acl_virt=آيا مي‌خواهيد واسطهاي مجازي را اضافه کنيد؟ acl_delete=آيا مي‌خواهيد واسطها را حذف کنيد؟ acl_hide=آيا واسطهاي غيرقابل ويرايش پنهان شوند؟ interfaces_title1=انتخاب واسطها ... interfaces_all=همه واسطها ... interfaces_sel=واسطهاي انتخاب شده interfaces_ok=تائيد interfaces_cancel=لغو interfaces_clear=پاک کردن interfaces_title2=انتخاب کاربر ... apply_ecannot=شما مجاز به به کاربستن پيکربندي نيستيد mod_egone=واسط فعال نيست! mod_title=واسط فعال mod_desc=واسط $1 براي $2 استفاده مي‌شود، پس قادر به نظارت بر استفاده از اين پيمانه نيست. mod_link=هر چند شما مي‌توانيد از پيمانه$2 براي مديريت آن استفاده کنيد. mod_ppp=يک ارتباط تلفني با $1 mod_adsl=يک ارتباط ADSL PPP mod_pptps=يک ارتباط PPTP از کارخواه $1 mod_pptpc=ارتباط PPTP $1 mod_zones=يک واسط مجازي براي منطقه$1 range_edit=ويرايش کردن گستره نشاني range_create=ايجاد گستره نشاني range_header=اختيارات واسط گستره نشاني range_start=نشاني آغاز range_end=نشاني پايان range_num=شماره اولين واسط مجازي range_iface=واسط حقيقي range_name=نام گستره range_err=عدم موفقيت در حفظ کردن گستره نشاني range_ename=نام گستره نامعتبر است و يا يافت نشد range_estart=نشاني IP آغاز نامعتبر است و يا يافت نشد range_eend=نشاني IP پايان نامعتبر است و يا يافت نشد range_enum=شماره اولين واسط مجازي يافت نشد و يا غير عددي است range_eclass=نشانيهاي آغاز و پايان بايد در کلاس يکساني از شبکه نوع C باشند range_ebefore=نشاني پايان بايد از نشاني آغاز بزرگ‌تر باشد chooser_any=<هر> chooser_other=ديگر.. net/lang/uk_UA0100664000567100000120000001260310656003101013171 0ustar jcameronwheelifcs_broad= routes_ifc= ifcs_now=, bifc_emask='$1' ifcs_addvirt= aifc_evirt= ifcs_title= ifcs_up= routes_none= ( DHCP) bifc_edup= $1 routes_device2= hosts_return= aifc_ehard='$1' routes_mask= index_return= bifc_evirt= hosts_title= dns_servers= DNS hosts_detail= ifcs_virts=³ aifc_eip='$1' IP- dns_search= routes_title= bifc_apply= ifcs_return= aifc_ebroad='$1' aifc_ename=' aifc_err1= aifc_err2= ifcs_mask= routes_static= ifcs_status= dns_none= routes_default= routes_enet='$1' bifc_ename=' ifcs_auto= aifc_evirtdup=³ $1 bifc_err1= bifc_err2= bifc_err3= routes_boot= , <> routes_emask='$1' bifc_create= , routes_edefault='$1' hosts_host= ifcs_mtu=MTU routes_defaults= index_title= bifc_evirtdup=³ $1 routes_net= routes_forward=ij ? ifcs_bootp= BOOTP hosts_add= dns_order= dns_eorder= dns_title=볺 DNS aifc_desc1= aifc_desc2= ifcs_boot=, aifc_emtu='$1' MTU aifc_edit= ifcs_virtual=³ routes_device= aifc_default= ifcs_name= routes_local= routes_edevice='$1' ifcs_ip=IP- bifc_desc1= , bifc_desc2= , bifc_eip='$1' IP- routes_gateway= aifc_emask='$1' aifc_eexist= '$1' bifc_emtu='$1' MTU aifc_create= hosts_edit= ifcs_act= ? dns_listed= .. ifcs_add= bifc_edit= , ifcs_dhcp= DHCP ifcs_type= hosts_create= hosts_ip=IP- bifc_ebroad='$1' dns_hostname=' dns_options= 볺 DNS ifcs_down= aifc_hard= routes_egateway='$1' aifc_edup= $1 routes_possible= dns_ens='$1' IP- log_delete_host= $1 interfaces_ok= ifcs_unknown= log_modify_aifc= $1 $2 log_create_bifc= $1 $2 routes_script= routes_err= acl_ifcs= ? routes_ecannot= log_delete_bifc= $1 $2 dns_esearch= interfaces_clear= log_create_aifc= $1 $2 routes_type= ifcs_ecannot_this= log_dns= 볺 DNS acl_routes= ? dns_err= DNS log_delete_aifc= $1 $2 routes_routed= ? log_routes= log_modify_host= $1 ifcs_ecannot= interfaces_cancel= acl_view=ҳ interfaces_all= ... acl_ifcs_only=ҳ interfaces_sel= bifc_eapply= , DHCP BOOTP acl_hosts= ? routes_etype='$1' log_create_host= $1 acl_dns= 볺 DNS? log_modify_bifc= $1 $2 dns_ecannot= 볺 DNS interfaces_title1= ... interfaces_title2= ... log_dyn= dns_ehost='$1' ' hosts_ecannot= bifc_capply= dns_edomain='$1' ' net/lang/zh_TW.UTF-80100664000567100000120000001466510656003101014034 0ustar jcameronwheelacl_apply=可以套用組態? acl_dns=可以編輯DNS客戶端設定? acl_hosts=可以編輯主機位置? acl_ifcs=可以編輯網路介面? acl_ifcs_only=只有介面 acl_routes=可以編輯路由與閘道器? acl_view=只能檢視 aifc_create=建立運作中的網路介面 aifc_default=預設 aifc_desc1=運作中網路介面的參數 aifc_desc2=運作中虛擬網路介面的參數 aifc_ebroad='$1' 不是一個有效的廣播位址 aifc_edit=編輯運作中的網路介面 aifc_edup=網路介面 $1 已經存在 aifc_eexist=網路介面 '$1' 不存在 aifc_ehard='$1' 不是一個有效的硬體位址 aifc_eip='$1' 不是一個有效的 IP 位址 aifc_emask='$1' 不是一個有效的子網路遮罩 aifc_emtu='$1' 不是一個有效的 MTU aifc_ename=遺失或錯誤的網路介面名稱 aifc_err1=無法刪除網路介面 aifc_err2=無法儲存網路介面 aifc_evirt=遺失或錯誤的虛擬網路介面編號 aifc_evirtdup=虛擬網路介面 $1 已經存在 aifc_evirtmin=虛擬介面數量至少要$1 aifc_hard=硬體位址 apply_ecannot=您不被允許套用組態 bifc_apply=儲存並套用 bifc_capply=建立與套用 bifc_create=建立 Bootup 網路介面 bifc_dapply=刪除與套用 bifc_desc1=啟動時期的網路介面參數 bifc_desc2=啟動時期的虛擬網路介面參數 bifc_eapply=您不能用DHCP或BOOTP的方式此啟動介面 bifc_ebroad='$1' 不是一個有效的廣播位址 bifc_edhcpmain=DHCP只能啟用於主要網路介面 bifc_edit=編輯 Bootup 網路介面 bifc_edup=網路介面 $1 已經存在 bifc_eip='$1' 不是一個有效的 IP 位址 bifc_emask='$1' 不是一個有效的子網路遮罩 bifc_emtu='$1' 不是一個有效的 MTU bifc_ename=遺失或錯誤的網路介面名稱 bifc_err1=無法刪除網路介面 bifc_err2=無法儲存網路介面 bifc_err3=無法啟動網路介面 bifc_err4=停止介面錯誤 bifc_evirt=遺失或錯誤的虛擬網路介面編號 bifc_evirtdup=虛擬網路介面 $1 已經存在 dns_ecannot=您不被允許編輯DNS客戶端選項 dns_edomain='$1'不是有效的網域名稱 dns_ehost='$1'不是有效的主機名稱 dns_ens='$1'不是有效的網域名稱伺服器IP位置 dns_eorder=遺失解析順序 dns_err=儲存DNS組態失敗 dns_esearch=未給予搜尋網域 dns_hostname=主機名稱 dns_hoststoo=當主機位置改變時更新主機名稱? dns_listed=列出的... dns_none=無 dns_options=DNS 客戶端選項 dns_order=解析順序 dns_search=搜尋網域 dns_servers=DNS 伺服器 dns_title=DNS 客戶端 hosts_add=加入一個新主機位址 hosts_create=建立主機位址 hosts_detail=主機與位址 hosts_ecannot=您不被允許編輯主機位置 hosts_edit=編輯主機位址 hosts_host=主機名稱 hosts_ip=IP 位址 hosts_return=主機位址列表 hosts_title=主機位址 ifcs_act=是否在開機時啟動? ifcs_add=增加新的網路介面 ifcs_addvirt=增加虛擬網路介面 ifcs_all=所有介面 ifcs_auto=自動 ifcs_boot=開機時啟動的網路介面 ifcs_bootp=從 BOOTP ifcs_broad=廣播位址 ifcs_dhcp=從 DHCP ifcs_down=停止 ifcs_ecannot=您不被允許編輯網路介面 ifcs_ecannot_this=您不被允許編輯網路介面 ifcs_ip=IP 位址 ifcs_mask=子網路遮罩 ifcs_mtu=MTU ifcs_name=名稱 ifcs_now=目前運作中的網路介面 ifcs_radd=增加新的網路範圍 ifcs_range=範圍$1 ifcs_return=網路介面 ifcs_status=狀態 ifcs_title=網路介面 ifcs_type=種類 ifcs_unknown=未知 ifcs_up=啟動 ifcs_virts=虛擬網路界面 ifcs_virtual=虛擬的 index_apply=套用組態 index_applydesc=按此按鈕來啟動目前開機狀態的網路介面與路由設定,通常會再重新開機後生效。警告這樣讓您的系統無法由網路進入和中斷與Webmin的連線 index_return=網路組態 index_title=網路組態 interfaces_all=所有介面... interfaces_cancel=取消 interfaces_clear=清除 interfaces_ok=確定 interfaces_sel=選取介面 interfaces_title1=選擇介面... interfaces_title2=選取使用者 log_create_aifc=啟動介面$1位置$2 log_create_bifc=新增介面$1位置$2 log_create_host=新增主機位置$1 log_delete_aifc=停止介面$1位置$2 log_delete_bifc=刪除介面$1位置$2 log_delete_host=刪除主機位置$1 log_dns=變更DNS客戶端選項 log_dyn=動態的 log_modify_aifc=重新啟動介面$1位置$2 log_modify_bifc=修改介面$1位置$2 log_modify_host=修改主機位置$1 log_routes=變更路由與閘道器選項 mod_adsl=一個ADSL PPP連線 mod_desc=$1介面已經給$2使用了,所以無法用此模組管理 mod_egone=介面不再啟動! mod_link=然而,您可以使用$2模組來代替管理 mod_ppp=PPP撥號連線到$1 mod_pptpc=PPTP連線$1 mod_pptps=從客戶端$1 PTP連線 mod_title=啟動介面 range_create=新增位置範圍 range_ebefore=結束位置比需大於開始位置 range_eclass=開始和結束位置必須是在同一個C等級網路 range_edit=編輯位置範圍 range_eend=無效或錯誤的結束IP位置 range_ename=無效或錯誤的範圍名稱 range_end=結束位置 range_enum=無效或非數字的開始虛擬介面號碼 range_err=儲存位置範圍失敗 range_estart=無效或錯誤的開始IP位置 range_header=位置範圍界面選項 range_iface=實體介面 range_name=範圍名稱 range_num=開始虛擬介面號碼 range_start=開始位置 routes_any=任何 routes_auto=自動 routes_boot=在啟動時期的啟動的路由組態 routes_default=預設路由器 routes_default2=預設路由 routes_defaults=預設路由器 routes_device=設備 routes_device2=預設的路由設備 routes_ecannot=您不被允許編輯路由與閘道器 routes_eclash=只有一個預設的路由從任何介面可以被定義 routes_eclash2=只有一個預設的路由從$1可以被定義 routes_edefault='$1' 不是一個有效的預設路由器 routes_edefault2=無效的預設路由位置編號$1 routes_edevice='$1' 不是一個有效的設備 routes_egateway='$1' 不是一個有效的閘道器 routes_emask='$1' 不是一個有效的子網路遮罩 routes_enet='$1' 不是一個有效地網路 routes_err=儲存路由失敗 routes_etype='$1'不是正確路由類型 routes_forward=是否像路由器的反應? routes_gateway=閘道器 routes_gwmetric=介面路由值 routes_ifc=網路介面 routes_local=本地端路由 routes_mask=子網路遮罩 routes_net=網路 routes_none=無 routes_none2=無 routes_now=現在路由組態啟動 routes_possible=如果可能 routes_routed=是否啟動路由找尋守護程式? routes_script=新增路由指令 routes_static=靜態路由 routes_title=路由與閘道器 routes_type=類型 net/lang/zh_CN.UTF-80100664000567100000120000000635610656003101014000 0ustar jcameronwheelindex_title=网络配置 index_return=网络配置 ifcs_title=网络接口 ifcs_now=接口当前活动 ifcs_name=名称 ifcs_type=类型 ifcs_ip=IP 地址 ifcs_mask=子网掩码 ifcs_status=状态 ifcs_virtual=虚拟 ifcs_up=启用 ifcs_down=关闭 ifcs_add=增加接口 ifcs_boot=启动时启用接口 ifcs_act=启动时启用? ifcs_bootp=来自 BOOTP ifcs_dhcp=来自 DHCP ifcs_broad=广播 ifcs_auto=自动 ifcs_mtu=最大传输单元 ifcs_virts=虚拟接口 ifcs_addvirt=增加虚拟接口 ifcs_return=网络接口 aifc_create=创建活动接口 aifc_edit=编辑活动接口 aifc_desc1=活动接口参数 aifc_desc2=活动虚拟接口参数 aifc_hard=硬件地址 aifc_default=缺省 aifc_err1=删除接口失败 aifc_err2=保存接口失败 aifc_evirt=丢失或者错误的虚拟接口号 aifc_evirtdup=该虚拟接口号 $1 已经存在 aifc_edup=接口 $1 已经存在 aifc_ename=丢失或者非法斗接口名称 aifc_eip='$1' 错误的IP地址 aifc_emask='$1' 错误的网络掩码 aifc_ebroad='$1' 错误的广播地址 aifc_emtu='$1' 错误的最大传输单元 aifc_ehard='$1' 错误的硬件地址 aifc_eexist=接口 '$1' 不存在 bifc_create=创建引导时接口 bifc_edit=编辑引导时接口 bifc_desc1=引导时接口参数 bifc_desc2=引导时虚拟接口参数 bifc_apply=保存并应用 bifc_err1=删除接口失败 bifc_err2=保存接口失败 bifc_evirt=丢失或错误的虚拟接口号 bifc_evirtdup=虚拟接口 $1 已经存在 bifc_edup=接口 $1 已经存在 bifc_ename=丢失或错误的接口名称 bifc_eip='$1' 错误的IP地址 bifc_emask='$1' 错误的网络掩码 bifc_ebroad='$1' 错误的广播地址 bifc_emtu='$1' 错误的最大传输单元 bifc_err3=启用接口失败 routes_title=路由和网关 routes_boot=引导时启用的路由配置 routes_default=缺省路由器 routes_none=无 routes_device=设备 routes_gateway=网关 routes_forward=作路由器? routes_routed=启动路由查找守护程序? routes_edefault='$1' 错误的缺省路由器 routes_edevice='$1'不是一个有效设备 routes_device2=缺省路由设备 routes_static=静态路由 routes_ifc=接口 routes_net=网络 routes_mask=子网掩码 routes_enet='$1' 错误网络 routes_emask='$1' 错误网络掩码 routes_egateway='$1' 错误的网关 routes_defaults=缺省路由器 routes_possible=如果可能 routes_local=本地路由 routes_err=存储路由失败 dns_title=DNS 客户 dns_options=DNS 客户选项 dns_hostname=主机名 dns_order=解析顺序 dns_servers=DNS 服务器 dns_search=搜索域 dns_none=无 dns_listed=列表 .. dns_eorder=丢失解析次序 hosts_title=主机地址 hosts_ip=IP 地址 hosts_host=主机名 hosts_add=增加主机地址 hosts_edit=编辑主机地址 hosts_create=创建主机地址 hosts_detail=主机和地址 hosts_return=主机地址列表 log_create_host=已创建客户地址 $1 log_delete_host=已删除客户地址 $1 log_modify_host=已更新客户地址 $1 log_dns=已改变 DNS 客户设置选项 log_routes=已改变路由和网关选项 log_create_aifc=启用的接口 $1 地址 $2 log_modify_aifc=重新启用的接口 $1 地址 $2 log_delete_aifc=禁用的接口 $1 地址 $2 log_create_bifc=已创建的接口 $1 地址 $2 log_modify_bifc=已更新的接口 $1 地址 $2 log_delete_bifc=已删除的接口 $1 地址 $2 net/lang/ja_JP.UTF-80100664000567100000120000002342410656003101013755 0ustar jcameronwheelacl_apply=設定を適用を許可しますか? acl_dns=DNSクライアント設定の編集を許可しますか? acl_hosts=ホストアドレスの編集を許可しますか? acl_ifcs=ネットワークインターフェースの編集を許可しますか? acl_ifcs_only=このインターフェースのみ acl_routes=ルーティングとゲートウェイの編集を許可しますか? acl_view=表示のみ aifc_create=アクティブ インターフェイスを作成 aifc_default=デフォルト aifc_desc1=アクティブ インターフェイス パラメータ aifc_desc2=アクティブ 仮想インターフェイス パラメータ aifc_ebroad='$1' は無効なブロードキャスト アドレスです aifc_edit=アクティブ インターフェイスを編集 aifc_edup=インターフェイス $1 はすでに存在します。 aifc_eexist=インターフェイス '$1' は存在しません aifc_ehard='$1' は無効なハードウェア アドレスです aifc_eip='$1' は無効な IP アドレスです aifc_emask='$1' は無効なネットマスクです aifc_emtu='$1' は無効な MTU です aifc_ename=インターフェイス名がないか無効です aifc_err1=インターフェイスを削除できませんでした aifc_err2=インターフェイスを保存できませんでした aifc_evirt=仮想インターフェイス番号がないか無効です aifc_evirtdup=仮想インターフェイス $1 はすでに存在しています aifc_evirtmin=仮想インターフェース番号は $1 以上でなくてはなりません aifc_hard=ハードウェア アドレス apply_ecannot=設定を適用する権限がありません bifc_apply=保存して適用 bifc_capply=作成と適用 bifc_create=起動 インターフェイスを作成 bifc_dapply=削除と適用 bifc_desc1=起動時の インターフェイス パラメータ bifc_desc2=起動時の仮想インターフェイス パラメータ bifc_eapply=DHCPまたはBOOTPを使用するインターフェースはアクティブ化できません bifc_ebroad='$1' は無効なブロードキャスト アドレスです bifc_edhcpmain=DHCPは第一ネットワークインターフェースにのみ使用できます bifc_edit=起動 インターフェイスを編集 bifc_edup=インターフェイス $1 はすでに存在します。 bifc_eip='$1' は無効な IP アドレスです bifc_emask='$1' は無効なネットマスクです bifc_emtu='$1' は無効な MTU です bifc_ename=インターフェイス名がないか無効です bifc_err1=インターフェイスを削除できませんでした bifc_err2=インターフェイスを保存できませんでした bifc_err3=インターフェイスをアクティブにできませんでした bifc_err4=インターフェースの非アクティブ化に失敗しました bifc_evirt=仮想インターフェイス番号がないか無効です bifc_evirtdup=仮想インターフェイス $1 はすでに存在しています dns_ecannot=DNSクライアント設定を編集する権限がありません dns_edomain='$1'は有効なドメイン名ではありません dns_ehost='$1' は有効なホスト名ではありません dns_ens='$1' は有効なネームサーバのIPアドレスではありません dns_eorder=解決順がありません dns_err=DNS設定の保存に失敗しました dns_esearch=検索するドメインが与えられていません dns_hostname=ホスト名 dns_hoststoo=ホストアドレスが変更されたら ホスト名を更新しますか? dns_listed=リスト.. dns_none=なし dns_options=DNS クライアント オプション dns_order=解決順 dns_search=ドメインの検索 dns_servers=DNS サーバ dns_title=DNS クライアント hosts_add=新規のホスト アドレスを追加 hosts_create=ホスト アドレスを作成 hosts_detail=ホストとアドレス hosts_ecannot=ホストアドレスを編集する権限がありません hosts_edit=ホスト アドレスを編集 hosts_host=ホスト名 hosts_ip=IP アドレス hosts_return=ホスト アドレス リスト hosts_title=ホスト アドレス ifcs_act=起動時にアクティブにしますか? ifcs_add=新規のインターフェイスを追加 ifcs_addvirt=仮想インターフェイスを追加 ifcs_all=全てのインターフェース ifcs_auto=自動 ifcs_boot=起動時にインターフェイスをアクティブ ifcs_bootp=BOOTP から ifcs_broad=ブロードキャスト ifcs_dhcp=DHCP から ifcs_down=ダウン ifcs_ecannot=ネットワークインターフェースを編集する権限がありません ifcs_ecannot_this=このネットワークインターフェースを編集する権限がありません ifcs_ip=IP アドレス ifcs_mask=ネットマスク ifcs_mtu=MTU ifcs_name=ホスト名 ifcs_now=インターフェイス アクティブ ifcs_radd=新しいアドレス範囲 ifcs_range=範囲 $1 ifcs_return=ネットワーク インターフェイス ifcs_status=ステータス ifcs_title=ネットワーク インターフェイス ifcs_type=種類 ifcs_unknown=不明 ifcs_up=動作中 ifcs_virts=仮想インターフェイス ifcs_virtual=仮想 index_apply=変更を適用する index_applydesc=このボタンをクリックすると、再起動時の用に現在の起動時のインターフェース及びルーティング設定をアクティブにします。 注意 - この操作はシステムをネットワークからアクセス不能にする可能性があります。Webminからも切断される可能性があります。 index_return=ネットワーク設定 index_title=ネットワーク設定 interfaces_all=全てのインターフェース... interfaces_cancel=キャンセル interfaces_clear=クリア interfaces_ok=OK interfaces_sel=選択したインターフェース interfaces_title1=インターフェースを選択... interfaces_title2=ユーザを選択... log_create_aifc=インターフェイス $1 アドレス $2 をアクティブにしました log_create_bifc=インターフェイス $1 アドレス $2 を作成しました log_create_host=ホスト アドレス $1 を作成しました log_delete_aifc=インターフェイス $1 アドレス $2 を非アクティブにしました log_delete_bifc=インターフェイス $1 アドレス $2 を削除しました log_delete_host=ホストアドレス $1 を削除しました log_dns=DNS クライアント オプションを変更しました log_dyn=動的 log_modify_aifc=インターフェイス $1 アドレス $2 を再度アクティブにしました log_modify_bifc=インターフェイス $1 アドレス $2 を変更しました log_modify_host=ホストアドレス $1 を変更しました log_routes=ルーティングとゲートウェイ オプション mod_adsl=ADSL PPP 接続 mod_desc=$1 インターフェースは$2に使用されているため、このモジュールでは管理できません mod_egone=インターフェースはアクティブではありません! mod_link=しかしながら、替わりに$2モジュール で管理できます mod_ppp=$1へのPPPダイヤルアップ接続 mod_pptpc=$1へのPPTP接続 mod_pptps=クライアント$1からのPPTP接続 mod_title=アクティブインターフェース range_create=アドレス範囲の作成 range_ebefore=アドレス範囲の終了値は開始値より大きくなければなりません range_eclass=アドレス範囲の開始値及び終了値は同じ クラスCネットワークに属している必要があります range_edit=アドレス範囲の編集 range_eend=終了値が空欄か無効なIPアドレスです range_ename=空欄もしくは無効な範囲名です range_end=終了アドレス range_enum=はじめの仮想インターフェース番号が空欄または数字以外の文字です range_err=アドレス範囲の保存に失敗しました range_estart=IPアドレスが空欄か無効なIPアドレスです range_header=アドレス範囲 インターフェースオプション range_iface=実インターフェース range_name=範囲名 range_num=最初の仮想インターフェース番号 range_start=開始アドレス routes_any=全て routes_auto=自動 routes_boot=ルーティング設定は起動時にアクティブになりました routes_default=デフォルト ルータ routes_default2=デフォルトルート routes_defaults=デフォルト ルータ routes_device=デバイス routes_device2=デフォルト ルート デバイス routes_ecannot=ルーティングとゲートウェイを編集する権限がありません routes_eclash=全てのインターフェースに対し、一つのデフォルトルートしか定義できません routes_eclash2=$1のデフォルトルートは一つだけ定義できます routes_edefault='$1' は無効なデフォルト ルータです routes_edefault2=デフォルトゲートウェイアドレス $1 は無効です routes_edevice='$1' は無効なデバイスです routes_egateway='$1' は無効なゲートウェイです routes_emask='$1' は無効なネットマスクです routes_enet='$1' は無効なネットワークです routes_err=ルーティングを保存できませんでした routes_etype='$1' は 有効なルートタイプではありません routes_forward=ルータとして動作させますか? routes_gateway=ゲートウェイ routes_gwmetric=インターフェイスメトリック routes_ifc=インターフェイス routes_local=ローカル ルート routes_mask=ネットマスク routes_net=ネットワーク routes_none=なし routes_none2=無し routes_now=ルーティング設定が有効になりました routes_possible=可能な場合 routes_routed=ルート ディスカバリ デーモンを起動しますか? routes_script=追加のルーティングコマンド routes_static=静的ルート routes_title=ルーティングとゲートウェイ routes_type=タイプ net/lang/ko_KR.UTF-80100664000567100000120000001102410656003101013770 0ustar jcameronwheelindex_title=革闘趨滴 姥失 index_return=革闘趨滴 姥失 ifcs_title=革闘趨滴 昔斗凪戚什 ifcs_now=薄仙 醗失 雌殿昔 昔斗凪戚什 ifcs_name=戚硯 ifcs_type=政莫 ifcs_ip=IP 爽社 ifcs_mask=掛原什滴 ifcs_status=雌殿 ifcs_virtual=亜雌 ifcs_up=臣顕 ifcs_down=鎧顕 ifcs_add=歯 昔斗凪戚什 蓄亜 ifcs_boot=採特 獣 昔斗凪戚什 醗失鉢 喫 ifcs_act=採特 獣 醗失鉢杯艦猿? ifcs_bootp=BOOTP稽 採斗 ifcs_dhcp=DHCP稽 採斗 ifcs_broad=崎稽球蝶什闘 ifcs_auto=切疑 ifcs_mtu=MTU ifcs_virts=亜雌 昔斗凪戚什 ifcs_addvirt=亜雌 昔斗凪戚什 蓄亜 ifcs_return=革闘趨滴 昔斗凪戚什 ifcs_unknown=硝 呪 蒸製 aifc_create=醗失 昔斗凪戚什 拙失 aifc_edit=醗失 昔斗凪戚什 畷増 aifc_desc1=醗失 昔斗凪戚什 古鯵 痕呪 aifc_desc2=醗失 亜雌 昔斗凪戚什 古鯵 痕呪 aifc_hard=馬球裾嬢 爽社 aifc_default=奄沙葵 aifc_err1=昔斗凪戚什研 肢薦馬走 公梅柔艦陥 aifc_err2=昔斗凪戚什研 煽舌馬走 公梅柔艦陥 aifc_evirt=蒸暗蟹 設公吉 亜雌 昔斗凪戚什 腰硲 aifc_evirtdup=亜雌 昔斗凪戚什 $1戚(亜) 戚耕 赤柔艦陥 aifc_edup=昔斗凪戚什 $1戚(亜) 戚耕 赤柔艦陥 aifc_ename=蒸暗蟹 設公吉 昔斗凪戚什 戚硯 aifc_eip='$1'精(澗) 政反廃 IP 爽社亜 焼鑑艦陥 aifc_emask='$1'精(澗) 政反廃 掛原什滴亜 焼鑑艦陥 aifc_ebroad='$1'精(澗) 政反廃 崎稽球蝶什闘 爽社亜 焼鑑艦陥 aifc_emtu='$1'精(澗) 政反廃 MTU亜 焼鑑艦陥 aifc_ehard='$1'精(澗) 政反廃 馬球裾嬢 爽社亜 焼鑑艦陥 aifc_eexist=昔斗凪戚什 '$1'戚(亜) 糎仙馬走 省柔艦陥 bifc_create=採闘 昔斗凪戚什 拙失 bifc_edit=採闘 昔斗凪戚什 畷増 bifc_desc1=採特 獣 昔斗凪戚什 古鯵 痕呪 bifc_desc2=採特 獣 亜雌 昔斗凪戚什 古鯵 痕呪 bifc_apply=煽舌 貢 旋遂 bifc_err1=昔斗凪戚什研 肢薦馬走 公梅柔艦陥 bifc_err2=昔斗凪戚什研 煽舌馬走 公梅柔艦陥 bifc_evirt=蒸暗蟹 設公吉 亜雌 昔斗凪戚什 腰硲 bifc_evirtdup=亜雌 昔斗凪戚什 $1戚(亜) 戚耕 赤柔艦陥 bifc_edup=昔斗凪戚什 $1戚(亜) 戚耕 赤柔艦陥 bifc_ename=蒸暗蟹 設公吉 昔斗凪戚什 戚硯 bifc_eip='$1'精(澗) 政反廃 IP 爽社亜 焼鑑艦陥 bifc_emask='$1'精(澗) 政反廃 掛原什滴亜 焼鑑艦陥 bifc_ebroad='$1'精(澗) 政反廃 崎稽球蝶什闘 爽社亜 焼鑑艦陥 bifc_emtu='$1'精(澗) 政反廃 MUT亜 焼鑑艦陥 bifc_err3=昔斗凪戚什研 醗失鉢馬走 公梅柔艦陥 routes_title=虞酔特 貢 惟戚闘裾戚 routes_boot=採特 獣 虞酔特 姥失 醗失鉢 喫 routes_default=奄沙 虞酔斗 routes_none=蒸製 routes_device=舌帖 routes_gateway=惟戚闘裾戚 routes_forward=虞酔斗稽 蝕拝聖 杯艦猿? routes_routed=虞酔闘 伊事 汽佼聖 獣拙杯艦猿? routes_edefault='$1'精(澗) 政反廃 奄沙 虞酔斗亜 焼鑑艦陥 routes_edevice='$1'精(澗) 政反廃 舌帖亜 焼鑑艦陥 routes_device2=奄沙 虞酔闘 舌帖 routes_static=舛旋 虞酔闘 routes_ifc=昔斗凪戚什 routes_net=革闘趨滴 routes_mask=掛原什滴 routes_enet='$1'精(澗) 政反廃 革闘趨滴亜 焼鑑艦陥 routes_emask='$1'精(澗) 政反廃 掛原什滴亜 焼鑑艦陥 routes_egateway='$1'精(澗) 政反廃 惟戚闘裾戚亜 焼鑑艦陥 routes_defaults=奄沙 虞酔斗 routes_possible=亜管廃 井酔 routes_local=稽鎮 虞酔闘 routes_err=虞酔特聖 煽舌馬走 公梅柔艦陥 dns_title=DNS 適虞戚情闘 dns_options=DNS 適虞戚情闘 辛芝 dns_hostname=硲什闘 戚硯 dns_order=繕噺 授辞 dns_servers=DNS 辞獄 dns_search=亀五昔 伊事 dns_none=蒸製 dns_listed=蟹伸吉 牌鯉.. dns_eorder=繕噺 授辞 蒸製 hosts_title=硲什闘 爽社 hosts_ip=IP 爽社 hosts_host=硲什闘 戚硯 hosts_add=歯 硲什闘 爽社 蓄亜 hosts_edit=硲什闘 爽社 畷増 hosts_create=硲什闘 爽社 拙失 hosts_detail=硲什闘 貢 爽社 hosts_return=硲什闘 爽社 鯉系 log_create_host=硲什闘 爽社 $1 拙失喫 log_delete_host=硲什闘 爽社 $1 肢薦喫 log_modify_host=硲什闘 爽社 $1 呪舛喫 log_dns=DNS 適虞戚情闘 辛芝 痕井喫 log_routes=虞酔特 貢 惟戚闘裾戚 辛芝 痕井喫 log_create_aifc=昔斗凪戚什 $1 爽社 $2 醗失鉢喫 log_modify_aifc=昔斗凪戚什 $1 爽社 $2 陥獣 醗失鉢喫 log_delete_aifc=昔斗凪戚什 $1 爽社 $2 搾醗失鉢喫 log_create_bifc=昔斗凪戚什 $1 爽社 $2 拙失喫 log_modify_bifc=昔斗凪戚什 $1 爽社 $2 呪舛喫 log_delete_bifc=昔斗凪戚什 $1 爽社 $2 肢薦喫 log_dyn=疑旋 net/net-lib.pl0100755000567100000120000002220610656003101013211 0ustar jcameronwheel# net-lib.pl # Common local networking functions do '../web-lib.pl'; &init_config(); do '../ui-lib.pl'; %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"; } 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"; } 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; &open_readfile(HOSTS, $config{'hosts_file'}); while() { s/\r|\n//g; s/#.*$//g; s/\s+$//g; if (/(\d+\.\d+\.\d+\.\d+)\s+(.*)$/) { push(@rv, { 'address' => $1, 'hosts' => [ split(/\s+/, $2) ], 'line', $lnum, 'index', scalar(@rv) }); } $lnum++; } close(HOSTS); return @rv; } # create_host(&host) # Add a new host to /etc/hosts sub create_host { &open_tempfile(HOSTS, ">>$config{'hosts_file'}"); &print_tempfile(HOSTS, $_[0]->{'address'},"\t",join(" ",@{$_[0]->{'hosts'}}),"\n"); &close_tempfile(HOSTS); } # modify_host(&host) # Update the address and hosts of a line in /etc/hosts sub modify_host { &replace_file_line($config{'hosts_file'}, $_[0]->{'line'}, $_[0]->{'address'}."\t".join(" ",@{$_[0]->{'hosts'}})."\n"); } # delete_host(&host) # Delete a host from /etc/hosts sub delete_host { &replace_file_line($config{'hosts_file'}, $_[0]->{'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() { 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 { local $form = @_ > 2 ? $_[2] : 0; local $w = $_[1] ? 500 : 300; return "\n"; } # prefix_to_mask(prefix) # Converts a number like 24 to a mask like 255.255.255.0 sub prefix_to_mask { return $_[0] >= 24 ? "255.255.255.".(256-(2 ** (32-$_[0]))) : $_[0] >= 16 ? "255.255.".(256-(2 ** (24-$_[0]))).".0" : $_[0] >= 16 ? "255.".(256-(2 ** (16-$_[0]))).".0.0" : (256-(2 ** (8-$_[0]))).".0.0.0"; } # mask_to_prefix(mask) # Converts a mask like 255.255.255.0 to a prefix like 24 sub mask_to_prefix { return $_[0] =~ /^255\.255\.255\.(\d+)$/ ? 32-&log2(256-$1) : $_[0] =~ /^255\.255\.(\d+)\.0$/ ? 24-&log2(256-$1) : $_[0] =~ /^255\.(\d+)\.0\.0$/ ? 16-&log2(256-$1) : $_[0] =~ /^(\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', "$c->[0]") }; } } } 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_create_iface { return $access{'ifcs'} == 2; } # interface_choice(name, value, blankmode-text, [disabled?]) # Returns HTML for an interface chooser menu sub interface_choice { local @ifaces = map { $_->{'fullname'} } (&net::active_interfaces(), &net::boot_interfaces()); @ifaces = sort { $a cmp $b } &unique(@ifaces); local $rv = ""; $rv .= sprintf "\n", !$found ? $_[1] : "", $_[3] ? " disabled=true" : ""; return $rv; } # 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; } 1; net/save_bifc.cgi0100755000567100000120000001235410656003101013732 0ustar jcameronwheel#!/usr/local/bin/perl # save_bifc.cgi # Create, save or delete a boot-time interface require './net-lib.pl'; &ReadParse(); @boot = &boot_interfaces(); if ($in{'delete'} || $in{'unapply'}) { # Delete interface &error_setup($text{'bifc_err1'}); $b = $boot[$in{'idx'}]; &can_iface($b) || &error($text{'ifcs_ecannot_this'}); if ($in{'unapply'}) { # Shut down this interface active (if active) &error_setup($text{'bifc_err4'}); @active = &active_interfaces(); ($act) = grep { $_->{'fullname'} eq $b->{'fullname'} } @active; if ($act) { if (defined(&unapply_interface)) { $err = &unapply_interface($act); $err && &error("
$err
"); } else { &deactivate_interface($act); } } } &delete_interface($b); &webmin_log("delete", "bifc", $b->{'fullname'}, $b); } else { # Save or create interface &error_setup($text{'bifc_err2'}); if (!$in{'new'}) { # Modifying an interface $oldb = $boot[$in{'idx'}]; &can_iface($oldb) || &error($text{'ifcs_ecannot_this'}); $b->{'name'} = $oldb->{'name'}; $b->{'file'} = $oldb->{'file'}; $b->{'gateway'} = $oldb->{'gateway'}; $b->{'virtual'} = $oldb->{'virtual'} if (defined($oldb->{'virtual'})); $b->{'code'} = $oldb->{'code'}; } elsif (defined($in{'virtual'})) { # creating a virtual interface $in{'virtual'} =~ /^\d+$/ || &error($text{'bifc_evirt'}); $in{'virtual'} >= $min_virtual_number || &error(&text('aifc_evirtmin', $min_virtual_number)); foreach $eb (@boot) { if ($eb->{'name'} eq $in{'name'} && $eb->{'virtual'} eq $in{'virtual'}) { &error(&text('bifc_evirtdup', "$in{'name'}:$in{'virtual'}")); } } $b->{'name'} = $in{'name'}; $b->{'virtual'} = $in{'virtual'}; &can_create_iface() || &error($text{'ifcs_ecannot'}); &can_iface($b) || &error($text{'ifcs_ecannot'}); } elsif ($in{'name'} =~ /^([a-z]+\d*(\.\d+)?):(\d+)$/) { # also creating a virtual interface foreach $eb (@boot) { if ($eb->{'name'} eq $1 && $eb->{'virtual'} eq $3) { &error(&text('bifc_evirtdup', $in{'name'})); } } $3 >= $min_virtual_number || &error(&text('aifc_evirtmin', $min_virtual_number)); $b->{'name'} = $1; $b->{'virtual'} = $3; &can_create_iface() || &error($text{'ifcs_ecannot'}); &can_iface($b) || &error($text{'ifcs_ecannot'}); } elsif ($in{'name'} =~/^[a-z]+\d*(\.\d+)?$/) { # creating a real interface foreach $eb (@boot) { if ($eb->{'fullname'} eq $in{'name'}) { &error(&text('bifc_edup', $in{'name'})); } } $b->{'name'} = $in{'name'}; &can_create_iface() || &error($text{'ifcs_ecannot'}); &can_iface($b) || &error($text{'ifcs_ecannot'}); } else { &error($text{'bifc_ename'}); } # Check for address clash $allow_clash = defined(&allow_interface_clash) ? &allow_interface_clash($b, 1) : 1; if (!$allow_clash && $in{'mode'} eq 'address' && ($in{'new'} || $oldb->{'address'} ne $in{'address'})) { ($clash) = grep { $_->{'address'} eq $in{'address'} && $_->{'up'} } @boot; $clash && &error(&text('aifc_eclash', $clash->{'fullname'})); } # Validate and store inputs if ($in{'mode'} eq 'dhcp' || $in{'mode'} eq 'bootp') { $in{'activate'} && !defined(&apply_interface) && &error($text{'bifc_eapply'}); $b->{$in{'mode'}}++; $auto++; } else { &valid_boot_address($in{'address'}) || &error(&text('bifc_eip', $in{'address'})); $b->{'address'} = $in{'address'}; } if ($virtual_netmask && $b->{'virtual'} ne "") { # Always use this netmask for virtuals $b->{'netmask'} = $virtual_netmask; } elsif (!$access{'netmask'}) { # Use default netmask $b->{'netmask'} = $in{'new'} ? $config{'def_netmask'} || "255.255.255.0" : $oldb->{'netmask'}; } elsif (&can_edit("netmask", $b) && $access{'netmask'}) { $auto && !$in{'netmask'} || &check_ipaddress($in{'netmask'}) || &error(&text('bifc_emask', $in{'netmask'})); $b->{'netmask'} = $in{'netmask'}; } if (!$access{'broadcast'}) { # Work out broadcast $b->{'broadcast'} = $in{'new'} ? &compute_broadcast($b->{'address'}, $b->{'netmask'}) : $oldb->{'broadcast'}; } elsif (&can_edit("broadcast", $b)) { $auto && !$in{'broadcast'} || &check_ipaddress($in{'broadcast'}) || &error(&text('bifc_ebroad', $in{'broadcast'})); $b->{'broadcast'} = $in{'broadcast'}; } if (!$access{'mtu'}) { # Use default MTU $b->{'mtu'} = $in{'new'} ? $config{'def_mtu'} : $oldb->{'mtu'}; } elsif (&can_edit("mtu", $b) && $access{'mtu'}) { $auto && !$in{'mtu'} || $in{'mtu'} =~ /^\d*$/ || &error(&text('bifc_emtu', $in{'mtu'})); $b->{'mtu'} = $in{'mtu'}; } if ($in{'new'} && !$access{'up'} || &can_edit("up", $b) && $in{'up'} && $access{'up'}) { $b->{'up'}++; } elsif (!$access{'up'}) { $b->{'up'} = $oldb->{'up'}; } $b->{'fullname'} = $b->{'name'}. ($b->{'virtual'} eq '' ? '' : ':'.$b->{'virtual'}); &save_interface($b); if ($in{'activate'}) { # Make this interface active (if possible) &error_setup($text{'bifc_err3'}); $b->{'up'}++; $b->{'address'} = &to_ipaddress($b->{'address'}); if (defined(&apply_interface)) { $err = &apply_interface($b); $err && &error("
$err
"); } else { &activate_interface($b); } } &webmin_log($in{'new'} ? 'create' : 'modify', "bifc", $b->{'fullname'}, $b); } &redirect("list_ifcs.cgi"); net/debian-linux-lib.pl0100755000567100000120000003727310656003101015014 0ustar jcameronwheel# debian-linux-lib.pl # Networking functions for Debian linux >= 2.2 (aka. potato) # Really, this won't work with releases prior to 2.2, don't even try it. # # Rene Mayrhofer, July 2000 # Some code has been taken from redhat-linux-lib.pl use File::Copy; $network_interfaces_config = '/etc/network/interfaces'; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { my @ifaces = &get_interface_defs(); my @autos = &get_auto_defs(); my @rv; foreach $iface (@ifaces) { my ($name, $addrfam, $method, $options) = @$iface; my $cfg; if ($addrfam eq 'inet') { $cfg->{'fullname'} = $name; if ($cfg->{'fullname'} =~ /(\S+):(\d+)/) { $cfg->{'name'} = $1; $cfg->{'virtual'} = $2; } else { $cfg->{'name'} = $cfg->{'fullname'}; } if ($gconfig{'os_version'} >= 3 || scalar(@autos)) { $cfg->{'up'} = &indexof($name, @autos) >= 0; } else { $cfg->{'up'} = 1; } foreach $option (@$options) { ($param, $value) = @$option; if ($param eq 'noauto') { $cfg->{'up'} = 0; } else { $cfg->{$param} = $value; } } $cfg->{'dhcp'} = ($method eq 'dhcp'); $cfg->{'bootp'} = ($method eq 'bootp'); $cfg->{'edit'} = ($cfg->{'name'} !~ /^ppp|lo/); $cfg->{'index'} = scalar(@rv); $cfg->{'file'} = $network_interfaces_config; push(@rv, $cfg); } } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { my $cfg = $_[0]; my $name = $cfg->{'virtual'} ne "" ? $cfg->{'name'}.":".$cfg->{'virtual'} : $cfg->{'name'}; my @options; my $method; if ($cfg->{'dhcp'} == 1) { $method = 'dhcp'; } elsif ($cfg->{'bootp'} == 1) { $method = 'bootp'; } else { $method = 'static'; push(@options, ['address', $cfg->{'address'}]); push(@options, ['netmask', $cfg->{'netmask'}]); push(@options, ['broadcast', $cfg->{'broadcast'}]); my ($ip1, $ip2, $ip3, $ip4) = split(/\./, $cfg->{'address'}); my ($nm1, $nm2, $nm3, $nm4) = split(/\./, $cfg->{'netmask'}); if ($cfg->{'address'} && $cfg->{'netmask'}) { my $network = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; push(@options, ['network', $network]); } } my @autos = get_auto_defs(); my $amode = $gconfig{'os_version'} > 3 || scalar(@autos); if (!$cfg->{'up'} && !$amode) { push(@options, ['noauto', '']); } my @ifaces = get_interface_defs(); my $changeit = 0; foreach $iface (@ifaces) { if ($iface->[0] eq $cfg->{'fullname'}) { $changeit = 1; foreach $o (@{$iface->[3]}) { if ($o->[0] eq 'gateway') { push(@options, $o); } } } } if ($changeit == 0) { new_interface_def($cfg->{'fullname'}, 'inet', $method, \@options); } else { modify_interface_def($cfg->{'fullname'}, 'inet', $method, \@options, 0); } if ($amode) { if ($cfg->{'up'}) { @autos = &unique(@autos, $cfg->{'fullname'}); } else { @autos = grep { $_ ne $cfg->{'fullname'} } @autos; } &modify_auto_defs(@autos); } } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { my $cfg = $_[0]; delete_interface_def($cfg->{'fullname'}, 'inet'); my @autos = get_auto_defs(); if ($gconfig{'os_version'} >= 3 || scalar(@autos)) { @autos = grep { $_ ne $cfg->{'fullname'} } @autos; &modify_auto_defs(@autos); } } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "mtu"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local (%conf, $f); &system_logged("hostname $_[0] >/dev/null 2>&1"); foreach $f ("/etc/hostname", "/etc/HOSTNAME") { if (-r $f) { &open_lock_tempfile(HOST, ">$f"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); } sub routing_config_files { return ( $network_interfaces_config ); } # show default router and device sub routing_input { local ($addr, $router) = &get_default_gateway(); local @ifaces = &get_interface_defs(); # Show default gateway print " $text{'routes_default'}\n"; printf " %s\n", $addr ? '' : 'checked', $text{'routes_none'}; printf " %s\n", $addr ? 'checked' : '', $text{'routes_gateway'}; printf "\n", $addr; print "$text{'routes_device'}\n"; print " \n"; # Get static routes local ($d, @st, @hr); foreach $d (@ifaces) { local ($name, $addrfam, $method, $options) = @$d; local $o; local $onum = -1; foreach $o (@$options) { $onum++; next if ($o->[0] ne "up"); if ($o->[1] =~ /^ip\s+route\s+add\s+([0-9\.]+)\/(\d+)\s+dev\s+(\S+)/) { push(@hr, [ $name, $1, &prefix_to_mask($2) ]); } elsif ($o->[1] =~ /^ip\s+route\s+add\s+([0-9\.]+)\/(\d+)\s+via\s+(\S+)/) { push(@st, [ $name, $1, &prefix_to_mask($2), $3 ]); } } } # Show static routes via gateways print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; local $i; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local ($dev, $gw); if (!$in{'gateway_def'}) { &check_ipaddress($in{'gateway'}) || &error(&text('routes_egateway', $in{'gateway'})); $gw = $in{'gateway'}; $dev = $in{'gatewaydev'}; } &set_default_gateway($gw, $dev); # Parse static and local routes local %st; local $i; local $dev; for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); local $net = $in{"net_$i"}; local $netmask = $in{"netmask_$i"}; local $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); local $prefix = &mask_to_prefix($netmask); push(@{$st{$dev}}, [ "up", "ip route add $net/$prefix via $gw" ]); } local %hr; for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { local $net = $in{"lnet_$i"}; local $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); local $prefix = &mask_to_prefix($netmask); push(@{$hr{$dev}}, [ "up", "ip route add $net/$prefix dev $dev" ]); } # Replace old routing directives local @ifaces = &get_interface_defs(); foreach $iface (@ifaces) { local @o = @{$iface->[3]}; @o = grep { $_->[0] ne "up" || $_->[1] !~ /^ip\s+route\s+add/ } @o; push(@o, @{$st{$iface->[0]}}); push(@o, @{$hr{$iface->[0]}}); $iface->[3] = \@o; &modify_interface_def($iface->[0], $iface->[1], $iface->[2], $iface->[3], 0); } } ############################################################################### # helper functions for file-internal use # gets a list of interface definitions (including their options) from the # central config file # the returned list is an array whose contents are tupels of # (name, addrfam, method, options) with # name the interface name (e.g. eth0) # addrfam the address family (e.g. inet, inet6) # method the address activation method (e.g. static, dhcp, loopback) # options is a list of (param, value) pairs sub get_interface_defs { local *CFGFILE; my @ret; &open_readfile(CFGFILE, $network_interfaces_config) || error("Unable to open $network_interfaces_config"); # read the file line by line $line = ; while (defined $line) { chomp($line); # skip comments if ($line =~ /^\s*#/ || $line =~ /^\s*$/) { $line = ; next; } if ($line =~ /^\s*auto/) { # skip auto stanzas $line = ; while(defined($line) && $line !~ /^\s*(iface|mapping|auto)/) { $line = ; next; } } elsif ($line =~ /^\s*mapping/) { # skip mapping stanzas $line = ; while(defined($line) && $line !~ /^\s*(iface|mapping|auto)/) { $line = ; next; } } elsif (my ($name, $addrfam, $method) = ($line =~ /^\s*iface\s+(\S+)\s+(\S+)\s+(\S+)\s*$/) ) { # only lines starting with "iface" are expected here my @iface_options; # now read everything until the next iface definition $line = ; while (defined $line && ! ($line =~ /^\s*(iface|mapping|auto)/)) { # skip comments and empty lines if ($line =~ /^\s*#/ || $line =~ /^\s*$/) { $line = ; next; } my ($param, $value); if ( ($param, $value) = ($line =~ /^\s*(\S+)\s+(.*)\s*$/) ) { push(@iface_options, [$param, $value]); } elsif ( ($param) = ($line =~ /^\s*(\S+)\s*$/) ) { push(@iface_options, [$param, '']); } else { error("Error in option line: '$line' invalid"); } $line = ; } push(@ret, [$name, $addrfam, $method, \@iface_options]); } else { error("Error reading file $pathname: unexpected line '$line'"); } } close(CFGFILE); return @ret; } # get_auto_defs() # Returns a list of interfaces in auto lines sub get_auto_defs { local @rv; &open_readfile(CFGFILE, $network_interfaces_config); while() { s/\r|\n//g; s/^\s*#.*$//g; if (/^\s*auto\s*(.*)/) { push(@rv, split(/\s+/, $1)); } } close(CFGFILE); return @rv; } # modify_auto_defs(iface, ...) # Replaces all auto lines with one containing the interfaces given as params sub modify_auto_defs { local $lref = &read_file_lines($network_interfaces_config); local $i; local $found; for($i=0; $i<@$lref; $i++) { local $l = $lref->[$i]; $l =~ s/\r|\n//g; $l =~ s/^\s*#.*$//g; if ($l =~ /^\s*auto\s*(.*)/) { if (!$found++) { # Replace the auto line $lref->[$i] = "auto ".join(" ", @_); } else { # Remove another auto line splice(@$lref, $i--, 1); } } } if (!$found) { splice(@$lref, 0, 0, "auto ".join(" ", @_)); } &flush_file_lines(); } # modifies the options of an already stored interface definition # the parameters should be (name, addrfam, method, options, mode) # with options being an array of (param, value) pairs # and mode being 0 for modify and 1 for delete sub modify_interface_def { my ($name, $addrfam, $method, $options, $mode) = @_; # make a backup copy copy("$network_interfaces_config", "$network_interfaces_config~"); local *OLDCFGFILE, *NEWCFGFILE; &open_readfile(OLDCFGFILE, "$network_interfaces_config~") || error("Unable to open $network_interfaces_config"); &lock_file($network_interfaces_config); &open_tempfile(NEWCFGFILE, "> $network_interfaces_config", 1) || error("Unable to open $network_interfaces_config"); my $inside_modify_region = 0; my $iface_line = 0; my $new_options_wrote; while (defined ($line=)) { if ($inside_modify_region == 0 && $line =~ /^\s*iface\s+$name\s+$addrfam\s+\S+\s*$/) { # Start of the iface section to modify $inside_modify_region = 1; $iface_line = 1; $new_options_wrote = 0; } elsif ($inside_modify_region == 1 && ($line =~ /^\s*iface\s+\S+\s+\S+\s+\S+\s*$/ || $line =~ /^\s*mapping/ || $line =~ /^\s*auto/)) { # End of an iface section $inside_modify_region = 0; } # preserve comments and blank lnks if ($line =~ /^\s*#/ || $line =~ /^\s*$/) { &print_tempfile(NEWCFGFILE, $line); } # inside modify region or not ? elsif ($inside_modify_region == 0) { &print_tempfile(NEWCFGFILE, $line); } else { # should the iface line be changed or the options ? if ($iface_line == 1 && $mode == 0) { &print_tempfile(NEWCFGFILE, "iface $name $addrfam $method\n"); } # only write the new options and skip the old ones or just do # nothing if mode is delete # write only upon first entrance here if ($mode == 0 && $new_options_wrote == 0) { $new_options_wrote = 1; foreach $option (@$options) { my ($param, $value) = @$option; &print_tempfile(NEWCFGFILE, "\t$param $value\n"); } } } $iface_line = 0; } close(OLDCFGFILE); &close_tempfile(NEWCFGFILE); &unlock_file($network_interfaces_config); } # creates a new interface definition in the config file # the parameters should be (name, addrfam, method, options) # with options being an array of (param, value) pairs # the selection key is (name, addrfam) sub new_interface_def { # make a backup copy copy("$network_interfaces_config", "$network_interfaces_config~"); local *CFGFILE; &open_lock_tempfile(CFGFILE, ">> $network_interfaces_config") || error("Unable to open $network_interfaces_config"); local ($name, $addrfam, $method, $options) = @_; &print_tempfile(CFGFILE, "\niface $name $addrfam $method\n"); foreach $option (@$options) { my ($param, $value) = @$option; &print_tempfile(CFGFILE, "\t$param $value\n"); } &close_tempfile(CFGFILE); } # delete an already defined interface # the parameters should be (name, addrfam) sub delete_interface_def { local ($name, $addrfam, $method) = @_; modify_interface_def($name, $addrfam, '', [], 1); } sub os_feedback_files { return ( $network_interfaces_config, "/etc/nsswitch.conf", "/etc/resolv.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/networking stop ; /etc/init.d/networking start) >/dev/null 2>&1"); } # get_default_gateway() # Returns the default gateway IP (if one is set) and device (if set) boot time # settings. sub get_default_gateway { local @ifaces = &get_interface_defs(); local ($router, $addr); foreach $iface (@ifaces) { foreach $o (@{$iface->[3]}) { if ($o->[0] eq 'gateway') { return ( $o->[1], $iface->[0] ); } } } return ( ); } # set_default_gateway([gateway, device]) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { local @ifaces = &get_interface_defs(); local $iface; foreach $iface (@ifaces) { # Remove the gateway directive $iface->[3] = [ grep { $_->[0] ne 'gateway' } @{$iface->[3]} ]; # Add if needed if ($iface->[0] eq $_[1]) { push(@{$iface->[3]}, [ 'gateway', $_[0] ]); } &modify_interface_def(@$iface); } } 1; net/edit_host.cgi0100755000567100000120000000244610656003101013774 0ustar jcameronwheel#!/usr/local/bin/perl # edit_host.cgi # Edit or create a host address require './net-lib.pl'; $access{'hosts'} == 2 || &error($text{'hosts_ecannot'}); &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'hosts_create'}, ""); } else { &ui_print_header(undef, $text{'hosts_edit'}, ""); @hosts = &list_hosts(); $h = $hosts[$in{'idx'}]; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'hosts_detail'}
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'hosts_ip'}{'address'}\">
$text{'hosts_host'}
\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; print "\n"; } print "
\n"; print "
\n"; &ui_print_footer("list_hosts.cgi", $text{'hosts_return'}); net/config.info.de0100644000567100000120000000010010656003101014015 0ustar jcameronwheelhosts_file=Datei in der Hosts und Adressen aufgelistet werden,0 net/config.info.sv0100644000567100000120000000005210656003101014063 0ustar jcameronwheelhosts_file=Fil med datorer och adresser,0 net/slackware-linux-lib.pl0100755000567100000120000001520610656003101015536 0ustar jcameronwheel# slackware-linux-lib.pl # Networking functions for slackware linux # To support boot-time interfaces, ifconfig commands are added to rc.local so # that additional virtual interfaces can be created do 'linux-lib.pl'; %iconfig = &foreign_config("init"); $interfaces_file = $iconfig{'local_script'} || $iconfig{'extra_init'}; $rc_init = "/etc/rc.d/rc.inet1"; $dhcp_init = "/etc/rc.d/rc.dhcpd"; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local @rv; # Look in rc.init1 file for master interface local $iface = { 'up' => 1, 'edit' => 1, 'index' => 0, 'init' => 1, 'name' => 'eth0', 'fullname' => 'eth0', 'file' => $rc_init }; local $gotdevice; &open_readfile(INIT, $rc_init); while() { s/\r|\n//g; s/#.*$//; if (/^\s*IPADDR\s*=\s*["']?([0-9\.]+)/) { $iface->{'address'} = $1; } elsif (/^\s*DEVICE\s*=\s*["']?([0-9\.]+)/) { $iface->{'name'} = $iface->{'fullname'} = $1; $gotdevice++; } elsif (/^\s*NETMASK\s*=\s*["']?([0-9\.]+)/) { $iface->{'netmask'} = $1; } elsif (/^\s*BROADCAST\s*=\s*["']?([0-9\.]+)/) { $iface->{'broadcast'} = $1; } elsif (/^\s*DHCP\s*=\s*["']?([0-9\.]+)/) { $iface->{'dhcp'} = ($1 eq "yes"); } elsif (/^\s*ifconfig\s+(\S+)\s+.*IPADDR.*/ && !$gotdevice) { $iface->{'name'} = $iface->{'fullname'} = $1; } } close(INIT); local @st1 = stat($rc_init); local @st2 = stat($dhcp_init); if ($st1[7] == $st2[7]) { # Looks like rc.dhcpd script has been copied to rc.inet1 - assume DHCP $iface->{'dhcp'} = 1; } push(@rv, $iface) if ($iface->{'address'} || $iface->{'dhcp'}); # Read extra init script for virtual interfaces local $lnum = 0; &open_readfile(IFACES, $interfaces_file); while() { s/\r|\n//g; if (/^(#*)\s*(\S*ifconfig)\s+(\S+)\s+(\S+)(\s+netmask\s+(\S+))?(\s+broadcast\s+(\S+))?(\s+mtu\s+(\d+))?\s+up$/) { # Found a usable interface line local $b = { 'fullname' => $3, 'up' => !$1, 'address' => $4, 'netmask' => $6, 'broadcast' => $8, 'mtu' => $10, 'edit' => 1, 'line' => $lnum, 'file' => $interfaces_file, 'index' => scalar(@rv) }; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } push(@rv, $b); } $lnum++; } close(IFACES); return @rv; } # save_interface(&details) # Create or update a boot-time interface's ifconfig command sub save_interface { if ($_[0]->{'index'} == 0 && $_[0]->{'fullname'} eq 'eth0') { # Modifying the primary interface &lock_file($rc_init); if ($_[0]->{'dhcp'} && -r $dhcp_init) { # Just copy rc.dhcpd to rc.inet1 &system_logged("cp $dhcp_init $rc_init"); } else { # Is the current file rc.dhcpd? if (!$_[0]->{'dhcp'}) { local @st1 = stat($rc_init); local @st2 = stat($dhcp_init); if ($st1[7] == $st2[7]) { # Yes! Use built-in static IP version &system_logged("cp $module_root_directory/rc.inet1 $rc_init"); } } # Update init script with new settings local $lref = &read_file_lines($rc_init); foreach $l (@$lref) { if ($l =~ /^(\s*)IPADDR\s*=\s*(\S+)(.*)/) { $l = $1."IPADDR=\"".$_[0]->{'address'}."\"".$3; } elsif ($l =~ /^(\s*)NETMASK\s*=\s*(\S+)(.*)/) { $l = $1."NETMASK=\"".$_[0]->{'netmask'}."\"".$3; } elsif ($l =~ /^(\s*)BROADCAST\s*=\s*(\S+)(.*)/) { $l = $1."BROADCAST=\"".$_[0]->{'broadcast'}."\"".$3; } if ($l =~ /^(\s*)DHCP\s*=\s*(\S+)(.*)/) { $l = $1."DHCP=\"".($_[0]->{'dhcp'} ? "yes" : "no")."\"".$3; } } &flush_file_lines(); } &unlock_file($rc_init); } else { # Modifying or adding some other interface $_[0]->{'dhcp'} && &error($text{'bifc_edhcpmain'}); &lock_file($interfaces_file); local $lref = &read_file_lines($interfaces_file); local $lnum = defined($_[0]->{'line'}) ? $_[0]->{'line'} : &interface_lnum($_[0]); if (defined($lnum)) { $lref->[$lnum] = &interface_line($_[0]); } else { push(@$lref, &interface_line($_[0])); } &flush_file_lines(); &unlock_file($interfaces_file); } } # delete_interface(&details) # Delete a boot-time interface's ifconfig command sub delete_interface { if ($_[0]->{'init'}) { &error("The primary network interface cannot be deleted"); } else { &lock_file($interfaces_file); local $lref = &read_file_lines($interfaces_file); local $lnum = defined($_[0]->{'line'}) ? $_[0]->{'line'} : &interface_lnum($_[0]); if (defined($lnum)) { splice(@$lref, $lnum, 1); } &flush_file_lines(); &unlock_file($interfaces_file); } } sub interface_lnum { local @boot = &boot_interfaces(); local ($found) = grep { $_->{'fullname'} eq $_[0]->{'fullname'} } @boot; return $found ? $found->{'line'} : undef; } sub interface_line { local $str; $str .= "# " if (!$_[0]->{'up'}); $str .= &has_command("ifconfig"); if (!$_[0]->{'fullname'}) { $_[0]->{'fullname'} = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; } $str .= " $_[0]->{'fullname'} $_[0]->{'address'}"; if ($_[0]->{'netmask'}) { $str .= " netmask $_[0]->{'netmask'}"; } if ($_[0]->{'broadcast'}) { $str .= " broadcast $_[0]->{'broadcast'}"; } if ($_[0]->{'mtu'}) { $str .= " mtu $_[0]->{'mtu'}"; } $str .= " up"; return $str; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "bootp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( $rc_init ); } sub routing_input { &open_readfile(INIT, $rc_init); while() { s/\r|\n//g; s/#.*$//; if (/^\s*GATEWAY\s*=\s*["']?([0-9\.]+)/) { $gw = $1; } } close(INIT); print " $text{'routes_default'} \n"; printf " %s\n", $gw ? "" : "checked", $text{'routes_none'}; printf " %s\n", $gw ? "checked" : "", $text{'routes_gateway'}; printf " \n", $gw; } sub parse_routing { local $gw = ""; if (!$in{'default'}) { &check_ipaddress($in{'gw'}) || &error(&text('routes_edefault', $in{'gw'})); $gw = $in{'gw'}; } &lock_file($rc_init); local $lref = &read_file_lines($rc_init); foreach $l (@$lref) { if ($l =~ /^(\s*)GATEWAY\s*=\s*(\S+)(.*)/) { $l = $1."GATEWAY=\"".$gw."\"".$3; } } &flush_file_lines(); &unlock_file($rc_init); } 1; net/freebsd-lib.pl0100755000567100000120000003267510656003101014050 0ustar jcameronwheel# freebsd-lib.pl # Networking functions for FreeBSD $virtual_netmask = "255.255.255.255"; # Netmask for virtual interfaces # active_interfaces() # Returns a list of currently ifconfig'd interfaces sub active_interfaces { local(@rv, @lines, $l); local @boot = &boot_interfaces(); local %boot = map { $_->{'address'}, $_ } @boot; local %bootname = map { $_->{'fullname'}, $_ } @boot; &open_execute_command(IFC, "ifconfig -a", 1, 1); while() { s/\r|\n//g; if (/^\S+:/) { push(@lines, $_); } elsif (@lines) { $lines[$#lines] .= $_; } } close(IFC); foreach $l (@lines) { local %ifc; $l =~ /^([^:\s]+):/; $ifc{'name'} = $ifc{'fullname'} = $1; if ($l =~ /^(\S+):(\d+):\s/) { $ifc{'virtual'} = $2; } local $bootiface = $bootname{$ifc{'fullname'}}; local $bootip = $bootiface ? $bootiface->{'address'} : undef; if ($l =~ s/inet\s+($bootip)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)// || $l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); $ifc{'broadcast'} = $3; } elsif ($l =~ s/inet\s+($bootip)\s+netmask\s+(\S+)// || $l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); } else { next; } if ($l =~ /ether\s+(\S+)/) { $ifc{'ether'} = $1; } if ($l =~ /mtu\s+(\S+)/) { $ifc{'mtu'} = $1; } $ifc{'up'}++ if ($l =~ /\{'virtual'}, 1 } grep { $_->{'name'} eq $vifc{'name'} && $_->{'virtual'} ne "" } @boot; while($l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)//) { local %vifc = %ifc; $vifc{'address'} = $1; $vifc{'netmask'} = &parse_hex($2); $vifc{'broadcast'} = $3; $vifc{'up'} = 1; $vifc{'edit'} = $ifc{'edit'}; local $boot = $boot{$vifc{'address'}}; if ($boot) { $vifc{'virtual'} = $boot->{'virtual'}; } else { for($vifc{'virtual'}=0; $vtaken{$vifc{'virtual'}}; $vifc{'virtual'}++) { } } $vtaken{$vifc{'virtual'}}++; $vifc{'fullname'} = $vifc{'name'}.':'.$vifc{'virtual'}; $vifc{'index'} = scalar(@rv); push(@rv, \%vifc); } } return @rv; } # activate_interface(&details) # Create or modify an interface sub activate_interface { local %act; map { $act{$_->{'fullname'}} = $_ } &active_interfaces(); local $old = $act{$_[0]->{'fullname'}}; $act{$_[0]->{'fullname'}} = $_[0]; &interface_sync(\%act, $_[0]->{'name'}, $_[0]->{'fullname'}); } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { local %act; local @act = &active_interfaces(); if ($_[0]->{'virtual'} eq '') { @act = grep { $_->{'name'} ne $_[0]->{'name'} } @act; } else { @act = grep { $_->{'fullname'} ne $_[0]->{'fullname'} } @act; } map { $act{$_->{'fullname'}} = $_ } @act; &interface_sync(\%act, $_[0]->{'name'}, $_[0]->{'fullname'}); } # interface_sync(interfaces, name, changee) sub interface_sync { # Remove all IP addresses except for the primary one (unless it is being edited) local $pri = $_[0]->{$_[1]}; local $ifconfig = &has_command("ifconfig"); while(1) { local $out; &execute_command("$ifconfig $_[1]", undef, \$out); last if ($out !~ /([\000-\377]*)\s+inet\s+(\d+\.\d+\.\d+\.\d+)/); last if ($2 eq $pri->{'address'} && $_[2] ne $pri->{'fullname'}); &system_logged("$ifconfig $_[1] delete $2 >/dev/null 2>&1"); } # Add them back again, except for the primary unless it is being changed foreach $a (sort { $a->{'fullname'} cmp $b->{'fullname'} } grep { $_->{'name'} eq $_[1] } values(%{$_[0]})) { next if ($a->{'fullname'} eq $pri->{'fullname'} && $_[2] ne $pri->{'fullname'}); local $cmd = "$ifconfig $a->{'name'}"; if ($a->{'virtual'} ne '') { $cmd .= " alias $a->{'address'}"; } else { $cmd .= " $a->{'address'}"; } if ($a->{'netmask'}) { $cmd .= " netmask $a->{'netmask'}"; } if ($a->{'broadcast'}) { $cmd .= " broadcast $a->{'broadcast'}"; } if ($a->{'mtu'}) { $cmd .= " mtu $a->{'mtu'}"; } local $out = &backquote_logged("$cmd 2>&1"); #if ($? && $out !~ /file exists/i) { if ($?) { &error($out); } if ($a->{'virtual'} eq '') { if ($a->{'up'}) { $out = &backquote_logged("$ifconfig $a->{'name'} up 2>&1"); } else { $out = &backquote_logged("$ifconfig $a->{'name'} down 2>&1"); } &error($out) if ($?); } } } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local %rc = &get_rc_conf(); local @rv; foreach $r (keys %rc) { local $v = $rc{$r}; local %ifc; if ($r =~ /^ifconfig_([a-z0-9]+)$/) { # Non-virtual interface %ifc = ( 'name' => $1, 'fullname' => $1 ); } elsif ($r =~ /^ifconfig_([a-z0-9]+)_alias(\d+)$/) { # Virtual interface %ifc = ( 'name' => $1, 'virtual' => $2, 'fullname' => "$1:$2" ); } else { next; } if ($v =~ /^inet\s+(\S+)/ || /^([0-9\.]+)/) { $ifc{'address'} = $1; } else { next; } local @a = split(/\./, $ifc{'address'}); if ($v =~ /netmask\s+(0x\S+)/) { $ifc{'netmask'} = &parse_hex($1); } elsif ($v =~ /netmask\s+([0-9\.]+)/) { $ifc{'netmask'} = $1; } else { $ifc{'netmask'} = $a[0] >= 192 ? "255.255.255.0" : $a[0] >= 128 ? "255.255.0.0" : "255.0.0.0"; } if ($v =~ /broadcast\s+(0x\S+)/) { $ifc{'broadcast'} = &parse_hex($1); } elsif ($v =~ /broadcast\s+([0-9\.]+)/) { $ifc{'broadcast'} = $1; } else { local @n = split(/\./, $ifc{'netmask'}); $ifc{'broadcast'} = sprintf "%d.%d.%d.%d", ($a[0] | ~int($n[0]))&0xff, ($a[1] | ~int($n[1]))&0xff, ($a[2] | ~int($n[2]))&0xff, ($a[3] | ~int($n[3]))&0xff; } $ifc{'mtu'} = $1 if ($v =~ /mtu\s+(\d+)/); $ifc{'up'} = 1; $ifc{'edit'} = 1; $ifc{'index'} = scalar(@rv); $ifc{'file'} = "/etc/rc.conf"; push(@rv, \%ifc); } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local $str = "inet $_[0]->{'address'}"; $str .= " netmask $_[0]->{'netmask'}" if ($_[0]->{'netmask'}); $str .= " broadcast $_[0]->{'broadcast'}" if ($_[0]->{'broadcast'}); &lock_file("/etc/rc.conf"); if ($_[0]->{'virtual'} eq '') { &save_rc_conf('ifconfig_'.$_[0]->{'name'}, $str); } else { local @boot = &boot_interfaces(); local ($old) = grep { $_->{'fullname'} eq $_[0]->{'fullname'} } @boot; if (!$old && $_[0]->{'virtual'} ne '') { # A new virtual interface .. pick a virtual number automaticlly local $b; $_[0]->{'virtual'} = 0; foreach $b (&boot_interfaces()) { if ($b->{'name'} eq $_[0]->{'name'} && $b->{'virtual'} ne '' && $b->{'virtual'} >= $_[0]->{'virtual'}) { $_[0]->{'virtual'} = $b->{'virtual'}+1; } } $_[0]->{'fullname'} = $_[0]->{'name'}.':'.$_[0]->{'virtual'}; } &save_rc_conf('ifconfig_'.$_[0]->{'name'}.'_alias'.$_[0]->{'virtual'}, $str); } &unlock_file("/etc/rc.conf"); } # delete_interface(&details, [noshift]) # Delete a boot-time interface sub delete_interface { &lock_file("/etc/rc.conf"); if ($_[0]->{'virtual'} eq '') { # Remove the real interface &save_rc_conf('ifconfig_'.$_[0]->{'name'}); } else { # Remove a virtual interface, and shift down all aliases above it &save_rc_conf('ifconfig_'.$_[0]->{'name'}.'_alias'.$_[0]->{'virtual'}); if (!$_[1]) { local ($b, %lastb); foreach $b (&boot_interfaces()) { if ($b->{'name'} eq $_[0]->{'name'} && $b->{'virtual'} ne '' && $b->{'virtual'} > $_[0]->{'virtual'}) { # This one needs to be shifted down %lastb = %$b; $b->{'virtual'}--; &save_interface($b); } } &delete_interface(\%lastb, 1) if (%lastb); } } &unlock_file("/etc/rc.conf"); } # iface_type(name) # Returns a human-readable interface type name sub iface_type { return $_[0] =~ /^tun/ ? "Loopback tunnel" : $_[0] =~ /^sl/ ? "SLIP" : $_[0] =~ /^ppp/ ? "PPP" : $_[0] =~ /^lo/ ? "Loopback" : $_[0] =~ /^ar/ ? "Arnet" : $_[0] =~ /^(bge|em)/ ? "Gigabit ethernet" : $_[0] =~ /^(ax|mx|pn|rl|tx|wb)/ ? "Fast ethernet" : $_[0] =~ /^(cs|dc|de|ed|el|ex|fe|fxp|ie|le|lnc|tl|vr|vx|xl|ze|zp)/ ? "Ethernet" : $text{'ifcs_unknown'}; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { return 0; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] =~ /netmask|broadcast/; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, search & order sub get_dns_config { local $dns; &open_readfile(RESOLV, "/etc/resolv.conf"); while() { s/\r|\n//g; s/#.*$//g; if (/nameserver\s+(.*)/) { push(@{$dns->{'nameserver'}}, split(/\s+/, $1)); } elsif (/domain\s+(\S+)/) { $dns->{'domain'} = [ $1 ]; } elsif (/search\s+(.*)/) { $dns->{'domain'} = [ split(/\s+/, $1) ]; } } close(RESOLV); &open_readfile(HOST, "/etc/host.conf"); while() { s/\r|\n//g; s/#.*$//; push(@{$dns->{'order'}}, $_) if (/\S/); } close(HOST); $dns->{'files'} = [ "/etc/resolv.conf", "/etc/host.conf" ]; return $dns; } # save_dns_config(&config) # Writes out the resolv.conf and host.conf files sub save_dns_config { &lock_file("/etc/resolv.conf"); &open_readfile(RESOLV, "/etc/resolv.conf"); local @resolv = ; close(RESOLV); &open_tempfile(RESOLV, ">/etc/resolv.conf"); foreach (@{$_[0]->{'nameserver'}}) { print RESOLV "nameserver $_\n"; } if ($_[0]->{'domain'}) { if ($_[0]->{'domain'}->[1]) { &print_tempfile(RESOLV, "search ",join(" ", @{$_[0]->{'domain'}}),"\n"); } else { &print_tempfile(RESOLV, "domain $_[0]->{'domain'}->[0]\n"); } } foreach (@resolv) { &print_tempfile(RESOLV, $_) if (!/^\s*(nameserver|domain|search)\s+/); } &close_tempfile(RESOLV); &unlock_file("/etc/resolv.conf"); &open_lock_tempfile(HOST, ">/etc/host.conf"); foreach (@{$_[0]->{'order'}}) { &print_tempfile(HOST, $_,"\n"); } &close_tempfile(HOST); } $max_dns_servers = 3; # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { local @o = @{$_[0]->{'order'}}; local ($rv, $i, $j); local @srcs = ( "", "hosts", "bind", "nis" ); local @srcn = ( "", "Hosts", "DNS", "NIS" ); for($i=1; $i<@srcs; $i++) { local $ii = $i-1; $rv .= "\n"; } return $rv; } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { local($i, @order); for($i=0; defined($in{"order_$i"}); $i++) { push(@order, $in{"order_$i"}) if ($in{"order_$i"}); } $_[0]->{'order'} = \@order; } # get_hostname() sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &lock_file("/etc/rc.conf"); &system_logged("hostname $_[0] >/dev/null 2>&1"); &save_rc_conf('hostname', $_[0]); &unlock_file("/etc/rc.conf"); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( "/etc/defaults/rc.conf", "/etc/rc.conf" ); } sub routing_input { local %rc = &get_rc_conf(); local $defr = $rc{'defaultrouter'}; print " $text{'routes_default'} \n"; printf " %s\n", $defr eq 'NO' ? 'checked' : '', $text{'routes_none'}; printf "\n", $defr eq 'NO' ? '' : 'checked'; printf " \n", $defr eq 'NO' ? '' : $defr; local $gw = $rc{'gateway_enable'}; print " $text{'routes_forward'} \n"; printf " %s\n", $gw eq 'YES' ? 'checked' : '', $text{'yes'}; printf " %s \n", $gw eq 'YES' ? '' : 'checked', $text{'no'}; local $rd = $rc{'router_enable'}; print " $text{'routes_routed'} \n"; printf " %s\n", $rd eq 'YES' ? 'checked' : '', $text{'yes'}; printf " %s \n", $rd eq 'YES' ? '' : 'checked', $text{'no'}; } sub parse_routing { &lock_file("/etc/rc.conf"); $in{'defr_def'} || &check_ipaddress($in{'defr'}) || &error(&text('routes_edefault', $in{'defr'})); &save_rc_conf('defaultrouter', $in{'defr_def'} ? 'NO' : $in{'defr'}); &save_rc_conf('gateway_enable', $in{'gw'}); &save_rc_conf('router_enable', $in{'rd'}); &unlock_file("/etc/rc.conf"); } # save_rc_conf(name, value) sub save_rc_conf { local $found; &open_readfile(CONF, "/etc/rc.conf"); local @conf = ; close(CONF); &open_tempfile(CONF, ">/etc/rc.conf"); foreach (@conf) { if (/^\s*([^=]+)\s*=\s*(.*)/ && $1 eq $_[0]) { &print_tempfile(CONF, "$_[0]=\"$_[1]\"\n") if (@_ > 1); $found++; } else { &print_tempfile(CONF, $_); } } if (!$found && @_ > 1) { &print_tempfile(CONF, "$_[0]=\"$_[1]\"\n"); } &close_tempfile(CONF); } # get_rc_conf() sub get_rc_conf { local ($file, %rv); foreach $file ("/etc/defaults/rc.conf", "/etc/rc.conf") { &open_readfile(FILE, $file); while() { s/\r|\n//g; s/#.*$//; if (/^\s*([^=\s]+)\s*=\s*"(.*)"/ || /^\s*([^=\s]+)\s*=\s*(\S+)/) { $rv{$1} = $2; } } close(FILE); } return %rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/netstart) >/dev/null 2>&1"); } sub os_feedback_files { return ( "/etc/rc.conf", "/etc/resolv.conf", "/etc/host.conf", "/etc/resolv.conf" ); } 1; net/solaris-lib.pl0100755000567100000120000003653410656003101014110 0ustar jcameronwheel# solaris-lib.pl # Networking functions for solaris $min_virtual_number = 1; # active_interfaces() # Returns a list of currently ifconfig'd interfaces sub active_interfaces { local(@rv, @lines, $l); &open_execute_command(IFC, "ifconfig -a", 1, 1); while() { s/\r|\n//g; if (/^\S+:/) { push(@lines, $_); } else { $lines[$#lines] .= $_; } } close(IFC); foreach $l (@lines) { local %ifc; $l =~ /^([^:\s]+):/; $ifc{'name'} = $1; $l =~ /^(\S+):/; $ifc{'fullname'} = $1; if ($l =~ /inet6\s+(\S+)/) { next; } # skip IPv6 for now if ($l =~ /^(\S+):(\d+):\s/) { $ifc{'virtual'} = $2; } if ($l =~ /inet\s+(\S+)/) { $ifc{'address'} = $1; } if ($l =~ /netmask\s+(\S+)/) { $ifc{'netmask'} = &parse_hex($1); } if ($l =~ /broadcast\s+(\S+)/) { $ifc{'broadcast'} = $1; } if ($l =~ /ether\s+(\S+)/) { $ifc{'ether'} = $1; } if ($l =~ /mtu\s+(\S+)/) { $ifc{'mtu'} = $1; } if ($l =~ /zone\s+(\S+)/) { $ifc{'zone'} = $1; } $ifc{'up'}++ if ($l =~ /\{'fullname'} eq $_[0]->{'fullname'} } @active; if (!$already) { if ($a->{'virtual'} eq "") { local $out = &backquote_logged("ifconfig $a->{'name'} plumb 2>&1"); if ($out) { &error(&text('aifc_eexist', $a->{'name'})); } } elsif ($gconfig{'os_version'} >= 8) { &system_logged("ifconfig $a->{'name'}:$a->{'virtual'} plumb >/dev/null 2>&1"); } } local $cmd = "ifconfig $a->{'name'}"; if ($a->{'virtual'} ne "") { $cmd .= ":$a->{'virtual'}"; } $cmd .= " $a->{'address'}"; if ($a->{'netmask'}) { $cmd .= " netmask $a->{'netmask'}"; } else { $cmd .= " netmask +"; } if ($a->{'broadcast'}) { $cmd .= " broadcast $a->{'broadcast'}"; } else { $cmd .= " broadcast +"; } if ($a->{'mtu'}) { $cmd .= " mtu $a->{'mtu'}"; } if ($a->{'zone'}) { $cmd .= " zone $a->{'zone'}"; } if ($a->{'up'}) { $cmd .= " up"; } else { $cmd .= " down"; } local $out = &backquote_logged("$cmd 2>&1"); if ($?) { &error("$cmd : $out"); } if ($a->{'ether'}) { $out = &backquote_logged( "ifconfig $a->{'name'} ether $a->{'ether'} 2>&1"); if ($? && $out !~ /Device busy/) { &error($out); } } } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { local $a = $_[0]; local $cmd; if ($a->{'virtual'} eq "") { $cmd = "ifconfig $a->{'name'} unplumb"; } elsif ($gconfig{'os_version'} >= 8) { $cmd = "ifconfig $a->{'name'}:$a->{'virtual'} unplumb"; } else { $cmd = "ifconfig $a->{'name'}:$a->{'virtual'} 0.0.0.0 down"; } local $out = &backquote_logged("$cmd 2>&1"); if ($?) { &error($out); } } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local (@rv, $f, %mask); push(@rv, { 'name' => 'lo0', 'fullname' => 'lo0', 'address' => '127.0.0.1', 'netmask' => '255.0.0.0', 'up' => 1, 'edit' => 0 }); local $etc = &translate_filename("/etc"); opendir(ETC, $etc); while($f = readdir(ETC)) { if ($f =~ /^hostname\.(\S+):(\d+)$/ || $f =~ /^hostname\.(\S+)/) { local %ifc; $ifc{'fullname'} = $ifc{'name'} = $1; $ifc{'virtual'} = $2 if (defined($2)); $ifc{'fullname'} .= ":$2" if (defined($2)); $ifc{'index'} = scalar(@rv); $ifc{'edit'}++; $ifc{'file'} = "$etc/$f"; open(FILE, "$etc/$f"); chop($ifc{'address'} = ); close(FILE); if ($ifc{'address'}) { $ifc{'netmask'} = &automatic_netmask($ifc{'address'}); $ifc{'broadcast'} = &compute_broadcast($ifc{'address'}, $ifc{'netmask'}); } else { $ifc{'dhcp'}++; } $ifc{'up'}++; push(@rv, \%ifc); } } closedir(ETC); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &open_lock_tempfile(IFACE, ">/etc/hostname.$name"); if (!$_[0]->{'dhcp'}) { &print_tempfile(IFACE, $_[0]->{'address'},"\n"); } &close_tempfile(IFACE); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &unlink_logged("/etc/hostname.$name"); } # iface_type(name) # Returns a human-readable interface type name sub iface_type { return "Fast Ethernet" if ($_[0] =~ /^hme/); return "Loopback" if ($_[0] =~ /^lo/); return "Token Ring" if ($_[0] =~ /^tr/); return "PPP" if ($_[0] =~ /^ipdptp/ || $_[0] =~ /^ppp/); return "Ethernet"; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { return $_[0] !~ /^(lo|ipdptp|ppp)/; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] eq "dhcp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return 1 if (&check_ipaddress($_[0])); return gethostbyname($_[0]) ? 1 : 0; } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, search & order sub get_dns_config { local $dns; &open_readfile(RESOLV, "/etc/resolv.conf"); while() { s/\r|\n//g; s/#.*$//g; if (/nameserver\s+(.*)/) { push(@{$dns->{'nameserver'}}, split(/\s+/, $1)); } elsif (/domain\s+(\S+)/) { $dns->{'domain'} = [ $1 ]; } elsif (/search\s+(.*)/) { $dns->{'domain'} = [ split(/\s+/, $1) ]; } } close(RESOLV); &open_readfile(SWITCH, "/etc/nsswitch.conf"); while() { s/\r|\n//g; if (/hosts:\s+(.*)/) { $dns->{'order'} = $1; } } close(SWITCH); $dns->{'files'} = [ "/etc/resolv.conf", "/etc/nsswitch.conf" ]; return $dns; } # save_dns_config(&config) # Writes out the resolv.conf and nsswitch.conf files sub save_dns_config { &lock_file("/etc/resolv.conf"); &open_readfile(RESOLV, "/etc/resolv.conf"); local @resolv = ; close(RESOLV); &open_tempfile(RESOLV, ">/etc/resolv.conf"); foreach (@{$_[0]->{'nameserver'}}) { &print_tempfile(RESOLV, "nameserver $_\n"); } if ($_[0]->{'domain'}) { if ($_[0]->{'domain'}->[1]) { &print_tempfile(RESOLV, "search ",join(" ", @{$_[0]->{'domain'}}),"\n"); } else { &print_tempfile(RESOLV, "domain $_[0]->{'domain'}->[0]\n"); } } foreach (@resolv) { &print_tempfile(RESOLV, $_) if (!/^\s*(nameserver|domain|search)\s+/); } &close_tempfile(RESOLV); &unlock_file("/etc/resolv.conf"); &lock_file("/etc/nsswitch.conf"); &open_readfile(SWITCH, "/etc/nsswitch.conf"); local @switch = ; close(SWITCH); &open_tempfile(SWITCH, ">/etc/nsswitch.conf"); foreach (@switch) { if (/hosts:\s+/) { &print_tempfile(SWITCH, "hosts:\t$_[0]->{'order'}\n"); } else { &print_tempfile(SWITCH, $_); } } &close_tempfile(SWITCH); &unlock_file("/etc/nsswitch.conf"); } $max_dns_servers = 3; # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { if ($_[0]->{'order'} =~ /\[/) { # Using a complex resolve list return "{'order'}\">\n"; } else { # Can select by menus local @o = split(/\s+/, $_[0]->{'order'}); local ($rv, $i, $j); local @srcs = ( "", "files", "dns", "nis", "nisplus", "ldap" ); local @srcn = ( "", "Hosts", "DNS", "NIS", "NIS+", "LDAP" ); for($i=1; $i<@srcs; $i++) { local $ii = $i-1; $rv .= "\n"; } return $rv; } } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { if (defined($in{'order'})) { $in{'order'} =~ /\S/ || &error($text{'dns_eorder'}); $_[0]->{'order'} = $in{'order'}; } else { local($i, @order); for($i=0; defined($in{"order_$i"}); $i++) { push(@order, $in{"order_$i"}) if ($in{"order_$i"}); } $_[0]->{'order'} = join(" ", @order); } } # get_hostname() sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); if (-r "/etc/nodename") { &open_tempfile(NODENAME, ">/etc/nodename"); &print_tempfile(NODENAME, $_[0],"\n"); &close_tempfile(NODENAME); } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { &system_logged("domainname ".quotemeta($_[0])); &lock_file("/etc/defaultdomain"); if ($_[0]) { &open_tempfile(DOMAIN, ">/etc/defaultdomain"); &print_tempfile(DOMAIN, $_[0],"\n"); &close_tempfile(DOMAIN); } else { &unlink_file("/etc/defaultdomain"); } &unlock_file("/etc/defaultdomain"); } sub routing_config_files { return ( "/etc/defaultrouter", "/etc/notrouter", "/etc/gateways" ); } # get_defaultrouters() # Returns a list of all default routers sub get_defaultrouters { local @defrt; &open_readfile(DEFRT, "/etc/defaultrouter"); while() { s/#.*$//g; if (/(\S+)/) { push(@defrt, $1); } } close(DEFRT); return @defrt; } sub routing_input { # show default router(s) input local @defrt = &get_defaultrouters(); print " $text{'routes_defaults'}\n"; print " \n"; # show router input local $notrt = (-r "/etc/notrouter"); local $gatew = (-r "/etc/gateways"); print " Act as router? \n"; printf " $text{'yes'}\n", $gatew && !$notrt ? "checked" : ""; printf " $text{'routes_possible'}\n", !$gatew && !$notrt ? "checked" : ""; printf " $text{'no'}\n", $notrt ? "checked" : ""; print " \n"; } sub parse_routing { local @defrt = split(/\s+/, $in{'defrt'}); foreach $d (@defrt) { gethostbyname($d) || &error(&text('routes_edefault', $d)); } &lock_file("/etc/defaultrouter"); if (@defrt) { &open_tempfile(DEFRT, ">/etc/defaultrouter"); foreach $d (@defrt) { &print_tempfile(DEFRT, $d,"\n"); } &close_tempfile(DEFRT); } else { &unlink_file("/etc/defaultrouter"); } &unlock_file("/etc/defaultrouter"); &lock_file("/etc/gateways"); &lock_file("/etc/notrouter"); if ($in{'router'} == 0) { &create_empty_file("/etc/gateways"); &unlink_file("/etc/notrouter"); } elsif ($in{'router'} == 2) { &create_empty_file("/etc/notrouter"); &unlink_file("/etc/gateways"); } else { &unlink_file("/etc/gateways"); &unlink_file("/etc/notrouter"); } &unlock_file("/etc/gateways"); &unlock_file("/etc/notrouter"); } # create_empty_file(filename) sub create_empty_file { if (!-r $_[0]) { &open_tempfile(EMPTY,">$_[0]"); &close_tempfile(EMPTY); } } sub os_feedback_files { opendir(DIR, "/etc"); local @f = map { "/etc/$_" } grep { /^hostname\./ } readdir(DIR); closedir(DIR); return ( @f, "/etc/netmasks", "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/defaultrouter", "/etc/notrouter", "/etc/gateways" ); } # get_default_gateway() # Returns the default gateway IP (if one is set) boot time # settings. sub get_default_gateway { local @defrt = &get_defaultrouters(); return @defrt ? ( $defrt[0] ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file("/etc/defaultrouter"); if ($_[0]) { &open_tempfile(DEF, ">/etc/defaultrouter"); &print_tempfile(DEF, $_[0],"\n"); &close_tempfile(DEF); } else { &unlink_file("/etc/defaultrouter"); } &unlock_file("/etc/defaultrouter"); } # list_routes() # Returns a list of active routes sub list_routes { local @rv; &open_execute_command(ROUTES, "netstat -rn", 1, 1); while() { s/\s+$//; if (/^([0-9\.]+|default)\s+([0-9\.]+)\s+\S+\s+\S+\s+\S+(\s+(\S+))?$/) { local $r = { 'dest' => $1 eq "default" ? "0.0.0.0" : $1, 'gateway' => $2, 'iface' => $4 }; $r->{'netmask'} = $r->{'dest'} eq '0.0.0.0' ? undef : $r->{'dest'} =~ /\.0\.0\.0$/ ? "255.0.0.0" : $r->{'dest'} =~ /\.0\.0$/ ? "255.255.0.0" : $r->{'dest'} =~ /\.0$/ ? "255.255.255.0" : undef; push(@rv, $r); } } close(ROUTES); return @rv; } # delete_route(&route) # Delete one active route, as returned by list_routes. Returns an error message # on failure, or undef on success sub delete_route { local ($route) = @_; local $cmd = "route delete"; if (!$route->{'dest'} || $route->{'dest'} eq '0.0.0.0') { $cmd .= " default"; } else { $cmd .= " $route->{'dest'}"; } if ($route->{'gateway'}) { $cmd .= " $route->{'gateway'}"; } elsif ($route->{'iface'}) { local @act = &active_interfaces(); local ($aiface) = grep { $_->{'fullname'} eq $route->{'iface'} } @act; if ($aiface) { $cmd .= " $aiface->{'address'}"; } } if ($route->{'netmask'}) { $cmd .= " $route->{'netmask'}"; } local $out = &backquote_logged("$cmd 2>&1 {'dest'}) { $cmd .= " default"; } else { $cmd .= " $route->{'dest'}"; } if ($route->{'gateway'}) { $cmd .= " $route->{'gateway'}"; } elsif ($route->{'iface'}) { local @act = &active_interfaces(); local ($aiface) = grep { $_->{'fullname'} eq $route->{'iface'} } @act; if ($aiface) { $cmd .= " $aiface->{'address'}"; } } if ($route->{'netmask'}) { $cmd .= " $route->{'netmask'}"; } local $out = &backquote_logged("$cmd 2>&1 {'fullname'}}++; } foreach $a (&active_interfaces()) { if (!$done{$a->{'fullname'}} && !$a->{'zone'}) { &deactive_interface($a); } } local @infile = &get_defaultrouters(); local @routes = &list_routes(); local @inmem = map { $_->{'gateway'} } grep { $_->{'dest'} eq "0.0.0.0" } @routes; if (join(" ", @infile) ne join(" ", @inmem)) { # Fix up default routes local $r; foreach $r (@inmem) { &system_logged("route delete default $r >/dev/null 2>&1"); } foreach $r (@infile) { &system_logged("route add default $r >/dev/null 2>&1"); } } } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { if ($_[0]->{'dhcp'}) { local $out = &backquote_logged("cd / ; ifconfig $_[0]->{'fullname'} 0.0.0.0 ; ifconfig $_[0]->{'fullname'} dhcp 2>&1 ) { s/\r|\n//g; s/#.*$//g; if (/([0-9\.]+)\s+([0-9\.]+)/) { $mask{$1} = $2; } } close(MASK); local ($a1, $a2, $a3, $a4) = split(/\./, $address); local $netmask = "255.255.255.0"; local $netaddr; foreach $netaddr (keys %mask) { $mask{$netaddr} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; local $na = sprintf "%d.%d.%d.%d", int($a1) & int($1), int($a2) & int($2), int($a3) & int($3), int($a4) & int($4); $netmask = $mask{$netaddr} if ($na eq $netaddr); } return $netmask; } 1; net/list_hosts.cgi0100755000567100000120000000236210656003101014202 0ustar jcameronwheel#!/usr/local/bin/perl # list_hosts.cgi # List hosts from /etc/hosts require './net-lib.pl'; $access{'hosts'} || &error($text{'hosts_ecannot'}); &ui_print_header(undef, $text{'hosts_title'}, ""); if ($access{'hosts'} == 2) { print &ui_form_start("delete_hosts.cgi", "post"); @links = ( &select_all_link("d"), &select_invert_link("d"), "$text{'hosts_add'}" ); print &ui_links_row(\@links); @tds = ( "width=5" ); } print &ui_columns_start([ $access{'hosts'} == 2 ? ( "" ) : ( ), $text{'hosts_ip'}, $text{'hosts_host'} ], undef, 0, \@tds); foreach $h (&list_hosts()) { local @cols; if ($access{'hosts'} == 2) { push(@cols, "{'index'}\">". &html_escape($h->{'address'}).""); } else { push(@cols, &html_escape($h->{'address'})); } push(@cols, join(" , ", map { &html_escape($_) } @{$h->{'hosts'}})); if ($access{'hosts'} == 2) { print &ui_checked_columns_row(\@cols, \@tds, "d",$h->{'index'}); } else { print &ui_columns_row(\@cols); } } print &ui_columns_end(); if ($access{'hosts'} == 2) { print &ui_links_row(\@links); print &ui_form_end([ [ "delete", $text{'hosts_delete'} ] ]); } &ui_print_footer("", $text{'index_return'}); net/save_host.cgi0100755000567100000120000000217010656003101013777 0ustar jcameronwheel#!/usr/local/bin/perl # save_host.cgi # Create, update or delete a host address require './net-lib.pl'; $access{'hosts'} == 2 || &error($text{'hosts_ecannot'}); &ReadParse(); &lock_file($config{'hosts_file'}); @hosts = &list_hosts(); if ($in{'delete'}) { # deleting a host $host = $hosts[$in{'idx'}]; &delete_host($host); } else { # saving or updating a host $whatfailed = "Failed to save host"; &check_ipaddress($in{'address'}) || &error("'$in{'address'}' is not a valid IP address"); @h = split(/\s+/, $in{'hosts'}); foreach $h (@h) { $h =~ /^[A-z0-9\-\.]+$/ || &error("'$h' is not a valid hostname"); } @h>0 || &error("You must enter at least one hostname"); if ($in{'new'}) { # saving a host $host = { 'address' => $in{'address'}, 'hosts' => \@h }; &create_host($host); } else { # updating a host $host = $hosts[$in{'idx'}]; $host->{'address'} = $in{'address'}; $host->{'hosts'} = \@h; &modify_host($host); } } &unlock_file($config{'hosts_file'}); &webmin_log($in{'delete'} ? 'delete' : $in{'new'} ? 'create' : 'modify', 'host', $host->{'address'}, $host); &redirect("list_hosts.cgi"); net/config-cygwin0100664000567100000120000000012210656003101014000 0ustar jcameronwheelhosts_file=/cygdrive/c/WINNT/system32/drivers/etc/hosts def_netmask=255.255.255.0 net/config.info0100644000567100000120000000030110656003101013431 0ustar jcameronwheelhosts_file=File listing hosts and addresses,0 ipnodes_file=File listing IPv6 hosts and addresses,0 def_netmask=Default netmask,0 def_broadcast=Default broadcast address,0 def_mtu=Default MTU,0 net/save_routes.cgi0100755000567100000120000000044110656003101014342 0ustar jcameronwheel#!/usr/local/bin/perl # save_routes.cgi # Save boot-time routing configuration require './net-lib.pl'; $access{'routes'} == 2 || &error($text{'routes_ecannot'}); &ReadParse(); &error_setup($text{'routes_err'}); &parse_routing(); &webmin_log("routes", undef, undef, \%in); &redirect(""); net/list_dns.cgi0100755000567100000120000000517110656003101013627 0ustar jcameronwheel#!/usr/local/bin/perl # list_dns.cgi # Display the DNS client configuration require './net-lib.pl'; $access{'dns'} || &error($text{'dns_ecannot'}); &ui_print_header(undef, $text{'dns_title'}, ""); $dns = &get_dns_config(); print "
\n"; print "\n"; print "\n"; print "
$text{'dns_options'}
\n"; print "\n"; printf "\n", &get_hostname(); $order = &order_input($dns); if ($order) { print "\n"; print "\n"; } # Find hostname in /etc/hosts @hosts = &list_hosts(); foreach $h (@hosts) { foreach $n (@{$h->{'hosts'}}) { $found++ if ($n eq &get_hostname()); } } if ($found) { print "\n"; print "\n"; } # Check if hostname is set from DHCP # XXX not done yet #$dhost = defined(&get_dhcp_hostname) ? &get_dhcp_hostname() : -1; #if ($dhost != -1) { # print "\n"; # print "\n"; # } print "\n"; if (@{$dns->{'name'}} > 1) { for ($j=1; $j<@{$dns->{'name'}}; $j++) { print "\n"; } } print "\n"; print "
$text{'dns_hostname'}$text{'dns_order'}$order
", "$text{'dns_hoststoo'}
",&ui_checkbox("dhcp", 1, $text{'dns_dhcp'}, $dhost), # "
"; print "$dns->{'name'}[0] " if $dns->{'name'}; print "$text{'dns_servers'} \n"; print "{'name'}[0]\">\n" if $dns->{'name'}; for($i=0; $i<$max_dns_servers; $i++) { printf "
\n", $dns->{'nameserver'}->[$i]; } print "
"; print "$dns->{'name'}[$j] "; print "$text{'dns_servers'} \n"; print "{'name'}[$j]\">\n"; for ($i=0; $i<$max_dns_servers; $i++) { printf "
\n", $dns->{"nameserver$j"}->[$i]; } print "
$text{'dns_search'} \n"; printf " $text{'dns_none'}\n", $dns->{'domain'} ? "" : "checked"; printf " $text{'dns_listed'}\n", $dns->{'domain'} ? "checked" : ""; print "
\n"; print "\n" if ($access{'dns'} == 2); print "
\n"; &ui_print_footer("", $text{'index_return'}); net/config.info.fr0100644000567100000120000000006510656003101014046 0ustar jcameronwheelhosts_file=Fichier de liste des postes et adresses,0 net/config-unixware0100644000567100000120000000006010656003101014341 0ustar jcameronwheelhosts_file=/etc/hosts def_netmask=255.255.255.0 net/cygwin-lib.pl0100775000567100000120000002662110656003101013732 0ustar jcameronwheel# cygwin-lib.pl # Networking functions for cygwin # # TODO: # * detect when netsh isn't available # * save domain list # * save domainname my $logfile = "/dev/null"; #my $logfile = "/tmp/debugwb"; #define variables that modify the behavior of the .cgi scripts #that are different than any other OS. $noos_support_add_ifcs = 1; #Windows doesn't supporting adding interfaces $noos_support_delete_ifcs = 1; #Windows doesn't supporting deleting interfaces $always_apply_ifcs = 1; #Changes made to interfaces are always applied $routes_active_now = 1; #Changes made to routes are always applied #Note: some changes Windows requires a reboot, some don't. #TODO2: determine which changes require a reboot. # active_interfaces() # Returns a list of currently ifconfig'd interfaces # ifc keys: 'name','fullname','virtual','address','netmask','broadcast', # 'ether','mtu','up','edit','index','dhcp' sub active_interfaces { local(@rv, @lines, $line); &open_execute_command(IFC, "ipconfig /all", 1, 1); while () { s/\r|\n//g; push(@lines, $_); } close(IFC); #Need to get the list of boottime interfaces, because ipconfig /all #doesn't return ipaddr if cable is disconnected my @bootifs = boot_interfaces(); my %ifc = (); foreach $line (@lines) { if ($line =~ /Ethernet adapter (.*):/) { my $name = $1; if (defined($ifc{'name'})) { #save the previous one $ifc{'index'} = scalar(@rv); local ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4); if ($ifc{'address'}) { $ifc{'netmask'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; $ifc{'broadcast'} = sprintf("%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff); } my %tmp = %ifc; push(@rv, \%tmp); } %ifc = (); $ifc{'name'} = $ifc{'fullname'} = $name; } elsif ($line =~ /Media State.*: (.*)/) { $ifc{'up'} = ($1 !~ /Disconnected/); foreach (@bootifs) { if ($_->{'name'} eq $ifc{'name'}) { $ifc{'dhcp'} = $_->{'dhcp'}; $ifc{'address'} = $_->{'address'}; $ifc{'netmask'} = $_->{'netmask'}; } } } elsif ($line =~ /Description.*: (.*) \#(\d+)\s*$/) { $ifc{'desc'} = $1; $ifc{'index'} = $2; } elsif ($line =~ /Description.*: (.*)$/) { $ifc{'desc'} = $1; chop($ifc{'desc'}); $ifc{'num'} = 1; } elsif ($line =~ /Physical Address.*: (.+)$/) { $ifc{'ether'} = $1; $ifc{'ether'} =~ s/-/:/g; } elsif ($line =~ /IP Address.*: (.+)$/) { $ifc{'address'} = $1; $ifc{'up'} = 1 if ! defined $ifc{'up'}; } elsif ($line =~ /Subnet Mask.*: (.+)$/) { $ifc{'netmask'} = $1; } elsif ($line =~ /Default Gateway.*: (.+)$/) { #this is used for the router subroutines below $ifc{'gateway'} = $1; } elsif ($line =~ /DHCP Enabled.*: (.+)$/) { $ifc{'dhcp'} = ($1 =~ /Yes/); } } if (defined($ifc{'name'})) { #save the last one $ifc{'index'} = scalar(@rv); local ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4); if ($ifc{'address'}) { $ifc{'netmask'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; $ifc{'broadcast'} = sprintf("%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff); } my %tmp = %ifc; push(@rv, \%tmp); } return @rv; } # activate_interface(&details) # Create or modify an interface sub activate_interface { save_interface($@); #Windows doesn't support adding or removing interfaces } # apply_interface(&details) # Save changes to an interface active now sub apply_interface { save_interface($@); } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { #TODO2: determine how to deactivate an interface } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { my @rv = (); #It doesn't seem to really help to display the loopback since #there's no mechanism in Windows to edit it. # push(@rv, { 'name' => 'lo0', # 'fullname' => 'lo0', # 'address' => '127.0.0.1', # 'netmask' => '255.0.0.0', # 'up' => 1, # 'edit' => 0 }); my (@lines, $l); &open_execute_command(IFC, "netsh interface ip dump", 1); while () { s/\r|\n//g; push(@lines, $_); } close(IFC); #my %ifc = (); foreach $l (@lines) { #TODO2: handle this message: #"Cannot access configuration. # Connection UI or someone else is accessing it." if ($l =~ /^set address name = "(.*)" source = dhcp/) { local %ifc; $ifc{'fullname'} = $ifc{'name'} = $1; $ifc{'index'} = scalar(@rv); $ifc{'edit'}++; $ifc{'dhcp'} = 1; $ifc{'up'} = 1; push(@rv, \%ifc); } elsif ($l =~ /^set address name = "(.*)" source = static addr = ([\d\.]+) mask = ([\d\.]+)/) { local %ifc; $ifc{'fullname'} = $ifc{'name'} = $1; $ifc{'address'} = $2; $ifc{'netmask'} = $3; $ifc{'index'} = scalar(@rv); $ifc{'edit'}++; $ifc{'address'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; local ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4); $ifc{'netmask'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; $ifc{'broadcast'} = sprintf("%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff); $ifc{'dhcp'} = 0; $ifc{'up'} = 1; push(@rv, \%ifc); } elsif ($l =~ /^set address name = "(.*)" gateway = ([\d\.]+) gwmetric = (\d)/) { foreach (@rv) { if ($_->{'name'} eq $1) { $_->{'gateway'} = $2; $_->{'gwmetric'} = $3; } } } } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { my $ifc = $_[0]; my $cmd = "netsh interface ip set address name = \"" . "$ifc->{'name'}\" source = "; if ($ifc->{'dhcp'}) { $cmd .= "dhcp"; } else { $cmd .= "static addr = $ifc->{'address'} mask = $ifc->{'netmask'}"; } system_logged("$cmd >$logfile 2>&1"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { #Windows doesn't support adding or removing interfaces } # iface_type(name) # Returns a human-readable interface type name sub iface_type { #TODO2 #return "Fast Ethernet" if #return "Token Ring" if #return "PPP" if return "Loopback" if $_[0] =~ /^lo0$/; return "Ethernet"; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { #TODO2: PPP return $_[0] !~ /^(lo\d)$/; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] =~ /^(dhcp|netmask)$/; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return 1 if (&check_ipaddress($_[0])); return gethostbyname($_[0]) ? 1 : 0; } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, order sub get_dns_config { my @lines = (); my $dns = {'domain' => []}; my $i = 0; if (&open_execute_command(CMD, "ipconfig /all", 1)) { my $doing_domain = 0; while () { s/[\n\r]//g; if ($doing_domain) { if (/(Ethernet adapter|:)/) { $doing_domain = 0; } elsif (/^\s*([^:]+\.[^:]+)$/) { push(@{$dns->{"domain"}}, $1); } } if (/Primary DNS Suffix.*: (.*)/) { push(@{$dns->{"domain"}}, $1); } elsif (/DNS Suffix Search List.*: (.*)/) { $doing_domain = 1; push(@{$dns->{"domain"}}, $1); } elsif (/^Ethernet adapter (.*):/) { $dns->{"name"}[$i++] = $1; } } close(CMD); } if (&open_execute_command(CMD, "netsh interface ip show dns", 1)) { my $doing_nameserver = 0; my $i = -1; my $key = "nameserver"; while () { s/\r|\n//g; if ($doing_nameserver) { if (/(Configuration for interface|:)/) { $doing_nameserver = 0; } elsif (/^\s*([\d\.]+)/) { push(@{$dns->{$key}}, $1); } } if (/Configuration for interface "(.*)"/) { $dns->{'name'}[++$i] = $1; $key = "nameserver"; $key .= $i if $i > 0; } elsif (/Statically Configured DNS Servers:\s*([\d\.]+)/) { push(@{$dns->{$key}}, $1); $doing_nameserver = 1; } } close(CMD); } return $dns; } # save_dns_config(&config) # Configures the DNS settings sub save_dns_config { my $dns = $_[0]; for ($i=0; $i < @{$dns->{'name'}}; $i++) { my $key = "nameserver"; $key .= $i if $i > 0; if (@{$dns->{$key}}) { my $cmd_fmt = "netsh interface ip %s dns name = \"" . $dns->{'name'}[$i] . "\"%s addr = %s"; my $addr = pop(@{$dns->{$key}}); my $cmd = sprintf($cmd_fmt, "set", " source = static", $addr); &system_logged("$cmd >$logfile 2>&1"); #add the new ones (any old list of adds was erased by the set cmd) foreach (@{$dns->{$key}}) { $cmd = sprintf($cmd_fmt, "add", "", $_); &system_logged("$cmd >$logfile 2>&1"); } } else { #set it to be obtained automatically my $cmd = "netsh interface ip set dns name = \"" . $dns->{'name'}[$i] . "\" source = dhcp"; &system_logged("$cmd >$logfile 2>&1"); #any old list of adds was erased by the set cmd } } #TODO: support saving the domain list #if ($_[0]->{'domain'}) { } $max_dns_servers = 16; #more is possible, but this is realistic # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { #TODO2 } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { #TODO2 } # get_hostname() sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { #TODO: determine how to get return ""; } # save_domainname(domain) sub save_domainname { #TODO: determine how to set } sub routing_config_files { return map { $_->{'file'} } &boot_interfaces(); } sub routing_input { # show default router(s) input my @if = boot_interfaces(); my $i = 0; foreach (@if) { next if $_->{'address'} eq "127.0.0.1"; my $none_or_dhcp = ! defined $ifc{'gateway'}; my $desc = $_->{'name'} . ($_->{'dhcp'}? "" : " ($_->{'address'})"); print "$desc $text{'routes_default'}:" . "\n"; printf " %s\n", $none_or_dhcp ? 'checked' : '', $text{'routes_none'}; printf "\n", $_->{'name'}; printf " %s", $none_or_dhcp ? '' : 'checked', $text{'routes_gateway'}; printf "\n", $_->{'gateway'}; print "$text{'routes_gwmetric'}"; printf "\n", $_->{'gwmetric'}; print "\n"; $i++; } } sub parse_routing { my $i = 0; my @if = boot_interfaces(); while (defined($in{"gateway${i}_def"})) { my $name = $in{"ifname$i"}; my $gateway = $in{"gateway$i"}; my $gwmetric = $in{"gwmetric$i"}; foreach (@if) { if ($_->{'name'} eq $name) { if (! $in{"gateway${i}_def"}) { if ($gateway != $_->{'gateway'} || $gwmetric != $_->{'gwmetric'}) { &check_ipaddress($gateway) || &error(&text('routes_egateway', $gateway)); my $cmd = "netsh interface ip set address name = \"" . $_->{'name'} . "\" gateway = $gateway " . "gwmetric = $gwmetric"; system_logged("$cmd > $logfile 2>&1"); } } else { if (defined($_->{'gateway'})) { my $cmd = "netsh interface ip delete address name = \"" . $_->{'name'} . "\" gateway = $_->{'gateway'}"; system_logged("$cmd > $logfile 2>&1"); } } } } $i++; } } 1; net/index.cgi0100755000567100000120000000200110656003101013104 0ustar jcameronwheel#!/usr/local/bin/perl # index.cgi # Display a menu of various network screens require './net-lib.pl'; &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("ifconfig hosts resolve.conf nsswitch.conf", "man")); $zone = &running_in_zone() || &running_in_vserver(); foreach $i ('ifcs', 'routes', 'dns', 'hosts', ($config{'ipnodes_file'} ? ('ipnodes') : ( ))) { next if (!$access{$i}); next if ($i eq "ifcs" && $zone); push(@links, "list_${i}.cgi"); push(@titles, $text{"${i}_title"}); push(@icons, "images/${i}.gif"); } &icons_table(\@links, \@titles, \@icons, @icons > 4 ? scalar(@icons) : 4); if (defined(&apply_network) && $access{'apply'} && !$zone) { # Allow the user to apply the network config print "
\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "
$text{'index_applydesc'}
\n"; } &ui_print_footer("/", $text{'index'}); net/defaultacl0100664000567100000120000000015110656003101013343 0ustar jcameronwheelifcs=2 routes=2 dns=2 hosts=2 apply=1 bootonly=0 netmask=1 broadcast=1 mtu=1 up=1 virt=1 delete=1 hide=0 net/edit_aifc.cgi0100755000567100000120000001002210656003101013706 0ustar jcameronwheel#!/usr/local/bin/perl # edit_aifc.cgi # Edit or create an active interface require './net-lib.pl'; &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'aifc_create'}, ""); &can_create_iface() || &error($text{'ifcs_ecannot'}); } else { @act = &active_interfaces(); $a = $act[$in{'idx'}]; &can_iface($a) || &error($text{'ifcs_ecannot_this'}); &ui_print_header(undef, $text{'aifc_edit'}, ""); } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
", $in{'virtual'} || $a && $a->{'virtual'} ne "" ? $text{'aifc_desc2'} : $text{'aifc_desc1'}, "
\n"; print "\n"; print "\n"; printf "\n", $a ? $a->{'address'} : ""; # Show netmask print "\n"; # Show broadcast address print "\n"; # Show MTU print "\n"; print "\n"; if ((!$a && $in{'virtual'} eq "") || ($a && $a->{'virtual'} eq "" && &iface_hardware($a->{'name'}))) { print "\n", $a ? $a->{'ether'} : ""; } else { print "\n"; } if ($a && $a->{'virtual'} eq "") { print "\n"; $vcount = 0; foreach $va (@act) { if ($va->{'virtual'} ne "" && $va->{'name'} eq $a->{'name'}) { $vcount++; } } print "\n"; } print "\n"; print "
$text{'ifcs_name'} \n"; if ($in{'new'} && $in{'virtual'}) { print "\n"; print "$in{'virtual'}:\n"; } elsif ($in{'new'}) { print "\n"; } else { print "$a->{'fullname'}\n"; } print "$text{'ifcs_ip'}
$text{'ifcs_mask'} \n"; if ($in{'virtual'} && $in{'new'} && $virtual_netmask) { # Virtual netmask cannot be edited print "$virtual_netmask\n"; } elsif (!$access{'netmask'}) { print $a ? $a->{'netmask'} : $config{'def_netmask'}; } else { print &ui_opt_textbox("netmask", $a ? $a->{'netmask'} : $config{'def_netmask'}, 15, $text{'ifcs_auto'}); } print "$text{'ifcs_broad'} \n"; if (!$access{'broadcast'}) { print $a ? $a->{'broadcast'} : $config{'def_broadcast'} ? $config{'def_broadcast'} : $text{'ifcs_auto'}; } else { print &ui_opt_textbox("broadcast", $a ? $a->{'broadcast'} : $config{'def_broadcast'}, 15, $text{'ifcs_auto'}); } print "
$text{'ifcs_mtu'} \n"; if (!$access{'mtu'}) { print $a ? $a->{'mtu'} : $config{'def_mtu'} ? $config{'def_mtu'} : $text{'default'}; } else { print &ui_opt_textbox("mtu", $a ? $a->{'mtu'} : $config{'def_mtu'}, 15, $text{'ifcs_auto'}); } print "$text{'ifcs_status'} \n"; if (!$access{'up'}) { print !$a ? $text{'ifcs_up'} : $a->{'up'} ? $text{'ifcs_up'} : $text{'ifcs_down'}; } else { print &ui_radio("up", !$a || $a->{'up'} ? 1 : 0, [ [ 1, $text{'ifcs_up'} ], [ 0, $text{'ifcs_down'} ] ]); } print "
$text{'aifc_hard'} \n"; if ($in{'new'}) { printf " %s\n", $a ? "" : "checked", $text{'aifc_default'}; printf "\n", $a ? "checked" : ""; } printf "
$text{'ifcs_virts'}$vcount\n"; print "(", "$text{'ifcs_addvirt'})
\n"; print "\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; if ($access{'delete'}) { print "\n"; } } print "
\n"; &ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'}); net/open-linux-lib.pl0100755000567100000120000001662510656003101014531 0ustar jcameronwheel# open-linux.pl # Networking functions for openlinux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/network-scripts/ifcfg-routes"; $nis_conf = "/etc/nis.conf"; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { next if ($f !~ /^ifcfg-(\S+)/ || $f eq 'ifcfg-routes' || $f =~ /\.sample$/); local (%conf, $b); &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'} ? $conf{'DEVICE'} : $1; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'} ? $conf{'IPADDR'} : "Automatic"; $b->{'netmask'} = $conf{'NETMASK'} ? $conf{'NETMASK'} : "Automatic"; $b->{'broadcast'} = $conf{'BROADCAST'} ? $conf{'BROADCAST'} : "Automatic"; $b->{'dhcp'} = $conf{'DYNAMIC'} eq 'dhcp'; $b->{'edit'} = ($b->{'name'} !~ /^ppp|plip/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); $conf{'DEVICE'} = $name; if ($_[0]->{'dhcp'}) { $conf{'DYNAMIC'} = 'dhcp'; } else { $conf{'IPADDR'} = $_[0]->{'address'}; delete($conf{'DYNAMIC'}); } local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; $conf{'BROADCAST'} = $_[0]->{'broadcast'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &unlink_logged("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "bootp" && $_[0] ne "mtu"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_file($network_config, \%conf); &unlock_file($network_config); undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { return ( $network_config, map { $_->{'file'} } &boot_interfaces() ); } sub routing_input { local (%conf, %ifc, $f, $gateway, $gatewaydev); &read_file($network_config, \%conf); local ($gateway, $gatewaydev) = &get_default_gateway(); print " $text{'routes_default'} \n"; printf " %s\n", $gateway ? "" : "checked", $text{'routes_none'}; printf " %s\n", $gateway ? "checked" : "", $text{'routes_gateway'}; printf " %s\n", $gateway, $text{'routes_device'}; printf " \n", $gatewaydev; print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'IPFORWARDING'} =~ /yes|true/i ? "checked" : ""; printf " $text{'no'} \n", $conf{'IPFORWARDING'} =~ /yes|true/i ? "" : "checked"; print " $text{'routes_script'} \n"; print " \n"; } sub parse_routing { local %conf; &lock_file($network_config); &read_file($network_config, \%conf); if ($in{'forward'}) { $conf{'IPFORWARDING'} = 'yes'; } else { delete($conf{'IPFORWARDING'}); } local %ifcs = map { $_->{'fullname'}, 1 } &all_interfaces(); if (!$in{'gateway_def'}) { gethostbyname($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); $ifcs{$in{'gatewaydev'}} || &error(&text('routes_edevice', $in{'gatewaydev'})); } &set_default_gateway($in{'gateway_def'} ? ( ) : ( $in{'gateway'}, $in{'gatewaydev'} ) ); &write_file($network_config, \%conf); &unlock_file($network_config); &open_lock_tempfile(SCRIPT, ">$static_route_config"); $in{'script'} =~ s/\r//g; &print_tempfile(SCRIPT, $in{'script'}); &close_tempfile(SCRIPT); &system_logged("chmod +x $static_route_config"); } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, $nis_conf, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/rc.d/init.d/network stop ; /etc/rc.d/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifup '$_[0]->{'fullname'}' 2>&1 ) { s/\r|\n//g; if (/^\S+:/) { push(@lines, $_); } else { $lines[$#lines] .= $_; } } close(IFC); foreach $l (@lines) { local %ifc; $l =~ /^([^:\s]+):/; $ifc{'name'} = $ifc{'fullname'} = $1; if ($l =~ /^(\S+):(\d+):\s/) { $ifc{'virtual'} = $2; } if ($l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); $ifc{'broadcast'} = $3; } elsif ($l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); } else { next; } if ($l =~ /ether\s+(\S+)/) { $ifc{'ether'} = $1; } if ($l =~ /mtu\s+(\S+)/) { $ifc{'mtu'} = $1; } $ifc{'up'}++ if ($l =~ /\{'fullname'}} = $_ } &active_interfaces(); local $old = $act{$_[0]->{'fullname'}}; $act{$_[0]->{'fullname'}} = $_[0]; &interface_sync(\%act, $_[0]->{'name'}); } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { local %act; local @act = &active_interfaces(); if ($_[0]->{'virtual'} eq '') { @act = grep { $_->{'name'} ne $_[0]->{'name'} } @act; } else { @act = grep { $_->{'fullname'} ne $_[0]->{'fullname'} } @act; } map { $act{$_->{'fullname'}} = $_ } @act; &interface_sync(\%act, $_[0]->{'name'}); } # interface_sync(interfaces, name) sub interface_sync { while(&backquote_command("ifconfig $_[1]") =~ /\s+inet\s+/) { &system_logged("ifconfig $_[1] delete >/dev/null 2>&1"); } foreach $a (sort { $a->{'fullname'} cmp $b->{'fullname'} } grep { $_->{'name'} eq $_[1] } values(%{$_[0]})) { local $cmd = "ifconfig $a->{'name'}"; if ($a->{'virtual'} ne '') { $cmd .= " alias $a->{'address'}"; } else { $cmd .= " $a->{'address'}"; } if ($a->{'netmask'}) { $cmd .= " netmask $a->{'netmask'}"; } if ($a->{'broadcast'}) { $cmd .= " broadcast $a->{'broadcast'}"; } if ($a->{'mtu'}) { $cmd .= " mtu $a->{'mtu'}"; } $msg .= "running $cmd
\n"; local $out = &backquote_logged("$cmd 2>&1"); if ($? && $out !~ /file exists/i) { &error($out); } if ($a->{'virtual'} eq '') { if ($a->{'up'}) { $out = &backquote_command("ifconfig $a->{'name'} up 2>&1"); } else { $out = &backquote_logged("ifconfig $a->{'name'} down 2>&1"); } &error($out) if ($?); } } } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local @rv; local @if_list = split(" ", &backquote_command("echo -n /etc/hostname.*[!~]")); if ( $if_list[0] eq "/etc/hostname.*[!~]" ) { return @rv; } foreach $r (@if_list) { local $if; local $alias_cnt = 0; ($if = $r) =~ s/\/etc\/hostname\.//; &open_readfile( IF_FILE, $r) or die "Could not open: $r"; while() { local %ifc; if( ! /^inet .*|^dhcp/ ) { next; } if( /^dhcp/ ) { %ifc = ( 'name' => $if, 'fullname' => $if, 'dhcp' => 1 ); } elsif( /alias/ ) { $_ =~ s/alias//; # Virtual interface %ifc = ( 'name' => $if, 'virtual' => $alias_cnt, 'fullname' => "$if:$alias_cnt" ); $alias_cnt++; } else { # Non-virtual interface %ifc = ( 'name' => $if, 'fullname' => $if ); } @_ = split; $ifc{'address'} = $_[1] if( $_[1] ne 'NONE' ); $ifc{'netmask'} = $_[2] if( $_[2] ne 'NONE' ); $ifc{'broadcast'} = $_[3] if( $_[3] ne 'NONE' ); $ifc{'up'} = 1; $ifc{'edit'} = 1; $ifc{'index'} = scalar(@rv); $ifc{'file'} = $r; push(@rv, \%ifc); } close( IF_FILE ); } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local ($str, $lines, $found = 0); local $if = $_[0]->{'name'}; local $alias_nr = $_[0]->{'virtual'}; &lock_file("/etc/hostname.$if"); if ( $_[0]->{'dhcp'} ){ &open_tempfile( IF_FILE, ">/etc/hostname.".$if ); &print_tempfile(IF_FILE, "dhcp\n"); &close_tempfile( IF_FILE ); &unlock_file("/etc/hostname.$if"); return; } if ( $alias_nr eq '' ) { $str = "inet "; $alias_nr = 0; } else { $str = "inet alias "; $alias_nr += 1; } $str .= $_[0]->{'address'}; $str .= " $_[0]->{'netmask'}" if ($_[0]->{'netmask'}); $str .= " $_[0]->{'broadcast'}" if ($_[0]->{'broadcast'}); $_ = &backquote_command("echo -n /etc/hostname.*"); if( /hostname.$if/ ) { $lines = &read_file_lines( "/etc/hostname.".$if ); foreach $l (@$lines) { $_ = $l; if( ! /^inet |^dhcp/ ) { next; } if( $alias_nr == 0 ) { $l = $str; $found = 1; last; } if( ! /alias/ ) { next; } if( $alias_nr == 1 ) { $l = $str; $found = 1; last; } $alias_nr--; } if( $found == 0 ) { push @$lines, ($str); } &flush_file_lines(); } else { &open_tempfile( IF_FILE, ">/etc/hostname.".$if ); &print_tempfile(IF_FILE, $str, "\n"); &close_tempfile( IF_FILE ); } &unlock_file("/etc/hostname.$if"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local ($cnt = 0, $lines, $found = 0); local $if = $_[0]->{'name'}; local $addr = $_[0]->{'address'}; $_ = &backquote_command("echo -n /etc/hostname.*"); &lock_file("/etc/hostname.$if"); if( /hostname.$if/ ) { $lines = &read_file_lines( "/etc/hostname.".$if ); foreach $l (@$lines) { $_ = $l; $cnt++; if ( /^\#/ ) { next; } $found++; if( ! /^inet / ) { next; } if( /$addr/ ) { splice @$lines, $cnt-1, 1; } } &flush_file_lines(); # check if we deleted the only entry in the file # if so delete the file (otherwise dhcp will be used for the interface) if( $found == 1 ) { &unlink_logged("/etc/hostname.".$if); } } &unlock_file("/etc/hostname.$if"); } # iface_type(name) # Returns a human-readable interface type name sub iface_type { return $_[0] =~ /^tun/ ? "Loopback tunnel" : $_[0] =~ /^sl/ ? "SLIP" : $_[0] =~ /^ppp/ ? "PPP" : $_[0] =~ /^lo/ ? "Loopback" : $_[0] =~ /^ar/ ? "Arnet" : $_[0] =~ /^(aue|cue|kue)/ ? "USB ethernet" : $_[0] =~ /^(sk|ti|wx)/ ? "Gigabit ethernet" : $_[0] =~ /^(al|ax|be|mx|qe|qec|rl|sf|sis|ste|tx|wb)/ ? "Fast ethernet" : $_[0] =~ /^(ae|cs|dc|de|ec|ed|eg|el|en|ep|es|ex|fxp|hme|ie|il|ix|iy|le|mc|ne|np|qn|sm|sn|tl|vr|vx|we|xe|xl|ze|zp)/ ? "Ethernet" : $text{'ifcs_unknown'}; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { return 0; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] =~ /netmask|broadcast|dhcp/; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, search & order sub get_dns_config { local $dns; &open_readfile(RESOLV, "/etc/resolv.conf"); while() { s/\r|\n//g; s/#.*$//g; if (/nameserver\s+(.*)/) { push(@{$dns->{'nameserver'}}, split(/\s+/, $1)); } elsif (/search\s+(.*)/) { $dns->{'domain'} = [ split(/\s+/, $1) ]; } elsif (/lookup\s+(.*)/) { $dns->{'order'} = [ split(/\s+/, $1) ]; } } close(RESOLV); $dns->{'files'} = [ "/etc/resolv.conf" ]; return $dns; } # save_dns_config(&config) # Writes out the resolv.conf file sub save_dns_config { &lock_file("/etc/resolv.conf"); &open_readfile(RESOLV, "/etc/resolv.conf"); local @resolv = ; close(RESOLV); &open_tempfile(RESOLV, ">/etc/resolv.conf"); foreach (@{$_[0]->{'nameserver'}}) { &print_tempfile(RESOLV, "nameserver $_\n"); } if ($_[0]->{'domain'}) { &print_tempfile(RESOLV, "search ",join(" ", @{$_[0]->{'domain'}}),"\n"); } foreach (@resolv) { &print_tempfile(RESOLV, $_) if (!/^\s*(nameserver|search|lookup)\s+/); } &print_tempfile(RESOLV, "lookup "); foreach (@{$_[0]->{'order'}}) { &print_tempfile(RESOLV, $_," "); } &print_tempfile(RESOLV, "\n"); &close_tempfile(RESOLV); &unlock_file("/etc/resolv.conf"); } $max_dns_servers = 3; # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { local @o = @{$_[0]->{'order'}}; local ($rv, $i, $j); local @srcs = ( "", "file", "bind", "yp" ); local @srcn = ( "", "Hosts", "DNS", "YP" ); for($i=1; $i<@srcs; $i++) { local $ii = $i-1; $rv .= "\n"; } return $rv; } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { local($i, @order); for($i=0; defined($in{"order_$i"}); $i++) { push(@order, $in{"order_$i"}) if ($in{"order_$i"}); } $_[0]->{'order'} = \@order; } # get_hostname() sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(MYNAME, ">/etc/myname"); &print_tempfile(MYNAME, $_[0],"\n"); &close_tempfile(MYNAME); undef(@main::get_system_hostname); # clear cache } sub set_line { local ($l, $lines, $found = 0); local $pat = $_[1]; local $news = $_[2]; $lines = read_file_lines($_[0]); foreach $l (@$lines) { $_ = $l; if( /$pat/ ) { $found = 1; $l = $news; } } if( ! $found ) { push @$lines, ($news); } &flush_file_lines(); } sub read_routing { $defr = ''; &open_readfile(DEFR, "/etc/mygate"); while() { $defr .= $_; } close(DEFR); local %sysctl; read_file("/etc/sysctl.conf", \%sysctl); $gw = "$sysctl{'net.inet.ip.forwarding'}"; $gw =~ s/\s*\#.*//; $gw = "0" if( $gw eq '' ); local %rc; read_file("/etc/rc.conf",\%rc); $rd = $rc{'routed_flags'}; $rd =~ s/\s*\#.*//; $rd = "NO" if( $rd eq '' ); } sub routing_config_files { return ( "/etc/mygate", "/etc/sysctl.conf", "/etc/rc.conf" ); } sub routing_input { &read_routing; print " $text{'routes_default'} \n"; printf " %s\n", $defr eq '' ? 'checked' : '', $text{'routes_none'}; printf "\n", $defr eq '' ? '' : 'checked'; printf " \n", $defr; print " $text{'routes_forward'} \n"; printf " %s\n", $gw eq '1' ? 'checked' : '', $text{'yes'}; printf " %s \n", $gw eq '1' ? '' : 'checked', $text{'no'}; print " $text{'routes_routed'} \n"; printf " %s\n", $rd eq 'NO' ? '':'checked', $text{'yes'}; printf " %s \n", $rd eq 'NO' ? 'checked':'', $text{'no'}; } sub parse_routing { $in{'defr_def'} || &check_ipaddress($in{'defr'}) || &error(&text('routes_edefault', $in{'defr'})); &read_routing; &lock_file("/etc/mygate"); if ( $in{'defr_def'} && -f "/etc/mygate" ) { &unlink_file("/etc/mygate"); } else { if( $in{'defr'} ne $defr ) { &open_tempfile(MYGATE, ">/etc/mygate"); &print_tempfile(MYGATE, $in{'defr'},"\n"); &close_tempfile(MYDATE); } } &unlock_file("/etc/mygate"); if( $in{'gw'} ne $gw ) { &set_line( "/etc/sysctl.conf", "^net.inet.ip.forwarding", "net.inet.ip.forwarding=$in{'gw'}" ); } if( $in{'rd'} ne $rd ) { &set_line( "/etc/rc.conf", "^routed_flags", "routed_flags=$in{'rd'}" ); } } sub os_feedback_files { return ( split(" ", `echo -n /etc/hostname.*[!~]`), "/etc/resolv.conf", "/etc/myname", "/etc/mygate", "/etc/rc.conf", "/etc/sysctl.conf" ); } 1; net/log_parser.pl0100775000567100000120000000232710656003101014020 0ustar jcameronwheel# log_parser.pl # Functions for parsing this module's logs do 'net-lib.pl'; # parse_webmin_log(user, script, action, type, object, ¶ms) # Converts logged information from this module into human-readable form sub parse_webmin_log { local ($user, $script, $action, $type, $object, $p) = @_; if ($type eq 'host') { return &text("log_${action}_host", "$object"); } elsif ($type eq 'ipnode') { return &text("log_${action}_ipnode", "$object"); } elsif ($type eq 'hosts' || $type eq 'aifcs' || $type eq 'bifcs') { return &text("log_${action}_${type}", $object); } elsif ($action eq 'dns') { return $text{'log_dns'}; } elsif ($action eq 'routes') { return $text{'log_routes'}; } elsif ($type eq 'aifc' || $type eq 'bifc') { return &text("log_${action}_${type}", "$object", $p->{'dhcp'} || $p->{'bootp'} ? $text{'log_dyn'} : "$p->{'address'}"); } elsif ($type eq 'route' && $action eq 'create') { if ($object) { return &text('log_create_route', "".&html_escape($object).""); } else { return &text('log_create_defroute'); } } elsif ($type eq 'routes' && $action eq 'delete') { return &text('log_delete_routes', $object); } else { return undef; } } net/config.info.tr0100644000567100000120000000007610656003101014066 0ustar jcameronwheelhosts_file=Makine adlarnn ve adreslerinin bulunduu dosya,0 net/config.info.pl0100755000567100000120000000010710656003101014052 0ustar jcameronwheelhosts_file=Plik z nazwami i adresami hostw hosts,0 net/cobalt-linux-lib.pl0100755000567100000120000005516610656003101015037 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/networking/devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifcfg-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifcfg-$name", "$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &unlink_file("$net_scripts_dir/ifcfg-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifcfg-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/backup_config.pl0100775000567100000120000000153010656003101014450 0ustar jcameronwheel do 'net-lib.pl'; # backup_config_files() # Returns files and directories that can be backed up sub backup_config_files { local @rv = ( $config{'hosts_file'} ); local $dns = &get_dns_config(); push(@rv, @{$dns->{'files'}}); if (defined(&routing_config_files)) { push(@rv, &routing_config_files()); } push(@rv, map { $_->{'file'} } &boot_interfaces()); return &unique(@rv); } # pre_backup(&files) # Called before the files are actually read sub pre_backup { return undef; } # post_backup(&files) # Called after the files are actually read sub post_backup { return undef; } # pre_restore(&files) # Called before the files are restored from a backup sub pre_restore { return undef; } # post_restore(&files) # Called after the files are restored from a backup sub post_restore { if (defined(&apply_network)) { &apply_network(); } return undef; } 1; net/config.info.ru_RU0100664000567100000120000000006510656003101014475 0ustar jcameronwheelhosts_file= ,0 net/suse-linux-9.0-lib.pl0100755000567100000120000002304210656003101015042 0ustar jcameronwheel# suse-linux-9.0-lib.pl # Networking functions for SuSE linux 9.0 and above $net_scripts_dir = "/etc/sysconfig/network"; $routes_config = "/etc/sysconfig/network/routes"; $sysctl_config = "/etc/sysconfig/sysctl"; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); local @active = &active_interfaces(); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { if ($f =~ /^ifcfg-eth-id-([a-f0-9:]+)$/i) { # An interface identified by MAC address! local (%conf, $b); $b->{'mac'} = $1; local ($a) = grep { lc($_->{'ether'}) eq lc($b->{'mac'}) } @active; next if (!$a); &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $a->{'fullname'}; $b->{'name'} = $a->{'name'}; $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'mtu'} = $conf{'MTU'}; $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-([a-z0-9:\.]+)$/) { # A normal interface file local (%conf, $b); $b->{'fullname'} = $1; &read_env_file("$net_scripts_dir/$f", \%conf); if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'mtu'} = $conf{'MTU'}; $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; local $file = $_[0]->{'file'} || "$net_scripts_dir/ifcfg-$name"; &lock_file($file); &read_env_file($file, \%conf); $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } delete($conf{'PREFIXLEN'}); $conf{'BROADCAST'} = $_[0]->{'broadcast'}; $conf{'STARTMODE'} = $_[0]->{'up'} ? "onboot" : $conf{'STARTMODE'} eq "onboot" ? "manual" : $conf{'STARTMODE'}; $conf{'BOOTPROTO'} = $_[0]->{'dhcp'} ? "dhcp" : "static"; $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'UNIQUE'} ||= time(); &write_env_file($file, \%conf); &unlock_file($file); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; local $file = $_[0]->{'file'} || "$net_scripts_dir/ifcfg-$name"; &unlink_logged($file); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "bootp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( $routes_config, $sysctl_config ); } # get_routes_config() # Returns the list of save static routes sub get_routes_config { local (@routes); &open_readfile(ROUTES, $routes_config); while() { s/#.*$//; s/\r|\n//g; local @r = map { $_ eq '-' ? undef : $_ } split(/\s+/, $_); push(@routes, \@r) if (@r); } close(ROUTES); return @routes; } # save_routes_config(&routes) sub save_routes_config { &open_tempfile(ROUTES, ">$routes_config"); foreach $r (@{$_[0]}) { &print_tempfile(ROUTES, join(" ", $r->[0] || "-", $r->[1] || "-", $r->[2] || "-", $r->[3] || "-"),"\n"); } &close_tempfile(ROUTES); } sub routing_input { local @routes = &get_routes_config(); # show default router and device local ($def) = grep { $_->[0] eq "default" } @routes; print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $def->[1] ? "" : "checked"; printf "\n", $def->[1] ? "checked" : ""; printf " \n", $def->[1]; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $def->[3] ? "" : "checked"; printf "\n", $def->[3] ? "checked" : ""; printf " \n", $def->[3]; &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'IP_FORWARD'} eq 'yes' ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'IP_FORWARD'} eq 'yes' ? "" : "checked"; # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", " ", "\n"; local ($r, $i = 0); foreach $r (@routes, [ ]) { next if ($r eq $def); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}$text{'routes_type'}
\n"; } sub parse_routing { # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { gethostbyname($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { $in{'gatewaydev'} =~ /^\S+$/ || &error(&text('routes_edevice', $in{'gatewaydev'})); $def[3] = $in{'gatewaydev'}; } push(@routes, \@def); } for($i=0; defined($in{"dev_$i"}); $i++) { next if (!$in{"net_$i"}); &check_ipaddress($in{"net_$i"}) || $in{"net_$i"} =~ /^(\S+)\/(\d+)$/ && &check_ipaddress($1) || &error(&text('routes_enet', $in{"net_$i"})); $in{"dev_$i"} =~ /^\S*$/ || &error(&text('routes_edevice', $dev)); !$in{"netmask_$i"} || &check_ipaddress($in{"netmask_$i"}) || &error(&text('routes_emask', $in{"netmask_$i"})); !$in{"gw_$i"} || &check_ipaddress($in{"gw_$i"}) || &error(&text('routes_egateway', $in{"gw_$i"})); $in{"type_$i"} =~ /^\S*$/ || &error(&text('routes_etype', $in{"type_$i"})); push(@routes, [ $in{"net_$i"}, $in{"gw_$i"}, $in{"netmask_$i"}, $in{"dev_$i"}, $in{"type_$i"} ] ); } # Save routes and routing option &save_routes_config(\@routes); local $lref = &read_file_lines($sysctl_config); for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^\s*IP_FORWARD\s*=/) { $lref->[$i] = "IP_FORWARD=".($in{'forward'} ? "yes" : "no"); } } &flush_file_lines(); } # get_default_gateway() # Returns the default gateway IP (if one is set) and device (if set) boot time # settings. sub get_default_gateway { local @routes = &get_routes_config(); local ($def) = grep { $_->[0] eq "default" } @routes; if ($def) { return ( $def->[1], $def->[3] ); } else { return ( ); } } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { local @routes = &get_routes_config(); local ($def) = grep { $_->[0] eq "default" } @routes; if ($def && $_[0]) { $def->[1] = $_[0]; $def->[3] = $_[1]; } elsif ($def && !$_[0]) { @routes = grep { $_ ne $def } @routes; } elsif (!$def && $_[0]) { splice(@routes, 0, 0, [ "default", $_[0], undef, $_[1] ]); } &save_routes_config(\@routes); } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } 1; net/config.info.ca0100644000567100000120000000035710656003101014026 0ustar jcameronwheelhosts_file=Fitxer que llista els hosts i les adreces,0 ipnodes_file=Fitxer que llista els hosts i adreces IPv6,0 def_netmask=Mscara de subxarxa per defecte,0 def_broadcast=Adrea de retransmissi per defecte,0 def_mtu=MTU per defecte,0 net/mandrake-linux-lib.pl0100755000567100000120000005516610656003101015355 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/networking/devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifcfg-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifcfg-$name", "$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &unlink_file("$net_scripts_dir/ifcfg-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifcfg-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/acl_security.pl0100755000567100000120000001056610656003101014353 0ustar jcameronwheel require 'net-lib.pl'; # acl_security_form(&options) # Output HTML for editing security options for the net module sub acl_security_form { print " $text{'acl_ifcs'} \n"; printf " $text{'yes'}\n", $_[0]->{'ifcs'} == 2 ? "checked" : ""; printf " $text{'acl_view'}\n", $_[0]->{'ifcs'} == 1 ? "checked" : ""; printf " $text{'no'}
\n", $_[0]->{'ifcs'} ? "" : "checked"; printf " $text{'acl_ifcs_only'}\n", $_[0]->{'ifcs'} == 3 ? "checked" : ""; print " ", &interfaces_chooser_button("interfaces", 1),"
\n"; printf " $text{'acl_ifcs_ex'}\n", $_[0]->{'ifcs'} == 4 ? "checked" : ""; print " ", &interfaces_chooser_button("interfaces", 1)," \n"; print " $text{'acl_bootonly'}\n"; print "",&ui_radio("bootonly", $_[0]->{'bootonly'}, [ [ 0, $text{'yes'} ], [ 1, $text{'no'} ] ]),"\n"; print "$text{'acl_netmask'}\n"; print "",&ui_radio("netmask", $_[0]->{'netmask'}, [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ])," \n"; print " $text{'acl_broadcast'}\n"; print "",&ui_radio("broadcast", $_[0]->{'broadcast'}, [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"\n"; print "$text{'acl_mtu'}\n"; print "",&ui_radio("mtu", $_[0]->{'mtu'}, [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ])," \n"; print " $text{'acl_up'}\n"; print "",&ui_radio("up", $_[0]->{'up'}, [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"\n"; print "$text{'acl_virt'}\n"; print "",&ui_radio("virt", $_[0]->{'virt'}, [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ])," \n"; print " $text{'acl_delete'}\n"; print "",&ui_radio("delete", $_[0]->{'delete'}, [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ]),"\n"; print "$text{'acl_hide'}\n"; print "",&ui_radio("hide", $_[0]->{'hide'}, [ [ 1, $text{'yes'} ], [ 0, $text{'no'} ] ])," \n"; print " $text{'acl_routes'} \n"; printf " $text{'yes'}\n", $_[0]->{'routes'} == 2 ? "checked" : ""; printf " $text{'acl_view'}\n", $_[0]->{'routes'} == 1 ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'routes'} ? "" : "checked"; print " $text{'acl_dns'} \n"; printf " $text{'yes'}\n", $_[0]->{'dns'} == 2 ? "checked" : ""; printf " $text{'acl_view'}\n", $_[0]->{'dns'} == 1 ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'dns'} ? "" : "checked"; print " $text{'acl_hosts'} \n"; printf " $text{'yes'}\n", $_[0]->{'hosts'} == 2 ? "checked" : ""; printf " $text{'acl_view'}\n", $_[0]->{'hosts'} == 1 ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'hosts'} ? "" : "checked"; print " $text{'acl_apply'} \n"; printf " $text{'yes'}\n", $_[0]->{'apply'} == 1 ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'apply'} ? "" : "checked"; } # acl_security_save(&options) # Parse the form for security options for the file module sub acl_security_save { $_[0]->{'ifcs'} = $in{'ifcs'}; $_[0]->{'routes'} = $in{'routes'}; $_[0]->{'dns'} = $in{'dns'}; $_[0]->{'hosts'} = $in{'hosts'}; $_[0]->{'interfaces'} = $in{'ifcs'} == 3 ? $in{'interfaces3'} : $in{'ifcs'} == 4 ? $in{'interfaces4'} : undef; $_[0]->{'apply'} = $in{'apply'}; $_[0]->{'bootonly'} = $in{'bootonly'}; $_[0]->{'netmask'} = $in{'netmask'}; $_[0]->{'broadcast'} = $in{'broadcast'}; $_[0]->{'mtu'} = $in{'mtu'}; $_[0]->{'up'} = $in{'up'}; $_[0]->{'virt'} = $in{'virt'}; $_[0]->{'delete'} = $in{'delete'}; $_[0]->{'hide'} = $in{'hide'}; } net/msc-linux-lib.pl0100755000567100000120000005516610656003101014355 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/networking/devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifcfg-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifcfg-$name", "$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &unlink_file("$net_scripts_dir/ifcfg-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifcfg-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/netbsd-lib.pl0100755000567100000120000003267510656003101013715 0ustar jcameronwheel# freebsd-lib.pl # Networking functions for FreeBSD $virtual_netmask = "255.255.255.255"; # Netmask for virtual interfaces # active_interfaces() # Returns a list of currently ifconfig'd interfaces sub active_interfaces { local(@rv, @lines, $l); local @boot = &boot_interfaces(); local %boot = map { $_->{'address'}, $_ } @boot; local %bootname = map { $_->{'fullname'}, $_ } @boot; &open_execute_command(IFC, "ifconfig -a", 1, 1); while() { s/\r|\n//g; if (/^\S+:/) { push(@lines, $_); } elsif (@lines) { $lines[$#lines] .= $_; } } close(IFC); foreach $l (@lines) { local %ifc; $l =~ /^([^:\s]+):/; $ifc{'name'} = $ifc{'fullname'} = $1; if ($l =~ /^(\S+):(\d+):\s/) { $ifc{'virtual'} = $2; } local $bootiface = $bootname{$ifc{'fullname'}}; local $bootip = $bootiface ? $bootiface->{'address'} : undef; if ($l =~ s/inet\s+($bootip)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)// || $l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); $ifc{'broadcast'} = $3; } elsif ($l =~ s/inet\s+($bootip)\s+netmask\s+(\S+)// || $l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); } else { next; } if ($l =~ /ether\s+(\S+)/) { $ifc{'ether'} = $1; } if ($l =~ /mtu\s+(\S+)/) { $ifc{'mtu'} = $1; } $ifc{'up'}++ if ($l =~ /\{'virtual'}, 1 } grep { $_->{'name'} eq $vifc{'name'} && $_->{'virtual'} ne "" } @boot; while($l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)//) { local %vifc = %ifc; $vifc{'address'} = $1; $vifc{'netmask'} = &parse_hex($2); $vifc{'broadcast'} = $3; $vifc{'up'} = 1; $vifc{'edit'} = $ifc{'edit'}; local $boot = $boot{$vifc{'address'}}; if ($boot) { $vifc{'virtual'} = $boot->{'virtual'}; } else { for($vifc{'virtual'}=0; $vtaken{$vifc{'virtual'}}; $vifc{'virtual'}++) { } } $vtaken{$vifc{'virtual'}}++; $vifc{'fullname'} = $vifc{'name'}.':'.$vifc{'virtual'}; $vifc{'index'} = scalar(@rv); push(@rv, \%vifc); } } return @rv; } # activate_interface(&details) # Create or modify an interface sub activate_interface { local %act; map { $act{$_->{'fullname'}} = $_ } &active_interfaces(); local $old = $act{$_[0]->{'fullname'}}; $act{$_[0]->{'fullname'}} = $_[0]; &interface_sync(\%act, $_[0]->{'name'}, $_[0]->{'fullname'}); } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { local %act; local @act = &active_interfaces(); if ($_[0]->{'virtual'} eq '') { @act = grep { $_->{'name'} ne $_[0]->{'name'} } @act; } else { @act = grep { $_->{'fullname'} ne $_[0]->{'fullname'} } @act; } map { $act{$_->{'fullname'}} = $_ } @act; &interface_sync(\%act, $_[0]->{'name'}, $_[0]->{'fullname'}); } # interface_sync(interfaces, name, changee) sub interface_sync { # Remove all IP addresses except for the primary one (unless it is being edited) local $pri = $_[0]->{$_[1]}; local $ifconfig = &has_command("ifconfig"); while(1) { local $out; &execute_command("$ifconfig $_[1]", undef, \$out); last if ($out !~ /([\000-\377]*)\s+inet\s+(\d+\.\d+\.\d+\.\d+)/); last if ($2 eq $pri->{'address'} && $_[2] ne $pri->{'fullname'}); &system_logged("$ifconfig $_[1] delete $2 >/dev/null 2>&1"); } # Add them back again, except for the primary unless it is being changed foreach $a (sort { $a->{'fullname'} cmp $b->{'fullname'} } grep { $_->{'name'} eq $_[1] } values(%{$_[0]})) { next if ($a->{'fullname'} eq $pri->{'fullname'} && $_[2] ne $pri->{'fullname'}); local $cmd = "$ifconfig $a->{'name'}"; if ($a->{'virtual'} ne '') { $cmd .= " alias $a->{'address'}"; } else { $cmd .= " $a->{'address'}"; } if ($a->{'netmask'}) { $cmd .= " netmask $a->{'netmask'}"; } if ($a->{'broadcast'}) { $cmd .= " broadcast $a->{'broadcast'}"; } if ($a->{'mtu'}) { $cmd .= " mtu $a->{'mtu'}"; } local $out = &backquote_logged("$cmd 2>&1"); #if ($? && $out !~ /file exists/i) { if ($?) { &error($out); } if ($a->{'virtual'} eq '') { if ($a->{'up'}) { $out = &backquote_logged("$ifconfig $a->{'name'} up 2>&1"); } else { $out = &backquote_logged("$ifconfig $a->{'name'} down 2>&1"); } &error($out) if ($?); } } } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local %rc = &get_rc_conf(); local @rv; foreach $r (keys %rc) { local $v = $rc{$r}; local %ifc; if ($r =~ /^ifconfig_([a-z0-9]+)$/) { # Non-virtual interface %ifc = ( 'name' => $1, 'fullname' => $1 ); } elsif ($r =~ /^ifconfig_([a-z0-9]+)_alias(\d+)$/) { # Virtual interface %ifc = ( 'name' => $1, 'virtual' => $2, 'fullname' => "$1:$2" ); } else { next; } if ($v =~ /^inet\s+(\S+)/ || /^([0-9\.]+)/) { $ifc{'address'} = $1; } else { next; } local @a = split(/\./, $ifc{'address'}); if ($v =~ /netmask\s+(0x\S+)/) { $ifc{'netmask'} = &parse_hex($1); } elsif ($v =~ /netmask\s+([0-9\.]+)/) { $ifc{'netmask'} = $1; } else { $ifc{'netmask'} = $a[0] >= 192 ? "255.255.255.0" : $a[0] >= 128 ? "255.255.0.0" : "255.0.0.0"; } if ($v =~ /broadcast\s+(0x\S+)/) { $ifc{'broadcast'} = &parse_hex($1); } elsif ($v =~ /broadcast\s+([0-9\.]+)/) { $ifc{'broadcast'} = $1; } else { local @n = split(/\./, $ifc{'netmask'}); $ifc{'broadcast'} = sprintf "%d.%d.%d.%d", ($a[0] | ~int($n[0]))&0xff, ($a[1] | ~int($n[1]))&0xff, ($a[2] | ~int($n[2]))&0xff, ($a[3] | ~int($n[3]))&0xff; } $ifc{'mtu'} = $1 if ($v =~ /mtu\s+(\d+)/); $ifc{'up'} = 1; $ifc{'edit'} = 1; $ifc{'index'} = scalar(@rv); $ifc{'file'} = "/etc/rc.conf"; push(@rv, \%ifc); } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local $str = "inet $_[0]->{'address'}"; $str .= " netmask $_[0]->{'netmask'}" if ($_[0]->{'netmask'}); $str .= " broadcast $_[0]->{'broadcast'}" if ($_[0]->{'broadcast'}); &lock_file("/etc/rc.conf"); if ($_[0]->{'virtual'} eq '') { &save_rc_conf('ifconfig_'.$_[0]->{'name'}, $str); } else { local @boot = &boot_interfaces(); local ($old) = grep { $_->{'fullname'} eq $_[0]->{'fullname'} } @boot; if (!$old && $_[0]->{'virtual'} ne '') { # A new virtual interface .. pick a virtual number automaticlly local $b; $_[0]->{'virtual'} = 0; foreach $b (&boot_interfaces()) { if ($b->{'name'} eq $_[0]->{'name'} && $b->{'virtual'} ne '' && $b->{'virtual'} >= $_[0]->{'virtual'}) { $_[0]->{'virtual'} = $b->{'virtual'}+1; } } $_[0]->{'fullname'} = $_[0]->{'name'}.':'.$_[0]->{'virtual'}; } &save_rc_conf('ifconfig_'.$_[0]->{'name'}.'_alias'.$_[0]->{'virtual'}, $str); } &unlock_file("/etc/rc.conf"); } # delete_interface(&details, [noshift]) # Delete a boot-time interface sub delete_interface { &lock_file("/etc/rc.conf"); if ($_[0]->{'virtual'} eq '') { # Remove the real interface &save_rc_conf('ifconfig_'.$_[0]->{'name'}); } else { # Remove a virtual interface, and shift down all aliases above it &save_rc_conf('ifconfig_'.$_[0]->{'name'}.'_alias'.$_[0]->{'virtual'}); if (!$_[1]) { local ($b, %lastb); foreach $b (&boot_interfaces()) { if ($b->{'name'} eq $_[0]->{'name'} && $b->{'virtual'} ne '' && $b->{'virtual'} > $_[0]->{'virtual'}) { # This one needs to be shifted down %lastb = %$b; $b->{'virtual'}--; &save_interface($b); } } &delete_interface(\%lastb, 1) if (%lastb); } } &unlock_file("/etc/rc.conf"); } # iface_type(name) # Returns a human-readable interface type name sub iface_type { return $_[0] =~ /^tun/ ? "Loopback tunnel" : $_[0] =~ /^sl/ ? "SLIP" : $_[0] =~ /^ppp/ ? "PPP" : $_[0] =~ /^lo/ ? "Loopback" : $_[0] =~ /^ar/ ? "Arnet" : $_[0] =~ /^(bge|em)/ ? "Gigabit ethernet" : $_[0] =~ /^(ax|mx|pn|rl|tx|wb)/ ? "Fast ethernet" : $_[0] =~ /^(cs|dc|de|ed|el|ex|fe|fxp|ie|le|lnc|tl|vr|vx|xl|ze|zp)/ ? "Ethernet" : $text{'ifcs_unknown'}; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { return 0; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] =~ /netmask|broadcast/; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, search & order sub get_dns_config { local $dns; &open_readfile(RESOLV, "/etc/resolv.conf"); while() { s/\r|\n//g; s/#.*$//g; if (/nameserver\s+(.*)/) { push(@{$dns->{'nameserver'}}, split(/\s+/, $1)); } elsif (/domain\s+(\S+)/) { $dns->{'domain'} = [ $1 ]; } elsif (/search\s+(.*)/) { $dns->{'domain'} = [ split(/\s+/, $1) ]; } } close(RESOLV); &open_readfile(HOST, "/etc/host.conf"); while() { s/\r|\n//g; s/#.*$//; push(@{$dns->{'order'}}, $_) if (/\S/); } close(HOST); $dns->{'files'} = [ "/etc/resolv.conf", "/etc/host.conf" ]; return $dns; } # save_dns_config(&config) # Writes out the resolv.conf and host.conf files sub save_dns_config { &lock_file("/etc/resolv.conf"); &open_readfile(RESOLV, "/etc/resolv.conf"); local @resolv = ; close(RESOLV); &open_tempfile(RESOLV, ">/etc/resolv.conf"); foreach (@{$_[0]->{'nameserver'}}) { print RESOLV "nameserver $_\n"; } if ($_[0]->{'domain'}) { if ($_[0]->{'domain'}->[1]) { &print_tempfile(RESOLV, "search ",join(" ", @{$_[0]->{'domain'}}),"\n"); } else { &print_tempfile(RESOLV, "domain $_[0]->{'domain'}->[0]\n"); } } foreach (@resolv) { &print_tempfile(RESOLV, $_) if (!/^\s*(nameserver|domain|search)\s+/); } &close_tempfile(RESOLV); &unlock_file("/etc/resolv.conf"); &open_lock_tempfile(HOST, ">/etc/host.conf"); foreach (@{$_[0]->{'order'}}) { &print_tempfile(HOST, $_,"\n"); } &close_tempfile(HOST); } $max_dns_servers = 3; # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { local @o = @{$_[0]->{'order'}}; local ($rv, $i, $j); local @srcs = ( "", "hosts", "bind", "nis" ); local @srcn = ( "", "Hosts", "DNS", "NIS" ); for($i=1; $i<@srcs; $i++) { local $ii = $i-1; $rv .= "\n"; } return $rv; } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { local($i, @order); for($i=0; defined($in{"order_$i"}); $i++) { push(@order, $in{"order_$i"}) if ($in{"order_$i"}); } $_[0]->{'order'} = \@order; } # get_hostname() sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &lock_file("/etc/rc.conf"); &system_logged("hostname $_[0] >/dev/null 2>&1"); &save_rc_conf('hostname', $_[0]); &unlock_file("/etc/rc.conf"); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( "/etc/defaults/rc.conf", "/etc/rc.conf" ); } sub routing_input { local %rc = &get_rc_conf(); local $defr = $rc{'defaultrouter'}; print " $text{'routes_default'} \n"; printf " %s\n", $defr eq 'NO' ? 'checked' : '', $text{'routes_none'}; printf "\n", $defr eq 'NO' ? '' : 'checked'; printf " \n", $defr eq 'NO' ? '' : $defr; local $gw = $rc{'gateway_enable'}; print " $text{'routes_forward'} \n"; printf " %s\n", $gw eq 'YES' ? 'checked' : '', $text{'yes'}; printf " %s \n", $gw eq 'YES' ? '' : 'checked', $text{'no'}; local $rd = $rc{'router_enable'}; print " $text{'routes_routed'} \n"; printf " %s\n", $rd eq 'YES' ? 'checked' : '', $text{'yes'}; printf " %s \n", $rd eq 'YES' ? '' : 'checked', $text{'no'}; } sub parse_routing { &lock_file("/etc/rc.conf"); $in{'defr_def'} || &check_ipaddress($in{'defr'}) || &error(&text('routes_edefault', $in{'defr'})); &save_rc_conf('defaultrouter', $in{'defr_def'} ? 'NO' : $in{'defr'}); &save_rc_conf('gateway_enable', $in{'gw'}); &save_rc_conf('router_enable', $in{'rd'}); &unlock_file("/etc/rc.conf"); } # save_rc_conf(name, value) sub save_rc_conf { local $found; &open_readfile(CONF, "/etc/rc.conf"); local @conf = ; close(CONF); &open_tempfile(CONF, ">/etc/rc.conf"); foreach (@conf) { if (/^\s*([^=]+)\s*=\s*(.*)/ && $1 eq $_[0]) { &print_tempfile(CONF, "$_[0]=\"$_[1]\"\n") if (@_ > 1); $found++; } else { &print_tempfile(CONF, $_); } } if (!$found && @_ > 1) { &print_tempfile(CONF, "$_[0]=\"$_[1]\"\n"); } &close_tempfile(CONF); } # get_rc_conf() sub get_rc_conf { local ($file, %rv); foreach $file ("/etc/defaults/rc.conf", "/etc/rc.conf") { &open_readfile(FILE, $file); while() { s/\r|\n//g; s/#.*$//; if (/^\s*([^=\s]+)\s*=\s*"(.*)"/ || /^\s*([^=\s]+)\s*=\s*(\S+)/) { $rv{$1} = $2; } } close(FILE); } return %rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/netstart) >/dev/null 2>&1"); } sub os_feedback_files { return ( "/etc/rc.conf", "/etc/resolv.conf", "/etc/host.conf", "/etc/resolv.conf" ); } 1; net/config-netbsd0100644000567100000120000000006010656003101013756 0ustar jcameronwheelhosts_file=/etc/hosts def_netmask=255.255.255.0 net/config.info.ja_JP.euc0100644000567100000120000000006210656003101015172 0ustar jcameronwheelhosts_file=ۥ̾ӥɥ쥹εҥե,0 net/config-windows0100664000567100000120000000011610656003101014175 0ustar jcameronwheelhosts_file=${systemroot}/system32/drivers/etc/hosts def_netmask=255.255.255.0 net/windows-lib.pl0100775000567100000120000002662110656003101014124 0ustar jcameronwheel# cygwin-lib.pl # Networking functions for cygwin # # TODO: # * detect when netsh isn't available # * save domain list # * save domainname my $logfile = "/dev/null"; #my $logfile = "/tmp/debugwb"; #define variables that modify the behavior of the .cgi scripts #that are different than any other OS. $noos_support_add_ifcs = 1; #Windows doesn't supporting adding interfaces $noos_support_delete_ifcs = 1; #Windows doesn't supporting deleting interfaces $always_apply_ifcs = 1; #Changes made to interfaces are always applied $routes_active_now = 1; #Changes made to routes are always applied #Note: some changes Windows requires a reboot, some don't. #TODO2: determine which changes require a reboot. # active_interfaces() # Returns a list of currently ifconfig'd interfaces # ifc keys: 'name','fullname','virtual','address','netmask','broadcast', # 'ether','mtu','up','edit','index','dhcp' sub active_interfaces { local(@rv, @lines, $line); &open_execute_command(IFC, "ipconfig /all", 1, 1); while () { s/\r|\n//g; push(@lines, $_); } close(IFC); #Need to get the list of boottime interfaces, because ipconfig /all #doesn't return ipaddr if cable is disconnected my @bootifs = boot_interfaces(); my %ifc = (); foreach $line (@lines) { if ($line =~ /Ethernet adapter (.*):/) { my $name = $1; if (defined($ifc{'name'})) { #save the previous one $ifc{'index'} = scalar(@rv); local ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4); if ($ifc{'address'}) { $ifc{'netmask'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; $ifc{'broadcast'} = sprintf("%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff); } my %tmp = %ifc; push(@rv, \%tmp); } %ifc = (); $ifc{'name'} = $ifc{'fullname'} = $name; } elsif ($line =~ /Media State.*: (.*)/) { $ifc{'up'} = ($1 !~ /Disconnected/); foreach (@bootifs) { if ($_->{'name'} eq $ifc{'name'}) { $ifc{'dhcp'} = $_->{'dhcp'}; $ifc{'address'} = $_->{'address'}; $ifc{'netmask'} = $_->{'netmask'}; } } } elsif ($line =~ /Description.*: (.*) \#(\d+)\s*$/) { $ifc{'desc'} = $1; $ifc{'index'} = $2; } elsif ($line =~ /Description.*: (.*)$/) { $ifc{'desc'} = $1; chop($ifc{'desc'}); $ifc{'num'} = 1; } elsif ($line =~ /Physical Address.*: (.+)$/) { $ifc{'ether'} = $1; $ifc{'ether'} =~ s/-/:/g; } elsif ($line =~ /IP Address.*: (.+)$/) { $ifc{'address'} = $1; $ifc{'up'} = 1 if ! defined $ifc{'up'}; } elsif ($line =~ /Subnet Mask.*: (.+)$/) { $ifc{'netmask'} = $1; } elsif ($line =~ /Default Gateway.*: (.+)$/) { #this is used for the router subroutines below $ifc{'gateway'} = $1; } elsif ($line =~ /DHCP Enabled.*: (.+)$/) { $ifc{'dhcp'} = ($1 =~ /Yes/); } } if (defined($ifc{'name'})) { #save the last one $ifc{'index'} = scalar(@rv); local ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4); if ($ifc{'address'}) { $ifc{'netmask'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; $ifc{'broadcast'} = sprintf("%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff); } my %tmp = %ifc; push(@rv, \%tmp); } return @rv; } # activate_interface(&details) # Create or modify an interface sub activate_interface { save_interface($@); #Windows doesn't support adding or removing interfaces } # apply_interface(&details) # Save changes to an interface active now sub apply_interface { save_interface($@); } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { #TODO2: determine how to deactivate an interface } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { my @rv = (); #It doesn't seem to really help to display the loopback since #there's no mechanism in Windows to edit it. # push(@rv, { 'name' => 'lo0', # 'fullname' => 'lo0', # 'address' => '127.0.0.1', # 'netmask' => '255.0.0.0', # 'up' => 1, # 'edit' => 0 }); my (@lines, $l); &open_execute_command(IFC, "netsh interface ip dump", 1); while () { s/\r|\n//g; push(@lines, $_); } close(IFC); #my %ifc = (); foreach $l (@lines) { #TODO2: handle this message: #"Cannot access configuration. # Connection UI or someone else is accessing it." if ($l =~ /^set address name = "(.*)" source = dhcp/) { local %ifc; $ifc{'fullname'} = $ifc{'name'} = $1; $ifc{'index'} = scalar(@rv); $ifc{'edit'}++; $ifc{'dhcp'} = 1; $ifc{'up'} = 1; push(@rv, \%ifc); } elsif ($l =~ /^set address name = "(.*)" source = static addr = ([\d\.]+) mask = ([\d\.]+)/) { local %ifc; $ifc{'fullname'} = $ifc{'name'} = $1; $ifc{'address'} = $2; $ifc{'netmask'} = $3; $ifc{'index'} = scalar(@rv); $ifc{'edit'}++; $ifc{'address'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; local ($a1, $a2, $a3, $a4) = ($1, $2, $3, $4); $ifc{'netmask'} =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/; $ifc{'broadcast'} = sprintf("%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff); $ifc{'dhcp'} = 0; $ifc{'up'} = 1; push(@rv, \%ifc); } elsif ($l =~ /^set address name = "(.*)" gateway = ([\d\.]+) gwmetric = (\d)/) { foreach (@rv) { if ($_->{'name'} eq $1) { $_->{'gateway'} = $2; $_->{'gwmetric'} = $3; } } } } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { my $ifc = $_[0]; my $cmd = "netsh interface ip set address name = \"" . "$ifc->{'name'}\" source = "; if ($ifc->{'dhcp'}) { $cmd .= "dhcp"; } else { $cmd .= "static addr = $ifc->{'address'} mask = $ifc->{'netmask'}"; } system_logged("$cmd >$logfile 2>&1"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { #Windows doesn't support adding or removing interfaces } # iface_type(name) # Returns a human-readable interface type name sub iface_type { #TODO2 #return "Fast Ethernet" if #return "Token Ring" if #return "PPP" if return "Loopback" if $_[0] =~ /^lo0$/; return "Ethernet"; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { #TODO2: PPP return $_[0] !~ /^(lo\d)$/; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] =~ /^(dhcp|netmask)$/; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return 1 if (&check_ipaddress($_[0])); return gethostbyname($_[0]) ? 1 : 0; } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, order sub get_dns_config { my @lines = (); my $dns = {'domain' => []}; my $i = 0; if (&open_execute_command(CMD, "ipconfig /all", 1)) { my $doing_domain = 0; while () { s/[\n\r]//g; if ($doing_domain) { if (/(Ethernet adapter|:)/) { $doing_domain = 0; } elsif (/^\s*([^:]+\.[^:]+)$/) { push(@{$dns->{"domain"}}, $1); } } if (/Primary DNS Suffix.*: (.*)/) { push(@{$dns->{"domain"}}, $1); } elsif (/DNS Suffix Search List.*: (.*)/) { $doing_domain = 1; push(@{$dns->{"domain"}}, $1); } elsif (/^Ethernet adapter (.*):/) { $dns->{"name"}[$i++] = $1; } } close(CMD); } if (&open_execute_command(CMD, "netsh interface ip show dns", 1)) { my $doing_nameserver = 0; my $i = -1; my $key = "nameserver"; while () { s/\r|\n//g; if ($doing_nameserver) { if (/(Configuration for interface|:)/) { $doing_nameserver = 0; } elsif (/^\s*([\d\.]+)/) { push(@{$dns->{$key}}, $1); } } if (/Configuration for interface "(.*)"/) { $dns->{'name'}[++$i] = $1; $key = "nameserver"; $key .= $i if $i > 0; } elsif (/Statically Configured DNS Servers:\s*([\d\.]+)/) { push(@{$dns->{$key}}, $1); $doing_nameserver = 1; } } close(CMD); } return $dns; } # save_dns_config(&config) # Configures the DNS settings sub save_dns_config { my $dns = $_[0]; for ($i=0; $i < @{$dns->{'name'}}; $i++) { my $key = "nameserver"; $key .= $i if $i > 0; if (@{$dns->{$key}}) { my $cmd_fmt = "netsh interface ip %s dns name = \"" . $dns->{'name'}[$i] . "\"%s addr = %s"; my $addr = pop(@{$dns->{$key}}); my $cmd = sprintf($cmd_fmt, "set", " source = static", $addr); &system_logged("$cmd >$logfile 2>&1"); #add the new ones (any old list of adds was erased by the set cmd) foreach (@{$dns->{$key}}) { $cmd = sprintf($cmd_fmt, "add", "", $_); &system_logged("$cmd >$logfile 2>&1"); } } else { #set it to be obtained automatically my $cmd = "netsh interface ip set dns name = \"" . $dns->{'name'}[$i] . "\" source = dhcp"; &system_logged("$cmd >$logfile 2>&1"); #any old list of adds was erased by the set cmd } } #TODO: support saving the domain list #if ($_[0]->{'domain'}) { } $max_dns_servers = 16; #more is possible, but this is realistic # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { #TODO2 } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { #TODO2 } # get_hostname() sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { #TODO: determine how to get return ""; } # save_domainname(domain) sub save_domainname { #TODO: determine how to set } sub routing_config_files { return map { $_->{'file'} } &boot_interfaces(); } sub routing_input { # show default router(s) input my @if = boot_interfaces(); my $i = 0; foreach (@if) { next if $_->{'address'} eq "127.0.0.1"; my $none_or_dhcp = ! defined $ifc{'gateway'}; my $desc = $_->{'name'} . ($_->{'dhcp'}? "" : " ($_->{'address'})"); print "$desc $text{'routes_default'}:" . "\n"; printf " %s\n", $none_or_dhcp ? 'checked' : '', $text{'routes_none'}; printf "\n", $_->{'name'}; printf " %s", $none_or_dhcp ? '' : 'checked', $text{'routes_gateway'}; printf "\n", $_->{'gateway'}; print "$text{'routes_gwmetric'}"; printf "\n", $_->{'gwmetric'}; print "\n"; $i++; } } sub parse_routing { my $i = 0; my @if = boot_interfaces(); while (defined($in{"gateway${i}_def"})) { my $name = $in{"ifname$i"}; my $gateway = $in{"gateway$i"}; my $gwmetric = $in{"gwmetric$i"}; foreach (@if) { if ($_->{'name'} eq $name) { if (! $in{"gateway${i}_def"}) { if ($gateway != $_->{'gateway'} || $gwmetric != $_->{'gwmetric'}) { &check_ipaddress($gateway) || &error(&text('routes_egateway', $gateway)); my $cmd = "netsh interface ip set address name = \"" . $_->{'name'} . "\" gateway = $gateway " . "gwmetric = $gwmetric"; system_logged("$cmd > $logfile 2>&1"); } } else { if (defined($_->{'gateway'})) { my $cmd = "netsh interface ip delete address name = \"" . $_->{'name'} . "\" gateway = $_->{'gateway'}"; system_logged("$cmd > $logfile 2>&1"); } } } } $i++; } } 1; net/feedback_files.pl0100775000567100000120000000011410656003101014561 0ustar jcameronwheel do 'net-lib.pl'; sub feedback_files { return &os_feedback_files(); } 1; net/suse-linux-8.0-lib.pl0100755000567100000120000001766510656003101015057 0ustar jcameronwheel# united-linux-lib.pl # Networking functions for united linux $net_scripts_dir = "/etc/sysconfig/network"; $routes_config = "/etc/sysconfig/network/routes"; $sysctl_config = "/etc/sysconfig/sysctl"; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { next if ($f !~ /^ifcfg-([a-z0-9:\.]+)$/); local (%conf, $b); $b->{'fullname'} = $1; &read_env_file("$net_scripts_dir/$f", \%conf); if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } delete($conf{'PREFIXLEN'}); $conf{'BROADCAST'} = $_[0]->{'broadcast'}; $conf{'STARTMODE'} = $_[0]->{'up'} ? "onboot" : $conf{'STARTMODE'} eq "onboot" ? "manual" : $conf{'STARTMODE'}; $conf{'BOOTPROTO'} = $_[0]->{'dhcp'} ? "dhcp" : "static"; $conf{'UNIQUE'} = time(); &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &unlink_logged("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "mtu" && $_[0] ne "bootp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { return ( $routes_config, $sysctl_config ); } sub routing_input { local (@routes, $i); &open_readfile(ROUTES, $routes_config); while() { s/#.*$//; s/\r|\n//g; local @r = map { $_ eq '-' ? undef : $_ } split(/\s+/, $_); push(@routes, \@r) if (@r); } close(ROUTES); # show default router and device local ($def) = grep { $_->[0] eq "default" } @routes; print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $def->[1] ? "" : "checked"; printf "\n", $def->[1] ? "checked" : ""; printf " \n", $def->[1]; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $def->[3] ? "" : "checked"; printf "\n", $def->[3] ? "checked" : ""; printf " \n", $def->[3]; &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'IP_FORWARD'} eq 'yes' ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'IP_FORWARD'} eq 'yes' ? "" : "checked"; # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", " ", "\n"; local ($r, $i = 0); foreach $r (@routes, [ ]) { next if ($r eq $def); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}$text{'routes_type'}
\n"; } sub parse_routing { # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { gethostbyname($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { $in{'gatewaydev'} =~ /^\S+$/ || &error(&text('routes_edevice', $in{'gatewaydev'})); $def[3] = $in{'gatewaydev'}; } push(@routes, \@def); } for($i=0; defined($in{"dev_$i"}); $i++) { next if (!$in{"net_$i"}); &check_ipaddress($in{"net_$i"}) || $in{"net_$i"} =~ /^(\S+)\/(\d+)$/ && &check_ipaddress($1) || &error(&text('routes_enet', $in{"net_$i"})); $in{"dev_$i"} =~ /^\S*$/ || &error(&text('routes_edevice', $dev)); !$in{"netmask_$i"} || &check_ipaddress($in{"netmask_$i"}) || &error(&text('routes_emask', $in{"netmask_$i"})); !$in{"gw_$i"} || &check_ipaddress($in{"gw_$i"}) || &error(&text('routes_egateway', $in{"gw_$i"})); $in{"type_$i"} =~ /^\S*$/ || &error(&text('routes_etype', $in{"type_$i"})); push(@routes, [ $in{"net_$i"}, $in{"gw_$i"}, $in{"netmask_$i"}, $in{"dev_$i"}, $in{"type_$i"} ] ); } # Save routes and routing option &open_tempfile(ROUTES, ">$routes_config"); foreach $r (@routes) { &print_tempfile(ROUTES,join(" ", map { $_ eq '' ? "-" : $_ } @$r),"\n"); } &close_tempfile(ROUTES); local $lref = &read_file_lines($sysctl_config); for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^\s*IP_FORWARD\s*=/) { $lref->[$i] = "IP_FORWARD=".($in{'forward'} ? "yes" : "no"); } } &flush_file_lines(); } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } 1; net/interface_chooser.cgi0100775000567100000120000000752510656003101015501 0ustar jcameronwheel#!/usr/local/bin/perl # interface_chooser.cgi # # Based on user_chooser.cgi by Jamie Cameron # (c) Tomas Pospisek # Licensed under the webmin license # # made possible by: # Sourcepole http://sourcepole.ch # under contract from: # AO Media Services http://www.ao-asif.ch/aoi/media/ # Thanks! # # TODO: # replace active_interfaces by a merged list from active_* and boot_interfaces # # This CGI generated the HTML for choosing an interface or a list of interfaces. require './../web-lib.pl'; require './net-lib.pl'; &init_config(); &ReadParse(); %access = &get_module_acl(); if ($in{'multi'}) { # selecting multiple interfaces. if ($in{'frame'} == 0) { # base frame &PrintHeader(); print "\n"; print "$text{'interfaces_title1'}\n"; print "\n"; print "\n"; print "\n"; print " \n"; print " \n"; print "\n"; print "\n"; } elsif ($in{'frame'} == 1) { # list of all interfaces to choose from &ui_print_header(undef, ); print "\n"; print "$text{'interfaces_all'}\n"; print "\n"; foreach $if (&active_interfaces()) { if ($in{'interface'} eq $if->{'fullname'}) { print "\n"; } else { print "\n"; } print "\n"; } print "
$if->{'fullname'}
\n"; } elsif ($in{'frame'} == 2) { # show chosen interfaces &ui_print_header(undef, ); print "$text{'interfaces_sel'}\n"; print <<'EOF';
EOF } elsif ($in{'frame'} == 3) { # output OK and Cancel buttons &ui_print_header(undef, ); print "
\n"; print "\n"; print "\n"; print "  \n"; print "
\n"; } } else { # selecting just one interface .. display a list of all interfaces to choose from &ui_print_header(undef, ); print "\n"; print "$text{'interfaces_title2'}\n"; print "\n"; foreach $if (&active_interfaces()) { if ($in{'interface'} eq $if->{'fullname'}) { print "\n"; } else { print "\n"; } print "\n"; } print "
$if->{'fullname'}
\n"; } net/gentoo-linux-lib.pl0100775000567100000120000002042710656003101015060 0ustar jcameronwheel# Networking functions for Gentoo 2006+ do 'linux-lib.pl'; $gentoo_net_config = "/etc/conf.d/net"; $min_virtual_number = 1; # parse_gentoo_net() # Parses the Gentoo net config file into an array of named sections sub parse_gentoo_net { local @rv; local $sect; local $lnum = 0; open(CONF, $gentoo_net_config); while() { s/\r|\n//g; s/#.*$//; if (/^\s*(\S+)\s*=\s*\((.*)/) { # Start of some section, which may span several lines $sect = { 'name' => $1, 'line' => $lnum }; push(@rv, $sect); local $v = $2; if ($v =~ /^(.*)\)/) { # Ends on same line $sect->{'values'} = [ &split_gentoo_values("$1") ]; $sect->{'eline'} = $lnum; $sect = undef; } else { # May span multiple $sect->{'values'} = [ &split_gentoo_values($v) ]; } } elsif (/^\s*\)/ && $sect) { # End of a section $sect->{'eline'} = $lnum; $sect = undef; } elsif (/^\s*(".*")\s*\)/ && $sect) { # End of a section, but with some values before it push(@{$sect->{'values'}}, &split_gentoo_values("$1")); $sect->{'eline'} = $lnum; $sect = undef; } elsif (/^\s*(".*")/ && $sect) { # Values within a section push(@{$sect->{'values'}}, &split_gentoo_values("$1")); } $lnum++; } close(CONF); return @rv; } # save_gentoo_net(&old, &new) # Update or create a Gentoo net config file section sub save_gentoo_net { local ($old, $new) = @_; local @lines; if ($new) { push(@lines, $new->{'name'}."=("); foreach my $v (@{$new->{'values'}}) { push(@lines," \"$v\""); } push(@lines, ")"); } local $lref = &read_file_lines($gentoo_net_config); if ($old && $new) { # Replace section splice(@$lref, $old->{'line'}, $old->{'eline'}-$old->{'line'}+1, @lines); $new->{'eline'} = $new->{'line'}+scalar(@lines)-1; } elsif ($old && !$new) { # Delete section splice(@$lref, $old->{'line'}, $old->{'eline'}-$old->{'line'}+1); } elsif (!$old && $new) { # Add section $new->{'line'} = scalar(@$lref); $new->{'eline'} = $new->{'line'}+scalar(@lines)-1; push(@$lref, @lines); } &flush_file_lines($gentoo_net_config); } # split_gentoo_values(string) # Splits a string like "foo bar" "smeg spod" into an array sub split_gentoo_values { local ($str) = @_; local @rv; while($str =~ /^\s*"([^"]+)",?(.*)/) { push(@rv, $1); $str = $2; } return @rv; } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local @rv; foreach my $g (&parse_gentoo_net()) { if ($g->{'name'} =~ /^config_(\S+)/) { local $gn = $1; local $n = 0; foreach my $v (@{$g->{'values'}}) { # An interface definition local $iface = { 'name' => $gn, 'up' => 1, 'edit' => 1, 'index' => scalar(@rv) }; if ($n == 0) { $iface->{'fullname'} = $gn; } else { $iface->{'fullname'} = $gn.":".$n; $iface->{'virtual'} = $n; } local @w = split(/\s+/, $v); if ($w[0] eq "dhcp") { $iface->{'dhcp'} = 1; } elsif ($w[0] eq "noop") { # Skipped, but still uses a up a number $n++; next; } if (&check_ipaddress($w[0])) { $iface->{'address'} = $w[0]; } elsif ($w[0] =~ /^([0-9\.]+)\/(\d+)$/) { $iface->{'address'} = $1; $iface->{'netmask'} = &prefix_to_mask($2); } for($i=1; $i<@w; $i++) { if ($w[$i] eq "netmask") { $iface->{'netmask'} = $w[++$i]; } elsif ($w[$i] eq "broadcast") { $iface->{'broadcast'} = $w[++$i]; } elsif ($w[$i] eq "mtu") { $iface->{'mtu'} = $w[++$i]; } } if ($iface->{'address'} && $iface->{'netmask'}) { $iface->{'broadcast'} ||= &compute_broadcast( $iface->{'address'}, $iface->{'netmask'}); } $iface->{'gentoo'} = $g; push(@rv, $iface); $n++; } } elsif ($g->{'name'} =~ /^routes_(\S+)/) { # A route definition for an interface local ($iface) = grep { $_->{'fullname'} eq $1 } @rv; local $spec = $g->{'values'}->[0]; if ($iface) { if ($spec =~ /default\s+via\s+([0-9\.]+)/ || $spec =~ /default\s+([0-9\.]+)/) { $iface->{'gateway'} = $1; $iface->{'gentoogw'} = $g; } } } $lnum++; } return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local ($iface) = @_; &lock_file($gentoo_net_config); # Build the interface line local @w; if ($iface->{'dhcp'}) { push(@w, "dhcp"); } else { push(@w, $iface->{'address'}); if ($iface->{'netmask'}) { push(@w, "netmask", $iface->{'netmask'}); } if ($iface->{'broadcast'}) { push(@w, "broadcast", $iface->{'broadcast'}); } if ($iface->{'mtu'}) { push(@w, "mtu", $iface->{'mtu'}); } } # Find the current block for this interface local @gentoo = &parse_gentoo_net(); local ($g) = grep { $_->{'name'} eq 'config_'.$iface->{'name'} } @gentoo; if ($g) { # Found it .. append or replace while (!$g->{'values'}->[$iface->{'virtual'}]) { push(@{$g->{'values'}}, "noop"); } $g->{'values'}->[$iface->{'virtual'}] = join(" ", @w); &save_gentoo_net($g, $g); } else { # Needs a new block $g = { 'name' => $iface->{'name'}, 'values' => [ join(" ", @w) ] }; &save_gentoo_net(undef, $g); } &unlock_file($gentoo_net_config); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local ($iface) = @_; # Find the current block for this interface &lock_file($gentoo_net_config); local @gentoo = &parse_gentoo_net(); local ($g) = grep { $_->{'name'} eq 'config_'.$iface->{'name'} } @gentoo; if ($g) { # Found it .. take out the interface if ($iface->{'virtual'} == scalar(@{$g->{'values'}})-1) { # Last one pop(@{$g->{'values'}}); } else { $g->{'values'}->[$iface->{'virtual'}] = 'noop'; } &save_gentoo_net($g, $g); } &unlock_file($gentoo_net_config); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne 'up' && $_[0] ne 'bootp'; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %host; &read_env_file("/etc/conf.d/hostname", \%host); $host{'HOSTNAME'} = $_[0]; &write_env_file("/etc/conf.d/hostname", \%host); &system_logged("hostname $_[0] >/dev/null 2>&1"); } # routing_input() # Prints HTML for editing routing settings sub routing_input { local ($gw, $dev) = &get_default_gateway(); local @ifaces = grep { $_->{'virtual'} eq '' } &boot_interfaces(); print " $text{'routes_def'}\n"; print "",&ui_radio("route_def", $gw ? 0 : 1, [ [ 1, $text{'routes_nogw'}."
" ], [ 0, &text('routes_ggw', &ui_textbox("gw", $gw, 20), &ui_select("dev", $dev, [ map { $_->{'name'} } @ifaces ])) ] ]), " \n"; } # parse_routing() # Applies settings from routing_input form sub parse_routing { if ($in{'route_def'}) { &set_default_gateway(); } else { &check_ipaddress($in{'gw'}) || &error(&text('routes_edefault', $in{'gw'})); &set_default_gateway($in{'gw'}, $in{'dev'}); } } # apply_network() # Apply the interface and routing settings sub apply_network { opendir(DIR, "/etc/init.d"); foreach my $f (readdir(DIR)) { if ($f =~ /^net.(\S+)/ && $1 ne "lo") { &system_logged("cd / ; /etc/init.d/$f restart >/dev/null 2>&1 {'gateway'} } @ifaces; if ($iface) { return ( $iface->{'gateway'}, $iface->{'name'} ); } else { return ( ); } } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { local ($gw, $dev) = @_; &lock_file($gentoo_net_config); local @ifaces = &boot_interfaces(); local ($iface) = grep { $_->{'gateway'} } @ifaces; if ($iface && $gw) { # Change existing default route $g = $iface->{'gentoogw'}; $g->{'name'} = 'routes_'.$dev; $g->{'values'}->[0] = "default via $gw"; &save_gentoo_net($g, $g); } elsif ($iface && !$gw) { # Deleting existing default route $g = $iface->{'gentoogw'}; &save_gentoo_net($g, undef); } elsif (!$iface && $gw) { # Adding new default route $g = { 'name' => 'routes_'.$dev, 'values' => [ "default via $gw" ] }; &save_gentoo_net(undef, $g); } &unlock_file($gentoo_net_config); } net/coherent-linux-lib.pl0100755000567100000120000005516610656003101015402 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-scripts"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/networking/devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifcfg-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifcfg-$name", "$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range". $_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &unlink_file("$net_scripts_dir/ifcfg-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifcfg-$name"); } &unlock_file("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifcfg-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/united-linux-lib.pl0100755000567100000120000001766510656003101015065 0ustar jcameronwheel# united-linux-lib.pl # Networking functions for united linux $net_scripts_dir = "/etc/sysconfig/network"; $routes_config = "/etc/sysconfig/network/routes"; $sysctl_config = "/etc/sysconfig/sysctl"; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { next if ($f !~ /^ifcfg-([a-z0-9:\.]+)$/); local (%conf, $b); $b->{'fullname'} = $1; &read_env_file("$net_scripts_dir/$f", \%conf); if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } delete($conf{'PREFIXLEN'}); $conf{'BROADCAST'} = $_[0]->{'broadcast'}; $conf{'STARTMODE'} = $_[0]->{'up'} ? "onboot" : $conf{'STARTMODE'} eq "onboot" ? "manual" : $conf{'STARTMODE'}; $conf{'BOOTPROTO'} = $_[0]->{'dhcp'} ? "dhcp" : "static"; $conf{'UNIQUE'} = time(); &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &unlink_logged("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "mtu" && $_[0] ne "bootp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { return ( $routes_config, $sysctl_config ); } sub routing_input { local (@routes, $i); &open_readfile(ROUTES, $routes_config); while() { s/#.*$//; s/\r|\n//g; local @r = map { $_ eq '-' ? undef : $_ } split(/\s+/, $_); push(@routes, \@r) if (@r); } close(ROUTES); # show default router and device local ($def) = grep { $_->[0] eq "default" } @routes; print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $def->[1] ? "" : "checked"; printf "\n", $def->[1] ? "checked" : ""; printf " \n", $def->[1]; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $def->[3] ? "" : "checked"; printf "\n", $def->[3] ? "checked" : ""; printf " \n", $def->[3]; &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'IP_FORWARD'} eq 'yes' ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'IP_FORWARD'} eq 'yes' ? "" : "checked"; # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", " ", "\n"; local ($r, $i = 0); foreach $r (@routes, [ ]) { next if ($r eq $def); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}$text{'routes_type'}
\n"; } sub parse_routing { # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { gethostbyname($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { $in{'gatewaydev'} =~ /^\S+$/ || &error(&text('routes_edevice', $in{'gatewaydev'})); $def[3] = $in{'gatewaydev'}; } push(@routes, \@def); } for($i=0; defined($in{"dev_$i"}); $i++) { next if (!$in{"net_$i"}); &check_ipaddress($in{"net_$i"}) || $in{"net_$i"} =~ /^(\S+)\/(\d+)$/ && &check_ipaddress($1) || &error(&text('routes_enet', $in{"net_$i"})); $in{"dev_$i"} =~ /^\S*$/ || &error(&text('routes_edevice', $dev)); !$in{"netmask_$i"} || &check_ipaddress($in{"netmask_$i"}) || &error(&text('routes_emask', $in{"netmask_$i"})); !$in{"gw_$i"} || &check_ipaddress($in{"gw_$i"}) || &error(&text('routes_egateway', $in{"gw_$i"})); $in{"type_$i"} =~ /^\S*$/ || &error(&text('routes_etype', $in{"type_$i"})); push(@routes, [ $in{"net_$i"}, $in{"gw_$i"}, $in{"netmask_$i"}, $in{"dev_$i"}, $in{"type_$i"} ] ); } # Save routes and routing option &open_tempfile(ROUTES, ">$routes_config"); foreach $r (@routes) { &print_tempfile(ROUTES,join(" ", map { $_ eq '' ? "-" : $_ } @$r),"\n"); } &close_tempfile(ROUTES); local $lref = &read_file_lines($sysctl_config); for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^\s*IP_FORWARD\s*=/) { $lref->[$i] = "IP_FORWARD=".($in{'forward'} ? "yes" : "no"); } } &flush_file_lines(); } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } 1; net/linux-lib.pl0100775000567100000120000002206610656003101013570 0ustar jcameronwheel# linux-lib.pl # Active interface functions for all flavours of linux # active_interfaces() # Returns a list of currently ifconfig'd interfaces sub active_interfaces { local(@rv, @lines, $l); &open_execute_command(IFC, "ifconfig -a", 1, 1); while() { s/\r|\n//g; if (/^\S+/) { push(@lines, $_); } else { $lines[$#lines] .= $_; } } close(IFC); foreach $l (@lines) { local %ifc; $l =~ /^([^:\s]+)/; $ifc{'name'} = $1; $l =~ /^(\S+)/; $ifc{'fullname'} = $1; if ($l =~ /^(\S+):(\d+)/) { $ifc{'virtual'} = $2; } if ($l =~ /inet addr:(\S+)/) { $ifc{'address'} = $1; } elsif (!$_[0]) { next; } if ($l =~ /Mask:(\S+)/) { $ifc{'netmask'} = $1; } if ($l =~ /Bcast:(\S+)/) { $ifc{'broadcast'} = $1; } if ($l =~ /HWaddr (\S+)/) { $ifc{'ether'} = $1; } if ($l =~ /MTU:(\d+)/) { $ifc{'mtu'} = $1; } if ($l =~ /P-t-P:(\S+)/) { $ifc{'ptp'} = $1; } $ifc{'up'}++ if ($l =~ /\sUP\s/); $ifc{'promisc'}++ if ($l =~ /\sPROMISC\s/); $ifc{'edit'} = ($ifc{'name'} !~ /^ppp/); $ifc{'index'} = scalar(@rv); push(@rv, \%ifc); } return @rv; } # activate_interface(&details) # Create or modify an interface sub activate_interface { local $a = $_[0]; local $cmd = "ifconfig $a->{'name'}"; if ($a->{'virtual'} ne "") { $cmd .= ":$a->{'virtual'}"; } $cmd .= " $a->{'address'}"; if ($a->{'netmask'}) { $cmd .= " netmask $a->{'netmask'}"; } if ($a->{'broadcast'}) { $cmd .= " broadcast $a->{'broadcast'}"; } if ($a->{'mtu'} && $a->{'virtual'} eq "") { $cmd .= " mtu $a->{'mtu'}"; } if ($a->{'up'}) { $cmd .= " up"; } else { $cmd .= " down"; } local $out = &backquote_logged("$cmd 2>&1"); if ($?) { &error($out); } if ($a->{'ether'}) { $out = &backquote_logged( "ifconfig $a->{'name'} hw ether $a->{'ether'} 2>&1"); if ($?) { &error($out); } } } # deactivate_interface(&details) # Shutdown some active interface sub deactivate_interface { local $name = $_[0]->{'name'}. ($_[0]->{'virtual'} ne "" ? ":$_[0]->{'virtual'}" : ""); if ($_[0]->{'virtual'} ne "") { # Shutdown virtual interface by setting address to 0 local $out = &backquote_logged("ifconfig $name 0 2>&1"); } local ($still) = grep { $_->{'fullname'} eq $name } &active_interfaces(); if ($still) { # Old version of ifconfig or non-virtual interface.. down it local $out = &backquote_logged("ifconfig $name down 2>&1"); local ($still) = grep { $_->{'fullname'} eq $name } &active_interfaces(); if ($still) { &error("
$out
"); } } } # iface_type(name) # Returns a human-readable interface type name sub iface_type { if ($_[0] =~ /^(.*)\.(\d+)$/) { return &iface_type("$1")." VLAN"; } return "PPP" if ($_[0] =~ /^ppp/); return "SLIP" if ($_[0] =~ /^sl/); return "PLIP" if ($_[0] =~ /^plip/); return "Ethernet" if ($_[0] =~ /^eth/); return "Wireless Ethernet" if ($_[0] =~ /^(wlan|ath)/); return "Arcnet" if ($_[0] =~ /^arc/); return "Token Ring" if ($_[0] =~ /^tr/); return "Pocket/ATP" if ($_[0] =~ /^atp/); return "Loopback" if ($_[0] =~ /^lo/); return "ISDN rawIP" if ($_[0] =~ /^isdn/); return "ISDN syncPPP" if ($_[0] =~ /^ippp/); return "CIPE" if ($_[0] =~ /^cip/); return "VmWare" if ($_[0] =~ /^vmnet/); return "Wireless" if ($_[0] =~ /^wlan/); return "Bonded" if ($_[0] =~ /^bond/); return $text{'ifcs_unknown'}; } # list_routes() # Returns a list of active routes sub list_routes { local @rv; &open_execute_command(ROUTES, "netstat -rn", 1, 1); while() { s/\s+$//; if (/^([0-9\.]+)\s+([0-9\.]+)\s+([0-9\.]+)\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)$/) { push(@rv, { 'dest' => $1, 'gateway' => $2, 'netmask' => $3, 'iface' => $4 }); } } close(ROUTES); return @rv; } # create_route(&route) # Delete one active route, as returned by list_routes. Returns an error message # on failure, or undef on success sub delete_route { local ($route) = @_; local $cmd = "route del "; if (!$route->{'dest'} || $route->{'dest'} eq '0.0.0.0') { $cmd .= " default"; } elsif ($route->{'netmask'} eq '255.255.255.255') { $cmd .= " -host $route->{'dest'}"; } else { $cmd .= " -net $route->{'dest'}"; if ($route->{'netmask'} && $route->{'netmask'} ne '0.0.0.0') { $cmd .= " netmask $route->{'netmask'}"; } } if ($route->{'gateway'}) { $cmd .= " gw $route->{'gateway'}"; } elsif ($route->{'iface'}) { $cmd .= " dev $route->{'iface'}"; } local $out = &backquote_logged("$cmd 2>&1 {'dest'}) { $cmd .= " default"; } else { if ($route->{'netmask'} eq '255.255.255.255') { $cmd .= " -host $route->{'dest'}"; } elsif ($route->{'netmask'}) { $cmd .= " -net $route->{'dest'} netmask $route->{'netmask'}"; } else { $cmd .= " $route->{'dest'}"; } } if ($route->{'gateway'}) { $cmd .= " gw $route->{'gateway'}"; } if ($route->{'iface'}) { $cmd .= " dev $route->{'iface'}"; } local $out = &backquote_logged("$cmd 2>&1 {'NAMESERVER'}) { # Special case - get DNS settings from SuSE config local @ns = split(/\s+/, $rc->{'NAMESERVER'}->{'value'}); $dns->{'nameserver'} = [ grep { $_ ne "YAST_ASK" } @ns ]; local $src = $rc->{'SEARCHLIST'}; $dns->{'domain'} = [ split(/\s+/, $src->{'value'}) ] if ($src); $dnsfile = $rc_config; } else { &open_readfile(RESOLV, "/etc/resolv.conf"); while() { s/\r|\n//g; s/#.*$//; if (/nameserver\s+(.*)/) { push(@{$dns->{'nameserver'}}, split(/\s+/, $1)); } elsif (/domain\s+(\S+)/) { $dns->{'domain'} = [ $1 ]; } elsif (/search\s+(.*)/) { $dns->{'domain'} = [ split(/\s+/, $1) ]; } } close(RESOLV); $dnsfile = "/etc/resolv.conf"; } &open_readfile(SWITCH, "/etc/nsswitch.conf"); while() { s/\r|\n//g; if (/^\s*hosts:\s+(.*)/) { $dns->{'order'} = $1; } } close(SWITCH); $dns->{'files'} = [ $dnsfile, "/etc/nsswitch.conf" ]; return $dns; } # save_dns_config(&config) # Writes out the resolv.conf and nsswitch.conf files sub save_dns_config { local $rc; &lock_file($rc_config) if ($suse_dns_config); if ($use_suse_dns && ($rc = &parse_rc_config()) && $rc->{'NAMESERVER'}) { &save_rc_config($rc, "NAMESERVER", join(" ", @{$_[0]->{'nameserver'}})); &save_rc_config($rc, "SEARCHLIST", join(" ", @{$_[0]->{'domain'}})); } else { &lock_file("/etc/resolv.conf"); &open_readfile(RESOLV, "/etc/resolv.conf"); local @resolv = ; close(RESOLV); &open_tempfile(RESOLV, ">/etc/resolv.conf"); foreach (@{$_[0]->{'nameserver'}}) { &print_tempfile(RESOLV, "nameserver $_\n"); } if ($_[0]->{'domain'}) { if ($_[0]->{'domain'}->[1]) { &print_tempfile(RESOLV, "search ",join(" ", @{$_[0]->{'domain'}}),"\n"); } else { &print_tempfile(RESOLV, "domain $_[0]->{'domain'}->[0]\n"); } } foreach (@resolv) { &print_tempfile(RESOLV, $_) if (!/^\s*(nameserver|domain|search)\s+/); } &close_tempfile(RESOLV); &unlock_file("/etc/resolv.conf"); } &lock_file("/etc/nsswitch.conf"); &open_readfile(SWITCH, "/etc/nsswitch.conf"); local @switch = ; close(SWITCH); &open_tempfile(SWITCH, ">/etc/nsswitch.conf"); foreach (@switch) { if (/^\s*hosts:\s+/) { &print_tempfile(SWITCH, "hosts:\t$_[0]->{'order'}\n"); } else { &print_tempfile(SWITCH, $_); } } &close_tempfile(SWITCH); &unlock_file("/etc/nsswitch.conf"); if ($suse_dns_config && $rc->{'USE_NIS_FOR_RESOLVING'}) { if ($_[0]->{'order'} =~ /nis/) { &save_rc_config($rc, "USE_NIS_FOR_RESOLVING", "yes"); } else { &save_rc_config($rc, "USE_NIS_FOR_RESOLVING", "no"); } } &unlock_file($rc_config) if ($suse_dns_config); } $max_dns_servers = 3; # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { if ($_[0]->{'order'} =~ /\[/) { # Using a complex resolve list return "{'order'}\">\n"; } else { # Can select by menus local @o = split(/\s+/, $_[0]->{'order'}); @o = map { s/nis\+/nisplus/; s/yp/nis/; $_; } @o; local ($rv, $i, $j); local @srcs = ( "", "files", "dns", "nis", "nisplus", "ldap", "db" ); local @srcn = ( "", "Hosts", "DNS", "NIS", "NIS+", "LDAP", "DB" ); for($i=1; $i<@srcs; $i++) { local $ii = $i-1; $rv .= "\n"; } return $rv; } } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { if (defined($in{'order'})) { $in{'order'} =~ /\S/ || &error($text{'dns_eorder'}); $_[0]->{'order'} = $in{'order'}; } else { local($i, @order); for($i=0; defined($in{"order_$i"}); $i++) { push(@order, $in{"order_$i"}) if ($in{"order_$i"}); } $_[0]->{'order'} = join(" ", @order); } } 1; net/apply.cgi0100775000567100000120000000027610656003101013140 0ustar jcameronwheel#!/usr/local/bin/perl # apply.cgi # Apply the current network config require './net-lib.pl'; $access{'apply'} || &error($text{'apply_ecannot'}); &apply_network(); sleep(1); &redirect(""); net/rbac-mapping0100664000567100000120000000026410656003101013604 0ustar jcameronwheel# RBAC authorization # Webmin ACL solaris.network.hosts.write noconfig=1,ifcs=0,routes=0,dns=0,apply=0 solaris.network.hosts.read noconfig=1,ifcs=0,routes=0,dns=0,hosts=1,apply=0 net/macos-lib.pl0100755000567100000120000002735010656003101013532 0ustar jcameronwheel# macos-lib.pl # Networking functions for OSX $virtual_netmask = "255.255.255.255"; # Netmask for virtual interfaces $iftab_file = "/etc/iftab"; $hostconfig_file = "/etc/hostconfig"; # active_interfaces() # Returns a list of currently ifconfig'd interfaces sub active_interfaces { local(@rv, @lines, $l); &open_execute_command(IFC, "ifconfig -a", 1, 1); while() { s/\r|\n//g; if (/^\S+:/) { push(@lines, $_); } elsif (@lines) { $lines[$#lines] .= $_; } } close(IFC); foreach $l (@lines) { local %ifc; $l =~ /^([^:\s]+):/; $ifc{'name'} = $ifc{'fullname'} = $1; if ($l =~ /^(\S+):(\d+):\s/) { $ifc{'virtual'} = $2; } if ($l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)\s+broadcast\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); $ifc{'broadcast'} = $3; } elsif ($l =~ s/inet\s+(\S+)\s+netmask\s+(\S+)//) { $ifc{'address'} = $1; $ifc{'netmask'} = &parse_hex($2); } else { next; } if ($l =~ /ether\s+(\S+)/) { $ifc{'ether'} = $1; } if ($l =~ /mtu\s+(\S+)/) { $ifc{'mtu'} = $1; } $ifc{'up'}++ if ($l =~ /\{'fullname'}} = $_ } &active_interfaces(); local $old = $act{$_[0]->{'fullname'}}; $act{$_[0]->{'fullname'}} = $_[0]; &interface_sync(\%act, $_[0]->{'name'}, $_[0]->{'fullname'}); } # deactivate_interface(&details) # Deactive an interface sub deactivate_interface { local %act; local @act = &active_interfaces(); if ($_[0]->{'virtual'} eq '') { @act = grep { $_->{'name'} ne $_[0]->{'name'} } @act; } else { @act = grep { $_->{'fullname'} ne $_[0]->{'fullname'} } @act; } map { $act{$_->{'fullname'}} = $_ } @act; &interface_sync(\%act, $_[0]->{'name'}, $_[0]->{'fullname'}); } # interface_sync(interfaces, name, changee) sub interface_sync { # Remove all IP addresses except for the primary one (unless it is being edited) local $pri = $_[0]->{$_[1]}; local $ifconfig = &has_command("ifconfig"); while(1) { local $out; &execute_command("$ifconfig $_[1]", undef, \$out); last if ($out !~ /([\000-\377]*)\s+inet\s+(\d+\.\d+\.\d+\.\d+)/); last if ($2 eq $pri->{'address'} && $_[2] ne $pri->{'fullname'}); &system_logged("$ifconfig $_[1] delete $2 >/dev/null 2>&1"); } # Add them back again, except for the primary unless it is being changed foreach $a (sort { $a->{'fullname'} cmp $b->{'fullname'} } grep { $_->{'name'} eq $_[1] } values(%{$_[0]})) { next if ($a->{'fullname'} eq $pri->{'fullname'} && $_[2] ne $pri->{'fullname'}); local $cmd = "$ifconfig $a->{'name'}"; if ($a->{'virtual'} ne '') { $cmd .= " alias $a->{'address'}"; } else { $cmd .= " $a->{'address'}"; } if ($a->{'netmask'}) { $cmd .= " netmask $a->{'netmask'}"; } if ($a->{'broadcast'}) { $cmd .= " broadcast $a->{'broadcast'}"; } if ($a->{'mtu'}) { $cmd .= " mtu $a->{'mtu'}"; } local $out = &backquote_logged("$cmd 2>&1"); #if ($? && $out !~ /file exists/i) { if ($?) { &error($out); } if ($a->{'virtual'} eq '') { if ($a->{'up'}) { $out = &backquote_logged("$ifconfig $a->{'name'} up 2>&1"); } else { $out = &backquote_logged("$ifconfig $a->{'name'} down 2>&1"); } &error($out) if ($?); } } } # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local @rv; local %virtual_count; local $lnum = 0; &open_readfile(IFTAB, $iftab_file); while() { s/\r|\n//g; s/#.*$//; if (/^(\S+)\s+(inet)\s+(.*)/i) { local $ifc = { 'name' => $1, 'index' => scalar(@rv), 'line' => $lnum }; local $opts = $3; next if ($opts =~ /^!/); $ifc->{'edit'} = 1 if ($ifc->{'name'} =~ /^[a-z]+[0-9]*$/i); if ($opts eq "-AUTOMATIC-" || $opts eq "-BOOTP-") { $ifc->{'bootp'} = 1; $ifc->{'up'} = 1; } elsif ($opts eq "-DHCP-") { $ifc->{'dhcp'} = 1; $ifc->{'up'} = 1; } else { # Parse the ifconfig params if ($opts =~ /^([0-9\.]+)/) { $ifc->{'address'} = $1; } local @a = split(/\./, $ifc->{'address'}); if ($opts =~ /netmask\s+([0-9\.]+)/) { $ifc->{'netmask'} = $1; } else { $ifc{'netmask'} = $a[0] >= 192 ? "255.255.255.0" : $a[0] >= 128 ? "255.255.0.0" : "255.0.0.0"; } if ($opts =~ /broadcast\s+([0-9\.]+)/) { $ifc->{'broadcast'} = $1; } else { local @n = split(/\./, $ifc->{'netmask'}); $ifc->{'broadcast'} = sprintf "%d.%d.%d.%d", ($a[0] | ~int($n[0]))&0xff, ($a[1] | ~int($n[1]))&0xff, ($a[2] | ~int($n[2]))&0xff, ($a[3] | ~int($n[3]))&0xff; } if ($opts =~ /mtu\s+([0-9\.]+)/) { $ifc->{'mtu'} = $1; } if ($opts =~ /\s+up/) { $ifc->{'up'} = 1; } if ($opts =~ /\s+alias/) { $ifc->{'up'} = 1; $ifc->{'virtual'} = int($virtual_count{$ifc->{'name'}}++); } } $ifc->{'fullname'} = $ifc->{'name'}; $ifc->{'fullname'} .= ":$ifc->{'virtual'}" if ($ifc->{'virtual'} ne ""); $ifc->{'file'} = $iftab_file; push(@rv, $ifc); } $lnum++; } close(IFTAB); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local $str = "$_[0]->{'name'} inet"; if ($_[0]->{'dhcp'}) { $str .= " -DHCP-"; } elsif ($_[0]->{'bootp'}) { $str .= " -AUTOMATIC-"; } else { $str .= " $_[0]->{'address'}"; $str .= " netmask $_[0]->{'netmask'}" if ($_[0]->{'netmask'}); $str .= " broadcast $_[0]->{'broadcast'}" if ($_[0]->{'broadcast'}); $str .= " mtu $_[0]->{'mtu'}" if ($_[0]->{'mtu'}); if ($_[0]->{'virtual'} eq '') { $str .= " up"; } else { $str .= " alias"; } } &lock_file($iftab_file); local $lref = &read_file_lines($iftab_file); local @boot = &boot_interfaces(); local ($old) = grep { $_->{'fullname'} eq $_[0]->{'fullname'} } @boot; if ($old) { # Replacing existing interface $lref->[$old->{'line'}] = $str; } else { # Adding new interface push(@$lref, $str); if ($_[0]->{'virtual'} ne '') { # Work out new virtual num $_[0]->{'virtual'} = 0; foreach $b (@boot) { if ($b->{'name'} eq $_[0]->{'name'} && $b->{'virtual'} ne '' && $b->{'virtual'} >= $_[0]->{'virtual'}) { $_[0]->{'virtual'} = $b->{'virtual'}+1; } } $_[0]->{'fullname'} = $_[0]->{'name'}.':'.$_[0]->{'virtual'}; } } &flush_file_lines(); &unlock_file($iftab_file); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { &lock_file($iftab_file); local $lref = &read_file_lines($iftab_file); splice(@$lref, $_[0]->{'line'}, 1); &flush_file_lines(); &unlock_file($iftab_file); } # iface_type(name) # Returns a human-readable interface type name sub iface_type { return $_[0] =~ /^ppp/ ? "PPP" : $_[0] =~ /^pppoe/ ? "PPPoE" : $_[0] =~ /^lo/ ? "Loopback" : $_[0] eq "*" ? $text{'ifcs_all'} : $_[0] =~ /^en/ ? "Ethernet" : $text{'ifcs_unknown'}; } # iface_hardware(name) # Does some interface have an editable hardware address sub iface_hardware { return 0; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] =~ /netmask|broadcast|dhcp|bootp/; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_dns_config() # Returns a hashtable containing keys nameserver, domain, search & order sub get_dns_config { local $dns; &open_readfile(RESOLV, "/etc/resolv.conf"); while() { s/\r|\n//g; s/#.*$//g; if (/nameserver\s+(.*)/) { push(@{$dns->{'nameserver'}}, split(/\s+/, $1)); } elsif (/domain\s+(\S+)/) { $dns->{'domain'} = [ $1 ]; } elsif (/search\s+(.*)/) { $dns->{'domain'} = [ split(/\s+/, $1) ]; } } close(RESOLV); $dns->{'files'} = [ "/etc/resolv.conf" ]; return $dns; } # save_dns_config(&config) # Writes out the resolv.conf file sub save_dns_config { &lock_file("/etc/resolv.conf"); &open_readfile(RESOLV, "/etc/resolv.conf"); local @resolv = ; close(RESOLV); &open_tempfile(RESOLV, ">/etc/resolv.conf"); foreach (@{$_[0]->{'nameserver'}}) { &print_tempfile(RESOLV, "nameserver $_\n"); } if ($_[0]->{'domain'}) { if ($_[0]->{'domain'}->[1]) { &print_tempfile(RESOLV, "search ",join(" ", @{$_[0]->{'domain'}}),"\n"); } else { &print_tempfile(RESOLV, "domain $_[0]->{'domain'}->[0]\n"); } } foreach (@resolv) { &print_tempfile(RESOLV, $_) if (!/^\s*(nameserver|domain|search)\s+/); } &close_tempfile(RESOLV); &unlock_file("/etc/resolv.conf"); } $max_dns_servers = 3; # order_input(&dns) # Returns HTML for selecting the name resolution order sub order_input { return undef; } # parse_order(&dns) # Parses the form created by order_input() sub parse_order { return undef; } # get_hostname() sub get_hostname { return &get_system_hostname(); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); &lock_file($hostconfig); &set_hostconfig("HOSTNAME", $_[0]); &unlock_file($hostconfig); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( $hostconfig_file ); } sub routing_input { local $hc = &read_hostconfig(); local $r = $hc->{'ROUTER'}; local $mode = $r eq "-AUTOMATIC-" ? 1 : $r ? 2 : 0; print " $text{'routes_default'} \n"; printf " %s\n", $mode == 0 ? "checked" : "", $text{'routes_none2'}; printf " %s\n", $mode == 1 ? "checked" : "", $text{'routes_auto'}; printf "\n", $mode == 2 ? "checked" : ""; printf " \n", $mode == 2 ? $r : ""; local $f = $hc->{'IPFORWARDING'}; print " $text{'routes_forward'} \n"; printf " %s\n", $f eq '-YES-' ? 'checked' : '', $text{'yes'}; printf " %s \n", $f eq '-YES-' ? '' : 'checked', $text{'no'}; } sub parse_routing { local $r; if ($in{'router_mode'} == 0) { $r = undef; } elsif ($in{'router_mode'} == 1) { $r = "-AUTOMATIC-"; } else { $r = $in{'router'}; &check_ipaddress($r) || &error(&text('routes_edefault', $r)); } &lock_file($hostconfig_file); &set_hostconfig("ROUTER", $r); &set_hostconfig("IPFORWARDING", $in{'forward'} ? "-YES-" : "-NO-"); &unlock_file($hostconfig_file); } # set_hostconfig(name, value) # Add or update an entry in the hostconfig file sub set_hostconfig { local $lref = &read_file_lines($hostconfig_file); local ($i, $found); for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^(\S+)\s*=/ && lc($1) eq lc($_[0])) { $lref->[$i] = "$_[0]=$_[1]"; $found++; } } if (!$found) { push(@$lref, "$_[0]=$_[1]"); } &flush_file_lines(); } # read_hostconfig() # Returns a hash of hostconfig file values sub read_hostconfig { local %rv; &open_readfile(HOST, $hostconfig_file); while() { s/\r|\n//g; s/#.*$//; if (/^(\S+)\s*=\s*(.*)/) { $rv{$1} = $2; } } close(HOST); return \%rv; } sub os_feedback_files { return ( "/etc/hostconfig", "/etc/resolv.conf", "/etc/iftab" ); } # apply_network() # Apply the interface and routing settings #sub apply_network #{ #system("killall ipconfigd && ipconfigd /dev/null 2>&1 &"); #system("ipconfig waitall >/dev/null 2>&1"); #local $hc = &read_hostconfig(); #system("killall -HUP netinfod >/dev/null 2>&1"); #system("killall -HUP lookupd >/dev/null 2>&1"); #} 1; net/config-macos0100644000567100000120000000006010656003101013601 0ustar jcameronwheelhosts_file=/etc/hosts def_netmask=255.255.255.0 net/suse-linux-8.2-lib.pl0100755000567100000120000001766510656003101015061 0ustar jcameronwheel# united-linux-lib.pl # Networking functions for united linux $net_scripts_dir = "/etc/sysconfig/network"; $routes_config = "/etc/sysconfig/network/routes"; $sysctl_config = "/etc/sysconfig/sysctl"; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { next if ($f !~ /^ifcfg-([a-z0-9:\.]+)$/); local (%conf, $b); $b->{'fullname'} = $1; &read_env_file("$net_scripts_dir/$f", \%conf); if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifcfg-$name"); &read_env_file("$net_scripts_dir/ifcfg-$name", \%conf); $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } delete($conf{'PREFIXLEN'}); $conf{'BROADCAST'} = $_[0]->{'broadcast'}; $conf{'STARTMODE'} = $_[0]->{'up'} ? "onboot" : $conf{'STARTMODE'} eq "onboot" ? "manual" : $conf{'STARTMODE'}; $conf{'BOOTPROTO'} = $_[0]->{'dhcp'} ? "dhcp" : "static"; $conf{'UNIQUE'} = time(); &write_env_file("$net_scripts_dir/ifcfg-$name", \%conf); &unlock_file("$net_scripts_dir/ifcfg-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &unlink_logged("$net_scripts_dir/ifcfg-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "mtu" && $_[0] ne "bootp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { return ( $routes_config, $sysctl_config ); } sub routing_input { local (@routes, $i); &open_readfile(ROUTES, $routes_config); while() { s/#.*$//; s/\r|\n//g; local @r = map { $_ eq '-' ? undef : $_ } split(/\s+/, $_); push(@routes, \@r) if (@r); } close(ROUTES); # show default router and device local ($def) = grep { $_->[0] eq "default" } @routes; print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $def->[1] ? "" : "checked"; printf "\n", $def->[1] ? "checked" : ""; printf " \n", $def->[1]; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $def->[3] ? "" : "checked"; printf "\n", $def->[3] ? "checked" : ""; printf " \n", $def->[3]; &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'IP_FORWARD'} eq 'yes' ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'IP_FORWARD'} eq 'yes' ? "" : "checked"; # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", " ", "\n"; local ($r, $i = 0); foreach $r (@routes, [ ]) { next if ($r eq $def); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}$text{'routes_type'}
\n"; } sub parse_routing { # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { gethostbyname($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { $in{'gatewaydev'} =~ /^\S+$/ || &error(&text('routes_edevice', $in{'gatewaydev'})); $def[3] = $in{'gatewaydev'}; } push(@routes, \@def); } for($i=0; defined($in{"dev_$i"}); $i++) { next if (!$in{"net_$i"}); &check_ipaddress($in{"net_$i"}) || $in{"net_$i"} =~ /^(\S+)\/(\d+)$/ && &check_ipaddress($1) || &error(&text('routes_enet', $in{"net_$i"})); $in{"dev_$i"} =~ /^\S*$/ || &error(&text('routes_edevice', $dev)); !$in{"netmask_$i"} || &check_ipaddress($in{"netmask_$i"}) || &error(&text('routes_emask', $in{"netmask_$i"})); !$in{"gw_$i"} || &check_ipaddress($in{"gw_$i"}) || &error(&text('routes_egateway', $in{"gw_$i"})); $in{"type_$i"} =~ /^\S*$/ || &error(&text('routes_etype', $in{"type_$i"})); push(@routes, [ $in{"net_$i"}, $in{"gw_$i"}, $in{"netmask_$i"}, $in{"dev_$i"}, $in{"type_$i"} ] ); } # Save routes and routing option &open_tempfile(ROUTES, ">$routes_config"); foreach $r (@routes) { &print_tempfile(ROUTES,join(" ", map { $_ eq '' ? "-" : $_ } @$r),"\n"); } &close_tempfile(ROUTES); local $lref = &read_file_lines($sysctl_config); for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^\s*IP_FORWARD\s*=/) { $lref->[$i] = "IP_FORWARD=".($in{'forward'} ? "yes" : "no"); } } &flush_file_lines(); } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } 1; net/config-*-linux0100644000567100000120000000006010656003101013765 0ustar jcameronwheelhosts_file=/etc/hosts def_netmask=255.255.255.0 net/config0100644000567100000120000000006010656003101012501 0ustar jcameronwheelhosts_file=/etc/hosts def_netmask=255.255.255.0 net/suse-linux-9.1-lib.pl0100755000567100000120000002304210656003101015043 0ustar jcameronwheel# suse-linux-9.0-lib.pl # Networking functions for SuSE linux 9.0 and above $net_scripts_dir = "/etc/sysconfig/network"; $routes_config = "/etc/sysconfig/network/routes"; $sysctl_config = "/etc/sysconfig/sysctl"; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); local @active = &active_interfaces(); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { if ($f =~ /^ifcfg-eth-id-([a-f0-9:]+)$/i) { # An interface identified by MAC address! local (%conf, $b); $b->{'mac'} = $1; local ($a) = grep { lc($_->{'ether'}) eq lc($b->{'mac'}) } @active; next if (!$a); &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $a->{'fullname'}; $b->{'name'} = $a->{'name'}; $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'mtu'} = $conf{'MTU'}; $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifcfg-([a-z0-9:\.]+)$/) { # A normal interface file local (%conf, $b); $b->{'fullname'} = $1; &read_env_file("$net_scripts_dir/$f", \%conf); if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'mtu'} = $conf{'MTU'}; $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; local $file = $_[0]->{'file'} || "$net_scripts_dir/ifcfg-$name"; &lock_file($file); &read_env_file($file, \%conf); $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } delete($conf{'PREFIXLEN'}); $conf{'BROADCAST'} = $_[0]->{'broadcast'}; $conf{'STARTMODE'} = $_[0]->{'up'} ? "onboot" : $conf{'STARTMODE'} eq "onboot" ? "manual" : $conf{'STARTMODE'}; $conf{'BOOTPROTO'} = $_[0]->{'dhcp'} ? "dhcp" : "static"; $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'UNIQUE'} ||= time(); &write_env_file($file, \%conf); &unlock_file($file); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; local $file = $_[0]->{'file'} || "$net_scripts_dir/ifcfg-$name"; &unlink_logged($file); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "bootp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( $routes_config, $sysctl_config ); } # get_routes_config() # Returns the list of save static routes sub get_routes_config { local (@routes); &open_readfile(ROUTES, $routes_config); while() { s/#.*$//; s/\r|\n//g; local @r = map { $_ eq '-' ? undef : $_ } split(/\s+/, $_); push(@routes, \@r) if (@r); } close(ROUTES); return @routes; } # save_routes_config(&routes) sub save_routes_config { &open_tempfile(ROUTES, ">$routes_config"); foreach $r (@{$_[0]}) { &print_tempfile(ROUTES, join(" ", $r->[0] || "-", $r->[1] || "-", $r->[2] || "-", $r->[3] || "-"),"\n"); } &close_tempfile(ROUTES); } sub routing_input { local @routes = &get_routes_config(); # show default router and device local ($def) = grep { $_->[0] eq "default" } @routes; print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $def->[1] ? "" : "checked"; printf "\n", $def->[1] ? "checked" : ""; printf " \n", $def->[1]; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $def->[3] ? "" : "checked"; printf "\n", $def->[3] ? "checked" : ""; printf " \n", $def->[3]; &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'IP_FORWARD'} eq 'yes' ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'IP_FORWARD'} eq 'yes' ? "" : "checked"; # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", " ", "\n"; local ($r, $i = 0); foreach $r (@routes, [ ]) { next if ($r eq $def); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}$text{'routes_type'}
\n"; } sub parse_routing { # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { gethostbyname($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { $in{'gatewaydev'} =~ /^\S+$/ || &error(&text('routes_edevice', $in{'gatewaydev'})); $def[3] = $in{'gatewaydev'}; } push(@routes, \@def); } for($i=0; defined($in{"dev_$i"}); $i++) { next if (!$in{"net_$i"}); &check_ipaddress($in{"net_$i"}) || $in{"net_$i"} =~ /^(\S+)\/(\d+)$/ && &check_ipaddress($1) || &error(&text('routes_enet', $in{"net_$i"})); $in{"dev_$i"} =~ /^\S*$/ || &error(&text('routes_edevice', $dev)); !$in{"netmask_$i"} || &check_ipaddress($in{"netmask_$i"}) || &error(&text('routes_emask', $in{"netmask_$i"})); !$in{"gw_$i"} || &check_ipaddress($in{"gw_$i"}) || &error(&text('routes_egateway', $in{"gw_$i"})); $in{"type_$i"} =~ /^\S*$/ || &error(&text('routes_etype', $in{"type_$i"})); push(@routes, [ $in{"net_$i"}, $in{"gw_$i"}, $in{"netmask_$i"}, $in{"dev_$i"}, $in{"type_$i"} ] ); } # Save routes and routing option &save_routes_config(\@routes); local $lref = &read_file_lines($sysctl_config); for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^\s*IP_FORWARD\s*=/) { $lref->[$i] = "IP_FORWARD=".($in{'forward'} ? "yes" : "no"); } } &flush_file_lines(); } # get_default_gateway() # Returns the default gateway IP (if one is set) and device (if set) boot time # settings. sub get_default_gateway { local @routes = &get_routes_config(); local ($def) = grep { $_->[0] eq "default" } @routes; if ($def) { return ( $def->[1], $def->[3] ); } else { return ( ); } } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { local @routes = &get_routes_config(); local ($def) = grep { $_->[0] eq "default" } @routes; if ($def && $_[0]) { $def->[1] = $_[0]; $def->[3] = $_[1]; } elsif ($def && !$_[0]) { @routes = grep { $_ ne $def } @routes; } elsif (!$def && $_[0]) { splice(@routes, 0, 0, [ "default", $_[0], undef, $_[1] ]); } &save_routes_config(\@routes); } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } 1; net/mod_aifc.cgi0100775000567100000120000000131210656003101013544 0ustar jcameronwheel#!/usr/local/bin/perl # mod_aifc.cgi # Show info about some interface that is being used by another module require './net-lib.pl'; $access{'ifcs'} || &error($text{'ifcs_ecannot'}); &ReadParse(); @act = &active_interfaces(); $a = $act[$in{'idx'}]; $mod = &module_for_interface($a); $mod || &error($text{'mod_egone'}); &ui_print_header(undef, $text{'mod_title'}, ""); print "

\n"; print &text('mod_desc', "$a->{'fullname'}", $mod->{'desc'}),"\n"; &read_acl(\%acl); if ($acl{$base_remote_user,$mod->{'module'}}) { %minfo = &get_module_info($mod->{'module'}); print &text('mod_link', "../$mod->{'module'}/", $minfo{'desc'}); } print "

\n"; &ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'}); net/save_range.cgi0100755000567100000120000000265210656003101014123 0ustar jcameronwheel#!/usr/local/bin/perl # save_range.cgi # Create, save or delete a boot-time address range require './net-lib.pl'; $access{'ifcs'} == 2 || $access{'ifcs'} == 3 || &error($text{'ifcs_ecannot'}); &ReadParse(); @boot = &boot_interfaces(); sub check_restricted_interfaces() { if ($access{'ifcs'} == 3) { map { $can_interfaces{$_}++ } split(/\s+/, $access{'interfaces'}); if (! $can_interfaces{$b->{'name'}}) { &error($text{'ifcs_ecannot_this'}); } } } if ($in{'delete'} || $in{'unapply'}) { # Delete interface &error_setup($text{'range_err1'}); $b = $boot[$in{'idx'}]; &check_restricted_interfaces(); if ($in{'unapply'}) { # Shut down this range &error_setup($text{'range_err4'}); $err = &unapply_interface($act); $err && &error("

$err
"); } &delete_interface($b); &webmin_log("delete", "range", $b->{'fullname'}, $b); } else { # Save or create interface &error_setup($text{'range_err2'}); if (!$in{'new'}) { $b = $boot[$in{'idx'}]; } else { $b = { }; } &parse_range($b, \%in); &check_restricted_interfaces(); &save_interface($b); if ($in{'activate'}) { # Make this interface active (if possible) &error_setup($text{'range_err3'}); $err = &apply_interface($b); $err && &error("
$err
"); } &webmin_log($in{'new'} ? 'create' : 'modify', "range", $b->{'fullname'}, $b); } &redirect("list_ifcs.cgi"); net/config.info.fa0100664000567100000120000000040610656003101014026 0ustar jcameronwheel hosts_file=پرونده‌اي که ميزبانها و نشانيهاي را فهرست مي‌کند,0 def_netmask=نقاب شبکه پيش‌گزيده,0 def_broadcast=نشاني انتشار پيش‌گزيده,0 def_mtu=MTU پيش‌گزيده,0 net/edit_range.cgi0100775000567100000120000000347210656003101014115 0ustar jcameronwheel#!/usr/local/bin/perl # edit_range.cgi # Edit or create an IP range bootup interface require './net-lib.pl'; $access{'ifcs'} == 2 || $access{'ifcs'} == 3 || &error($text{'ifcs_ecannot'}); &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'range_create'}, ""); } else { @boot = &boot_interfaces(); $b = $boot[$in{'idx'}]; if ($access{'ifcs'} == 3) { map { $can_interfaces{$_}++ } split(/\s+/, $access{'interfaces'}); if (! $can_interfaces{$b->{'fullname'}}) { &error($text{'ifcs_ecannot_this'}); } } &ui_print_header(undef, $text{'range_edit'}, ""); } print "
\n"; print "\n"; print "\n"; print "\n"; print "
\n"; print "\n"; print "
$text{'range_header'}
\n"; &range_input($b); print "
\n"; print "\n"; if ($in{'new'}) { print "\n"; print "\n"; } else { print "\n" unless $always_apply_ifcs; if (defined(&apply_interface)) { print "\n"; } if (defined(&unapply_interface)) { print "\n"; } print "\n" unless $noos_support_delete_ifcs; } print "
\n"; &ui_print_footer("list_ifcs.cgi", $text{'ifcs_return'}); net/suse-linux-9.2-ALL-lib.pl0100755000567100000120000002657410656003101015467 0ustar jcameronwheel# suse-linux-10.0-lib.pl # Networking functions for SuSE linux 10.0 and above $net_scripts_dir = "/etc/sysconfig/network"; $routes_config = "/etc/sysconfig/network/routes"; $sysctl_config = "/etc/sysconfig/sysctl"; do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); local @active = &active_interfaces(); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { if ($f =~ /^ifcfg-eth-id-([a-f0-9:]+)$/i) { # An interface identified by MAC address! local (%conf, $b); $b->{'mac'} = $1; local ($a) = grep { lc($_->{'ether'}) eq lc($b->{'mac'}) } @active; next if (!$a); &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $a->{'fullname'}; $b->{'name'} = $a->{'name'}; $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot' || $conf{'STARTMODE'} eq 'auto'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'mtu'} = $conf{'MTU'}; $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); # Also find aliases in same file foreach my $k (keys %conf) { if ($k =~ /^IPADDR_(.*)$/) { # Found one local $n = $1; local $label = $conf{"LABEL_$n"}; local $ab = { 'address' => $conf{$k}, 'netmask' => $conf{"NETMASK_$n"}, 'broadcast' => &compute_broadcast( $conf{$k}, $conf{"NETMASK_$n"}), 'code' => $n, 'edit' => 1, 'index' => scalar(@rv), 'name' => $b->{'name'}, 'virtual' => $label, 'fullname' => $b->{'name'}. ":$label", 'up' => 1, 'file' => "$net_scripts_dir/$f", }; push(@rv, $ab); } } } elsif ($f =~ /^ifcfg-([a-z0-9:\.]+)$/) { # A normal interface file local (%conf, $b); $b->{'fullname'} = $1; &read_env_file("$net_scripts_dir/$f", \%conf); if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = ($conf{'STARTMODE'} eq 'onboot' || $conf{'STARTMODE'} eq 'auto'); local $pfx; if ($conf{'IPADDR'} =~ /^(\S+)\/(\d+)$/) { $b->{'address'} = $1; $pfx = $2; } else { $b->{'address'} = $conf{'IPADDR'}; } $pfx = $conf{'PREFIXLEN'} if (!$pfx); if ($pfx) { $b->{'netmask'} = &prefix_to_mask($pfx); } else { $b->{'netmask'} = $conf{'NETMASK'}; } $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'mtu'} = $conf{'MTU'}; $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); if ($_[0]->{'code'} || !$_[0]->{'file'} && $_[0]->{'virtual'} ne '') { # An alias interface in the main interface's file local $file = $_[0]->{'file'}; if (!$file) { # Get file from parent local @boot = &boot_interfaces(); local ($parent) = grep { $_->{'virtual'} eq '' && $_->{'name'} eq $_[0]->{'name'} } @boot; $file = $parent->{'file'}; } &lock_file($file); &read_env_file($file, \%conf); if (!$_[0]->{'code'}) { # Choose a Unique code $_[0]->{'code'} = $_[0]->{'virtual'}; } $conf{'IPADDR_'.$_[0]->{'code'}} = $_[0]->{'address'}; $conf{'NETMASK_'.$_[0]->{'code'}} = $_[0]->{'netmask'}; $conf{'LABEL_'.$_[0]->{'code'}} = $_[0]->{'virtual'}; &write_env_file($file, \%conf); &unlock_file($file); } else { # Interface has it's own file local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; local $file = $_[0]->{'file'} || "$net_scripts_dir/ifcfg-$name"; &lock_file($file); &read_env_file($file, \%conf); $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } delete($conf{'PREFIXLEN'}); $conf{'BROADCAST'} = $_[0]->{'broadcast'}; $conf{'STARTMODE'} = $_[0]->{'up'} ? "auto" : "manual"; $conf{'BOOTPROTO'} = $_[0]->{'dhcp'} ? "dhcp" : "static"; $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'UNIQUE'} ||= time(); &write_env_file($file, \%conf); &unlock_file($file); } } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { if ($_[0]->{'code'}) { # Alias interface in the parent interface's file local $file = $_[0]->{'file'}; &lock_file($file); &read_env_file($file, \%conf); delete($conf{'IPADDR_'.$_[0]->{'code'}}); delete($conf{'NETMASK_'.$_[0]->{'code'}}); delete($conf{'LABEL_'.$_[0]->{'code'}}); &write_env_file($file, \%conf); &unlock_file($file); } else { # Has it's own file local $name = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; local $file = $_[0]->{'file'} || "$net_scripts_dir/ifcfg-$name"; &unlink_logged($file); } } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "bootp"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( $routes_config, $sysctl_config ); } # get_routes_config() # Returns the list of save static routes sub get_routes_config { local (@routes); &open_readfile(ROUTES, $routes_config); while() { s/#.*$//; s/\r|\n//g; local @r = map { $_ eq '-' ? undef : $_ } split(/\s+/, $_); push(@routes, \@r) if (@r); } close(ROUTES); return @routes; } # save_routes_config(&routes) sub save_routes_config { &open_tempfile(ROUTES, ">$routes_config"); foreach $r (@{$_[0]}) { &print_tempfile(ROUTES, join(" ", $r->[0] || "-", $r->[1] || "-", $r->[2] || "-", $r->[3] || "-"),"\n"); } &close_tempfile(ROUTES); } sub routing_input { local @routes = &get_routes_config(); # show default router and device local ($def) = grep { $_->[0] eq "default" } @routes; print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $def->[1] ? "" : "checked"; printf "\n", $def->[1] ? "checked" : ""; printf " \n", $def->[1]; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $def->[3] ? "" : "checked"; printf "\n", $def->[3] ? "checked" : ""; printf " \n", $def->[3]; &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'IP_FORWARD'} eq 'yes' ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'IP_FORWARD'} eq 'yes' ? "" : "checked"; # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", " ", "\n"; local ($r, $i = 0); foreach $r (@routes, [ ]) { next if ($r eq $def); print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; $i++; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}$text{'routes_type'}
\n"; } sub parse_routing { # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { gethostbyname($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { $in{'gatewaydev'} =~ /^\S+$/ || &error(&text('routes_edevice', $in{'gatewaydev'})); $def[3] = $in{'gatewaydev'}; } push(@routes, \@def); } for($i=0; defined($in{"dev_$i"}); $i++) { next if (!$in{"net_$i"}); &check_ipaddress($in{"net_$i"}) || $in{"net_$i"} =~ /^(\S+)\/(\d+)$/ && &check_ipaddress($1) || &error(&text('routes_enet', $in{"net_$i"})); $in{"dev_$i"} =~ /^\S*$/ || &error(&text('routes_edevice', $dev)); !$in{"netmask_$i"} || &check_ipaddress($in{"netmask_$i"}) || &error(&text('routes_emask', $in{"netmask_$i"})); !$in{"gw_$i"} || &check_ipaddress($in{"gw_$i"}) || &error(&text('routes_egateway', $in{"gw_$i"})); $in{"type_$i"} =~ /^\S*$/ || &error(&text('routes_etype', $in{"type_$i"})); push(@routes, [ $in{"net_$i"}, $in{"gw_$i"}, $in{"netmask_$i"}, $in{"dev_$i"}, $in{"type_$i"} ] ); } # Save routes and routing option &save_routes_config(\@routes); local $lref = &read_file_lines($sysctl_config); for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^\s*IP_FORWARD\s*=/) { $lref->[$i] = "IP_FORWARD=".($in{'forward'} ? "yes" : "no"); } } &flush_file_lines(); } # get_default_gateway() # Returns the default gateway IP (if one is set) and device (if set) boot time # settings. sub get_default_gateway { local @routes = &get_routes_config(); local ($def) = grep { $_->[0] eq "default" } @routes; if ($def) { return ( $def->[1], $def->[3] ); } else { return ( ); } } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { local @routes = &get_routes_config(); local ($def) = grep { $_->[0] eq "default" } @routes; if ($def && $_[0]) { $def->[1] = $_[0]; $def->[3] = $_[1]; } elsif ($def && !$_[0]) { @routes = grep { $_ ne $def } @routes; } elsif (!$def && $_[0]) { splice(@routes, 0, 0, [ "default", $_[0], undef, $_[1] ]); } &save_routes_config(\@routes); } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifcfg-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } 1; net/list_ipnodes.cgi0100755000567100000120000000177110656003101014506 0ustar jcameronwheel#!/usr/local/bin/perl # list_ipnodes.cgi # List ipnodes from /etc/ipnodes require './net-lib.pl'; $access{'ipnodes'} || &error($text{'ipnodes_ecannot'}); &ui_print_header(undef, $text{'ipnodes_title'}, ""); print "$text{'ipnodes_add'}
\n" if ($access{'ipnodes'} == 2); print "\n"; print " ", "\n"; foreach $h (&list_ipnodes()) { print "\n"; if ($access{'ipnodes'} == 2) { print "\n"; } else { print "\n"; } print "\n"; } print "
$text{'ipnodes_ip'}$text{'ipnodes_ipnode'}
{'index'}\">", &html_escape($h->{'address'}),"",&html_escape($h->{'address'}),"",join(" , ", map { &html_escape($_) } @{$h->{'ipnodes'}}),"
\n"; print "$text{'ipnodes_add'}\n" if ($access{'ipnodes'} == 2); print "

\n"; &ui_print_footer("", $text{'index_return'}); net/edit_ipnode.cgi0100755000567100000120000000251010656003101014265 0ustar jcameronwheel#!/usr/local/bin/perl # edit_ipnode.cgi # Edit or create a ipnode address require './net-lib.pl'; $access{'ipnodes'} == 2 || &error($text{'ipnodes_ecannot'}); &ReadParse(); if ($in{'new'}) { &ui_print_header(undef, $text{'ipnodes_create'}, ""); } else { &ui_print_header(undef, $text{'ipnodes_edit'}, ""); @ipnodes = &list_ipnodes(); $h = $ipnodes[$in{'idx'}]; } print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'ipnodes_detail'}
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'ipnodes_ip'}{'address'}\">
$text{'ipnodes_host'}
\n"; if ($in{'new'}) { print "\n"; } else { print "\n"; print "\n"; } print "
\n"; print "
\n"; &ui_print_footer("list_ipnodes.cgi", $text{'ipnodes_return'}); net/save_ipnode.cgi0100755000567100000120000000235710656003101014307 0ustar jcameronwheel#!/usr/local/bin/perl # save_ipnode.cgi # Create, update or delete a ipnode address require './net-lib.pl'; $access{'ipnodes'} == 2 || &error($text{'ipnodes_ecannot'}); &ReadParse(); &lock_file($config{'ipnodes_file'}); @ipnodes = &list_ipnodes(); if ($in{'delete'}) { # deleting a ipnode $ipnode = $ipnodes[$in{'idx'}]; &delete_ipnode($ipnode); } else { # saving or updating a ipnode $whatfailed = "Failed to save ipnode"; &check_ipaddress($in{'address'}) || &check_ip6address($in{'address'}) || &error("'$in{'address'}' is not a valid IPv4 or v6 address"); @h = split(/\s+/, $in{'ipnodes'}); foreach $h (@h) { $h =~ /^[A-z0-9\-\.]+$/ || &error("'$h' is not a valid ipnodename"); } @h>0 || &error("You must enter at least one ipnodename"); if ($in{'new'}) { # saving a ipnode $ipnode = { 'address' => $in{'address'}, 'ipnodes' => \@h }; &create_ipnode($ipnode); } else { # updating a ipnode $ipnode = $ipnodes[$in{'idx'}]; $ipnode->{'address'} = $in{'address'}; $ipnode->{'ipnodes'} = \@h; &modify_ipnode($ipnode); } } &unlock_file($config{'ipnodes_file'}); &webmin_log($in{'delete'} ? 'delete' : $in{'new'} ? 'create' : 'modify', 'ipnode', $ipnode->{'address'}, $ipnode); &redirect("list_ipnodes.cgi"); net/config.info.uk_UA0100664000567100000120000000007010656003101014441 0ustar jcameronwheelhosts_file= ,0 net/config.info.zh_TW.UTF-80100664000567100000120000000005410656003101015274 0ustar jcameronwheelhosts_file=主機與位址的列表檔案,0 net/config.info.zh_CN.UTF-80100664000567100000120000000005310656003101015241 0ustar jcameronwheelhosts_file=主机名与IP地址映射表,0 net/config.info.ja_JP.UTF-80100664000567100000120000000010410656003101015220 0ustar jcameronwheelhosts_file=ホスト名およびアドレスの記述ファイル,0 net/openmamba-linux-lib.pl0100775000567100000120000005520310656003101015524 0ustar jcameronwheel# redhat-linux-lib.pl # Networking functions for redhat linux $net_scripts_dir = "/etc/sysconfig/network-devices"; $network_config = "/etc/sysconfig/network"; $static_route_config = "/etc/sysconfig/static-routes"; $sysctl_config = "/etc/sysctl.conf"; $devices_dir = "/etc/sysconfig/network-devices"; # Redhat 7.2+ and Mandrake 9.1+ support separate gateways in each interface file $supports_dev_gateway = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 8.0+ and Mandrake 9.1+ have a separate file for static routes for # each interface $supports_dev_routes = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0) || ($gconfig{'os_type'} eq 'trustix-linux'); # Redhat 10 (ES/AS 3) uses route-$dev instead of $dev.route $supports_route_dev = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 10.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat 9.0+ uses the ONPARENT variable for virtual interfaces $uses_on_parent = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 9.0) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 9.1) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); # Redhat versions 7.2 and above allow the MTU to be set at boot time $supports_mtu = ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.2) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); do 'linux-lib.pl'; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local(@rv, $f); opendir(CONF, &translate_filename($net_scripts_dir)); while($f = readdir(CONF)) { local (%conf, $b); if ($f =~ /^ifconfig-([a-z0-9:\.]+)\-range([a-z0-9\.\_]+)$/) { # A range of addresses &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = "$1-range$2"; $b->{'name'} = $1; $b->{'range'} = $2; $b->{'start'} = $conf{'IPADDR_START'}; $b->{'end'} = $conf{'IPADDR_END'}; $b->{'num'} = $conf{'CLONENUM_START'}; $b->{'up'} = 1; $b->{'edit'} = 1; $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } elsif ($f =~ /^ifconfig-[a-z0-9:\.]+$/ && $f !~ /\.(bak|old)$/i) { # Normal interface &read_env_file("$net_scripts_dir/$f", \%conf); $b->{'fullname'} = $conf{'DEVICE'}; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } $b->{'up'} = defined($conf{'ONPARENT'}) && $b->{'virtual'} ne '' ? ($conf{'ONPARENT'} eq 'yes') : ($conf{'ONBOOT'} eq 'yes'); $b->{'address'} = $conf{'IPADDR'}; $b->{'netmask'} = $conf{'NETMASK'}; $b->{'broadcast'} = $conf{'BROADCAST'}; $b->{'gateway'} = $conf{'GATEWAY'}; $b->{'mtu'} = $conf{'MTU'}; $b->{'dhcp'} = ($conf{'BOOTPROTO'} eq 'dhcp'); $b->{'bootp'} = ($conf{'BOOTPROTO'} eq 'bootp'); $b->{'edit'} = ($b->{'name'} !~ /^ppp|irlan/); $b->{'index'} = scalar(@rv); $b->{'file'} = "$net_scripts_dir/$f"; push(@rv, $b); } } closedir(CONF); return @rv; } # save_interface(&details) # Create or update a boot-time interface sub save_interface { local(%conf); local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range".$_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifconfig-$name"); &read_env_file("$net_scripts_dir/ifconfig-$name", \%conf); if ($_[0]->{'range'} ne "") { # Special case - saving a range $conf{'IPADDR_START'} = $_[0]->{'start'}; $conf{'IPADDR_END'} = $_[0]->{'end'}; $conf{'CLONENUM_START'} = $_[0]->{'num'}; } else { # Saving a normal interface $conf{'DEVICE'} = $name; $conf{'IPADDR'} = $_[0]->{'address'}; local($ip1, $ip2, $ip3, $ip4) = split(/\./, $_[0]->{'address'}); $conf{'NETMASK'} = $_[0]->{'netmask'}; local($nm1, $nm2, $nm3, $nm4) = split(/\./, $_[0]->{'netmask'}); if ($_[0]->{'address'} && $_[0]->{'netmask'}) { $conf{'NETWORK'} = sprintf "%d.%d.%d.%d", ($ip1 & int($nm1))&0xff, ($ip2 & int($nm2))&0xff, ($ip3 & int($nm3))&0xff, ($ip4 & int($nm4))&0xff; } else { $conf{'NETWORK'} = ''; } $conf{'BROADCAST'} = $_[0]->{'broadcast'}; if ($_[0]->{'gateway'}) { $conf{'GATEWAY'} = $_[0]->{'gateway'}; } else { delete($conf{'GATEWAY'}); } $conf{'MTU'} = $_[0]->{'mtu'}; $conf{'ONBOOT'} = $_[0]->{'up'} ? "yes" : "no"; $conf{'ONPARENT'} = $_[0]->{'up'} ? "yes" : "no" if ($_[0]->{'virtual'} ne ''); $conf{'BOOTPROTO'} = $_[0]->{'bootp'} ? "bootp" : $_[0]->{'dhcp'} ? "dhcp" : "none"; } &write_env_file("$net_scripts_dir/ifconfig-$name", \%conf); if (-d &translate_filename($devices_dir)) { &link_file("$net_scripts_dir/ifconfig-$name", "$devices_dir/ifconfig-$name"); } &unlock_file("$net_scripts_dir/ifconfig-$name"); } # delete_interface(&details) # Delete a boot-time interface sub delete_interface { local $name = $_[0]->{'range'} ne "" ? $_[0]->{'name'}."-range".$_[0]->{'range'} : $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; &lock_file("$net_scripts_dir/ifconfig-$name"); &unlink_file("$net_scripts_dir/ifconfig-$name"); if (-d &translate_filename($devices_dir)) { &unlink_file("$devices_dir/ifconfig-$name"); } &unlock_file("$net_scripts_dir/ifconfig-$name"); } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { if ($supports_mtu) { return 1; } else { return $_[0] ne "mtu"; } } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { local $old = &get_hostname(); local %conf; &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); &lock_file($network_config); &read_env_file($network_config, \%conf); $conf{'HOSTNAME'} = $_[0]; &write_env_file($network_config, \%conf); &unlock_file($network_config); # If any ifconfig-XXX files have the old hostname in DHCP_HOSTNAME, fix it foreach my $b (&boot_interfaces()) { local %ifc; &read_env_file($b->{'file'}, \%ifc); if ($ifc{'DHCP_HOSTNAME'} eq $old) { $ifc{'DHCP_HOSTNAME'} = $_[0]; &lock_file($b->{'file'}); &write_env_file($b->{'file'}, \%ifc); &unlock_file($b->{'file'}); } } undef(@main::get_system_hostname); # clear cache } # get_domainname() sub get_domainname { local $d; &execute_command("domainname", undef, \$d, undef); chop($d); return $d; } # save_domainname(domain) sub save_domainname { local %conf; &execute_command("domainname ".quotemeta($_[0])); &read_env_file($network_config, \%conf); if ($_[0]) { $conf{'NISDOMAIN'} = $_[0]; } else { delete($conf{'NISDOMAIN'}); } &write_env_file($network_config, \%conf); } sub routing_config_files { local @rv = ( $network_config, $sysctl_config ); if (!$supports_dev_routes) { push(@rv, $static_route_config); } else { local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { push(@rv, "$devices_dir/$f"); } } closedir(DIR); } return @rv; } sub routing_input { local (%conf, @st, @hr, %sysctl); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # show default router and device print " $text{'routes_default'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAY'} ? "" : "checked"; printf "\n", $conf{'GATEWAY'} ? "checked" : ""; printf " \n", $conf{'GATEWAY'}; print " $text{'routes_device2'} \n"; printf " $text{'routes_none'}\n", $conf{'GATEWAYDEV'} ? "" : "checked"; printf "\n", $conf{'GATEWAYDEV'} ? "checked" : ""; printf " \n", $conf{'GATEWAYDEV'}; } else { # multiple default routers can exist! print " $text{'routes_default2'}\n"; print "\n"; print " ", "\n"; local $r = 0; if ($conf{'GATEWAY'}) { print "\n"; print "\n"; printf "\n", $conf{'GATEWAY'}; print "\n"; $r++; } local @boot = &boot_interfaces(); foreach $b (grep { $_->{'gateway'} && $_->{'virtual'} eq '' } @boot) { print "\n"; print "\n"; printf "\n", $b->{'gateway'}; print "\n"; $r++; } print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'routes_ifc'}$text{'routes_gateway'}
",&interface_sel("gatewaydev$r", $conf{'GATEWAYDEV'} || "*"),"
",&interface_sel("gatewaydev$r", $b->{'name'}),"
",&interface_sel("gatewaydev$r"),"
\n"; } # show routing if ($gconfig{'os_version'} < 7.0) { print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $conf{'FORWARD_IPV4'} eq "yes" ? "checked" : ""; printf " $text{'no'} \n", $conf{'FORWARD_IPV4'} eq "yes" ? "" : "checked"; } else { &read_env_file($sysctl_config, \%sysctl); print " $text{'routes_forward'} \n"; printf " $text{'yes'}\n", $sysctl{'net.ipv4.ip_forward'} ? "checked" : ""; printf " $text{'no'} \n", $sysctl{'net.ipv4.ip_forward'} ? "" : "checked"; } if (!$supports_dev_routes) { # get static routes from single file &open_readfile(STATIC, $static_route_config); while() { if (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, $3, $4 ]); } elsif (/(\S+)\s+host\s+(\S+)\s+gw\s+(\S+)/) { push(@st, [ $1, $2, '255.255.255.255', $3 ]); } elsif (/(\S+)\s+net\s+(\S+)\s+netmask\s+(\S+)/) { push(@hr, [ $1, $2, $3 ]); } elsif (/(\S+)\s+host\s+(\S+)/) { push(@hr, [ $1, $2, '255.255.255.255' ]); } } close(STATIC); } else { # get static routes from per-interface files local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if ($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) { local $dev = $1; local (%rfile, $i); &read_env_file("$devices_dir/$f", \%rfile); for($i=0; defined($rfile{"ADDRESS$i"}); $i++) { if ($rfile{"GATEWAY$i"}) { push(@st, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"}, $rfile{"GATEWAY$i"} ]); } else { push(@hr, [ $dev, $rfile{"ADDRESS$i"}, $rfile{"NETMASK$i"} || "255.255.255.255" ]); } } } } closedir(DIR); } # show static network routes print " $text{'routes_static'}\n"; print "\n"; print " ", " ", " ", "\n"; for($i=0; $i<=@st; $i++) { local $st = $st[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}$text{'routes_gateway'}
\n"; # Show static host routes print " $text{'routes_local'}\n"; print "\n"; print " ", " ", "\n"; for($i=0; $i<=@hr; $i++) { local $st = $hr[$i]; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'routes_ifc'}$text{'routes_net'}$text{'routes_mask'}
\n"; } sub parse_routing { local (%conf, @st, %sysctl, %st, @boot); &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } elsif (!gethostbyname($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } if ($in{'gatewaydev_def'}) { delete($conf{'GATEWAYDEV'}); } elsif ($in{'gatewaydev'} !~ /^\S+$/) { &error(&text('routes_edevice', $in{'gatewaydev'})); } else { $conf{'GATEWAYDEV'} = $in{'gatewaydev'}; } } else { # Multiple defaults can be specified! local ($r, $b); @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); for($r=0; defined($in{"gatewaydev$r"}); $r++) { next if (!$in{"gatewaydev$r"}); &check_ipaddress($in{"gateway$r"}) || &error(&text('routes_edefault2', $r+1)); if ($in{"gatewaydev$r"} eq "*") { # For any interface $conf{'GATEWAY'} && &error(&text('routes_eclash')); $conf{'GATEWAY'} = $in{"gateway$r"}; } else { # For a specific interface local ($b) = grep { $_->{'fullname'} eq $in{"gatewaydev$r"} } @boot; $b->{'gateway'} && &error(&text('routes_eclash2', $in{"gatewaydev$r"})); $b->{'gateway'} = $in{"gateway$r"}; } } } if ($gconfig{'os_version'} < 7.0) { if ($in{'forward'}) { $conf{'FORWARD_IPV4'} = 'yes'; } else { $conf{'FORWARD_IPV4'} = 'no'; } } else { &lock_file($sysctl_config); &read_env_file($sysctl_config, \%sysctl); $sysctl{'net.ipv4.ip_forward'} = $in{'forward'}; } # Parse static and local routes for($i=0; defined($dev = $in{"dev_$i"}); $i++) { next if (!$dev); $net = $in{"net_$i"}; $netmask = $in{"netmask_$i"}; $gw = $in{"gw_$i"}; $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); gethostbyname($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } else { push(@st, "$dev net $net netmask $netmask gw $gw\n"); } push(@{$st{$dev}}, [ $net, $netmask, $gw ]); } for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { $net = $in{"lnet_$i"}; $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net\n"); } else { push(@st, "$dev net $net netmask $netmask\n"); } push(@{$st{$dev}}, [ $net, $netmask ]); } if (!$supports_dev_routes) { # Write to a single file &open_lock_tempfile(STATIC, ">$static_route_config"); &print_tempfile(STATIC, @st); &close_tempfile(STATIC); } else { # Write to one file per interface (delete old, then save new/updated) local $f; opendir(DIR, &translate_filename($devices_dir)); while($f = readdir(DIR)) { if (($f =~ /^([a-z]+\d*(\.\d+)?(:\d+)?)\.route$/ || $f =~ /^route\-([a-z]+\d*(\.\d+)?(:\d+)?)$/) && !$st{$1}) { &unlink_logged("$devices_dir/$f"); &unlink_logged("$net_scripts_dir/$f"); } } closedir(DIR); foreach $dev (keys %st) { $f = $supports_route_dev ? "route-$dev" : "$dev.route"; local (%rfile, $i); for($i=0; $i<@{$st{$dev}}; $i++) { $rfile{"ADDRESS$i"} = $st{$dev}->[$i]->[0]; $rfile{"NETMASK$i"} = $st{$dev}->[$i]->[1]; $rfile{"GATEWAY$i"} = $st{$dev}->[$i]->[2]; } &lock_file("$devices_dir/$f"); &write_env_file("$devices_dir/$f", \%rfile); &unlock_file("$devices_dir/$f"); &lock_file("$net_scripts_dir/$f"); &link_file("$devices_dir/$f", "$net_scripts_dir/$f"); &unlock_file("$net_scripts_dir/$f"); } } &write_env_file($network_config, \%conf); &unlock_file($network_config); if (%sysctl) { &write_env_file($sysctl_config, \%sysctl); &unlock_file($sysctl_config); } if (@boot) { local $b; foreach $b (@boot) { &save_interface($b); } } } sub os_feedback_files { opendir(DIR, $net_scripts_dir); local @f = readdir(DIR); closedir(DIR); return ( (map { "$net_scripts_dir/$_" } grep { /^ifconfig-/ } @f), $network_config, $static_route_config, "/etc/resolv.conf", "/etc/nsswitch.conf", "/etc/HOSTNAME" ); } # interface_sel(name, value) # Returns a menu for all boot-time interfaces sub interface_sel { local $rv = "\n"; return $rv; } # apply_network() # Apply the interface and routing settings sub apply_network { &system_logged("(cd / ; /etc/init.d/network stop ; /etc/init.d/network start) >/dev/null 2>&1"); } # apply_interface(&iface) # Calls an OS-specific function to make a boot-time interface active sub apply_interface { local $out = &backquote_logged("cd / ; ifdown '$_[0]->{'fullname'}' >/dev/null 2>&1 {'fullname'}' 2>&1 {'fullname'}' 2>&1 {'gateway'} && $_->{'virtual'} eq '' } @boot; return ( $gifc->{'gateway'}, $gifc->{'fullname'} ) if ($gifc); return $conf{'GATEWAY'} ? ( $conf{'GATEWAY'}, $conf{'GATEWAYDEV'} ) : ( ); } # set_default_gateway(gateway, device) # Sets the default gateway to the given IP accessible via the given device, # in the boot time settings. sub set_default_gateway { &lock_file($network_config); &read_env_file($network_config, \%conf); if (!$supports_dev_gateway) { # Just update the network config file local %conf; if ($_[0]) { $conf{'GATEWAY'} = $_[0]; $conf{'GATEWAYDEV'} = $_[1]; } else { delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } } else { # Set the gateway in the specified interface file, and clear the rest local @boot = grep { $->{'virtual'} eq '' } &boot_interfaces(); foreach $b (@boot) { delete($b->{'gateway'}); if ($_[0] && $b->{'fullname'} eq $_[1]) { $b->{'gateway'} = $_[0]; &save_interface($b); } } delete($conf{'GATEWAY'}); delete($conf{'GATEWAYDEV'}); } &write_env_file($network_config, \%conf); &unlock_file($network_config); } # supports_ranges() # Returns 1 for newer redhat versions sub supports_ranges { return ($gconfig{'os_type'} eq 'redhat-linux' && $gconfig{'os_version'} >= 7.3) || ($gconfig{'os_type'} eq 'mandrake-linux' && $gconfig{'os_version'} >= 8.0) || ($gconfig{'os_type'} eq 'coherant-linux' && $gconfig{'os_version'} >= 3.0); } # range_input([&interface]) # Print HTML for a IP range interface sub range_input { local $new = !$_[0]; # Base interface print " $text{'range_iface'}\n"; if ($new) { print "\n"; } else { print "$_[0]->{'name'}\n"; } # Name for this range print "$text{'range_name'}\n"; if ($new) { print " \n"; } else { print "$_[0]->{'range'} \n"; } # Start print " $text{'range_start'}\n"; printf "\n", $_[0]->{'start'}; # Stop print "$text{'range_end'}\n"; printf " \n", $_[0]->{'end'}; # Base number print " $text{'range_num'}\n"; printf " \n", $_[0]->{'num'}; } # parse_range(&range, &in) sub parse_range { local %in = %{$_[1]}; if ($in{'new'}) { $_[0]->{'name'} = $in{'iface'}; $in{'range'} =~ /^[a-z0-9\.\_]+$/ || &error($text{'range_ename'}); $_[0]->{'range'} = $in{'range'}; $_[0]->{'fullname'} = $in{'iface'}."-range".$in{'range'}; } &check_ipaddress($in{'start'}) || &error($text{'range_estart'}); $_[0]->{'start'} = $in{'start'}; &check_ipaddress($in{'end'}) || &error($text{'range_eend'}); $_[0]->{'end'} = $in{'end'}; local @sip = split(/\./, $in{'start'}); local @eip = split(/\./, $in{'end'}); $sip[0] == $eip[0] && $sip[1] == $eip[1] && $sip[2] == $eip[2] || &error($text{'range_eclass'}); $sip[3] <= $eip[3] || &error($text{'range_ebefore'}); $in{'num'} =~ /^\d+$/ || &error($text{'range_enum'}); $_[0]->{'num'} = $in{'num'}; } # get_dhcp_hostname() # Returns 0 if the hostname is not set by DHCP, 1 if it is, or -1 if this # feature is not supported on this OS. sub get_dhcp_hostname { return -1 if ($gconfig{'os_type'} ne 'redhat-linux' || $gconfig{'os_version'} < 11); local @boot = &boot_interfaces(); local ($eth) = grep { $_->{'fullname'} =~ /^eth\d+$/ } @boot; return -1 if (!$eth); local %eth; &read_env_file($eth->{'file'}, \%eth); return $eth{'DHCP_HOSTNAME'} ne &get_system_hostname(); } # save_dhcp_hostname(set) # If called with a parameter of 0, the hostname is fixed and not set by # DHCP. If called with 1, the hostname is chosen by DHCP. sub save_dhcp_hostname { } 1; net/delete_routes.cgi0100775000567100000120000000070610656003101014654 0ustar jcameronwheel#!/usr/local/bin/perl # Deletes several active routes require './net-lib.pl'; $access{'routes'} || &error($text{'routes_ecannot'}); &ReadParse(); &error_setup($text{'routes_derr'}); @d = split(/\0/, $in{'d'}); @d || &error($text{'routes_denone'}); @routes = &list_routes(); foreach $d (sort { $b <=> $a } @d) { $err = &delete_route($routes[$d]); &error($err) if ($err); } &webmin_log("delete", "routes", scalar(@d)); &redirect("list_routes.cgi"); net/delete_hosts.cgi0100775000567100000120000000102110656003101014462 0ustar jcameronwheel#!/usr/local/bin/perl # Delete several host file entries require './net-lib.pl'; &error_setup($text{'hdelete_err'}); $access{'hosts'} == 2 || &error($text{'hosts_ecannot'}); &ReadParse(); @d = split(/\0/, $in{'d'}); @d || &error($text{'hdelete_enone'}); # Do the deletions &lock_file($config{'hosts_file'}); @hosts = &list_hosts(); foreach $d (sort { $b <=> $a } @d) { $host = $hosts[$d]; &delete_host($host); } &unlock_file($config{'hosts_file'}); &webmin_log("delete", "hosts", scalar(@d)); &redirect("list_hosts.cgi"); net/delete_aifcs.cgi0100775000567100000120000000102010656003101014406 0ustar jcameronwheel#!/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'}); &deactivate_interface($a); } &webmin_log("delete", "aifcs", scalar(@d)); &redirect("list_ifcs.cgi"); net/delete_bifcs.cgi0100775000567100000120000000211110656003101014411 0ustar jcameronwheel#!/usr/local/bin/perl # Delete some boot-time interfaces, and perhaps de-activate them too require './net-lib.pl'; &ReadParse(); &error_setup($in{'apply'} ? $text{'dbifcs_err2'} : $text{'dbifcs_err'}); @d = split(/\0/, $in{'b'}); @d || &error($text{'daifcs_enone'}); # Do the deletes @boot = &boot_interfaces(); @active = &active_interfaces(); foreach $d (reverse(@d)) { ($b) = grep { $_->{'fullname'} eq $d } @boot; $b || &error($text{'daifcs_egone'}); &can_iface($b) || &error($text{'ifcs_ecannot_this'}); if ($in{'apply'}) { # Make this interface active &activate_interface($b); } else { # Deleting if ($in{'deleteapply'}) { # De-activate first ($act) = grep { $_->{'fullname'} eq $b->{'fullname'} } @active; if ($act) { if (defined(&unapply_interface)) { $err = &unapply_interface($act); $err && &error("
$err
"); } else { &deactivate_interface($act); } } } # Delete config &delete_interface($b); } } &webmin_log($in{'apply'} ? "apply" : "delete", "bifcs", scalar(@d)); &redirect("list_ifcs.cgi"); net/create_route.cgi0100775000567100000120000000172410656003101014473 0ustar jcameronwheel#!/usr/local/bin/perl # Create a new active route require './net-lib.pl'; $access{'routes'} || &error($text{'routes_ecannot'}); &ReadParse(); &error_setup($text{'routes_cerr'}); # Validate and parse inputs $route = { }; $in{'dest_def'} || &check_ipaddress($in{'dest'}) || &error($text{'routes_ecdest'}); $route->{'dest'} = $in{'dest_def'} ? undef : $in{'dest'}; $in{'netmask_def'} || &check_ipaddress($in{'netmask'}) || &error($text{'routes_ecnetmask'}); if ($in{'dest_def'}) { $in{'netmask_def'} || &error($text{'routes_ecnetmask2'}); } $route->{'netmask'} = $in{'netmask_def'} ? undef : $in{'netmask'}; if ($in{'via'}) { # Via gateway &check_ipaddress($in{'gateway'}) || &error($text{'routes_ecgw'}); $route->{'gateway'} = $in{'gateway'}; } else { # Local interface $route->{'iface'} = $in{'iface'}; } # Create the route $err = &create_route($route); &error($err) if ($err); &webmin_log("create", "route", $route->{'dest'}, $route); &redirect("list_routes.cgi"); net/slackware-linux-9.1-ALL-lib.pl0100775000567100000120000001742310656003101016456 0ustar jcameronwheel# slackware-linux-9.1-lib.pl # Networking functions for slackware linux 9.1 and above. Unlike older releases # of slackware, this one actually has a networking config file!! do 'linux-lib.pl'; $inet_conf = "/etc/rc.d/rc.inet1.conf"; %iconfig = &foreign_config("init"); $interfaces_file = $iconfig{'local_script'} || $iconfig{'extra_init'}; # boot_interfaces() # Returns a list of interfaces brought up at boot time sub boot_interfaces { local @rv; local $iface; # Add loopback push(@rv, { 'up' => 1, 'init' => 1, 'edit' => 0, 'name' => 'lo', 'fullname' => 'lo', 'address' => '127.0.0.1', 'netmask' => '255.0.0.0' } ); # Look in inet1.conf file for master interfaces local $lnum = 0; &open_readfile(CONF, $inet_conf); while() { if (/^\s*IPADDR\[(\d+)\]\s*=\s*"(.*)"/) { push(@rv, { 'up' => 1, 'init' => 1, 'edit' => 1, 'address' => $2, 'line' => $lnum, 'eline' => $lnum, 'number' => $1, 'file' => $inet_conf, 'name' => 'eth'.$1, 'fullname' => 'eth'.$1 }); } elsif (/^\s*NETMASK\[(\d+)\]\s*=\s*"(.*)"/ && @rv) { $rv[$#rv]->{'netmask'} = $2; if ($2 =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/ && $rv[$#rv]->{'address'}) { local ($a1, $a2, $a3, $a4) = split(/\./, $rv[$#rv]->{'address'}); $rv[$#rv]->{'broadcast'} = sprintf "%d.%d.%d.%d", ($a1 | ~int($1))&0xff, ($a2 | ~int($2))&0xff, ($a3 | ~int($3))&0xff, ($a4 | ~int($4))&0xff; } $rv[$#rv]->{'eline'} = $lnum; } elsif (/^\s*USE_DHCP\[(\d+)\]\s*=\s*"(.*)"/ && @rv) { $rv[$#rv]->{'dhcp'} = 1 if (lc($2) eq "yes"); $rv[$#rv]->{'eline'} = $lnum; } elsif (/^\s*\S+\[(\d+)\]\s*=\s*"(.*)"/ && @rv) { # Some other directive in the current section $rv[$#rv]->{'eline'} = $lnum; } $lnum++; } close(CONF); # Filter out any unset @rv = grep { $_->{'address'} || $_->{'dhcp'} } @rv; local $i; for($i=0; $i<@rv; $i++) { $rv[$i]->{'index'} = $i; } # Read extra init script for virtual interfaces local $lnum = 0; &open_readfile(IFACES, $interfaces_file); while() { s/\r|\n//g; if (/^(#*)\s*(\S*ifconfig)\s+(\S+)\s+(\S+)(\s+netmask\s+(\S+))?(\s+broadcast\s+(\S+))?(\s+mtu\s+(\d+))?\s+up$/) { # Found a usable interface line local $b = { 'fullname' => $3, 'up' => !$1, 'address' => $4, 'netmask' => $6, 'broadcast' => $8, 'mtu' => $10, 'edit' => 1, 'line' => $lnum, 'index' => scalar(@rv) }; if ($b->{'fullname'} =~ /(\S+):(\d+)/) { $b->{'name'} = $1; $b->{'virtual'} = $2; } else { $b->{'name'} = $b->{'fullname'}; } push(@rv, $b); } $lnum++; } close(IFACES); return @rv; } # save_interface(&details) # Create or update a boot-time interface's ifconfig command sub save_interface { # Find in existing config local @boot = &boot_interfaces(); local ($old) = grep { $_->{'fullname'} eq $_[0]->{'fullname'} } @boot; if ($old && $old->{'init'}) { # Modifying in inet1.conf file &lock_file($inet_conf); local $lref = &read_file_lines($inet_conf); local $i; for($i=$old->{'line'}; $i<=$old->{'eline'}; $i++) { if ($lref->[$i] =~ /^\s*IPADDR\[(\d+)\]\s*=\s*"(.*)"/) { $lref->[$i] = "IPADDR\[$1\]=\"$_[0]->{'address'}\""; } elsif ($lref->[$i] =~ /^\s*NETMASK\[(\d+)\]\s*=\s*"(.*)"/) { $lref->[$i] = "NETMASK\[$1\]=\"$_[0]->{'netmask'}\""; } elsif ($lref->[$i] =~ /^\s*USE_DHCP\[(\d+)\]\s*=\s*"(.*)"/) { local $dhcp = $_[0]->{'dhcp'} ? "yes" : ""; $lref->[$i] = "USE_DHCP\[$1\]=\"$dhcp\""; } } &flush_file_lines(); &unlock_file($inet_conf); } elsif (!$old && $_[0]->{'fullname'} =~ /^eth([0-3])$/) { # Adding to inet1.conf file, in the appropriate empty section local $num = $1; &lock_file($inet_conf); local $lref = &read_file_lines($inet_conf); local $i; for($i=0; $i<@$lref; $i++) { if ($lref->[$i] =~ /^\s*IPADDR\[(\d+)\]\s*=\s*"(.*)"/ && $1 == $num) { $lref->[$i] = "IPADDR\[$1\]=\"$_[0]->{'address'}\""; } elsif ($lref->[$i] =~ /^\s*NETMASK\[(\d+)\]\s*=\s*"(.*)"/ && $1 == $num) { $lref->[$i] = "NETMASK\[$1\]=\"$_[0]->{'netmask'}\""; } elsif ($lref->[$i] =~ /^\s*USE_DHCP\[(\d+)\]\s*=\s*"(.*)"/ && $1 == $num) { local $dhcp = $_[0]->{'dhcp'} ? "yes" : ""; $lref->[$i] = "USE_DHCP\[$1\]=\"$dhcp\""; } } &flush_file_lines(); &unlock_file($inet_conf); } else { # Modifying or adding some other interface in separate file &lock_file($interfaces_file); local $lref = &read_file_lines($interfaces_file); local $lnum = defined($_[0]->{'line'}) ? $_[0]->{'line'} : &interface_lnum($_[0]); if (defined($lnum)) { $lref->[$lnum] = &interface_line($_[0]); } else { push(@$lref, &interface_line($_[0])); } &flush_file_lines(); &unlock_file($interfaces_file); } } # delete_interface(&details) # Delete a boot-time interface's ifconfig command sub delete_interface { # Find in existing config local @boot = &boot_interfaces(); local ($old) = grep { $_->{'fullname'} eq $_[0]->{'fullname'} } @boot; if ($old && $old->{'init'}) { # Deleting from inet1.conf file .. just set to blank &lock_file($inet_conf); local $lref = &read_file_lines($inet_conf); local $i; for($i=$old->{'line'}; $i<=$old->{'eline'}; $i++) { if ($lref->[$i] =~ /^\s*(\S+)\[(\d+)\]\s*=\s*"(.*)"/) { $lref->[$i] = "$1\[$2\]=\"\""; } } &flush_file_lines(); &unlock_file($inet_conf); } else { # Deleting from separate file &lock_file($interfaces_file); local $lref = &read_file_lines($interfaces_file); local $lnum = defined($_[0]->{'line'}) ? $_[0]->{'line'} : &interface_lnum($_[0]); if (defined($lnum)) { splice(@$lref, $lnum, 1); } &flush_file_lines(); &unlock_file($interfaces_file); } } sub interface_lnum { local @boot = &boot_interfaces(); local ($found) = grep { $_->{'fullname'} eq $_[0]->{'fullname'} } @boot; return $found ? $found->{'line'} : undef; } sub interface_line { local $str; $str .= "# " if (!$_[0]->{'up'}); $str .= &has_command("ifconfig"); if (!$_[0]->{'fullname'}) { $_[0]->{'fullname'} = $_[0]->{'virtual'} ne "" ? $_[0]->{'name'}.":".$_[0]->{'virtual'} : $_[0]->{'name'}; } $str .= " $_[0]->{'fullname'} $_[0]->{'address'}"; if ($_[0]->{'netmask'}) { $str .= " netmask $_[0]->{'netmask'}"; } if ($_[0]->{'broadcast'}) { $str .= " broadcast $_[0]->{'broadcast'}"; } if ($_[0]->{'mtu'}) { $str .= " mtu $_[0]->{'mtu'}"; } $str .= " up"; return $str; } # can_edit(what) # Can some boot-time interface parameter be edited? sub can_edit { return $_[0] ne "bootp" && $_[0] ne "mtu"; } # valid_boot_address(address) # Is some address valid for a bootup interface sub valid_boot_address { return &check_ipaddress($_[0]); } # get_hostname() sub get_hostname { return &get_system_hostname(1); } # save_hostname(name) sub save_hostname { &system_logged("hostname $_[0] >/dev/null 2>&1"); &open_lock_tempfile(HOST, ">/etc/HOSTNAME"); &print_tempfile(HOST, $_[0],"\n"); &close_tempfile(HOST); undef(@main::get_system_hostname); # clear cache } sub routing_config_files { return ( $inet_conf ); } sub routing_input { &open_readfile(INIT, $inet_conf); while() { s/\r|\n//g; s/#.*$//; if (/^\s*GATEWAY\s*=\s*"(.*)"/) { $gw = $1; } } close(INIT); print " $text{'routes_default'} \n"; printf " %s\n", $gw ? "" : "checked", $text{'routes_none'}; printf " %s\n", $gw ? "checked" : "", $text{'routes_gateway'}; printf " \n", $gw; } sub parse_routing { local $gw = ""; if (!$in{'default'}) { &check_ipaddress($in{'gw'}) || &error(&text('routes_edefault', $in{'gw'})); $gw = $in{'gw'}; } &lock_file($inet_conf); local $lref = &read_file_lines($inet_conf); foreach $l (@$lref) { if ($l =~ /^(\s*)GATEWAY\s*=\s*"(.*)"(.*)/) { $l = $1."GATEWAY=\"".$gw."\"".$3; } } &flush_file_lines(); &unlock_file($inet_conf); }