|
@@ -116,6 +116,7 @@ static void sender(const struct ifreq *ifr, size_t nb)
|
|
|
static int get_hwaddr(const char * restrict iface, struct ifreq * restrict dest_ifr)
|
|
static int get_hwaddr(const char * restrict iface, struct ifreq * restrict dest_ifr)
|
|
|
{
|
|
{
|
|
|
int shw;
|
|
int shw;
|
|
|
|
|
+ int rc;
|
|
|
|
|
|
|
|
strncpy(dest_ifr->ifr_name, iface, sizeof dest_ifr->ifr_name);
|
|
strncpy(dest_ifr->ifr_name, iface, sizeof dest_ifr->ifr_name);
|
|
|
dest_ifr->ifr_addr.sa_family = AF_LINK;
|
|
dest_ifr->ifr_addr.sa_family = AF_LINK;
|
|
@@ -124,8 +125,12 @@ static int get_hwaddr(const char * restrict iface, struct ifreq * restrict dest_
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ioctl(shw, SIOCGHWADDR, dest_ifr);
|
|
|
|
|
|
|
+ rc = ioctl(shw, SIOCGHWADDR, dest_ifr);
|
|
|
close(shw);
|
|
close(shw);
|
|
|
|
|
+
|
|
|
|
|
+ if (rc)
|
|
|
|
|
+ return -1;
|
|
|
|
|
+
|
|
|
VPRINTF("Destination %s, HW address: %s.\n", iface, ether_ntoa((const struct ether_addr *)dest_ifr->ifr_addr.sa_data));
|
|
VPRINTF("Destination %s, HW address: %s.\n", iface, ether_ntoa((const struct ether_addr *)dest_ifr->ifr_addr.sa_data));
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|