Subject: Re: Auto detecting profile during boot up
To: Yasir Malik <ymalik@cs.stevens-tech.edu>
From: Richard Rauch <rkr@olib.org>
List: port-i386
Date: 01/20/2005 13:40:32
[BTW, I think that you really should have directed this *general*
 help question to netbsd-help@, rather than port-i386.  There is
 nothing i386-specific about what you are doing.]

Before I knew about newbtconf, I worked out my own solution to
this.  I added soemthing like /etc/rc.d/net-probe or some such.
net-probe would use ping, asking ping to only ping once and to wait
no more than 1 second for the result.  By pinging a particular
static IP address, I could detect if I was connected to a particular
network.  (The script would speculatively configure its ethernet
connection for the network that it thought that it might be in,
then ping.)

I only had to distinguish between "home" and "office", and could
assume that if I wasn't in one case, then I was in the other.  A
full second waiting for pings that may not come back (and pinging
every address of a long list no matter how soon one comes back
positive) could be prohibitive.  Shorter pings (maybe making a
longer pass if the first pass fails) and dropping out as soon
as a match is found are obvious things to consider.

-- 
  "I probably don't know what I'm talking about."  http://www.olib.org/~rkr/