diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-02-23 18:05:30 -0600 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-02-23 18:05:30 -0600 |
commit | 0977f61ae4c904d6f67e549ecd06f938686620d8 (patch) | |
tree | 555d34a5d53aedaf8e4dc107cda2e4c047c054bc | |
parent | d541001f5a070e5565e54d390b27d92ab1e16c20 (diff) | |
download | vyatta-cfg-vpn-0977f61ae4c904d6f67e549ecd06f938686620d8.tar.gz vyatta-cfg-vpn-0977f61ae4c904d6f67e549ecd06f938686620d8.zip |
Don't make vpn-config.pl run if there were no relevant changes, before it ran everytime there was a change in pptp or l2tp configs as well.
-rwxr-xr-x | scripts/vpn-config.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/vpn-config.pl b/scripts/vpn-config.pl index b862d09..69ca64c 100755 --- a/scripts/vpn-config.pl +++ b/scripts/vpn-config.pl @@ -73,6 +73,14 @@ my $vc = new Vyatta::Config(); my $vcVPN = new Vyatta::Config(); $vcVPN->setLevel('vpn'); +# check to see if the config has changed. +# if it has not then exit +my $retval = getConfigStatus('ipsec', $vcVPN); +my $retval2 = getConfigStatus('rsa-keys', $vcVPN); +if (!$retval && !$retval2) { + exit 0; +} + if ( $vcVPN->exists('ipsec') ) { # @@ -1418,5 +1426,25 @@ EOS close $dhcp_hook; } +sub getConfigStatus { + my ($level, $vconfig) = @_; + my @nodes = $vconfig->listNodes($level); + foreach my $node (@nodes){ + my $newlevel = "$level $node"; + return 1 if ($vconfig->isChanged($newlevel)); + getConfigStatus($newlevel, $vconfig); + } +} + +sub logger { + my $msg = pop(@_); + my $FACILITY = "daemon"; + my $LEVEL = "notice"; + my $TAG = "vyatta-vpn-config"; + my $LOGCMD = "logger -t $TAG -p $FACILITY.$LEVEL"; + system("$LOGCMD $msg"); +} + + # end of file |