Check that a fd is a socket before calling ioctl_get_hwaddr.