diff options
author | mikeh <mikeh@FreeBSD.org> | 2002-03-20 01:31:15 +0000 |
---|---|---|
committer | mikeh <mikeh@FreeBSD.org> | 2002-03-20 01:31:15 +0000 |
commit | 64dbc53bb1bf0e1d0793f11dc42c58dafd9091de (patch) | |
tree | 70675638f82fc4d6818872fc162cd3c9900fce00 | |
parent | 67d7812f71c9493f9e700a850d6a02975a8ba18c (diff) | |
download | FreeBSD-src-64dbc53bb1bf0e1d0793f11dc42c58dafd9091de.zip FreeBSD-src-64dbc53bb1bf0e1d0793f11dc42c58dafd9091de.tar.gz |
Fix bugs from previous commit: initialize the correct field and use
the correct local variable.
Caught by: Joachim Isaksson <Joachim.Isaksson@algitech.com>
Pointy hat to: mikeh
-rw-r--r-- | usr.sbin/arp/arp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c index 56f63ba..3c5866d 100644 --- a/usr.sbin/arp/arp.c +++ b/usr.sbin/arp/arp.c @@ -158,7 +158,7 @@ main(int argc, char *argv[]) argv += optind; bzero(&so_mask, sizeof(so_mask)); - so_mask.sin_family = 8; + so_mask.sin_len = 8; so_mask.sin_addr.s_addr = 0xffffffff; bzero(&blank_sin, sizeof(blank_sin)); blank_sin.sin_len = sizeof(blank_sin); @@ -688,7 +688,7 @@ get_ether_addr(u_int32_t ipaddr, u_char *hwaddr) ifc.ifc_len = sizeof(ifs); ifc.ifc_req = ifs; - if (ioctl(s, SIOCGIFCONF, &ifc) < 0) { + if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) { warnx("ioctl(SIOCGIFCONF)"); close(sock); return 0; @@ -709,7 +709,7 @@ get_ether_addr(u_int32_t ipaddr, u_char *hwaddr) * Check that the interface is up, * and not point-to-point or loopback. */ - if (ioctl(s, SIOCGIFFLAGS, &ifreq) < 0) + if (ioctl(sock, SIOCGIFFLAGS, &ifreq) < 0) continue; if ((ifreq.ifr_flags & (IFF_UP|IFF_BROADCAST|IFF_POINTOPOINT| @@ -720,7 +720,7 @@ get_ether_addr(u_int32_t ipaddr, u_char *hwaddr) * Get its netmask and check that it's on * the right subnet. */ - if (ioctl(s, SIOCGIFNETMASK, &ifreq) < 0) + if (ioctl(sock, SIOCGIFNETMASK, &ifreq) < 0) continue; mask = ((struct sockaddr_in *) &ifreq.ifr_addr)->sin_addr.s_addr; @@ -751,7 +751,7 @@ nextif: */ dla = (struct sockaddr_dl *) &ifr->ifr_addr; memcpy(hwaddr, LLADDR(dla), dla->sdl_alen); - close (s); + close (sock); printf("using interface %s for proxy with address ", ifp->ifr_name); ether_print(hwaddr); |