summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGaurav Sinha <gaurav.sinha@vyatta.com>2011-12-15 17:26:10 -0800
committerGaurav Sinha <gaurav.sinha@vyatta.com>2011-12-15 17:26:10 -0800
commit726332166821253c36995aaa690923d159c08274 (patch)
tree24450b99510020dcc964a34ed46b5c26dee9827d /scripts
parent7aaa5c08f46203cd6bdf3c9c12e6c9185341c616 (diff)
parent7b98a85b8b777182e698d0c2c4e668fa90245555 (diff)
downloadvyatta-conntrack-726332166821253c36995aaa690923d159c08274.tar.gz
vyatta-conntrack-726332166821253c36995aaa690923d159c08274.zip
Bug 7676: including unstaged changes for 7677
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-params-on-reboot.d/conntrack-hash-size4
-rw-r--r--scripts/vyatta-update-conntrack-log.pl46
2 files changed, 48 insertions, 2 deletions
diff --git a/scripts/check-params-on-reboot.d/conntrack-hash-size b/scripts/check-params-on-reboot.d/conntrack-hash-size
index 4849bda..19524d7 100755
--- a/scripts/check-params-on-reboot.d/conntrack-hash-size
+++ b/scripts/check-params-on-reboot.d/conntrack-hash-size
@@ -6,10 +6,10 @@
BOOTFILE=$1
# Obtain firewall config version
-version=`tail -n 2 $BOOTFILE | sed -n 's/.*\(firewall\@[0-9]\).*/\1/; h; x;p;q' | awk -F '@' '{print $2}'`
+version=`grep "=== vyatta-config-version:" $BOOTFILE | sed -n 's/.*\(firewall\@[0-9]\).*/\1/; h; x;p;q' | awk -F '@' '{print $2}'`
if [ -z $version ]; then
- echo "Warning: could not determine firewall config version. Conntrack hash size will not be updated."
+ logger -s "Warning: could not determine firewall config version. Conntrack hash size will not be updated."
exit 1
fi
diff --git a/scripts/vyatta-update-conntrack-log.pl b/scripts/vyatta-update-conntrack-log.pl
new file mode 100644
index 0000000..09ee0a5
--- /dev/null
+++ b/scripts/vyatta-update-conntrack-log.pl
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+
+use strict;
+use lib "/opt/vyatta/share/perl5";
+use Vyatta::Conntrack::Config;
+
+my $pfile = '/var/run/vyatta/connlogd.lock';
+my $lfile = '/var/run/vyatta/connlogd.log';
+
+my $config = new Vyatta::Conntrack::Config;
+my $oconfig = new Vyatta::Conntrack::Config;
+$config->setup();
+$oconfig->setupOrig();
+
+if (!($config->isDifferentFrom($oconfig))) {
+ if ($config->isEmpty()) {
+ print STDERR "Empty Configuration\n";
+ exit 1;
+ }
+ # config not changed. do nothing.
+ exit 0;
+}
+
+if ($config->isEmpty()) {
+ # delete the daemon process
+ Vyatta::Conntrack::Config::kill_daemon();
+ # delete the .lock and .log file getting generated
+ `rm -f $pfile`;
+ `rm -f $lfile`;
+ exit 0;
+}
+
+my $cmd = $config->get_command();
+if ($cmd) {
+ # First stop the daemon and restart with config
+ Vyatta::Conntrack::Config::kill_daemon();
+ `rm -f $pfile`;
+ `rm -f $lfile`;
+ system("$cmd");
+ if ($? >> 8) {
+ print STDERR "Failed to start conntrack logging daemon";
+ exit 1;
+ }
+}
+
+exit 0;