Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131900234
D20086.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D20086.diff
View Options
Index: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localsctp.ksh
===================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localsctp.ksh
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localsctp.ksh
@@ -58,36 +58,52 @@
sctpport=1024
bound=5000
-while [ $sctpport -lt $bound ]; do
- ncat --sctp -z $local $sctpport > /dev/null || break
- sctpport=$(($sctpport + 1))
-done
-if [ $sctpport -eq $bound ]; then
- echo "couldn't find an available SCTP port"
- exit 1
-fi
mkdir $DIR
cd $DIR
-# ncat will exit when the association is closed.
-ncat --sctp --listen $local $sctpport &
-
-cat > test.pl <<-EOPERL
+cat > client.pl <<-EOPERL
use IO::Socket;
my \$s = IO::Socket::INET->new(
Type => SOCK_STREAM,
Proto => "sctp",
LocalAddr => "$local",
PeerAddr => "$local",
- PeerPort => $sctpport,
+ PeerPort => \$ARGV[0],
Timeout => 3);
- die "Could not connect to host $local port $sctpport \$@" unless \$s;
+ die "Could not connect to host $local port \$ARGV[0] \$@" unless \$s;
close \$s;
- sleep(2);
+ sleep(\$ARGV[1]);
EOPERL
-$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
+while [ $sctpport -lt $bound ]; do
+ perl client.pl $sctpport 0 2>&- || break
+ sctpport=$(($sctpport + 1))
+done
+if [ $sctpport -eq $bound ]; then
+ echo "couldn't find an available SCTP port"
+ exit 1
+fi
+
+cat > server.pl <<-EOPERL
+ use IO::Socket;
+ my \$l = IO::Socket::INET->new(
+ Type => SOCK_STREAM,
+ Proto => "sctp",
+ LocalAddr => "$local",
+ LocalPort => $sctpport,
+ Listen => 1,
+ Reuse => 1);
+ die "Could not listen on $local port $sctpport \$@" unless \$l;
+ my \$c = \$l->accept();
+ close \$l;
+ while (<\$c>) {};
+ close \$c;
+EOPERL
+
+perl server.pl &
+
+$dtrace -c "perl client.pl $sctpport 2" -qs /dev/stdin <<EODTRACE
BEGIN
{
ipsend = sctpsend = ipreceive = sctpreceive = 0;
@@ -122,10 +138,10 @@
END
{
printf("Minimum SCTP events seen\n\n");
- printf("ip:::send (%d) - %s\n", ipsend, ipsend >= 7 ? "yes" : "no");
- printf("ip:::receive (%d) - %s\n", ipreceive, ipreceive >= 7 ? "yes" : "no");
- printf("sctp:::send (%d) - %s\n", sctpsend, sctpsend >= 7 ? "yes" : "no");
- printf("sctp:::receive (%d) - %s\n", sctpreceive, sctpreceive >= 7 ? "yes" : "no");
+ printf("ip:::send - %s\n", ipsend >= 7 ? "yes" : "no");
+ printf("ip:::receive - %s\n", ipreceive >= 7 ? "yes" : "no");
+ printf("sctp:::send - %s\n", sctpsend >= 7 ? "yes" : "no");
+ printf("sctp:::receive - %s\n", sctpreceive >= 7 ? "yes" : "no");
}
EODTRACE
Index: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localsctpstate.ksh
===================================================================
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localsctpstate.ksh
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localsctpstate.ksh
@@ -61,36 +61,52 @@
sctpport=1024
bound=5000
-while [ $sctpport -lt $bound ]; do
- ncat --sctp -z $local $sctpport > /dev/null || break
- sctpport=$(($sctpport + 1))
-done
-if [ $sctpport -eq $bound ]; then
- echo "couldn't find an available SCTP port"
- exit 1
-fi
mkdir $DIR
cd $DIR
-# ncat will exit when the association is closed.
-ncat --sctp --listen $local $sctpport &
-
-cat > test.pl <<-EOPERL
+cat > client.pl <<-EOPERL
use IO::Socket;
my \$s = IO::Socket::INET->new(
Type => SOCK_STREAM,
Proto => "sctp",
LocalAddr => "$local",
PeerAddr => "$local",
- PeerPort => $sctpport,
+ PeerPort => \$ARGV[0],
Timeout => 3);
- die "Could not connect to host $local port $sctpport \$@" unless \$s;
+ die "Could not connect to host $local port \$ARGV[0] \$@" unless \$s;
close \$s;
- sleep(2);
+ sleep(\$ARGV[1]);
EOPERL
-$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
+while [ $sctpport -lt $bound ]; do
+ perl client.pl $sctpport 0 2>&- || break
+ sctpport=$(($sctpport + 1))
+done
+if [ $sctpport -eq $bound ]; then
+ echo "couldn't find an available SCTP port"
+ exit 1
+fi
+
+cat > server.pl <<-EOPERL
+ use IO::Socket;
+ my \$l = IO::Socket::INET->new(
+ Type => SOCK_STREAM,
+ Proto => "sctp",
+ LocalAddr => "$local",
+ LocalPort => $sctpport,
+ Listen => 1,
+ Reuse => 1);
+ die "Could not listen on $local port $sctpport \$@" unless \$l;
+ my \$c = \$l->accept();
+ close \$l;
+ while (<\$c>) {};
+ close \$c;
+EOPERL
+
+perl server.pl &
+
+$dtrace -c "perl client.pl $sctpport 2" -qs /dev/stdin <<EODTRACE
BEGIN
{
ipsend = sctpsend = ipreceive = sctpreceive = 0;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Oct 13, 2:05 AM (7 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23651571
Default Alt Text
D20086.diff (4 KB)
Attached To
Mode
D20086: Replace ncat by a perl script for running an SCTP discard server
Attached
Detach File
Event Timeline
Log In to Comment