]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Fixed connscheduler reconnecting even if not pppoe.
authorChristian Schmidt <maniacikarus@ipfire.org>
Sat, 16 Jan 2010 12:08:01 +0000 (13:08 +0100)
committerChristian Schmidt <maniacikarus@ipfire.org>
Sat, 16 Jan 2010 12:08:01 +0000 (13:08 +0100)
The reconnect should only get active if RED_TYPE is set to pppoe,
otherwise is should break and log. Added info to config that this
reconnect only works forWe have to ensure that reconnect is
not called by any static or dynamic RED_TYPE.

config/cfgroot/connscheduler.conf
config/rootfiles/core/35/filelists/files
src/scripts/connscheduler

index 9bcf1955d5b0b79eae1bf1c5d3873aadc7311cfa..379ac924534ffe54bf111b7f84328e45cab28fb3 100644 (file)
@@ -1 +1 @@
-on,reconnect,,05:00,weekdays,,Mon Tue Wed Thu Fri Sat Sun ,,MorningReconnect
+on,reconnect,,05:00,weekdays,,Mon Tue Wed Thu Fri Sat Sun ,,MorningReconnect for pppoe
index 15fca784311ea4f3e2f5aa030d6e52b31e574d01..a6bf8111537cc367e3c0e1bd5c12ad7b98f90776 100644 (file)
@@ -13,3 +13,5 @@ lib/modules/2.6.27.42-ipfire-xen/kernel/net/ieee80211/ieee80211_crypt_tkip.off
 lib/modules/2.6.27.42-ipfire-xen/kernel/net/ieee80211/ieee80211_crypt_wep.off
 srv/web/ipfire/cgi-bin/outgoingfw.cgi
 var/ipfire/outgoing/bin/outgoingfw.pl
 lib/modules/2.6.27.42-ipfire-xen/kernel/net/ieee80211/ieee80211_crypt_wep.off
 srv/web/ipfire/cgi-bin/outgoingfw.cgi
 var/ipfire/outgoing/bin/outgoingfw.pl
+usr/local/bin/connscheduler
+var/ipfire/connscheduler/connscheduler.conf
index bc4d4eb6562302b5fc60c2600604bf3226213e5a..ceb411601e55efbfb4f2a7fe2a11742b8917dbe6 100644 (file)
@@ -21,6 +21,9 @@ $weekday = ($weekday + 6) % 7;
 # get the closest thing possible
 $minute = int($minute / 5) * 5;
 
 # get the closest thing possible
 $minute = int($minute / 5) * 5;
 
+my $swroot = "/var/ipfire";
+my %ethernetsettings;
+&readhash("${swroot}/ethernet/settings", \%ethernetsettings);
 
 if ( $ARGV[0] eq 'hangup' )
 {
 
 if ( $ARGV[0] eq 'hangup' )
 {
@@ -117,7 +120,11 @@ sub dial
 
 
 sub reconnect
 
 
 sub reconnect
-{
+{ 
+  if ( $ethernetsettings{'RED_TYPE'} ne 'PPPOE' ){
+         &General::log("ConnSched skipped because not running pppoe");
+         exit;
+  }
   &hangup() if ( -e "${General::swroot}/red/active" );
   # now wait for active triggerfile and ppp daemon to disappear
   # wait maximum 60 seconds
   &hangup() if ( -e "${General::swroot}/red/active" );
   # now wait for active triggerfile and ppp daemon to disappear
   # wait maximum 60 seconds
@@ -242,3 +249,31 @@ sub timer
     }
   }
 }
     }
   }
 }
+
+sub readhash
+{
+       my $filename = $_[0];
+       my $hash = $_[1];
+       my ($var, $val);
+
+       if (-e $filename)
+       {
+               open(FILE, $filename) or die "Unable to read file $filename";
+               while (<FILE>)
+               {
+                       chop;
+                       ($var, $val) = split /=/, $_, 2;
+                       if ($var)
+                       {
+                               $val =~ s/^\'//g;
+                               $val =~ s/\'$//g;
+       
+                               # Untaint variables read from hash
+                               $var =~ /([A-Za-z0-9_-]*)/;        $var = $1;
+                               $val =~ /([\w\W]*)/; $val = $1;
+                               $hash->{$var} = $val;
+                       }
+               }
+               close FILE;
+       }
+}
\ No newline at end of file