From 06274cee44fe4e1ff9901299b914199fca485437 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 13 Oct 2006 12:38:43 +0000 Subject: [PATCH] - Before doing ioctl(SIOCGIFNETMASK) put the proper IP address into the ifreq, to obtain correct netmask in case of interface with multiple aliases. - While here, remove a comment with a bad idea. PR: bin/42120 Submitted by: Dmitry Frolov --- usr.sbin/arp/arp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index b0d8b8769fe4..f251243d6af1 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -761,9 +761,9 @@ get_ether_addr(in_addr_t ipaddr, struct ether_addr *hwaddr) for (ifr = ifc.ifc_req; ifr < ifend; ifr = NEXTIFR(ifr) ) { if (ifr->ifr_addr.sa_family != AF_INET) continue; - /* XXX can't we use *ifr instead of ifreq ? */ strncpy(ifreq.ifr_name, ifr->ifr_name, sizeof(ifreq.ifr_name)); + ifreq.ifr_addr = ifr->ifr_addr; /* * Check that the interface is up, * and not point-to-point or loopback.