diff --git a/net/cygwin-lib.pl b/net/cygwin-lib.pl index bf508e505..ae04797ab 100755 --- a/net/cygwin-lib.pl +++ b/net/cygwin-lib.pl @@ -250,8 +250,7 @@ return $_[0] =~ /^(dhcp|netmask)$/; # Is some address valid for a bootup interface sub valid_boot_address { -return 1 if (&check_ipaddress($_[0])); -return gethostbyname($_[0]) ? 1 : 0; +return &to_ipaddress($_[0]) ? 1 : 0; } # get_dns_config() diff --git a/net/debian-linux-lib.pl b/net/debian-linux-lib.pl index 04c429b33..370d901a7 100755 --- a/net/debian-linux-lib.pl +++ b/net/debian-linux-lib.pl @@ -521,9 +521,10 @@ for($i=0; defined($dev = $in{"dev_$i"}); $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_any($netmask) || &error(&text('routes_emask', $netmask)); - gethostbyname($gw) || &error(&text('routes_egateway', $gw)); + &to_ipaddress($net) || &error(&text('routes_enet', $net)); + &check_ipaddress_any($netmask) || + &error(&text('routes_emask', $netmask)); + &to_ipaddress($gw) || &error(&text('routes_egateway', $gw)); local $prefix = &mask_to_prefix($netmask); push(@{$st{$dev}}, [ "up", "ip route add $net/$prefix via $gw" ]); } @@ -533,9 +534,11 @@ for($i=0; defined($dev = $in{"ldev_$i"}); $i++) { local $netmask = $in{"lnetmask_$i"}; next if (!$dev && !$net); $dev =~ /^\S+$/ || &error(&text('routes_edevice', $dev)); - gethostbyname($net) || $net =~ /^(\S+)\/(\d+)$/ && gethostbyname($1) || + &to_ipaddress($net) || + $net =~ /^(\S+)\/(\d+)$/ && &to_ipaddress("$1") || &error(&text('routes_enet', $net)); - &check_ipaddress_any($netmask) || &error(&text('routes_emask', $netmask)); + &check_ipaddress_any($netmask) || + &error(&text('routes_emask', $netmask)); local $prefix = &mask_to_prefix($netmask); push(@{$hr{$dev}}, [ "up", "ip route add $net/$prefix dev $dev" ]); } diff --git a/net/open-linux-lib.pl b/net/open-linux-lib.pl index f7daadc7d..000f61474 100755 --- a/net/open-linux-lib.pl +++ b/net/open-linux-lib.pl @@ -194,7 +194,7 @@ else { delete($conf{'IPFORWARDING'}); } local %ifcs = map { $_->{'fullname'}, 1 } &all_interfaces(); if (!$in{'gateway_def'}) { - gethostbyname($in{'gateway'}) || + &to_ipaddress($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); $ifcs{$in{'gatewaydev'}} || &error(&text('routes_edevice', $in{'gatewaydev'})); diff --git a/net/redhat-linux-lib.pl b/net/redhat-linux-lib.pl index 3cae8f5be..0898589bc 100755 --- a/net/redhat-linux-lib.pl +++ b/net/redhat-linux-lib.pl @@ -428,7 +428,7 @@ local (%conf, @st, %sysctl, %st, @boot); if (!$supports_dev_gateway) { # Just update a single file if ($in{'gateway_def'}) { delete($conf{'GATEWAY'}); } - elsif (!gethostbyname($in{'gateway'})) { + elsif (!&to_ipaddress($in{'gateway'})) { &error(&text('routes_edefault', $in{'gateway'})); } else { $conf{'GATEWAY'} = $in{'gateway'}; } @@ -483,9 +483,9 @@ 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)); + &to_ipaddress($net) || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); - gethostbyname($gw) || &error(&text('routes_egateway', $gw)); + &to_ipaddress($gw) || &error(&text('routes_egateway', $gw)); if ($netmask eq "255.255.255.255") { push(@st, "$dev host $net gw $gw\n"); } @@ -498,7 +498,8 @@ 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) || + &to_ipaddress($net) || + $net =~ /^(\S+)\/(\d+)$/ && &to_ipaddress("$1") || &error(&text('routes_enet', $net)); &check_ipaddress($netmask) || &error(&text('routes_emask', $netmask)); if ($netmask eq "255.255.255.255") { diff --git a/net/solaris-lib.pl b/net/solaris-lib.pl index 7834789a3..8de38af21 100755 --- a/net/solaris-lib.pl +++ b/net/solaris-lib.pl @@ -186,8 +186,7 @@ return $_[0] eq "dhcp"; # Is some address valid for a bootup interface sub valid_boot_address { -return 1 if (&check_ipaddress($_[0])); -return gethostbyname($_[0]) ? 1 : 0; +return &to_ipaddress($_[0]) ? 1 : 0; } # get_dns_config() @@ -386,8 +385,8 @@ print &ui_table_row($text{'routes_forward'}, sub parse_routing { local @defrt = split(/\s+/, $in{'defrt'}); -foreach $d (@defrt) { - gethostbyname($d) || &error(&text('routes_edefault', $d)); +foreach my $d (@defrt) { + &to_ipaddress($d) || &error(&text('routes_edefault', $d)); } &lock_file("/etc/defaultrouter"); if (@defrt) { diff --git a/net/suse-linux-9.0-lib.pl b/net/suse-linux-9.0-lib.pl index 74b353af1..d866a2c55 100755 --- a/net/suse-linux-9.0-lib.pl +++ b/net/suse-linux-9.0-lib.pl @@ -245,7 +245,7 @@ sub parse_routing # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { - gethostbyname($in{'gateway'}) || + &to_ipaddress($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { diff --git a/net/suse-linux-9.2-ALL-lib.pl b/net/suse-linux-9.2-ALL-lib.pl index 6d0af4469..509c88582 100755 --- a/net/suse-linux-9.2-ALL-lib.pl +++ b/net/suse-linux-9.2-ALL-lib.pl @@ -332,7 +332,7 @@ sub parse_routing # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { - gethostbyname($in{'gateway'}) || + &to_ipaddress($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { diff --git a/net/suse-linux-lib.pl b/net/suse-linux-lib.pl index 37cf89739..e4d9ea3d5 100755 --- a/net/suse-linux-lib.pl +++ b/net/suse-linux-lib.pl @@ -267,7 +267,7 @@ 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) || + &to_ipaddress($net) || &error(&text('routes_enet', $net)); &check_ipaddress($mask) || &error(&text('routes_emask', $mask)); @@ -276,16 +276,16 @@ for($i=0; defined($dev = $in{"lr_dev_$i"}); $i++) { 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) || + &to_ipaddress($gw) || &error(&text('routes_egateway', $gw)); - gethostbyname($net) || + &to_ipaddress($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'}) || + &to_ipaddress($in{'default'}) || &error(&text('routes_edefault', $in{'default'})); $route .= "default\t\t$in{'default'}\n"; } diff --git a/net/united-linux-lib.pl b/net/united-linux-lib.pl index c2aee5e90..5454691ea 100755 --- a/net/united-linux-lib.pl +++ b/net/united-linux-lib.pl @@ -210,7 +210,7 @@ sub parse_routing # Parse route inputs local (@routes, $r, $i); if (!$in{'gateway_def'}) { - gethostbyname($in{'gateway'}) || + &to_ipaddress($in{'gateway'}) || &error(&text('routes_edefault', $in{'gateway'})); local @def = ( "default", $in{'gateway'}, undef, undef ); if (!$in{'gatewaydev_def'}) { diff --git a/net/unixware-lib.pl b/net/unixware-lib.pl index 1a9c71e7a..1ef1d0d74 100755 --- a/net/unixware-lib.pl +++ b/net/unixware-lib.pl @@ -194,8 +194,7 @@ return $_[0] eq "dhcp"; # Is some address valid for a bootup interface sub valid_boot_address { -return 1 if (&check_ipaddress($_[0])); -return gethostbyname($_[0]) ? 1 : 0; +return &to_ipaddress($_[0]) ? 1 : 0; } # get_dns_config() @@ -370,8 +369,8 @@ print &ui_table_row($text{'routes_forward'}, sub parse_routing { local @defrt = split(/\s+/, $in{'defrt'}); -foreach $d (@defrt) { - gethostbyname($d) || &error(&text('routes_edefault', $d)); +foreach my $d (@defrt) { + &to_ipaddress($d) || &error(&text('routes_edefault', $d)); } &lock_file("/etc/defaultrouter"); if (@defrt) {