aboutsummaryrefslogtreecommitdiff
path: root/cddl
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2013-05-15 22:56:24 +0000
committerMark Johnston <markj@FreeBSD.org>2013-05-15 22:56:24 +0000
commitfa0deba90f3138dc206448aa04c232f63ba5d299 (patch)
treeb1b873bc12d17d14e69652e733758633763a1821 /cddl
parent29c4b7861b74ac8c40a422d7a4c1318ddb3c7cec (diff)
downloadsrc-fa0deba90f3138dc206448aa04c232f63ba5d299.tar.gz
src-fa0deba90f3138dc206448aa04c232f63ba5d299.zip
Convert a couple of helper scripts used to test the ip provider to work on
FreeBSD. In the IPv6 case, try each interface before returning an error; each IPv6-enabled interface will have a link-local address even if the link isn't up. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=250685
Diffstat (limited to 'cddl')
-rwxr-xr-xcddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl2
-rwxr-xr-xcddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl29
2 files changed, 20 insertions, 11 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl
index 128263eaec22..ccc247dec514 100755
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl
@@ -73,7 +73,7 @@ die "Could not determine local IP address" if $local eq "";
# Find the first remote host that responds to an icmp echo,
# which isn't a local address.
#
-open PING, "/sbin/ping -ns $Broadcast{$local} 56 $MAXHOSTS |" or
+open PING, "/sbin/ping -n -s 56 -c $MAXHOSTS $Broadcast{$local} |" or
die "Couldn't run ping: $!\n";
while (<PING>) {
if (/bytes from (.*): / and not defined $Broadcast{$1}) {
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl
index 837ca3c799d2..35bea8e58fa1 100755
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl
@@ -48,7 +48,9 @@ my $MULTICAST = "FF02::1"; # IPv6 multicast address
#
my $local = "";
my $remote = "";
+my $interf = "";
my %Local;
+my %Addr;
my $up;
open IFCONFIG, '/sbin/ifconfig -a inet6 |'
or die "Couldn't run ifconfig: $!\n";
@@ -59,27 +61,34 @@ while (<IFCONFIG>) {
$up = 1 if /^[a-z].*<UP,/;
$up = 0 if /^[a-z].*<,/;
+ if (m:(\S+\d+)\: :) {
+ $interf = $1;
+ }
+
# assume output is "inet6 ...":
- if (m:inet6 (\S+)/:) {
+ if (m:inet6 (\S+) :) {
my $addr = $1;
$Local{$addr} = 1;
- $local = $addr if $up and $local eq "";
+ $Addr{$interf} = $addr;
$up = 0;
+ $interf = "";
}
}
close IFCONFIG;
-exit 1 if $local eq "";
#
# Find the first remote host that responds to an icmp echo,
-# which isn't a local address.
+# which isn't a local address. Try each IPv6-enabled interface.
#
-open PING, "/sbin/ping -ns -A inet6 $MULTICAST 56 $MAXHOSTS |" or
- die "Couldn't run ping: $!\n";
-while (<PING>) {
- if (/bytes from (.*): / and not defined $Local{$1}) {
- $remote = $1;
- last;
+foreach $interf (split(' ', `ifconfig -l -u inet6`)) {
+ next if $interf =~ /lo[0-9]+/;
+ open PING, "/sbin/ping6 -n -s 56 -c $MAXHOSTS $MULTICAST\%$interf |" or next;
+ while (<PING>) {
+ if (/bytes from (.*), / and not defined $Local{$1}) {
+ $remote = $1;
+ $local = $Addr{$interf};
+ last;
+ }
}
}
close PING;