summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-04-19 18:34:08 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-04-19 18:34:08 +0100
commit9cc0c043132676c1803b017b8f77dba45c20c08e (patch)
treef4cfff50247b170ed94f7647c39cd87f6ebdc9b8
parent4e5552a4239587e8bcc6a7fae5c6b276b6b8e873 (diff)
downloaduserv-utils-9cc0c043132676c1803b017b8f77dba45c20c08e.tar.gz
ipif: service-wrap: make v0config into a positional arg
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xipif/service-wrap22
1 files changed, 8 insertions, 14 deletions
diff --git a/ipif/service-wrap b/ipif/service-wrap
index 412c2dc..3a4e806 100755
--- a/ipif/service-wrap
+++ b/ipif/service-wrap
@@ -13,7 +13,7 @@
#
# Usage:
#
-# .../ipif1 <v1config> <real-service-program> -- <service-args>...
+# .../ipif1 <v1config> <real-service-program> <v0config> -- <service-args>...
#
# Config file is a series of lines, or a directory. If a directory,
# all files with names matching ^[-A-Za-z0-9_]+$ are processed.
@@ -50,10 +50,11 @@
#
# include <other-config-file-or-directory>
#
-# v0config <v0configfile>
+# <v0config>
#
-# If none of the `permit' lines match, will read <v0configfile>
-# in old format. Must come after all `permit' lines.
+# If none of the `permit' lines match, will process <v0config> in
+# old format. See service.c head comment. <v0config> may be
+# `' or `#' or `/dev/null' to process new-style config only.
#
# <config> --
@@ -79,8 +80,8 @@ sub oneaddr ($) {
$$ar = $x;
}
-@ARGV == 5 or badusage "wrong number of arguments";
-our ($v1config, $realservice, $sep, $addrsarg, $rnets) = @ARGV;
+@ARGV == 6 or badusage "wrong number of arguments";
+our ($v1config, $realservice, $v0config, $sep, $addrsarg, $rnets) = @ARGV;
$sep eq '--' or badusage "separator should be \`--'";
my ($local_addr, $peer_addr, $mtu, $protocol, $ifname) =
@@ -110,8 +111,6 @@ sub execreal ($) {
or die "exec $realservice: $!\n";
}
-our $v0config;
-
our $cfgpath;
sub badcfg ($) {
@@ -203,7 +202,6 @@ sub readconfig ($) {
next if m/^\#/;
next unless m/\S/;
if (s{^permit\s+}{}) {
- badcfg "v0config before permit" if defined $v0config;
%need_allow = ();
need_allow_singleton 'Caller', allowent 'caller';
need_allow_singleton 'Local',
@@ -266,9 +264,6 @@ sub readconfig ($) {
print "config $cfgpath:$.: mismatch: $_\n"
foreach @wrong;
}
- } elsif (m{^v0config\s+(\S+)$}) {
- badcfg "repeated v0config" if defined $v0config;
- $v0config = $1;
} elsif (m{^include\s+(\S+)$}) {
readconfig $1;
} else {
@@ -278,8 +273,7 @@ sub readconfig ($) {
$cfgfh->error and die $!;
close $cfgfh;
- if (defined $v0config) {
- $v0config =~ s{^}{./} unless $v0config =~ m{^/};
+ if ($v0config && $v0config =~ m{^[^#]} && $v0config ne '/dev/null') {
print "trying v0 config $v0config...\n" if $protocol eq 'debug';
execreal $v0config;
}