[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Patch to implement SIOCGIFINDEX
On Apr 2, 2013, at 4:49 AM, Roy Marples <roy%marples.name@localhost> wrote:
> On 02/04/2013 0:13, Ty Sarna wrote:
>> The following short patch implements SIOCGIFINDEX as found on Linux
>> (and maybe elsewhere), which translates an interface name to its index.
> Is there a reason why you cannot use if_nametoindex(3)?
One could (Linux has it too), but in practice the socketcan examples
don't, and so the code out there using socketcan doesn't either. Granted,
there are already other changes one will have to make when porting
(I drew the line at <linux/...> headers, for example!), but my
preference is to make it easy to port.
(Also, for what little it matters, SIOCGIFINDEX is more efficient than
if_nametoindex, given that the latter makes multiple syscalls to suck
the entire interface list from the kernel and then walks it.)
Main Index |
Thread Index |