hi all,
i have the need in my program to determine, given an ip address, what
interface the packets will actually leave the box from. in otherwords,
something like a getdevicename(char *ipaddr) that walks the routing
table & returns an "eth0","eth1" etc. i know i usally take the
routing decision for granted & just leave it up to the kernel to take
care of that for me, but in this case, i need to somehow get that
info. i can quickly write a function like that mentioned above that
will, given an ip, walk the routing table, apply the netmasks & return
the interface name, but i was wondering if any of you guys had a more
clever way of getting this info. or if you're aware of some obscure
function call that does something like this.
thanks in advance!
-grant
|