Silicondust / libhdhomerun

Silicondust library and cli utility for controlling HDHomeRun tuners
GNU Lesser General Public License v2.1
110 stars 44 forks source link

Network Interface Detection Bug Fix #10

Closed entropyofchaos closed 5 years ago

entropyofchaos commented 6 years ago

It appears that the socket ioctl command SIOCGIFCONF can return invalid objects. When the socket ioctl command SIOCGIFFLAGS was called on the network interfaces returned by SIOCGIFCONF, the function can return in error with errno ENODEV (19) "No such device." Specifically, this affected running the software on my DD-WRT ARM based linux distrobution.

According to "http://refspecs.linuxbase.org/LSB_3.0.0/LSB-PDA/LSB-PDA/baselib-sockio-2.html", It appears that this command has been deprecated and "[t]he SIOCGIFCONF interface is superceded by the if_nameindex() family of functions (see ISO POSIX (2003))."

After switching to use if_nameindex(), the hdhomerun_local_ip_info() function is now successfully is able to lookup network interfaces on DD-WRT's ARM implementation. Additionally, I have tested this on my MacBook and it appears to work with no problems.

Testing was done by running the command "./hdhomerun_config discover"

nickkelsey commented 5 years ago

SIOCGIFCONF is still required for Android prior to 7.0.

The latest libhdhomerun code uses if_nameindex by default, with an optional define to force it use the old SIOCGIFCONF API.

No API changes.