summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2014-10-08 20:07:34 +0200
committerDaniil Baturin <daniil@baturin.org>2014-10-08 20:07:34 +0200
commit2b2b8e3a4073cec8546a9662e390f9a4ddd31119 (patch)
tree6db51020c48f333c9087740ec1a5d72093ea26b6
parent65a6b5005819f40f210bfc6ce04a6d41576c2f31 (diff)
downloadvyatta-cfg-system-2b2b8e3a4073cec8546a9662e390f9a4ddd31119.tar.gz
vyatta-cfg-system-2b2b8e3a4073cec8546a9662e390f9a4ddd31119.zip
Fix regular expression so it works with any (I hope!) interface types.
Minor cleanup.
-rw-r--r--scripts/vyos-intfwatchd11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/vyos-intfwatchd b/scripts/vyos-intfwatchd
index 8f9842c2..27ae35f3 100644
--- a/scripts/vyos-intfwatchd
+++ b/scripts/vyos-intfwatchd
@@ -46,6 +46,8 @@ use constant
UNLOCK => 8
};
+my $debug = 0;
+
sub daemonize
{
syslog("info", "%s", "Starting in daemon mode");
@@ -120,8 +122,8 @@ sub terminate
exit(0);
}
-$SIG{'INT'} = \&terminateNormally;
-$SIG{'TERM'} = \&terminateNormally;
+$SIG{'INT'} = \&terminate;
+$SIG{'TERM'} = \&terminate;
$SIG{'KILL'} = sub { exit(0); };
# This solution should be bad enough to be fixed immediately
@@ -129,16 +131,15 @@ $SIG{'KILL'} = sub { exit(0); };
while(<HANDLE>)
{
- if( $_ =~ /^[0-9]+:\s(.*)(@.*)\s<.*UP,.*>/ )
+ if( $_ =~ /^[0-9]+:\s+(.*)(@.*)*:\s+<.*UP,.*>/ )
{
- print "Event event $1\n";
my $intf_name = $1;
my $intf = new Vyatta::Interface($intf_name);
my $intf_addr_path = $intf->path() . " address";
# Get IPv6 addresses
my @addresses = grep /:/, $config->returnValues($intf_addr_path);
- print Dumper(@addresses);
+ print Dumper(@addresses) if $debug;
foreach my $address (@addresses)
{