libnet: `libnet_init(LIBNET_LINK, ): ` on some macs

See https://github.com/ThomasHabets/arping/issues/36

I don’t have a mac, but I suspect this could be a libnet issue picking a special system interface as if it’s a normal network interface, when given NULL as ifname.

Possibly only reproducible on Mac Pro with a touchbar.

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 23 (4 by maintainers)

Most upvoted comments

It doesn’t have to be a public API, but yeah that’s a good point about stability.

libnet_init()
{
      devs = libnet_select_devices(ifname);
      for (...) {
        if (!libnet_open_link(dev[i])) {
          free(devs);
          return ok;
        }
     }
     free(devs);
     return fail
}
libnet_select_device(dev) { devs= libnet_select_devices(dev); return devs ? fail : devs[0]; }

But actually doing that instead of pseudocode may not be as simple. Seems fine to push to a later release, and if anyone wants to volunteer a PR that may show how it’s cleaner than we think, it can be merged.