DragonFly BSD
DragonFly users List (threaded) for 2005-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: Example of 'brilliant' apps?


From: "Jason M. Leonard" <fuzz@xxxxxxxxxxxxx>
Date: Sun, 20 Mar 2005 12:26:18 -0500 (EST)



On Sun, 20 Mar 2005, Martin P. Hellwig wrote:

Gabriel Ambuehl wrote:
<cut>

It would seem like an awfully hard thing to reliably detect what network your on for all but the very simplest networks, no? Partner MAC will rarely be the same all the time in complex networks (especially when they use multiple AP to cover wide ranges with WiFi), IP often are private ones, so not really useful either...

Well the combination of the gateways IP & full dns name should be enough I think.

I was thinking something quick and dirty like so (note that this is thoroughly untested here in Powerbook land):


#!/usr/local/bin/bash
GATEWAYS="list of known default gateway IP addresses"
cp /etc/rc.conf /etc/rc.conf.start
cp /etc/resolv.conf /etc/resolv.conf.start
for GATEWAY in $GATEWAYS; do
	cp /etc/rc.conf /etc/rc.conf.last
	cp /etc/rc.conf.$GATEWAY /etc/rc.conf
	cp /etc/resolv.conf /etc/resolv.conf.last
	cp /etc/resolv.conf.$GATEWAY /etc/resolv.conf
	/etc/netstart
	if [ ping -oc1 google.com > /dev/null 2>&1 ]; then
		echo "Successfully configured network using \
			gateway $GATEWAY"
		exit 0
	fi
done
mv /etc/rc.conf.start /etc/rc.conf
mv /etc/resolv.conf.start /etc/resolv.conf
/etc/netstart


:Fuzz




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]