-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Friday 2005-11-11 at 01:20 +0100, I wrote:
The Tuesday 2005-11-08 at 01:06 +0100, I wrote:
I have observed that, sometimes, when the modem connection goes down, the pppd daemon doesn't always call ip-down -
This is a failure log; the sequence is:
11:15:58 - pppd decides to terminate the connection due to lack of activity. - calls script /etc/ppp/ip-down 11:15:58 - script ip-down reports entry 11:16:03 - script ip-down reports modyfing firewall settings 11:16:03 - pppd sends SIGTERM to ip-down, killing it before it can do its job. 11:19:04 - I notice it and manually call ip-kill to clean up.
Why does pppd decide to kill ip-down? ip-down had no chance to do all its jobs.
To learn what was happening, I wrote a hack to /etc/ppp/ip-down script; the key is that I decided to trap the signal SIGTERM, and also I added some trace points (echo to log): ip-down) #CER: pppd sometimes kills ip-down with sigterm before time. trap 'logger -s -t $BASENAME -p mail.warn "SIGTERM TRAPPED!" ; "echo" ' SIGTERM logger -t $BASENAME -p mail.debug " -> ip-down code: restore_nameservers" restore_nameservers logger -t $BASENAME -p mail.debug " -> ip-down code: isdn_restartinterface" isdn_restartinterface logger -t $BASENAME -p mail.debug " -> ip-down code: start_firewall" start_firewall logger -t $BASENAME -p mail.debug " -> ip-down code: ip-down.local?" # call ip-down.local if it exists and is executable: if test -x /etc/ppp/ip-down.local ; then logger -t $BASENAME -p mail.debug " -> ip-down code: call ip-down.local" /etc/ppp/ip-down.local "$@" | logger -p security.notice -t ip-down.local > /dev/null & fi logger -t $BASENAME -p mail.debug " -> ip-down code: ip_resend hook" # ip_resend hook test "$IP_RESEND" = "yes" -a -x /usr/sbin/ip_resend && \ /usr/sbin/ip_resend -o $INTERFACE $IP_RESEND_PARAMETER logger -t $BASENAME -p mail.debug " -> ip-down code: any ip-down.d scripts?" # run additional scripts if they exist if [ -d /etc/ppp/ip-down.d ]; then for SCRIPT in /etc/ppp/ip-down.d/*; do [ -d $SCRIPT -o ! -x $SCRIPT ] && continue; # ignore backup files and leftovers from rpm case $SCRIPT in *.rpmsave|*.rpmnew|*rpmorig|*~) continue ;; esac $SCRIPT "$@" | logger -p security.notice -t $SCRIPT > /dev/null & done fi logger -t $BASENAME -p mail.debug " -> ip-down code: end" #run_ifdown #CER: pppd sometimes kills ip-down with sigterm before time. trap - SIGTERM ;; The problem only happens very occasionally, but tonight it happened; see the log: Dec 9 01:22:11 nimrodel ip-down: -> Entrando a /etc/ppp/ip-down - ppp0 /dev/ttyS1 115200 L: 81.41.201.248 R: 80.58.197.105 Prm: Dec 9 01:22:12 nimrodel ip-down: -> ip-down code: restore_nameservers Dec 9 01:22:12 nimrodel ip-down: -> ip-down code: isdn_restartinterface Dec 9 01:22:12 nimrodel ip-down: -> ip-down code: start_firewall Dec 9 01:22:18 nimrodel ip-down: SIGTERM TRAPPED! Dec 9 01:22:18 nimrodel ip-down: -> ip-down code: ip-down.local? Dec 9 01:22:18 nimrodel ip-down: -> ip-down code: call ip-down.local Dec 9 01:22:18 nimrodel ip-down: -> ip-down code: ip_resend hook Dec 9 01:22:18 nimrodel ip-down: -> ip-down code: any ip-down.d scripts? Dec 9 01:22:18 nimrodel ip-down: -> ip-down code: end Dec 9 01:22:18 nimrodel ip-down: -> Saliendo de /etc/ppp/ip-down Dec 9 01:22:18 nimrodel ip-down.local: -> Llamando a /etc/ppp/ip-down.local ppp0 /dev/ttyS1 115200 L: 81.41.201.248 R: 80.58.197.105 Prm: When the script (/etc/ppp/ip-down) was waiting for the call to "/sbin/SuSEfirewall2" to return (for six seconds), pppd decided to stop waiting and sent a SIGTERM signal to /etc/ppp/ip-down, which I trapped and ignored. I noticed that this happened while the daily cron jobs were running, probably the updatedb part, having the system HD pretty occupied, so that the call to SuSEfirewall2 took longer than normal. Trapping SIGTERM solves the issue. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFDmNRhtTMYHG2NR9URAs18AJsE+6yJRs9dgFsrpJwXx3V/Q9VC6gCffNRy PAk3uX88SKDtiadzZjLmfhc= =tU5q -----END PGP SIGNATURE-----