Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Mar 1998 11:51:11 +1030
From:      Greg Lehey <grog@lemis.com>
To:        Benjamin Lewis <bhlewis@gte.net>, Peter van Heusden <pvh@leftside.wcape.school.za>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Detecting state of PPP
Message-ID:  <19980306115111.62161@freebie.lemis.com>
In-Reply-To: <199803060014.TAA13234@gte.net>; from Benjamin Lewis on Thu, Mar 05, 1998 at 07:14:00PM -0500
References:  <Pine.BSF.3.95.980305071307.15655F-100000@leftside.wcape.school.za> <199803060014.TAA13234@gte.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu,  5 March 1998 at 19:14:00 -0500, Benjamin Lewis wrote:
>
> pvh@leftside.wcape.school.za wrote:
>
>> How does one go about writing a program to check if a PPP link is up
>> or down?
>
> I've seen lots of complicated responses to this, so there is probably
> something inherintly wrong with what I've always done, check for the
> existence of the /var/spool/lock/LCK..cuaa? file.  If there is a possibility
> that something else is using the serial line, one could check whether the
> PID in the file matches the PPP process.

Why not just look at the interface status:

$ ifconfig -a
lp0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> mtu 1500
ep0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet 192.109.197.137 netmask 0xffffff00 broadcast 192.109.197.255
        ether 00:a0:24:37:0d:2b 
tun0: flags=8151<UP,POINTOPOINT,RUNNING,PROMISC,MULTICAST> mtu 1518
        inet 192.109.197.137 --> 192.109.197.211 netmask 0xffffff00 

This one is up (RUNNING)

sl0: flags=c010<POINTOPOINT,LINK2,MULTICAST> mtu 552
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
        inet 139.130.136.133 --> 139.130.136.129 netmask 0xffff0000 

This one is up

ppp1: flags=8010<POINTOPOINT,MULTICAST> mtu 1500

This one is down

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet 127.0.0.1 netmask 0xff000000 

Greg

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980306115111.62161>