can I pick anyone's brains?

David Collier from_busybox_maillist at dexdyne.com
Wed Jan 26 17:07:00 UTC 2011


I want to make my box present different details on a web-site, depending
on whether the user is on either of my 'local' networks or not.

I have eth0 onto our office LAN, and eth1 as a debug port. Of course
other people may do it differently. In the field someone might just plug
in a laptop to eth0 or eth1.

from time to time PPP and vpn routings may appear - the remote access is
usually over the vpn, but it could be different.

If they are local, then the hotlink on the page to ftp into my box is
meaningful.

If they are on another continent then a hotlink to ftp:10.212.1.5 isn't a
useful thing to offer them....

I know the IP address through which the pages are being served. So, as
people have said, I can decode and parse out the route table, and do
matches against it, in the same way the kernel does. But it's a
reasonable amount of bash/c/javascript to knock out. And we know the
kernel has all the code up and running.

If I could say "resolve 10.198.7.9" and get back "eth0 local" then could
know what options to offer the punter.

D



In article <4D4048AB.2000105 at gmx.de>, ralda at gmx.de (Harald Becker) wrote:

> *From:* Harald Becker <ralda at gmx.de>
> *To:* from_busybox_maillist at dexdyne.com
> *CC:* busybox at busybox.net
> *Date:* Wed, 26 Jan 2011 17:15:39 +0100
> 
>  Hallo David!
> 
> Here we are again ... :-)
> > If I have an IP address... 10.12.15.7 or something, is there a 
> > simple
> > command I can issue from a script which will examine all the 
> > routing
> > tables for me and return
> >
> > "eth0"  "local"
> > or 
> > "eth1"  "gateway"
> > or
> > "tun0"  "gateway" 
> >
> > or something similar?
> Can you please tell a bit more, what you want to achieve? The 
> routing is
> normally done by the kernel, so not required to be done in user 
> space
> programs or shell scripts.
> 
> There is one command, that allows to dump the routing table, that 
> is the
> command "route". With an awk script it would be possible to filter 
> the
> table output and select an appropriate routing entry. That way an 
> awk
> script could be used to build a command with your requirements ... 
> else
> I don't know any standard command for your purpose.
> 
> --
> Harald
> 
> 


More information about the busybox mailing list