summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2016-09-22 01:16:30 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2016-09-22 01:16:30 +0000
commit4c068d6c51cbc9b820008b37570fa23df72a8a48 (patch)
treef12d1addbb7829713772aae7fbf5bb82c8a606e0
parentab4aac88dab9db91ece995c859d5cd48b2ddeb6d (diff)
Call setsockopt(2) before listen(2) in relayd tests and adjust some
error messages.
-rw-r--r--regress/usr.sbin/relayd/Client.pm10
-rw-r--r--regress/usr.sbin/relayd/Server.pm15
2 files changed, 13 insertions, 12 deletions
diff --git a/regress/usr.sbin/relayd/Client.pm b/regress/usr.sbin/relayd/Client.pm
index 854b912fe21..b3e011de13d 100644
--- a/regress/usr.sbin/relayd/Client.pm
+++ b/regress/usr.sbin/relayd/Client.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Client.pm,v 1.11 2015/07/18 22:11:34 benno Exp $
+# $OpenBSD: Client.pm,v 1.12 2016/09/22 01:16:29 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -61,22 +61,22 @@ sub child {
if ($self->{sndbuf}) {
setsockopt($cs, SOL_SOCKET, SO_SNDBUF,
pack('i', $self->{sndbuf}))
- or die ref($self), " set sndbuf listen failed: $!";
+ or die ref($self), " set SO_SNDBUF failed: $!";
}
if ($self->{rcvbuf}) {
setsockopt($cs, SOL_SOCKET, SO_RCVBUF,
pack('i', $self->{rcvbuf}))
- or die ref($self), " set rcvbuf listen failed: $!";
+ or die ref($self), " set SO_SNDBUF failed: $!";
}
if ($self->{sndtimeo}) {
setsockopt($cs, SOL_SOCKET, SO_SNDTIMEO,
pack('l!l!', $self->{sndtimeo}, 0))
- or die ref($self), " set SO_SNDTIMEO failed failed: $!";
+ or die ref($self), " set SO_SNDTIMEO failed: $!";
}
if ($self->{rcvtimeo}) {
setsockopt($cs, SOL_SOCKET, SO_RCVTIMEO,
pack('l!l!', $self->{rcvtimeo}, 0))
- or die ref($self), " set SO_RCVTIMEO failed failed: $!";
+ or die ref($self), " set SO_RCVTIMEO failed: $!";
}
print STDERR "connect sock: ",$cs->sockhost()," ",$cs->sockport(),"\n";
diff --git a/regress/usr.sbin/relayd/Server.pm b/regress/usr.sbin/relayd/Server.pm
index 22d2855a284..5ada2f91833 100644
--- a/regress/usr.sbin/relayd/Server.pm
+++ b/regress/usr.sbin/relayd/Server.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: Server.pm,v 1.10 2016/08/25 22:56:13 bluhm Exp $
+# $OpenBSD: Server.pm,v 1.11 2016/09/22 01:16:29 bluhm Exp $
# Copyright (c) 2010-2015 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -41,35 +41,36 @@ sub new {
Proto => "tcp",
ReuseAddr => 1,
Domain => $self->{listendomain},
- Listen => 1,
$self->{listenaddr} ? (LocalAddr => $self->{listenaddr}) : (),
$self->{listenport} ? (LocalPort => $self->{listenport}) : (),
SSL_key_file => "server.key",
SSL_cert_file => "server.crt",
SSL_verify_mode => SSL_VERIFY_NONE,
- ) or die ref($self), " $iosocket socket listen failed: $!,$SSL_ERROR";
+ ) or die ref($self), " $iosocket socket failed: $!,$SSL_ERROR";
if ($self->{sndbuf}) {
setsockopt($ls, SOL_SOCKET, SO_SNDBUF,
pack('i', $self->{sndbuf}))
- or die ref($self), " set sndbuf SO_SNDBUF failed: $!";
+ or die ref($self), " set SO_SNDBUF failed: $!";
}
if ($self->{rcvbuf}) {
setsockopt($ls, SOL_SOCKET, SO_RCVBUF,
pack('i', $self->{rcvbuf}))
- or die ref($self), " set rcvbuf SO_RCVBUF failed: $!";
+ or die ref($self), " set SO_RCVBUF failed: $!";
}
my $packstr = $Config{longsize} == 8 ? 'ql!' :
$Config{byteorder} == 1234 ? 'lxxxxl!' : 'xxxxll!';
if ($self->{sndtimeo}) {
setsockopt($ls, SOL_SOCKET, SO_SNDTIMEO,
pack($packstr, $self->{sndtimeo}, 0))
- or die ref($self), " set SO_SNDTIMEO failed failed: $!";
+ or die ref($self), " set SO_SNDTIMEO failed: $!";
}
if ($self->{rcvtimeo}) {
setsockopt($ls, SOL_SOCKET, SO_RCVTIMEO,
pack($packstr, $self->{rcvtimeo}, 0))
- or die ref($self), " set SO_RCVTIMEO failed failed: $!";
+ or die ref($self), " set SO_RCVTIMEO failed: $!";
}
+ listen($ls, 1)
+ or die ref($self), " socket listen failed: $!";
my $log = $self->{log};
print $log "listen sock: ",$ls->sockhost()," ",$ls->sockport(),"\n";
$self->{listenaddr} = $ls->sockhost() unless $self->{listenaddr};