freebsd-ports/net/libnet/files/patch-src-libnet_link_bpf.c
Sunpoet Po-Chuan Hsieh 8ed03fb8db - Backport upstream fixes (from 1.2 to 1.1.6)
- Bump PORTREVISION for package change
- While I'm here, rename patch-libnet.h.in to patch-include-libnet.h.in

PR:		196818
Submitted by:	Kevin Hung <khung@nullaxiom.com> (via email)
Obtained from:	18cbe497dd
		2e724b2f5c
		408fa2266a
		c9390bf8f3
2015-01-18 10:36:16 +00:00

32 lines
1.1 KiB
C

- Make libnet_get_hwaddr() work with 802.1q interfaces in bpf (BSD).
Obtained from: https://github.com/sam-github/libnet/commit/408fa2266a4af402152cc0f1e9a40b56477b995a
--- src/libnet_link_bpf.c.orig 2012-03-20 00:59:50.000000000 +0800
+++ src/libnet_link_bpf.c 2015-01-18 03:09:08.169400000 +0800
@@ -316,7 +316,11 @@
if (ifm->ifm_type == RTM_IFINFO)
{
sdl = (struct sockaddr_dl *)(ifm + 1);
- if (sdl->sdl_type != IFT_ETHER)
+ if (sdl->sdl_type != IFT_ETHER
+ && sdl->sdl_type != IFT_FASTETHER
+ && sdl->sdl_type != IFT_FASTETHERFX
+ && sdl->sdl_type != IFT_GIGABITETHERNET
+ && sdl->sdl_type != IFT_L2VLAN)
continue;
if (strncmp(&sdl->sdl_data[0], l->device, sdl->sdl_nlen) == 0)
{
@@ -326,6 +330,12 @@
}
}
free(buf);
+ if (next == end) {
+ snprintf(l->err_buf, LIBNET_ERRBUF_SIZE,
+ "%s(): interface %s of known type not found.",
+ __func__, l->device);
+ return NULL;
+ }
return (&ea);
}