/* Get the hardware type of the given interface as ARPHRD_xxx constant.  */
static int iface_get_arptype(int fd, const char *device, char *ebuf)
/* Get the hardware type of the given interface as ARPHRD_xxx constant.  */
static int iface_get_arptype(int fd, const char *device, char *ebuf)
{
	struct ifreq	ifr;
	int		ret;
	memset(&ifr, 0, sizeof(ifr));
	pcap_strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
	if (ioctl(fd, SIOCGIFHWADDR, &ifr) == -1) {
		if (errno == ENODEV) {
			ret = PCAP_ERROR_NO_SUCH_DEVICE;
		} else
			ret = PCAP_ERROR;
		pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
		    errno, "SIOCGIFHWADDR");
		return ret;
	}
	return ifr.ifr_hwaddr.sa_family;
}