-# $OpenBSD: Proc.pm,v 1.6 2014/05/09 11:49:26 andre Exp $
+# $OpenBSD: Proc.pm,v 1.7 2014/05/12 21:30:42 andre Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
do {
my($kid, $status, $code) = $self->wait(WNOHANG);
- if ($kid > 0 && $status != 0 && not $self->{dummyrun}) {
+ if ($kid > 0 && $status != 0 && !$self->{dryrun}) {
# child terminated with failure
die ref($self), " child status: $status $code";
}
-# $OpenBSD: Relayd.pm,v 1.8 2014/05/09 11:49:26 andre Exp $
+# $OpenBSD: Relayd.pm,v 1.9 2014/05/12 21:30:42 andre Exp $
# Copyright (c) 2010-2012 Alexander Bluhm <bluhm@openbsd.org>
#
my %args = @_;
$args{logfile} ||= "relayd.log";
$args{up} ||= "Started";
- $args{down} ||= "parent terminating";
+ $args{down} ||= $args{dryrun} ? "no actions" : "parent terminating";
$args{func} = sub { Carp::confess "$class func may not be called" };
$args{conffile} ||= "relayd.conf";
$args{forward}
sub up {
my $self = Proc::up(shift, @_);
my $timeout = shift || 10;
- my $dummyrun = $self->{dummyrun} || 0;
- my $lsock = $self->loggrep(qr/relay_launch: /, $timeout)
- or croak ref($self), " no relay_launch in $self->{logfile} ".
- "after $timeout seconds" unless $dummyrun;
+ my $regex = $self->{dryrun} || "relay_launch: ";
+ my $lsock = $self->loggrep(qr/$regex/, $timeout)
+ or croak ref($self), " no $regex in $self->{logfile} ".
+ "after $timeout seconds";
return $self;
}
loggrep => {
qr/relayd.conf\:.*action only supported for headers/ => 1
},
- dummyrun => 1,
+ dryrun => "relayd.conf",
},
server => {
noserver => 1,
'request path mark "*" with 99 marked 55',
],
loggrep => { "either mark or marked" => 1 },
- dummyrun => 1,
+ dryrun => "relayd.conf",
},
server => {
noserver => 1,
#!/usr/bin/perl
-# $OpenBSD: relayd.pl,v 1.9 2014/05/09 11:49:26 andre Exp $
+# $OpenBSD: relayd.pl,v 1.10 2014/05/12 21:30:42 andre Exp $
# Copyright (c) 2010-2013 Alexander Bluhm <bluhm@openbsd.org>
#
connectaddr => "127.0.0.1",
connectport => $rport,
%{$args{client}},
-);
+) unless $args{client}{noclient};
$s->run unless $args{server}{noserver};
$r->run;
$c->down unless $args{client}{noclient};
$s->down unless $args{server}{noserver};
$r->kill_child;
-$r->down unless $args{relayd}{dummyrun};
+$r->down;
check_logs($c, $r, $s, %args);