Revision: 6145
http://ipcop.svn.sourceforge.net/ipcop/?rev=6145&view=rev
Author: owes
Date: 2011-11-30 14:40:20 +0000 (Wed, 30 Nov 2011)
Log Message:
-----------
Add exit sub() for some extra logging. Most logging to RED section, admin
should look there in case of trouble.
Modified Paths:
--------------
ipcop/trunk/src/rc.d/rc.red
Modified: ipcop/trunk/src/rc.d/rc.red
===================================================================
--- ipcop/trunk/src/rc.d/rc.red 2011-11-30 14:38:13 UTC (rev 6144)
+++ ipcop/trunk/src/rc.d/rc.red 2011-11-30 14:40:20 UTC (rev 6145)
@@ -41,6 +41,18 @@
&General::readhash("/var/ipcop/ethernet/settings", \%netsettings);
&General::readhash("/var/ipcop/dhcp/settings", \%dhcpsettings);
+sub myexit
+{
+ my $retcode = shift;
+
+ unlink('/var/ipcop/red/connecting');
+ unlink('/var/ipcop/red/disconnecting');
+
+ &General::log("ERROR ($retcode) in rc.red") if ($retcode);
+
+ exit $retcode;
+}
+
sub dodhcpdial($;$) {
my ($iface, $dhcp_name) = @_;
@@ -57,8 +69,7 @@
if (system(@dhcpcommand)) {
&General::log('red', 'dhcp client fail');
- unlink('/var/ipcop/red/connecting');
- exit 1;
+ myexit(1);
}
else {
&General::log('red', 'dhcp client success');
@@ -184,9 +195,8 @@
}
}
else {
- &General::log("ERROR: Can't start RED when RED device not set!");
- unlink('/var/ipcop/red/connecting');
- exit 1;
+ &General::log('red', "ERROR: Can't start RED when RED device not
set!");
+ myexit(1);
}
}
@@ -195,8 +205,8 @@
}
if ($pppsettings{'VALID'} ne 'yes') {
- &General::log("ERROR: Profile has errors.");
- exit 1;
+ &General::log('red', 'ERROR: Profile has errors.');
+ myexit(1);
}
if (-e "/var/ipcop/ppp/updatesettings") {
@@ -249,7 +259,9 @@
$iface = &General::getredinterface();
my $device = &General::getinterfacefromfile("/var/ipcop/red/device");
- system('/usr/bin/touch /var/ipcop/red/disconnecting');
+ if (-e "/var/ipcop/red/active") {
+ system('/usr/bin/touch /var/ipcop/red/disconnecting');
+ }
unlink "/var/ipcop/red/dial-on-demand";
unlink "/var/ipcop/red/active";
unlink "/var/ipcop/red/connecting";
@@ -490,8 +502,8 @@
my $phone;
if (system('/etc/rc.d/rc.isdn', 'start')) {
- &General::log("ERROR: ISDN module failed to load");
- exit 1;
+ &General::log('red', 'ERROR: ISDN module failed to load');
+ myexit(1);
}
$seconds = $pppsettings{'TIMEOUT'} * 60;
@@ -522,14 +534,13 @@
system('/usr/sbin/isdnctrl', 'dialmode', 'ippp1', 'auto');
my @pppcommand = (
- '/usr/sbin/ipppd',
'ms-get-dns',
- 'noipdefault', '+mp',
- 'defaultroute', 'user',
- $pppsettings{'USERNAME'}, 'name',
- $pppsettings{'USERNAME'},
'active-filter',
- 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0',
'pidfile',
- '/var/run/ppp-ipcop.pid',
'/dev/ippp0',
- '/dev/ippp1'
+ '/usr/sbin/ipppd', 'ms-get-dns',
+ 'noipdefault', '+mp', 'defaultroute',
+ 'user', $pppsettings{'USERNAME'},
+ 'name', $pppsettings{'USERNAME'},
+ 'active-filter', 'outbound and not icmp[0] == 3 and not tcp[13]
& 4 != 0',
+ 'pidfile', '/var/run/ppp-ipcop.pid',
+ '/dev/ippp0', '/dev/ippp1'
);
if ($pppsettings{'DEBUG'} eq 'on') {
@@ -585,7 +596,6 @@
}
else {
system('/usr/sbin/isdnctrl', 'dial', 'ippp0');
-
}
system('/usr/bin/killall', 'ibod');
@@ -766,8 +776,8 @@
sub doeciadsldial {
if (system('/etc/rc.d/rc.eciadsl', 'start')) {
- &General::log("ERROR: ECI ADSL failed to start");
- exit 1;
+ &General::log('red', 'ERROR: ECI ADSL failed to start');
+ myexit(1);
}
if ($pppsettings{'PROTOCOL'} eq 'RFC1483') {
if ($pppsettings{'ENCAP'} =~ /^(0|1)$/) {
@@ -814,12 +824,12 @@
}
close(MODEMS);
if ($VID2 eq '') {
- &General::log("$pppsettings{'MODEM'} not found in modems.db");
- exit 1;
+ &General::log('red', "$pppsettings{'MODEM'} not found in
modems.db");
+ myexit(1);
}
if ($CHIP eq '') {
- &General::log("error in modems.db reading for
$pppsettings{'MODEM'}");
- exit 1;
+ &General::log('red', "error in modems.db reading for
$pppsettings{'MODEM'}");
+ myexit(1);
}
if ($pppsettings{'ENCAP'} eq '1') {
$ECIMODE = "LLC_RFC2364";
@@ -886,8 +896,8 @@
my $controller;
if (system('/etc/rc.d/rc.fritzdsl', 'start')) {
- &General::log("ERROR: Fritz DSL module failed to load");
- exit 1;
+ &General::log('red', 'ERROR: Fritz DSL module failed to load');
+ myexit(1);
}
# controller number
@@ -984,8 +994,8 @@
sub doeagleusbadsldial {
if (system('/etc/rc.d/rc.eagleusbadsl', 'start')) {
- &General::log("ERROR: EAGLE-USB ADSL MODEM failed to start");
- exit 1;
+ &General::log('red', 'ERROR: EAGLE-USB ADSL MODEM failed to start');
+ myexit(1);
}
# I'm guessing here, but documentation suggests to use br2684ctl etc.
@@ -1069,8 +1079,8 @@
sub dopulsardsldial {
if (system('/etc/rc.d/rc.pulsardsl', 'start')) {
- &General::log("ERROR: PULSAR ADSL modem failed to start");
- exit 1;
+ &General::log('red', 'ERROR: PULSAR ADSL modem failed to start');
+ myexit(1);
}
doatmdial();
}
@@ -1078,16 +1088,16 @@
sub doconexantpciadsldial {
if (system('/etc/rc.d/rc.conexantpciadsl', 'start')) {
- &General::log("ERROR: Conexant PCI ADSL modem failed to start");
- exit 1;
+ &General::log('red', 'ERROR: Conexant PCI ADSL modem failed to start');
+ myexit(1);
}
doatmdial();
}
sub dowanpipeadsldial {
if (system('/etc/rc.d/rc.wanpipe', 'start')) {
- &General::log("ERROR: wanpipe adsl failed to start");
- exit 1;
+ &General::log('red', 'ERROR: wanpipe adsl failed to start');
+ myexit(1);
}
doatmdial();
}
@@ -1178,8 +1188,8 @@
if (open(FILE, ">/var/ipcop/red/iface")) { print FILE $iface;
close FILE; }
if (system('/bin/ps -ef | /bin/grep -q [a]tmarpd')) {
if (system('/usr/sbin/atmarpd -b -l syslog')) {
- &General::log('atmarpd fail');
- exit 1;
+ &General::log('red', 'atmarpd fail');
+ myexit(1);
}
# it will fail on all attempt after the first because
interface still exist
@@ -1210,8 +1220,8 @@
sub dowanpipeserialdial {
if (system('/etc/rc.d/rc.wanpipe', 'start')) {
- &General::log("ERROR: Sangoma Wanpipe serial interface failed to
start");
- exit 1;
+ &General::log('red', 'ERROR: Sangoma Wanpipe serial interface failed
to start');
+ myexit(1);
}
my @pppcommand = ('/usr/sbin/pppd');
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn