Subject: Re: Finding the correct interface for a packet
To: Klaus Klein <firstname.lastname@example.org>
From: Andrew Brown <email@example.com>
Date: 12/03/1998 16:47:35
>> % route get 220.127.116.11
>> 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" >-----|
firstname.lastname@example.org * "ah! i see you have the internet
email@example.com (Andrew Brown) that goes *ping*!"
firstname.lastname@example.org * "information is power -- share the wealth."