summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-02-23 18:05:30 -0600
committerJohn Southworth <john.southworth@vyatta.com>2011-02-23 18:05:30 -0600
commit0977f61ae4c904d6f67e549ecd06f938686620d8 (patch)
tree555d34a5d53aedaf8e4dc107cda2e4c047c054bc
parentd541001f5a070e5565e54d390b27d92ab1e16c20 (diff)
downloadvyatta-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-xscripts/vpn-config.pl28
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