aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2015-05-19 07:10:34 +0300
committerSergey Poznyakoff <gray@gnu.org>2015-05-19 07:10:34 +0300
commit20fed8167852cf54fc89322bb5f5cb1e16653b3d (patch)
tree3bd8aae2655a7ad471f8de3e9f922dc347c3ff92
parenteb851ae32ee068dd368a8cb6db9b04e526316643 (diff)
downloaddnstools-20fed8167852cf54fc89322bb5f5cb1e16653b3d.tar.gz
dnstools-20fed8167852cf54fc89322bb5f5cb1e16653b3d.tar.bz2
Bugfixes
* dgd/dgd: Support for core.pidfile (readconfig): New keyword include.pathopt Use bsd_globr; don't complain if pattern does not match any file. (scan_links): Don't treat undefined core.active as error. * dgd/rc.uplink (linkup): Print semicolon after each IP.
-rwxr-xr-xdgd/dgd31
-rwxr-xr-xdgd/rc.uplink2
2 files changed, 25 insertions, 8 deletions
diff --git a/dgd/dgd b/dgd/dgd
index 0afae81..4aa7f02 100755
--- a/dgd/dgd
+++ b/dgd/dgd
@@ -19,2 +19,3 @@ use Getopt::Long qw(:config gnu_getopt no_ignore_case);
use File::Basename;
+use File::Glob ':bsd_glob';
use Net::Ping;
@@ -72,3 +73,4 @@ my %kw = (
down => { check => \&check_prog },
- logpriority => { re => '^0|1$' }
+ logpriority => { re => '^0|1$' },
+ pidfile => 1
}
@@ -205,6 +207,8 @@ sub readconfig {
+ debug(1, "reading $file");
open(my $fd, "<", $file)
or do {
+ error("can't open configuration file $file: $!");
return 1 if $param{include};
- abend(EX_NOINPUT, "can't open configuration file $file: $!");
+ exit(EX_NOINPUT);
};
@@ -265,5 +269,8 @@ sub readconfig {
$err += readconfig($v, $conf, include => 1, @_);
+ } elsif ($k eq 'pathopt') {
+ $err += readconfig($v, $conf, include => 1, @_)
+ if -f $v;
} elsif ($k eq 'glob') {
- foreach my $file (glob $v) {
- $err += readconfig($file, $conf, @_);
+ foreach my $file (bsd_glob($v, 0)) {
+ $err += readconfig($file, $conf, include => 1, @_);
}
@@ -316,3 +323,3 @@ sub readconfig {
if (defined($param{kw}) and !$param{include}) {
- $err += check_mandatory($conf, $param{kw}, "$file:$line", 1)
+ $err += check_mandatory($conf, $param{kw}, "$file:$line", 1);
}
@@ -355,4 +362,5 @@ sub scan_links {
my $gw = get_default_gw();
- debug(1, "default gw $gw");
if (defined($gw)) {
+ debug(1, "default gw $gw");
+
for ($active_link = 0; $active_link <= $#links; ++$active_link) {
@@ -366,3 +374,4 @@ sub scan_links {
} else {
- abend(EX_CONFIG, "no active link configured")
+ debug(1, "no active link configured");
+ $active_link = undef;
}
@@ -626,2 +635,6 @@ Include contents of F<FILE>. The file must exist.
+=item B<pathopt => F<FILE>
+
+Same as B<path>, except that F<FILE> is not required to exist.
+
=item B<glob => I<PATTERN>
@@ -675,2 +688,6 @@ the link in question is passed as argument to I<COMMAND>.
+=item B<pidfile => I<FILE>
+
+Write PID of the B<dgd> daemon process to I<FILE>.
+
=back
diff --git a/dgd/rc.uplink b/dgd/rc.uplink
index ac0488a..f116293 100755
--- a/dgd/rc.uplink
+++ b/dgd/rc.uplink
@@ -76,3 +76,3 @@ EOT
BEGIN { print "forwarders {" }
-{ for (i = 1; i <= NF; i++) print " " $(i); }
+{ for (i = 1; i <= NF; i++) print " " $(i) ";"; }
END { print "};" }' > $forwarders

Return to:

Send suggestions and report system problems to the System administrator.