Subject: Re: Finding the correct interface for a packet
To: Klaus Klein <email@example.com>
From: Andrew Brown <firstname.lastname@example.org>
Date: 12/03/1998 16:47:35
>> % route get 184.108.40.206
>> in each case, the "interface" line is what you want. i, at one
>> point, snarfed pieces of code from route.c and cobbled some other bits
>> together for just this purpose.
>> the snag: it uses routing sockets, which means it needs to be root.
>That's no longer true; the routing socket interface has been changed
>to not require super-user privileges for RTM_GET.
then this is probably the ideal.
as for the comment that connected udp sockets are "bad" since routing
tables can change (which is true), i don't think that's really an
issue unless the information that was being obtained (ie, the name of
the interface) was expected to stay constant for a considerable length
of time. if you just need to know "right now" for "right now" then
either method is fine.
but, of course, i don't know exactly what the original querier (matt?)
had in mind. :)
|-----< "CODE WARRIOR" >-----|
email@example.com * "ah! i see you have the internet
firstname.lastname@example.org (Andrew Brown) that goes *ping*!"
email@example.com * "information is power -- share the wealth."