*BSD News Article 83942


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!nntp.coast.net!news-peer.gsl.net!news.gsl.net!howland.erols.net!newsfeed.internetmci.com!news.wildstar.net!serv.hinet.net!netnews.hinet.net!news
From: vcba79@ms1.hinet.net (Vincent Chen)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: why this script works under linux but not freebsd?
Date: Sat, 30 Nov 1996 22:05:48 GMT
Organization: Vincent Research
Lines: 54
Message-ID: <329eef7c.869544@netnews.hinet.net>
NNTP-Posting-Host: 168.95.101.71
X-Newsreader: Forte Free Agent 1.1/32.230


Hi, all

  I wrote a short script to dialup and start ppp daemon only
if carrier detected. ( pppd can't do this and it won't return
dialup status. please correct me if I was wrong. :-) Any way,
the following routine work fine under linux but not for freebsd.
Under freebsd, it repeat dial until carrier detect and start ppp
daemon. this way, ppp daemon always tell me 'config request
timeout'. But if put chat sequence into ppp command line, it
works. I don't get it. It might be serial port config problem. But
I can't figure out what's wrong.

Any comment would be greatly appreciated.

#
# Function: Connect
#
# Return value: 0 - connect to ppp server successfully
#               1 - ppp device not created
#               2 - chat failed to make connection
#               3 - failed to change ownership of serial device
#
Connect()
{
  if [ -f $LOCKDIR/LCK..$DEVICE ]
  then
    unlock $DEVICE
  fi
  stty -f /dev/$DEVICE $BAUD crtscts -tostop
  (
  if chat -f $SCRIPTDIR/chat.$1
  then
    pppd /dev/$DEVICE $BAUD file $SCRIPTDIR/options.$1 &
    if CheckDevice
    then
     return 0
    else
     return 1
    fi
  else
    return 2
  fi
  ) < /dev/$DEVICE > /dev/$DEVICE
}


==

Vincent Chen				vcba79@ms1.hinet.net

Taipei,Taiwan					
R.O.C.