can I pick anyone's brains?

Harald Becker ralda at
Wed Jan 26 17:31:31 UTC 2011

 Sorry David,

I don't know of any command that does this ... especially not in busybox
... suggesting to write an own small C program that does exactly this,
than you are able to use it in your scripts.


On 26.01.2011 18:07, David Collier wrote:
> 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: 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" and get back "eth0 local" then could
> know what options to offer the punter.
> D
> In article <4D4048AB.2000105 at>, ralda at (Harald Becker) wrote:
>> *From:* Harald Becker <ralda at>
>> *To:* from_busybox_maillist at
>> *CC:* busybox at
>> *Date:* Wed, 26 Jan 2011 17:15:39 +0100
>>  Hallo David!
>> Here we are again ... :-)
>>> If I have an IP address... 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
> _______________________________________________
> busybox mailing list
> busybox at

More information about the busybox mailing list