From owner-cvs-all Tue Jul 3 20:47:16 2001 Delivered-To: cvs-all@freebsd.org Received: from Awfulhak.org (gw.Awfulhak.org [217.204.245.18]) by hub.freebsd.org (Postfix) with ESMTP id D9A7137B408; Tue, 3 Jul 2001 20:47:03 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.4/8.11.4) with ESMTP id f643lfr77295; Wed, 4 Jul 2001 04:47:42 +0100 (BST) (envelope-from brian@lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.4/8.11.4) with ESMTP id f643lwc15969; Wed, 4 Jul 2001 04:47:58 +0100 (BST) (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200107040347.f643lwc15969@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: freebsd-mobile@FreeBSD.org Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, Brian Somers Subject: Wireless setup (was: cvs commit: src/usr.sbin/ppp main.c) In-Reply-To: Message from Brian Somers of "Tue, 03 Jul 2001 20:34:20 PDT." <200107040334.f643YKx49662@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 04 Jul 2001 04:47:58 +0100 From: Brian Somers Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 http://www.freebsd-services.com/ Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message