Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Jul 2001 04:47:58 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        freebsd-mobile@FreeBSD.org
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, Brian Somers <brian@Awfulhak.org>
Subject:   Wireless setup (was: cvs commit: src/usr.sbin/ppp main.c)
Message-ID:  <200107040347.f643lwc15969@hak.lan.Awfulhak.org>
In-Reply-To: Message from Brian Somers <brian@FreeBSD.org>  of "Tue, 03 Jul 2001 20:34:20 PDT." <200107040334.f643YKx49662@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
For those interested in how my wireless gear is setup (now that 
it's working):

At home, I have my wireless access point attached to my external 
(dirty) network.  When I attach my laptop, it obtains a (MAC-based) 
IP number via dhcp from my gateway box.  I have an 
/etc/dhclient-exit-hooks script that says:

case "$reason" in
BOUND|REBOOT|RENEW)
        if [ ."$new_ip_address" = .217.204.245.19 -a \
             ."$new_server_name" = .gw.Awfulhak.org ]
        then
                ps axopid,command | fgrep 'ppp -ddial hgw' | while read pid cmd
                do
                        kill $pid
                        kill -2 $pid
                done
                ppp -ddial hgw
                killall -0 nmbd 2>/dev/null ||
                    /usr/local/etc/rc.d/samba.sh start
        fi;;
esac

The hgw profile runs an encrypted PPPoE session to my gateway box - 
providing un-firewalled VPN access.

Because dhclient was executing this with closed stdin/stdout/stderr 
descriptors in the RENEW case, ppp was erroneously opening /dev/tun0 
as descriptor 0 and the daemonisation bit further on in main() happily 
closed STDIN_FILENO, blowing away half of the tun device !

This bug has been irritating me for weeks !!!

> brian       2001/07/03 20:34:20 PDT
> 
>   Modified files:
>     usr.sbin/ppp         main.c 
>   Log:
>   Handle any of descriptors 0, 1 or 2 being closed when we're
>   envoked -- don't use them (as return values from open()), then
>   (say) close(STDIN_FILENO) when daemonising.
>   
>   This is done by grabbing 3 descriptors to /dev/null at startup and
>   releasing them after we've daemonised.
>   
>   MFC after: 1 week
>   
>   Revision  Changes    Path
>   1.181     +19 -2     src/usr.sbin/ppp/main.c

-- 
Brian <brian@freebsd-services.com>                <brian@Awfulhak.org>
      http://www.freebsd-services.com/        <brian@[uk.]FreeBSD.org>
Don't _EVER_ lose your sense of humour !      <brian@[uk.]OpenBSD.org>



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




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