Re: Kernel PPPoE is dieing...
On Tue, Aug 23, 2005 at 11:49:48AM -0400, Melameth, Daniel D. wrote: Since the fixes for this are not in stable and I should probably be running -current instead of this workaround, logger does the job just fine... Yeah, logger. Now I feel dumb :) Anyway, I thought for sure when I wrote that code (posted earlier) that there should already be such a utility. Oh well, thanks for pointing that out to me! Matt -- Matt Garman email at: http://raw-sewage.net/index.php?file=email
Re: Kernel PPPoE is dieing...
On Tue, Aug 16, 2005 at 10:09:49AM -0300, Felipe Mesquita wrote: in-kernel pppoe. Anyway, I've made the script that checks for the device ip, and Croned it every 3 minutes (Depending on the needs it can be higher..) I took the smarts of your script, and also wrote a simple logging tool. It's just a wrapper for the syslog(3) function call (that allows you to log to syslog via the shell). In root's crontab, I have this entry: * * * * * /usr/local/sbin/chkpppoe.sh The chkpppoe.sh script looks like this: #!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin SYSLOGGER=/usr/local/sbin/syslogger IFACE=pppoe0 PROGNAME=chkpppoe.sh VAR=`ifconfig ${IFACE} | grep inet | cut -c 7` if [ $VAR = 0 ]; then ${SYSLOGGER} ${PROGNAME}: ${IFACE} appears to be down; attempting to bring it back up ifconfig ${IFACE} up sleep 60 else ${SYSLOGGER} ${PROGNAME}: ${IFACE} appears to be up; doing nothing fi #end of chkpppoe.sh The 'syslogger' program is this trivial program: /* syslogger.c begin */ #include syslog.h #include stdarg.h #include stdio.h #include stdlib.h #include string.h #define DEFAULT_PRIORITY LOG_INFO #define DEFAULT_PRIORITY_STRING LOG_INFO void usage (int argc, char* argv[]) { printf (usage: %s [-ln] \user message\\n, argv[0]); printf (where -ln specifies the log level, an n is is one of\n \t-l0 LOG_EMERG\n \t-l1 LOG_ALERT\n \t-l2 LOG_CRIT\n \t-l3 LOG_ERR\n \t-l4 LOG_WARNING\n \t-l5 LOG_NOTICE\n \t-l6 LOG_INFO (default)\n \t-l7 LOG_DEBUG\n ); exit(EXIT_SUCCESS); } int main (int argc, char* argv[]) { int priority = DEFAULT_PRIORITY; char* msg = NULL; switch (argc) { case 3: if ( (3==strlen(argv[1])) (0==strncmp(-l, argv[1], 2)) ) { priority = (int)strtol(argv[1][2], (char**)NULL, 10); if ( (priority 0) || (priority 7) ) { fprintf(stderr, warning: no such priority: %i; defaulting to %s\n, priority, DEFAULT_PRIORITY_STRING); priority = DEFAULT_PRIORITY; } } else { fprintf(stderr, warning: invalid option '%s'; defaulting to %s\n, argv[1], DEFAULT_PRIORITY_STRING); priority = DEFAULT_PRIORITY; } msg = argv[2]; break; case 2: msg = argv[1]; break; default: usage(argc,argv); } syslog(priority, %s, msg); return 0; } /* syslogger.c end */ I just saw the program actually work, and can verify it in /var/log/messages: ... Aug 23 09:14:01 excrement syslogger: chkpppoe.sh: pppoe0 appears to be up; doing nothing Aug 23 09:14:08 excrement /bsd: pppoe0: down Aug 23 09:14:08 excrement /bsd: pppoe0: phase terminate Aug 23 09:14:16 excrement /bsd: pppoe0: phase dead Aug 23 09:15:01 excrement syslogger: chkpppoe.sh: pppoe0 appears to be down; attempting to bring it back up Aug 23 09:15:01 excrement /bsd: pppoe0: phase establish Aug 23 09:15:01 excrement /bsd: pppoe0: phase authenticate Aug 23 09:15:03 excrement /bsd: pppoe0: phase network Aug 23 09:16:01 excrement syslogger: chkpppoe.sh: pppoe0 appears to be up; doing nothing ... Hopefully someone finds this useful :) Matt -- Matt Garman email at: http://raw-sewage.net/index.php?file=email
Re: Kernel PPPoE is dieing...
Matt Garman wrote: I took the smarts of your script, and also wrote a simple logging tool. It's just a wrapper for the syslog(3) function call (that allows you to log to syslog via the shell). In root's crontab, I have this entry: * * * * * /usr/local/sbin/chkpppoe.sh The chkpppoe.sh script looks like this: #!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin SYSLOGGER=/usr/local/sbin/syslogger IFACE=pppoe0 PROGNAME=chkpppoe.sh VAR=`ifconfig ${IFACE} | grep inet | cut -c 7` if [ $VAR = 0 ]; then ${SYSLOGGER} ${PROGNAME}: ${IFACE} appears to be down; attempting to bring it back up ifconfig ${IFACE} up sleep 60 else ${SYSLOGGER} ${PROGNAME}: ${IFACE} appears to be up; doing nothing fi #end of chkpppoe.sh The 'syslogger' program is this trivial program: /* syslogger.c begin */ #include syslog.h #include stdarg.h #include stdio.h #include stdlib.h #include string.h ... I just saw the program actually work, and can verify it in /var/log/messages: ... Aug 23 09:14:01 excrement syslogger: chkpppoe.sh: pppoe0 appears to be up; doing nothing Aug 23 09:14:08 excrement /bsd: pppoe0: down Aug 23 09:14:08 excrement /bsd: pppoe0: phase terminate Aug 23 09:14:16 excrement /bsd: pppoe0: phase dead Aug 23 09:15:01 excrement syslogger: chkpppoe.sh: pppoe0 appears to be down; attempting to bring it back up Aug 23 09:15:01 excrement /bsd: pppoe0: phase establish Aug 23 09:15:01 excrement /bsd: pppoe0: phase authenticate Aug 23 09:15:03 excrement /bsd: pppoe0: phase network Aug 23 09:16:01 excrement syslogger: chkpppoe.sh: pppoe0 appears to be up; doing nothing ... Hopefully someone finds this useful :) Since the fixes for this are not in stable and I should probably be running -current instead of this workaround, logger does the job just fine... $ cat pppoecheck #!/bin/sh # # NAME # pppoecheck - attempt to restart pppoe interface if it is down # pppoe0 interface exists if [ -f /etc/hostname.pppoe0 ]; then down=`ifconfig pppoe inet | fgrep 0.0.0.0` if [ $down ]; then logger -p user.err pppoe0: phase restart ifconfig pppoe0 up fi fi
Re: Kernel PPPoE is dieing...
Thanks Marius! I was just thinking about a more technical solution, or improviment for the in-kernel pppoe. Anyway, I've made the script that checks for the device ip, and Croned it every 3 minutes (Depending on the needs it can be higher..) In my case, I've got the advantage of, not running my DynDNS script if the device is dead.. It was boring me because was sending many mails to root.. Here is a part of the script. Simple, but can be very useful anyway... checkip.sh VAR=`ifconfig pppoe0 | grep inet | cut -c 7` if [ $VAR = 0 ]; then ifconfig pppoe0 up sleep 20 fi # To get the external IP, use: VAR2=`ifconfig pppoe0 | grep inet | cut -c 7-21 | tr -d - | tr -d ` # It can be helpful for updating dynamic dns services, etc... end Thanks again, any sugestion will be very welcome... =D Felipe M. Oliveira -- Date: Mon, 15 Aug 2005 14:27:26 +0200 From: Marius Van Deventer - Umzimkulu [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: misc@openbsd.org Subject: Re: Kernel PPPoE is dieing... Message-ID: [EMAIL PROTECTED] If it always dies after a set number of days, maybe you can issue a command from cron to either restart the connection or reboot the pc automatically? -Original Message- From: Felipe Mesquita [mailto:[EMAIL PROTECTED] Sent: 15 August 2005 02:19 PM To: [EMAIL PROTECTED] Cc: misc@openbsd.org Subject: Kernel PPPoE is dieing... Hi List, I4m using OpenBBSD 3.7 as a (basicly) web, mail and gateway server. I have 2 network devices, one for DSL connection and other to my localnet. Ok.. When i turn my server on, it get all up and running automaticly, including the ADSL connection. It connects to my ADSL service, authenticates correctly, and get working.. Very nice, fast... This is part of the log: --- Aug 14 22:14:42 noronha /bsd: pppoe0: phase establish Aug 14 22:14:42 noronha /bsd: pppoe0: phase authenticate Aug 14 22:14:42 noronha /bsd: pppoe0: phase network --- But some days after, the connection dies, and it don4t restart alone, so that my server stays down until i restart it. The log show: --- Aug 14 21:54:48 noronha /bsd: pppoe0: phase dead --- When the server is up, and runnig connected, the 4ifconfig pppoe04 show my internet IP, etc. When the connection dies, the ip is 0.0.0.0 (of course) and i noticed that the retry number commonly is 10. So i think the connection is dieing 10 times, and then it do not restart. The question is: 4How do i set retry number to infinite, so that it always restart the connection as soon as it deads??4 Sorry the long text for the simple question, i didn4t wanted to leave any doubts.. =D Sooo... Thanks to all for reading... Felipe M. Oliveira
Re: Kernel PPPoE is dieing...
Felipe Mesquita wrote: Hi List, I4m using OpenBBSD 3.7 as a (basicly) web, mail and gateway server. I have 2 network devices, one for DSL connection and other to my localnet. Ok.. When i turn my server on, it get all up and running automaticly, including the ADSL connection. It connects to my ADSL service, authenticates correctly, and get working.. Very nice, fast... This is part of the log: --- Aug 14 22:14:42 noronha /bsd: pppoe0: phase establish Aug 14 22:14:42 noronha /bsd: pppoe0: phase authenticate Aug 14 22:14:42 noronha /bsd: pppoe0: phase network --- But some days after, the connection dies, and it don4t restart alone, so that my server stays down until i restart it. The log show: --- Aug 14 21:54:48 noronha /bsd: pppoe0: phase dead --- When the server is up, and runnig connected, the 4ifconfig pppoe04 show my internet IP, etc. When the connection dies, the ip is 0.0.0.0 (of course) and i noticed that the retry number commonly is 10. So i think the connection is dieing 10 times, and then it do not restart. The question is: 4How do i set retry number to infinite, so that it always restart the connection as soon as it deads??4 Try -current--enhancements have been made that might address this.
Kernel PPPoE is dieing...
Hi List, I4m using OpenBBSD 3.7 as a (basicly) web, mail and gateway server. I have 2 network devices, one for DSL connection and other to my localnet. Ok.. When i turn my server on, it get all up and running automaticly, including the ADSL connection. It connects to my ADSL service, authenticates correctly, and get working.. Very nice, fast... This is part of the log: --- Aug 14 22:14:42 noronha /bsd: pppoe0: phase establish Aug 14 22:14:42 noronha /bsd: pppoe0: phase authenticate Aug 14 22:14:42 noronha /bsd: pppoe0: phase network --- But some days after, the connection dies, and it don4t restart alone, so that my server stays down until i restart it. The log show: --- Aug 14 21:54:48 noronha /bsd: pppoe0: phase dead --- When the server is up, and runnig connected, the 4ifconfig pppoe04 show my internet IP, etc. When the connection dies, the ip is 0.0.0.0 (of course) and i noticed that the retry number commonly is 10. So i think the connection is dieing 10 times, and then it do not restart. The question is: 4How do i set retry number to infinite, so that it always restart the connection as soon as it deads??4 Sorry the long text for the simple question, i didn4t wanted to leave any doubts.. =D Sooo... Thanks to all for reading... Felipe M. Oliveira
Re: Kernel PPPoE is dieing...
If it always dies after a set number of days, maybe you can issue a command from cron to either restart the connection or reboot the pc automatically? -Original Message- From: Felipe Mesquita [mailto:[EMAIL PROTECTED] Sent: 15 August 2005 02:19 PM To: [EMAIL PROTECTED] Cc: misc@openbsd.org Subject: Kernel PPPoE is dieing... Hi List, I4m using OpenBBSD 3.7 as a (basicly) web, mail and gateway server. I have 2 network devices, one for DSL connection and other to my localnet. Ok.. When i turn my server on, it get all up and running automaticly, including the ADSL connection. It connects to my ADSL service, authenticates correctly, and get working.. Very nice, fast... This is part of the log: --- Aug 14 22:14:42 noronha /bsd: pppoe0: phase establish Aug 14 22:14:42 noronha /bsd: pppoe0: phase authenticate Aug 14 22:14:42 noronha /bsd: pppoe0: phase network --- But some days after, the connection dies, and it don4t restart alone, so that my server stays down until i restart it. The log show: --- Aug 14 21:54:48 noronha /bsd: pppoe0: phase dead --- When the server is up, and runnig connected, the 4ifconfig pppoe04 show my internet IP, etc. When the connection dies, the ip is 0.0.0.0 (of course) and i noticed that the retry number commonly is 10. So i think the connection is dieing 10 times, and then it do not restart. The question is: 4How do i set retry number to infinite, so that it always restart the connection as soon as it deads??4 Sorry the long text for the simple question, i didn4t wanted to leave any doubts.. =D Sooo... Thanks to all for reading... Felipe M. Oliveira [demime 1.01d removed an attachment of type application/x-pkcs7-signature which had a name of smime.p7s]
Re: Kernel PPPoE is dieing...
On Mon, 15 Aug 2005 09:19:07 -0300, Felipe Mesquita wrote: The question is: 4How do i set retry number to infinite, so that it always restart the connection as soon as it deads??4 * * * * * /usr/local/sbin/chkpppoe into crontab -e for root. (I don't have access to the chkpppoe now; but there is at least one example in this list.) Uwe