/* Query the kernel for the MTU of the given interface.  */
static int iface_get_mtu(int fd, const char *device, char *ebuf)
/* Query the kernel for the MTU of the given interface.  */
static int iface_get_mtu(int fd, const char *device, char *ebuf)
{
	struct ifreq	ifr;
	if (!device)
		return BIGGER_THAN_ALL_MTUS;
	memset(&ifr, 0, sizeof(ifr));
	pcap_strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
	if (ioctl(fd, SIOCGIFMTU, &ifr) == -1) {
		pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
		    errno, "SIOCGIFMTU");
		return -1;
	}
	return ifr.ifr_mtu;
}