From 4e5653511ddf3d44e26122c390bc93f6b924082d Mon Sep 17 00:00:00 2001
From: ms
Date: Mon, 17 Jul 2006 18:18:39 +0000
Subject: [PATCH] =?utf8?q?Hinzugef=C3=BCgt:=20=20=20*=20Wake-On-Lan=20=20?=
=?utf8?q?=20*=20Connection-Scheduler?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@211 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
---
config/cfgroot/connscheduler-lib.pl | 77 +++++
config/cfgroot/header-menu.pl | 24 --
config/cfgroot/header.pl | 8 +-
config/cron/crontab | 7 +-
html/cgi-bin/connscheduler.cgi | 475 ++++++++++++++++++++++++++++
html/cgi-bin/wakeonlan.cgi | 439 +++++++++++++++++++++++++
html/html/images/down.gif | Bin 0 -> 323 bytes
html/html/images/up.gif | Bin 0 -> 321 bytes
html/html/images/wakeup.gif | Bin 0 -> 189 bytes
langs/de/cgi-bin/de.pl | 18 ++
langs/en/cgi-bin/en.pl | 18 ++
lfs/configroot | 13 +-
make.sh | 1 +
src/ROOTFILES.i386 | 4 +
src/misc-progs/Makefile | 5 +-
src/misc-progs/launch-ether-wake.c | 33 ++
src/scripts/connscheduler | 214 +++++++++++++
17 files changed, 1302 insertions(+), 34 deletions(-)
create mode 100644 config/cfgroot/connscheduler-lib.pl
delete mode 100644 config/cfgroot/header-menu.pl
create mode 100644 html/cgi-bin/connscheduler.cgi
create mode 100644 html/cgi-bin/wakeonlan.cgi
create mode 100644 html/html/images/down.gif
create mode 100644 html/html/images/up.gif
create mode 100644 html/html/images/wakeup.gif
create mode 100644 src/misc-progs/launch-ether-wake.c
create mode 100644 src/scripts/connscheduler
diff --git a/config/cfgroot/connscheduler-lib.pl b/config/cfgroot/connscheduler-lib.pl
new file mode 100644
index 0000000000..f9e4e54664
--- /dev/null
+++ b/config/cfgroot/connscheduler-lib.pl
@@ -0,0 +1,77 @@
+#!/usr/bin/perl
+#
+# Library file for Connection Scheduler AddOn
+#
+# This code is distributed under the terms of the GPL
+#
+
+package CONNSCHED;
+
+$CONNSCHED::maxprofiles = 5;
+
+@CONNSCHED::weekdays = ( 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' );
+@CONNSCHED::weekdays_pr = ( 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday' );
+
+%CONNSCHED::config;
+$CONNSCHED::configfile = "/var/ipfire/connscheduler/connscheduler.conf";
+&ReadConfig;
+
+
+1;
+
+#
+# load the configuration file
+#
+sub ReadConfig
+{
+ # datafileformat:
+ # active,action,profilenr,time,daystype,days,weekdays,,comment
+
+ @CONNSCHED::config = ();
+
+ my @tmpfile = ();
+ if ( open(FILE, "$configfile") )
+ {
+ @tmpfile = ;
+ close (FILE);
+ }
+
+ foreach $line ( @tmpfile )
+ {
+ chomp($line); # remove newline
+ my @temp = split(/\,/,$line,9);
+ if ( ($temp[0] ne 'on') && ($temp[0] ne 'off') ) { next; }
+
+ my $weekdays_pr = '';
+ for (my $i = 0; $i < 7; $i++)
+ {
+ if ( index($temp[6], $CONNSCHED::weekdays[$i]) != -1 )
+ {
+ $weekdays_pr .= "$Lang::tr{$CONNSCHED::weekdays_pr[$i]} ";
+ }
+ }
+
+ push @CONNSCHED::config, { ACTIVE => $temp[0], ACTION => $temp[1], PROFILENR => $temp[2], TIME => $temp[3],
+ DAYSTYPE => $temp[4], DAYS => $temp[5], WEEKDAYS => $temp[6], WEEKDAYS_PR => $weekdays_pr, COMMENT => $temp[8] };
+ }
+}
+
+#
+# write the configuration file
+#
+sub WriteConfig
+{
+ open(FILE, ">$configfile") or die 'hosts datafile error';
+
+ for my $i ( 0 .. $#CONNSCHED::config )
+ {
+ if ( ($CONNSCHED::config[$i]{'ACTIVE'} ne 'on') && ($CONNSCHED::config[$i]{'ACTIVE'} ne 'off') ) { next; }
+
+ print FILE "$CONNSCHED::config[$i]{'ACTIVE'},$CONNSCHED::config[$i]{'ACTION'},$CONNSCHED::config[$i]{'PROFILENR'},";
+ print FILE "$CONNSCHED::config[$i]{'TIME'},$CONNSCHED::config[$i]{'DAYSTYPE'},";
+ print FILE "$CONNSCHED::config[$i]{'DAYS'},$CONNSCHED::config[$i]{'WEEKDAYS'},,$CONNSCHED::config[$i]{'COMMENT'}\n";
+ }
+ close FILE;
+
+ &ReadConfig();
+}
diff --git a/config/cfgroot/header-menu.pl b/config/cfgroot/header-menu.pl
deleted file mode 100644
index ead049d7ca..0000000000
--- a/config/cfgroot/header-menu.pl
+++ /dev/null
@@ -1,24 +0,0 @@
-sub genmenu
-{
- ... snip ...
- if ( ! -e "${General::swroot}/proxy/enable" && ! -e "${General::swroot}/proxy/enable_blue" ) {
- splice (@{$menu{'2.status'}{'subMenu'}}, 4, 1);
- splice (@{$menu{'7.mainlogs'}{'subMenu'}}, 2, 1);
- }
-
- # Read additionnal menus entry
- # this have to be hardened and accepted. To be extended.
- opendir (DIR, "${General::swroot}/addon-menu");
- while (my $menuitem = readdir (DIR)) {
-
- if ( $menuitem =~ /^menu\.([1-6]\..*)\..*/) { #model is "menu.(N.submenu).filename"
- my $submenu = $1;
- open (FILE,"${General::swroot}/addon-menu/$menuitem") or die;
- while (my $text = ) { # file may content many entry
- splice (@{$menu{$submenu}{'subMenu'}} ,-1,0, [ eval($text) ] );
- }
- close (FILE);
- }
- }
- closedir (DIR);
-}
diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl
index 18c1dad3fb..1cb3d957be 100644
--- a/config/cfgroot/header.pl
+++ b/config/cfgroot/header.pl
@@ -268,6 +268,12 @@ sub genmenu {
'title' => "$tr{'aliases'}",
'enabled' => 0,
};
+ $subnetwork->{'80.wakeonlan'} = {
+ 'caption' => $tr{'WakeOnLan'},
+ 'uri' => '/cgi-bin/wakeonlan.cgi',
+ 'title' => "$tr{'WakeOnLan'}",
+ 'enabled' => 1,
+ };
my %subserviceshash = ();
my $subservices = \%subserviceshash;
@@ -463,7 +469,7 @@ sub genmenu {
if (! blue_used()) {
$menu->{'05.firewall'}{'subMenu'}->{'30.wireless'}{'enabled'} = 0;
}
- if (! $ethsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
+ if ( $ethsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
$menu->{'03.network'}{'subMenu'}->{'70.aliases'}{'enabled'} = 1;
}
}
diff --git a/config/cron/crontab b/config/cron/crontab
index 2b74778155..3d59179142 100644
--- a/config/cron/crontab
+++ b/config/cron/crontab
@@ -1,5 +1,5 @@
#
-# $Id: crontab,v 1.9.2.5 2005/08/16 05:39:23 gespinasse Exp $
+# crontab for ipfire
#
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -33,9 +33,12 @@ HOME=/
find /var/log/logwatch/ -ctime +${LOGWATCH_KEEP=56} -exec rm -f '{}' ';'
# hddshutdown
-00 * * * * /usr/local/bin/hddshutdown >/dev/null
+02 * * * * /usr/local/bin/hddshutdown >/dev/null
# URL Filter
%nightly * 3-5 /var/ipfire/urlfilter/autoupdate/cron.daily
%weekly * 3-5 /var/ipfire/urlfilter/autoupdate/cron.weekly
%monthly * 3-5 * /var/ipfire/urlfilter/autoupdate/cron.monthly
+
+# connection-scheduler
+*/5 * * * * /usr/local/bin/connscheduler timer > /dev/null
diff --git a/html/cgi-bin/connscheduler.cgi b/html/cgi-bin/connscheduler.cgi
new file mode 100644
index 0000000000..1ad7ff16c9
--- /dev/null
+++ b/html/cgi-bin/connscheduler.cgi
@@ -0,0 +1,475 @@
+#!/usr/bin/perl
+#
+# IPCop Connection Scheduler Web-Iface
+#
+# This code is distributed under the terms of the GPL
+#
+
+
+use strict;
+
+# enable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+require '/var/ipfire/connscheduler/lib.pl';
+
+my $buttontext = $Lang::tr{'add'};
+my $hiddenvalue = 'add';
+my $day;
+my $hour;
+my $minute;
+my %temppppsettings=();
+my @profilenames=();
+
+
+#
+# defaults for settings
+#
+my $selected_hour = '00';
+my $selected_minute = '00';
+my $checked_connect = "checked='checked'";
+my $checked_profile = '';
+my %selected = ();
+$selected{'reconnect'} = '';
+$selected{'dial'} = '';
+$selected{'hangup'} = '';
+$selected{'reboot'} = '';
+$selected{'shutdown'} = '';
+my $selected_profile = 1;
+my $checked_days = "checked='checked'";
+my $selected_daystart = 1;
+my $selected_dayend = 31;
+my $checked_weekdays = '';
+my $checked_mon = "checked='checked'";
+my $checked_tue = "checked='checked'";
+my $checked_wed = "checked='checked'";
+my $checked_thu = "checked='checked'";
+my $checked_fri = "checked='checked'";
+my $checked_sat = "checked='checked'";
+my $checked_sun = "checked='checked'";
+my $comment = '';
+
+my %cgiparams = ();
+
+$cgiparams{'ACTION'} = ''; # add/edit/update/remove/wakeup
+$cgiparams{'ACTION_ACTION'} = ''; # CONNECT/PROFILE
+$cgiparams{'ACTION_CONNECT'} = ''; # connect/disconnect/reconnect
+$cgiparams{'ACTION_PROFILENR'} = 0;
+$cgiparams{'ACTION_HOUR'} = '';
+$cgiparams{'ACTION_MINUTE'} = '';
+$cgiparams{'ACTION_DAYSTYPE'} = '';
+$cgiparams{'ACTION_DAYSTART'} = 1;
+$cgiparams{'ACTION_DAYEND'} = 31;
+$cgiparams{'Mon'} = '';
+$cgiparams{'Tue'} = '';
+$cgiparams{'Wed'} = '';
+$cgiparams{'Thu'} = '';
+$cgiparams{'Fri'} = '';
+$cgiparams{'Sat'} = '';
+$cgiparams{'Sun'} = '';
+$cgiparams{'ACTION_COMMENT'} = '';
+
+&Header::getcgihash(\%cgiparams);
+
+
+# read the profile names
+my $i=0;
+for ($i = 1; $i <= $CONNSCHED::maxprofiles; $i++)
+{
+ %temppppsettings = ();
+ $temppppsettings{'PROFILENAME'} = $Lang::tr{'empty'};
+ &General::readhash("${General::swroot}/ppp/settings-$i", \%temppppsettings);
+ $profilenames[$i] = $temppppsettings{'PROFILENAME'};
+}
+
+&Header::showhttpheaders();
+&Header::openpage($Lang::tr{'connscheduler'}, 1, '');
+&Header::openbigbox('100%', 'left', '', '');
+
+
+# Found this usefull piece of code in BlockOutTraffic AddOn 8-)
+# fwrules.cgi
+###############
+# DEBUG DEBUG
+#&Header::openbox('100%', 'left', 'DEBUG');
+#my $debugCount = 0;
+#foreach my $line (sort keys %cgiparams) {
+# print "$line = $cgiparams{$line}
\n";
+# $debugCount++;
+#}
+#print " Count: $debugCount\n";
+#&Header::closebox();
+# DEBUG DEBUG
+###############
+
+
+if ( $cgiparams{'ACTION'} eq 'toggle' )
+{
+ if ( $CONNSCHED::config[$cgiparams{'ID'}]{'ACTIVE'} eq 'on' )
+ {
+ $CONNSCHED::config[$cgiparams{'ID'}]{'ACTIVE'} = 'off';
+ }
+ else
+ {
+ $CONNSCHED::config[$cgiparams{'ID'}]{'ACTIVE'} = 'on';
+ }
+
+ &CONNSCHED::WriteConfig;
+}
+
+if ( ($cgiparams{'ACTION'} eq 'add') || ($cgiparams{'ACTION'} eq 'update') )
+{
+ my $l_action = $cgiparams{'ACTION_CONNECT'};
+ my $l_profilenr = '';
+ my $l_days = '';
+ my $l_weekdays = '';
+
+ if ( $cgiparams{'ACTION'} eq 'add' )
+ {
+ $i = $#CONNSCHED::config + 1;
+ $CONNSCHED::config[$i]{'ACTIVE'} = 'on';
+ }
+ else
+ {
+ $i = $cgiparams{'UPDATE_ID'};
+ }
+
+ if ( $cgiparams{'ACTION_ACTION'} eq 'PROFILE')
+ {
+ $l_action = 'select profile';
+ $l_profilenr = $cgiparams{'ACTION_PROFILENR'};
+ }
+
+ if ( $cgiparams{'ACTION_DAYSTYPE'} eq 'WEEKDAYS' )
+ {
+ if ( $cgiparams{'Mon'} eq 'on' ) { $l_weekdays .= 'Mon '; }
+ if ( $cgiparams{'Tue'} eq 'on' ) { $l_weekdays .= 'Tue '; }
+ if ( $cgiparams{'Wed'} eq 'on' ) { $l_weekdays .= 'Wed '; }
+ if ( $cgiparams{'Thu'} eq 'on' ) { $l_weekdays .= 'Thu '; }
+ if ( $cgiparams{'Fri'} eq 'on' ) { $l_weekdays .= 'Fri '; }
+ if ( $cgiparams{'Sat'} eq 'on' ) { $l_weekdays .= 'Sat '; }
+ if ( $cgiparams{'Sun'} eq 'on' ) { $l_weekdays .= 'Sun '; }
+ }
+ else
+ {
+ $l_days = "$cgiparams{'ACTION_DAYSTART'} - $cgiparams{'ACTION_DAYEND'}";
+ }
+
+ $CONNSCHED::config[$i]{'ACTION'} = $l_action;
+ $CONNSCHED::config[$i]{'PROFILENR'} = $l_profilenr;
+ $CONNSCHED::config[$i]{'TIME'} = "$cgiparams{'ACTION_HOUR'}:$cgiparams{'ACTION_MINUTE'}";
+ $CONNSCHED::config[$i]{'DAYSTYPE'} = lc($cgiparams{'ACTION_DAYSTYPE'});
+ $CONNSCHED::config[$i]{'DAYS'} = $l_days;
+ $CONNSCHED::config[$i]{'WEEKDAYS'} = $l_weekdays;
+ $CONNSCHED::config[$i]{'COMMENT'} = &Header::cleanhtml($cgiparams{'ACTION_COMMENT'});
+
+ &CONNSCHED::WriteConfig;
+}
+
+if ( $cgiparams{'ACTION'} eq 'edit' )
+{
+ $i = $cgiparams{'ID'};
+
+ $selected_hour = substr($CONNSCHED::config[$i]{'TIME'},0,2);
+ $selected_minute = substr($CONNSCHED::config[$i]{'TIME'},3,2);
+
+ if ( $CONNSCHED::config[$i]{'ACTION'} eq 'select profile' )
+ {
+ $checked_connect = '';
+ $checked_profile = "checked='checked'";
+ $selected_profile = $CONNSCHED::config[$i]{'PROFILENR'};
+ }
+ else
+ {
+ $selected{"$CONNSCHED::config[$i]{'ACTION'}"} = "selected='selected'";
+ }
+
+ if ( $CONNSCHED::config[$i]{'DAYSTYPE'} eq 'days' )
+ {
+ my @temp = split(/-/,$CONNSCHED::config[$i]{'DAYS'},2);
+
+ $selected_daystart = substr($temp[0], 0, -1);
+ $selected_dayend = substr($temp[1], 1);
+ }
+ else
+ {
+ my $wd = $CONNSCHED::config[$i]{'WEEKDAYS'};
+ $checked_mon = '' if ( index($wd, 'Mon') == -1 ) ;
+ $checked_tue = '' if ( index($wd, 'Tue') == -1 ) ;
+ $checked_wed = '' if ( index($wd, 'Wed') == -1 ) ;
+ $checked_thu = '' if ( index($wd, 'Thu') == -1 ) ;
+ $checked_fri = '' if ( index($wd, 'Fri') == -1 ) ;
+ $checked_sat = '' if ( index($wd, 'Sat') == -1 ) ;
+ $checked_sun = '' if ( index($wd, 'Sun') == -1 ) ;
+
+ $checked_days = '';
+ $checked_weekdays = "checked='checked'";
+ }
+
+ $comment = $CONNSCHED::config[$cgiparams{'ID'}]{'COMMENT'};
+
+ $buttontext = $Lang::tr{'update'};
+ $hiddenvalue = 'update';
+}
+
+if ( $cgiparams{'ACTION'} eq 'remove' )
+{
+ # simply set ACTIVE to empty, WriteConfig will handle the gory details
+ $CONNSCHED::config[$cgiparams{'ID'}]{'ACTIVE'} = '';
+ &CONNSCHED::WriteConfig;
+}
+if ( ($cgiparams{'ACTION'} eq 'down') || ($cgiparams{'ACTION'} eq 'up') )
+{
+ my $action = @CONNSCHED::config[$cgiparams{'ID'}];
+ my $newpos = 0;
+
+ splice(@CONNSCHED::config, $cgiparams{'ID'}, 1);
+
+ if ( ($cgiparams{'ACTION'} eq 'down') )
+ {
+ $newpos = $cgiparams{'ID'} + 1;
+ }
+ else
+ {
+ $newpos = $cgiparams{'ID'} - 1;
+ }
+
+ splice(@CONNSCHED::config, $newpos, 0, $action);
+
+ &CONNSCHED::WriteConfig;
+}
+
+
+#
+# Add / Edit Box
+#
+
+&Header::openbox('100%', 'left', $Lang::tr{'add action'});
+
+print <
+
+
+
+
+
+END
+;
+
+&Header::closebox();
+
+#
+# Box with List of events
+#
+
+&Header::openbox('100%', 'left', $Lang::tr{'scheduled actions'});
+print <
+
+$Lang::tr{'time'} |
+ |
+$Lang::tr{'remark'} |
+$Lang::tr{'action'} |
+
+END
+;
+
+for my $id ( 0 .. $#CONNSCHED::config )
+{
+ my $trcolor;
+
+ if ( ($cgiparams{'ACTION'} eq 'edit') && ($id == $cgiparams{'ID'}) )
+ {
+ $trcolor = "";
+ }
+ elsif ( $id % 2 )
+ {
+ $trcolor = "
";
+ }
+ else
+ {
+ $trcolor = "
";
+ }
+
+print <$CONNSCHED::config[$id]{'TIME'}
+$Lang::tr{"$CONNSCHED::config[$id]{'ACTION'}"} $CONNSCHED::config[$id]{'PROFILENR'} |
+$CONNSCHED::config[$id]{'COMMENT'} |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+$trcolor
+ |
+$CONNSCHED::config[$id]{'DAYS'}$CONNSCHED::config[$id]{'WEEKDAYS_PR'} |
+
+END
+;
+}
+
+print <
+
+
+
+END
+;
+
+
+&Header::closebox();
+
+&Header::closebigbox();
+&Header::closepage();
diff --git a/html/cgi-bin/wakeonlan.cgi b/html/cgi-bin/wakeonlan.cgi
new file mode 100644
index 0000000000..ff60304af1
--- /dev/null
+++ b/html/cgi-bin/wakeonlan.cgi
@@ -0,0 +1,439 @@
+#!/usr/bin/perl
+#
+# IPFire WakeOnLan-AddOn CGI
+#
+# This code is distributed under the terms of the GPL
+#
+
+use strict;
+
+# enable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+
+# remove comment from next line to get wakeup info in seperate page
+my $refresh = 'yes';
+# remove comment from next line to get wakeup info as inline box
+#my $refresh = '';
+
+
+#workaround to suppress a warning when a variable is used only once
+my @dummy = ( ${Header::colouryellow} );
+undef (@dummy);
+my $line;
+my $i;
+
+my @wol_devices = ();
+#configfile
+our $datafile = "/var/ipfire/wakeonlan/clients.conf";
+&ReadConfig;
+
+my %netsettings = ();
+&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
+my %cgiparams = ();
+
+$cgiparams{'ACTION'} = ''; # add/edit/update/remove/wakeup
+$cgiparams{'ID'} = ''; # points to record for ACTION (edit/update/remove)
+$cgiparams{'CLIENT_MAC'} = '';
+$cgiparams{'CLIENT_IFACE'} = '';
+$cgiparams{'CLIENT_COMMENT'} = '';
+&Header::getcgihash(\%cgiparams);
+
+my %selected = ();
+$selected{'CLIENT_IFACE'}{'green'} = '';
+$selected{'CLIENT_IFACE'}{'blue'} = '';
+$selected{'CLIENT_IFACE'}{'orange'} = '';
+$selected{'CLIENT_IFACE'}{'red'} = '';
+
+&Header::showhttpheaders();
+
+my $errormessage = "";
+
+if ( $cgiparams{'ACTION'} eq 'add' )
+{
+ # add a device, check for valid and non-duplicate MAC
+ if ( $cgiparams{'CLIENT_MAC'} eq '' )
+ {
+ goto ADDEXIT;
+ }
+
+ $cgiparams{'CLIENT_MAC'} =~ tr/-/:/;
+
+ unless( &General::validmac($cgiparams{'CLIENT_MAC'}) )
+ {
+ $errormessage = $Lang::tr{'invalid mac address'};
+ goto ADDEXIT;
+ }
+
+ for $i ( 0 .. $#wol_devices )
+ {
+ if ( lc($cgiparams{'CLIENT_MAC'}) eq lc($wol_devices[$i]{'MAC'}) )
+ {
+ $errormessage = $Lang::tr{'duplicate mac'};
+ goto ADDEXIT;
+ }
+ }
+
+ unless ( $errormessage )
+ {
+ push @wol_devices, { MAC => uc($cgiparams{'CLIENT_MAC'}), IFace => $cgiparams{'CLIENT_IFACE'}, Comment => $cgiparams{'CLIENT_COMMENT'} };
+ &WriteConfig;
+ undef %cgiparams;
+ }
+
+ADDEXIT:
+# jump here to keep cgiparams!
+}
+
+if ( $cgiparams{'ACTION'} eq 'update' )
+{
+ # update a device, check for valid and non-duplicate MAC
+ if ( $cgiparams{'CLIENT_MAC'} eq '' )
+ {
+ goto UPDATEEXIT;
+ }
+
+ $cgiparams{'CLIENT_MAC'} =~ tr/-/:/;
+
+ unless( &General::validmac($cgiparams{'CLIENT_MAC'}) )
+ {
+ $errormessage = $Lang::tr{'invalid mac address'};
+ goto UPDATEEXIT;
+ }
+
+ for $i ( 0 .. $#wol_devices )
+ {
+ if ( $i == $cgiparams{'ID'} ) { next; }
+ if ( lc($cgiparams{'CLIENT_MAC'}) eq lc($wol_devices[$i]{'MAC'}) )
+ {
+ $errormessage = $Lang::tr{'duplicate mac'};
+ goto UPDATEEXIT;
+ }
+ }
+
+ unless ( $errormessage )
+ {
+ $wol_devices[$cgiparams{'ID'}]{'MAC'} = $cgiparams{'CLIENT_MAC'};
+ $wol_devices[$cgiparams{'ID'}]{'IFace'} = $cgiparams{'CLIENT_IFACE'};
+ $wol_devices[$cgiparams{'ID'}]{'Comment'} = $cgiparams{'CLIENT_COMMENT'};
+ &WriteConfig;
+ undef %cgiparams;
+ }
+
+UPDATEEXIT:
+# jump here to keep cgiparams!
+}
+
+if ( $cgiparams{'ACTION'} eq 'remove' )
+{
+ # simply set MAC to empty, WriteConfig will handle the gory details
+ $wol_devices[$cgiparams{'ID'}]{'MAC'} = '';
+ &WriteConfig;
+}
+
+if ( ($cgiparams{'ACTION'} ne 'wakeup') || ($refresh ne 'yes') )
+{
+ &Header::openpage($Lang::tr{'WakeOnLan'}, 1, '');
+ &Header::openbigbox('100%', 'left', '', $errormessage);
+}
+
+if ( $cgiparams{'ACTION'} eq 'wakeup' )
+{
+ # wakey wakey
+ my $mac = $wol_devices[$cgiparams{'ID'}]{'MAC'};
+ my $iface = uc($wol_devices[$cgiparams{'ID'}]{'IFace'}).'_DEV';
+ $iface = $netsettings{"$iface"};
+
+ undef %cgiparams;
+
+ system("/usr/local/sbin/launch-ether-wake $mac $iface");
+
+ # make a box with info, 'refresh' to normal screen after 5 seconds
+ if ( $refresh eq 'yes' )
+ {
+ &Header::openpage($Lang::tr{'WakeOnLan'}, 1, "$Lang::tr{'magic packet send to:'} $mac ($iface)
";
+ &Header::closebox();
+
+ if ( $refresh eq 'yes' )
+ {
+ &Header::closebigbox();
+ &Header::closepage();
+ # that's all folks
+ exit;
+ }
+}
+
+#print "Action: $cgiparams{'ACTION'}
";
+#print "ID: $cgiparams{'ID'}
";
+#print "MAC: $cgiparams{'CLIENT_MAC'}
";
+#print "IFace: $cgiparams{'CLIENT_IFACE'}
";
+#print "Rem: $cgiparams{'CLIENT_COMMENT'}
";
+
+if ( $errormessage )
+{
+ # some error from add / update
+ &Header::openbox('100%', 'left', $Lang::tr{'error messages'});
+ print "$errormessage\n";
+ print " \n";
+ &Header::closebox();
+}
+
+print "\n";
+
+#######################################
+#
+# now list already configured devivces
+#
+#######################################
+&Header::openbox('100%', 'left', "$Lang::tr{'current devices'}");
+
+print <
+
+$Lang::tr{'mac address'} |
+$Lang::tr{'interface'} |
+$Lang::tr{'remark'} |
+$Lang::tr{'action'} |
+
+END
+;
+
+for $i ( 0 .. $#wol_devices )
+{
+ my $wol_mac = $wol_devices[$i]{'MAC'};
+ my $wol_iface = $wol_devices[$i]{'IFace'};
+ my $wol_txt = &Header::cleanhtml($wol_devices[$i]{'Comment'});
+
+ if ( (($cgiparams{'ACTION'} eq 'edit') || ($cgiparams{'ACTION'} eq 'update')) && ($i == $cgiparams{'ID'}) )
+ {
+ print "";
+ }
+ elsif ( $i % 2)
+ {
+ print "
";
+ }
+ else
+ {
+ print "
";
+ }
+
+ print <$wol_mac
+$Lang::tr{"$wol_iface"} |
+$wol_txt |
+
+END
+;
+ if ( (($wol_iface eq 'blue') && ! &haveBlueNet())
+ || (($wol_iface eq 'orange') && ! &haveOrangeNet()) )
+ {
+ # configured IFace (momentarily) not available -> now wakeup button/image
+ print " ";
+ }
+ else
+ {
+ print <
+
+
+
+
+END
+;
+ }
+ print <
+
+
+ |
+
+
+ |
+END
+;
+ print " |
\n";
+}
+
+print "";
+
+&Header::closebox();
+
+&Header::closebigbox();
+&Header::closepage();
+
+#
+# load the configuration file
+#
+sub ReadConfig
+{
+ # datafileformat:
+ # ID,MAC,IFACE,,Comment
+ #
+ my @tmpfile = ();
+ if ( open(FILE, "$datafile") )
+ {
+ @tmpfile = ;
+ close (FILE);
+ }
+
+ @wol_devices = ();
+
+ # populate devices list
+ foreach $line ( @tmpfile )
+ {
+ chomp($line); # remove newline
+ my @temp = split(/\,/,$line,5);
+ if ( $temp[1] eq '' ) { next; }
+ unless(&General::validmac($temp[1])) { next; }
+
+ push @wol_devices, { ID => $temp[0], MAC => $temp[1], IFace => $temp[2], Comment => $temp[4] };
+ }
+}
+
+#
+# write the configuration file
+#
+sub WriteConfig
+{
+ my $line;
+ my @temp;
+
+ my @tmp_clients;
+
+ for $i ( 0 .. $#wol_devices )
+ {
+ unless(&General::validmac($wol_devices[$i]{'MAC'})) { next; }
+ unshift (@tmp_clients, uc($wol_devices[$i]{'MAC'}).",$wol_devices[$i]{'IFace'},,$wol_devices[$i]{'Comment'}");
+ }
+
+ # sort tmp_clients on MAC
+ @tmp_clients = sort ( @tmp_clients );
+
+ open(FILE, ">$datafile") or die 'hosts datafile error';
+
+ my $count = 0;
+ foreach $line (@tmp_clients)
+ {
+ print FILE "$count,$line\n";
+ $count++;
+ }
+ close FILE;
+
+ &ReadConfig;
+}
+
+
+#
+# copied these from dmzholes.cgi (thnx dotzball)
+# seems to be the way to do this :-S
+#
+sub haveOrangeNet
+{
+ if ($netsettings{'CONFIG_TYPE'} == 1) {return 1;}
+ if ($netsettings{'CONFIG_TYPE'} == 3) {return 1;}
+ if ($netsettings{'CONFIG_TYPE'} == 5) {return 1;}
+ if ($netsettings{'CONFIG_TYPE'} == 7) {return 1;}
+ return 0;
+}
+
+sub haveBlueNet
+{
+ if ($netsettings{'CONFIG_TYPE'} == 4) {return 1;}
+ if ($netsettings{'CONFIG_TYPE'} == 5) {return 1;}
+ if ($netsettings{'CONFIG_TYPE'} == 6) {return 1;}
+ if ($netsettings{'CONFIG_TYPE'} == 7) {return 1;}
+ return 0;
+}
diff --git a/html/html/images/down.gif b/html/html/images/down.gif
new file mode 100644
index 0000000000000000000000000000000000000000..60b7794efeff00784c671f9b557adbdfc9c70766
GIT binary patch
literal 323
zc-nLKbhEHb6k*_ESjxbVu)HE+ZYe{Nnt5XYORhRkzOG=Ei9n;7Q%jIkg{4xPv)W`Y
zksx`oME;#
zE^kMh*}Mp^wb|iY$__j}Q-6Af#h#@9GysY}Ss1w(>=|?zfB@tt2DXF)^9@vlr26dx
zU)=au;~>7|Bh#-6D<>bf%^O`Nil26yd{9PJ*z2e^Pq>C~=a=gRHVP9wSpFB7JagjU
sksx`oME;#
zE^kMh*}Mp^wb|iY$__j}Q-6Af#h#@9GysY}Ss1w(>=|?zfB@tt2DZ2Z^9w9k7&=ZY
zF;Ea-nR0<~p{Iny#O9`l1qLE(uFESej4+Vkc4aEewU86=P!X!Pkn%d&60|Xai}R!&}_-b-9TUQX6UQ7KVL(b-IrG4Q15ckm{SV|YFev_H;bdT7VbB4o0I6l*
zXky^xknz~C;9wIYgGPwN1BHVv3|t;lPFzrI>|ip=5(!{vINTz|%ONmR(80M`f>l6b
zrBU+nW=+lxlMRy=yH8;?x|WmqS;1qTjjvVD$g%HhM)BQzdv=Ddxw1a-tX@cl*lVX{xr^CY7_0$sl0zy0
literal 0
Hc-jL100001
diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
index 66ba324779..95f479dbbf 100644
--- a/langs/de/cgi-bin/de.pl
+++ b/langs/de/cgi-bin/de.pl
@@ -1486,6 +1486,24 @@
'mbmon temp' => 'Temperature',
'mbmon temp in' => 'Temperature in',
'mbmon volt' => 'Voltage',
+'current devices' => 'Schnittstellen',
+'invalid mac address' => 'Ungültige MAC-Adresse',
+'WakeOnLan' => 'Wake On LAN',
+'wol wakeup' => 'WakeUp',
+'magic packet send to:' => 'Sende WOL-Paket an',
+'add action' => 'Aktion hinzufügen',
+'change profile title' => 'Wechsle zu Profil:',
+'connscheduler' => 'Connection Scheduler',
+'connscheduler action' => 'Aktion:',
+'connscheduler days' => 'Tage:',
+'connscheduler time' => 'Zeit:',
+'connsched weekdays' => 'Wochentage:',
+'down' => 'Runter',
+'reconnect' => 'Neu verbinden',
+'scheduled actions' => 'Geplante Aktionen',
+'scheduler' => 'Scheduler',
+'select profile' => 'Wähle Profil',
+'up' => 'Hoch',
);
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index c1bdf3ab68..6598cad0cf 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -1519,5 +1519,23 @@
'mbmon temp' => 'Temperature',
'mbmon temp in' => 'Temperature in',
'mbmon volt' => 'Voltage',
+'current devices' => 'Current devices',
+'invalid mac address' => 'Invalid MAC address',
+'WakeOnLan' => 'Wake On LAN',
+'wol wakeup' => 'WakeUp',
+'magic packet send to:' => 'Magic packet send to',
+'add action' => 'Add action',
+'change profile title' => 'Change to profile:',
+'connscheduler' => 'Connection Scheduler',
+'connscheduler action' => 'Action:',
+'connscheduler days' => 'Days:',
+'connscheduler time' => 'Time:',
+'connsched weekdays' => 'Days of the week:',
+'down' => 'Down',
+'reconnect' => 'Reconnect',
+'scheduled actions' => 'Scheduled actions',
+'scheduler' => 'Scheduler',
+'select profile' => 'Select profile',
+'up' => 'Up',
);
diff --git a/lfs/configroot b/lfs/configroot
index c34a4d090a..a4896ed218 100644
--- a/lfs/configroot
+++ b/lfs/configroot
@@ -50,21 +50,21 @@ $(TARGET) :
@$(PREBUILD)
# Create all directories
- for i in addon-lang alcatelusb auth backup backup/sets ca certs cnx_pci crls ddns dhcp dhcpc dmzholes \
+ for i in addon-lang alcatelusb auth backup backup/sets ca certs cnx_pci connscheduler crls ddns dhcp dhcpc dmzholes \
eagle-usb eciadsl ethernet isdn key langs logging main mbmon modem net-traffic nfs optionsfw outgoing patches pakfire portfw \
- ppp private proxy/advanced qos/bin red remote snort time urlfilter/autoupdate urlfilter/bin vpn wireless xtaccess ; do \
+ ppp private proxy/advanced qos/bin red remote snort time urlfilter/autoupdate urlfilter/bin vpn wakeonlan wireless xtaccess ; do \
mkdir -p $(CONFIG_ROOT)/$$i; \
done
# Touch empty files
for i in auth/users backup/include.user backup/exclude.user \
- certs/index.txt ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
+ certs/index.txt connscheduler/connscheduler.conf ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
dhcp/fixleases dhcp/advoptions dmzholes/config ethernet/aliases ethernet/settings \
- isdn/settings main/hosts main/settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings patches/available patches/installed \
+ isdn/settings main/hosts main/settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings \
portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
ppp/settings-5 ppp/settings proxy/settings remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \
snort/settings vpn/config vpn/settings vpn/ipsec.conf \
- vpn/ipsec.secrets vpn/caconfig wireless/config wireless/settings; do \
+ vpn/ipsec.secrets vpn/caconfig wakeonlan/clients.conf wireless/config wireless/settings; do \
touch $(CONFIG_ROOT)/$$i; \
done
@@ -73,10 +73,11 @@ $(TARGET) :
cp $(DIR_SRC)/config/cfgroot/general-functions.pl $(CONFIG_ROOT)/
cp $(DIR_SRC)/config/cfgroot/lang.pl $(CONFIG_ROOT)/
cp $(DIR_SRC)/config/cfgroot/countries.pl $(CONFIG_ROOT)/
+ cp $(DIR_SRC)/config/cfgroot/advoptions-list $(CONFIG_ROOT)/dhcp/advoptions-list
cp $(DIR_SRC)/config/cfgroot/backup-exclude $(CONFIG_ROOT)/backup/exclude.system
cp $(DIR_SRC)/config/cfgroot/backup-include $(CONFIG_ROOT)/backup/include.system
cp $(DIR_SRC)/config/cfgroot/backup-exclude.hardware $(CONFIG_ROOT)/backup/exclude.hardware
- cp $(DIR_SRC)/config/cfgroot/advoptions-list $(CONFIG_ROOT)/dhcp/advoptions-list
+ cp $(DIR_SRC)/config/cfgroot/connscheduler-lib.pl $(CONFIG_ROOT)/connscheduler/lib.pl
cp $(DIR_SRC)/config/cfgroot/mbmon-settings $(CONFIG_ROOT)/mbmon/settings
cp $(DIR_SRC)/config/cfgroot/modem-defaults $(CONFIG_ROOT)/modem/defaults
cp $(DIR_SRC)/config/cfgroot/modem-settings $(CONFIG_ROOT)/modem/settings
diff --git a/make.sh b/make.sh
index c8c4adeafd..e703e09161 100644
--- a/make.sh
+++ b/make.sh
@@ -1135,6 +1135,7 @@ commit)
echo "Upload the changed files:"
svn commit
./make.sh sync
+ clear
svn up
;;
make)
diff --git a/src/ROOTFILES.i386 b/src/ROOTFILES.i386
index 53bf0df38d..e5ccd172e4 100644
--- a/src/ROOTFILES.i386
+++ b/src/ROOTFILES.i386
@@ -1353,6 +1353,7 @@ tmp
#usr/lib
#usr/local
#usr/local/bin
+usr/local/bin/connscheduler
usr/local/bin/httpscert
usr/local/bin/hddshutdown
usr/local/bin/hddshutdown-state
@@ -21077,6 +21078,8 @@ home/httpd/cgi-bin/xtaccess.cgi
home/httpd/cgi-bin/traffic.cgi
home/httpd/cgi-bin/traffics.cgi
home/httpd/cgi-bin/pakfire.cgi
+home/httpd/cgi-bin/wakeonlan.cgi
+home/httpd/cgi-bin/connscheduler.cgi
#home/httpd/htdocs
#home/httpd/htdocs/apache_pb.gif
#home/httpd/htdocs/index.html.ca
@@ -22561,6 +22564,7 @@ usr/local/bin/ipfirebkcfg
usr/local/bin/ipfirereboot
usr/local/bin/ipfirerscfg
usr/local/bin/ipsecctrl
+usr/local/bin/launch-ether-wake
usr/local/bin/logwatch
usr/local/bin/openvpnctrl
usr/local/bin/rebuildhosts
diff --git a/src/misc-progs/Makefile b/src/misc-progs/Makefile
index 9938b5c029..28ea7cf583 100644
--- a/src/misc-progs/Makefile
+++ b/src/misc-progs/Makefile
@@ -10,7 +10,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess restartdhcp restartsno
setaliases ipfirebackup restartntpd \
restartapplejuice setdate rebuildhosts \
restartsyslogd logwatch openvpnctrl timecheckctrl \
- restartwireless getipstat qosctrl
+ restartwireless getipstat qosctrl launch-ether-wake
install : all
install -m 755 $(PROGS) /usr/local/bin
@@ -42,6 +42,9 @@ openvpnctrl: openvpnctrl.c setuid.o ../install+setup/libsmooth/varval.o
qosctrl: qosctrl.c setuid.o ../install+setup/libsmooth/varval.o
$(COMPILE) -I../install+setup/libsmooth/ qosctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
+launch-ether-wake: launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o
+ $(COMPILE) -I../install+setup/libsmooth/ launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o -o $@
+
setaliases: setaliases.c setuid.o ../install+setup/libsmooth/varval.o
$(COMPILE) -I../install+setup/libsmooth/ setaliases.c setuid.o ../install+setup/libsmooth/varval.o -o $@
diff --git a/src/misc-progs/launch-ether-wake.c b/src/misc-progs/launch-ether-wake.c
new file mode 100644
index 0000000000..703ace7a67
--- /dev/null
+++ b/src/misc-progs/launch-ether-wake.c
@@ -0,0 +1,33 @@
+/* This file is part of the Wake-on-LAN GUI AddOn
+ *
+ * This program is distributed under the terms of the GNU General Public
+ * Licence. See the file COPYING for details.
+ *
+ * Copyright (C) 2006-03-03 weizen_42
+ *
+ *
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "setuid.h"
+
+
+#define BUFFER_SIZE 512
+
+char command[BUFFER_SIZE];
+
+int main(int argc, char *argv[])
+{
+ if (!(initsetuid()))
+ exit(1);
+
+ snprintf(command, BUFFER_SIZE-1, "/usr/bin/ether-wake -i %s %s", argv[2], argv[1]);
+ safe_system(command);
+
+ return(0);
+}
diff --git a/src/scripts/connscheduler b/src/scripts/connscheduler
new file mode 100644
index 0000000000..9a4e44fe83
--- /dev/null
+++ b/src/scripts/connscheduler
@@ -0,0 +1,214 @@
+#!/usr/bin/perl
+#
+# IPFire Connection Scheduler (F)Cron Job
+#
+# This code is distributed under the terms of the GPL
+#
+
+use strict;
+
+require '/var/ipfire/general-functions.pl';
+require '/var/ipfire/connscheduler/lib.pl';
+
+
+# seems to be necessary
+my $sleep_after_profile = 5;
+
+my ($second, $minute, $hour, $day, $month ,$year, $weekday) = localtime(time);
+# correction for weekday, I am used to weeks starting with Monday (= 0) ;-)
+$weekday = ($weekday + 6) % 7;
+# get the closest thing possible
+$minute = int($minute / 5) * 5;
+
+
+if ( $ARGV[0] eq 'hangup' )
+{
+ &hangup();
+}
+elsif ( $ARGV[0] eq 'dial' )
+{
+ &dial();
+}
+elsif ( $ARGV[0] eq 'reconnect' )
+{
+ &reconnect();
+}
+elsif ( $ARGV[0] eq 'profile' )
+{
+ &profile($ARGV[1]);
+}
+elsif ( $ARGV[0] eq 'timer' )
+{
+ &timer();
+}
+elsif ( $ARGV[0] eq 'test' )
+{
+ &test();
+}
+else
+{
+ print "Usage: $0 {dial | hangup | reconnect | profile nr# }\n";
+}
+
+exit 0;
+
+
+# __ _ _
+# / _| | | (_)
+# | |_ _ _ _ __ ___| |_ _ ___ _ __ ___
+# | _| | | | '_ \ / __| __| |/ _ \| '_ \/ __|
+# | | | |_| | | | | (__| |_| | (_) | | | \__ \
+# |_| \__,_|_| |_|\___|\__|_|\___/|_| |_|___/
+#
+sub hangup
+{
+ unless ( -e "${General::swroot}/red/active" )
+ {
+ &General::log("ConnSched already disconnected");
+ return;
+ }
+
+ &General::log("ConnSched disconnect");
+ unless ( system('/etc/rc.d/rc.red', 'stop') == 0 )
+ {
+ &General::log("ConnSched disconnect failed: $?");
+ return;
+ }
+
+ # now wait for active triggerfile and ppp daemon to disappear
+ sleep 1;
+ while ( -e "${General::swroot}/red/active" || -e '/var/run/ppp-ipcop.pid' )
+ {
+ sleep 1;
+ }
+}
+
+
+sub dial
+{
+ if ( -e "${General::swroot}/red/active" )
+ {
+ &General::log("ConnSched already connected");
+ return;
+ }
+
+ &General::log("ConnSched connect");
+ unless ( system('/etc/rc.d/rc.red', 'start') == 0 )
+ {
+ &General::log("ConnSched connect failed: $?");
+ return;
+ }
+
+ # wait maximum 60 seconds for active triggerfile
+ my $counter = 60;
+ until ( -e "${General::swroot}/red/active" || $counter == 0 )
+ {
+ sleep 1;
+ $counter--;
+ }
+}
+
+
+sub reconnect
+{
+ &hangup() if ( -e "${General::swroot}/red/active" );
+ &dial();
+}
+
+
+sub profile
+{
+ my $profile = shift;
+ my $restart_red = 0;
+
+ unless ( ($profile > 0) and ($profile < $CONNSCHED::maxprofiles) )
+ {
+ &General::log("ConnSched invalid profile: $profile");
+ return;
+ }
+
+ unless ( -e "${General::swroot}/ppp/settings-$profile" )
+ {
+ &General::log("ConnSched profile file does not exist: $profile");
+ return;
+ }
+
+ if ( -e "${General::swroot}/red/active" )
+ {
+ # remember to restart red after changing profile
+ $restart_red = 1;
+ &hangup();
+ }
+
+ &General::log("ConnSched select profile: $profile");
+
+ # Method to change Profile from pppsetup.cgi
+ unlink("${General::swroot}/ppp/settings");
+ link("${General::swroot}/ppp/settings-$profile", "${General::swroot}/ppp/settings");
+ system ("/bin/touch", "${General::swroot}/ppp/updatesettings");
+
+ if ( $restart_red == 1 )
+ {
+ ## FIXME: do we need to do this ?
+ sleep($sleep_after_profile);
+ &dial();
+ }
+}
+
+
+# fcronjob entry
+sub timer
+{
+ for my $i ( 0 .. $#CONNSCHED::config )
+ {
+ next if ( $CONNSCHED::config[$i]{'ACTIVE'} ne 'on' );
+
+ my $action_hour = substr($CONNSCHED::config[$i]{'TIME'},0,2);
+ my $action_minute = substr($CONNSCHED::config[$i]{'TIME'},3,2);
+
+ next if ( $action_hour != $hour );
+ next if ( $action_minute != $minute );
+
+ if ( $CONNSCHED::config[$i]{'DAYSTYPE'} eq 'days' )
+ {
+ my @temp = split(/-/,$CONNSCHED::config[$i]{'DAYS'},2);
+
+ my $daystart = substr($temp[0], 0, -1);
+ my $dayend = substr($temp[1], 1);
+
+ next if ( ($day < $daystart) || ($day > $dayend) );
+ }
+ else
+ {
+ next if ( index($CONNSCHED::config[$i]{'WEEKDAYS'}, $CONNSCHED::weekdays[$weekday]) == -1 );
+ }
+
+
+ if ( $CONNSCHED::config[$i]{'ACTION'} eq 'reconnect' )
+ {
+ &reconnect()
+ }
+ elsif ( $CONNSCHED::config[$i]{'ACTION'} eq 'dial' )
+ {
+ &dial();
+ }
+ elsif ( $CONNSCHED::config[$i]{'ACTION'} eq 'hangup' )
+ {
+ &hangup();
+ }
+ elsif ( $CONNSCHED::config[$i]{'ACTION'} eq 'select profile' )
+ {
+ &profile($CONNSCHED::config[$i]{'PROFILENR'});
+ }
+ elsif ( $CONNSCHED::config[$i]{'ACTION'} eq 'reboot' )
+ {
+ &General::log("ConnSched reboot");
+ system ("/usr/local/bin/ipfirereboot", "boot");
+ }
+ elsif ( $CONNSCHED::config[$i]{'ACTION'} eq 'shutdown' )
+ {
+ &General::log("ConnSched shutdown");
+ system ("/usr/local/bin/ipfirereboot", "down");
+ }
+ }
+}
--
2.39.2