aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2015-05-20 08:04:56 +0300
committerSergey Poznyakoff <gray@gnu.org>2015-05-20 08:08:37 +0300
commit1866566b9abb7ee4d3cd4f04fe9a88959db8fc4e (patch)
tree7761d3029ccfbda3dad6824820e176642bafbfd6
parent20fed8167852cf54fc89322bb5f5cb1e16653b3d (diff)
downloaddnstools-1866566b9abb7ee4d3cd4f04fe9a88959db8fc4e.tar.gz
dnstools-1866566b9abb7ee4d3cd4f04fe9a88959db8fc4e.tar.bz2
Fix reconfiguration on SIGNUP
* dgd/dgd (defconfig): New variable. (readconfig): Remove calls to check_mandatory (temporarly) (scan_links): Filter off incomplete link definitions. Don't panic if core.active points to an undefined link. (main): Initialize %config. (SIGHUP): Initialize %t.
-rwxr-xr-xdgd/dgd36
1 files changed, 20 insertions, 16 deletions
diff --git a/dgd/dgd b/dgd/dgd
index 4aa7f02..1aeac04 100755
--- a/dgd/dgd
+++ b/dgd/dgd
@@ -38,3 +38,3 @@ my $active_link;
-my %config = (
+my %defconfig = (
core => {
@@ -46,2 +46,3 @@ my %config = (
);
+my %config;
@@ -237,5 +238,2 @@ sub readconfig {
if (/^\[(.+?)\]$/) {
- $err += check_mandatory($section, $kw, "$file:$line")
- if defined $kw;
-
$include = 0;
@@ -322,5 +320,5 @@ sub readconfig {
close $fd;
- if (defined($param{kw}) and !$param{include}) {
- $err += check_mandatory($conf, $param{kw}, "$file:$line", 1);
- }
+ # if (defined($param{kw}) and !$param{include}) {
+ # $err += check_mandatory($conf, $param{kw}, "$file:$line", 1);
+ # }
return $err;
@@ -344,5 +342,9 @@ sub scan_links {
@links = sort { $a->{priority} <=> $b->{priority} }
- map { $_->{priority} = 100 unless exists $_->{priority};
- debug(1, "registered link $_->{name} via $_->{if}");
- $_
+ map { if (defined($_->{name})) {
+ $_->{priority} = 100 unless exists $_->{priority};
+ debug(1, "registered link $_->{name} via $_->{if}");
+ $_
+ } else {
+ ()
+ }
} values %{$config{link}};
@@ -356,7 +358,8 @@ sub scan_links {
}
+ error("no link corresponding to the active one");
+ $active_link = undef;
+ delete $config{core}{active};
+ }
- abend(EX_CONFIG,
- "no link corresponding to the active one")
- if ($active_link > $#links);
- } else {
+ unless (defined($active_link)) {
my $gw = get_default_gw();
@@ -483,2 +486,3 @@ GetOptions("h" => sub {
+%config = %defconfig;
if (readconfig($conffile, \%config, kw => \%kw)) {
@@ -526,5 +530,5 @@ unless ($foreground) {
$SIG{HUP} = sub {
- my %t;
+ my %t = %defconfig;
diag('info', "re-reading configuration file");
- if (readconfig($conffile, \%t)) {
+ if (readconfig($conffile, \%t) == 0) {
%config = %t;

Return to:

Send suggestions and report system problems to the System administrator.