Subject: Re: ppp connection strangeness...
To: Peter Seebach <seebs@solon.com>
From: David Jones <dej@inode.org>
List: current-users
Date: 03/02/1997 09:44:06
Peter Seebach wrote:
| 

[ Kill-if-ping fails script deleted ]

| 1.  The above script fairly frequently chooses to kill pppd when the link
| is working perfectly well.

Here's mine.  Link down is detected properly, and it rarely goes down, which
implies that false alarms are rare.

#!/bin/sh

echo $$ >/var/run/ship.pid
cd /etc/ppp
cp ship/options.ship options
pppd tty00
while true; do
    sleep 60
    /usr/local/bin/newping -o -c 10 206.248.33.145 >/dev/null 2>&1 || {
        # It's down!
        logger IP link down - restarting PPP 
        kill `cat /var/run/ppp0.pid`
        sleep 3
        pppd tty00
    }
done


"newping" is ping with the -o option added: quit if you get any icmp replies.
In this case, up to 10 pings are sent, but in practice a reply will be
received before the second ping is sent.

*** /mnt/netbsd/src/src/sbin/ping/ping.c	Thu Nov  7 07:14:23 1996
--- ping.c	Sun Feb 16 18:02:30 1997
***************
*** 115,120 ****
--- 115,121 ----
  #define	F_SO_DONTROUTE	0x080
  #define	F_VERBOSE	0x100
  #define	F_SADDR		0x200
+ #define	F_ONCE		0x400
  
  /* multicast options */
  int moptions;
***************
*** 189,195 ****
  
  	preload = 0;
  	datap = &outpack[8 + sizeof(struct timeval)];
! 	while ((ch = getopt(argc, argv, "I:LRS:c:dfh:i:l:np:qrs:t:vw:")) != EOF)
  		switch(ch) {
  		case 'c':
  			npackets = atoi(optarg);
--- 190,196 ----
  
  	preload = 0;
  	datap = &outpack[8 + sizeof(struct timeval)];
! 	while ((ch = getopt(argc, argv, "I:LRS:c:dfh:i:l:nop:qrs:t:vw:")) != EOF)
  		switch(ch) {
  		case 'c':
  			npackets = atoi(optarg);
***************
*** 229,234 ****
--- 230,238 ----
  		case 'n':
  			options |= F_NUMERIC;
  			break;
+ 		case 'o':
+ 			options |= F_ONCE;
+ 			break;
  		case 'p':		/* fill buffer with user pattern */
  			options |= F_PINGFILLED;
  			fill((char *)datap, optarg);
***************
*** 416,421 ****
--- 420,427 ----
  		}
  		pr_pack((char *)packet, cc, &from);
  		if (npackets && nreceived >= npackets)
+ 			break;
+ 		if (nreceived > 0 && (options & F_ONCE))
  			break;
  	}
  	finish();

[ Link woes ]

| The PPP link is over a 28.8 modem which claims to have some compression.  I
| don't recall seeing this when I was using my Amiga as a network feed.
| 
| Any suggestions?  Is this a sun thing, or a PPP thing, or a couple-months-old
| -current thing?

Could be a sun thing.

The UART on Suns (and Amigas too) really sucks.  I splurged and got a 386DX/33
for my router.