Skip to content

Commit

Permalink
Make libnet_get_hwaddr() work with 802.1q interfaces in bpf (BSD).
Browse files Browse the repository at this point in the history
This fixes a regression in introduced in
27282bb.
  • Loading branch information
ThomasHabets committed Jun 30, 2013
1 parent 305e586 commit 408fa22
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion libnet/src/libnet_link_bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,11 @@ libnet_get_hwaddr(libnet_t *l)
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)
{
Expand All @@ -324,6 +328,12 @@ libnet_get_hwaddr(libnet_t *l)
}
}
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);
}

Expand Down

0 comments on commit 408fa22

Please sign in to comment.