mirror of
https://github.com/siemens-mobile-hacks/llvm-c166.git
synced 2026-11-27 19:34:57 +00:00
This patch implements if_nametoindex and if_indextoname for Linux. Both functions work by creating a temporary AF_UNIX socket and issuing ioctl calls (SIOCGIFINDEX and SIOCGIFNAME, respectively). The main implementation details: - for if_nametoindex, I check that the interface name fits within IF_NAMESIZE before issuing the ioctl - for if_indextoname, if the kernel returns ENODEV for an unknown index, I map it to ENXIO to comply with POSIX requirements - added the definition of struct ifreq to support these operations. Similar to the other net structure definitions, I'm using an anonymous union to avoid #defining members. Assisted by Gemini. |
||
|---|---|---|
| .. | ||
| if.yaml | ||