aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/arpping.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-06-10 17:22:49 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-06-10 17:22:49 +0000
commit24833430bc2dbea733c3b0b9ea6c6b976f95474a (patch)
tree805a4197b8a0d36eaa6880dfc23d8c2539359fe9 /networking/udhcp/arpping.c
parent6c43f743a3f607f91ee22a53db880fce2df645f0 (diff)
downloadbusybox-w32-24833430bc2dbea733c3b0b9ea6c6b976f95474a.tar.gz
busybox-w32-24833430bc2dbea733c3b0b9ea6c6b976f95474a.tar.bz2
busybox-w32-24833430bc2dbea733c3b0b9ea6c6b976f95474a.zip
Vodz, last_patch_88
Diffstat (limited to 'networking/udhcp/arpping.c')
-rw-r--r--networking/udhcp/arpping.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c
index 4c0b3d83b..e20395a9e 100644
--- a/networking/udhcp/arpping.c
+++ b/networking/udhcp/arpping.c
@@ -5,22 +5,19 @@
5 * by Yoichi Hariguchi <yoichi@fore.com> 5 * by Yoichi Hariguchi <yoichi@fore.com>
6 */ 6 */
7 7
8#include <sys/types.h>
9#include <sys/time.h> 8#include <sys/time.h>
10#include <time.h> 9#include <time.h>
11#include <sys/types.h>
12#include <sys/socket.h> 10#include <sys/socket.h>
13#include <netinet/if_ether.h> 11#include <netinet/if_ether.h>
14#include <net/if_arp.h> 12#include <net/if_arp.h>
15#include <netinet/in.h> 13#include <netinet/in.h>
16#include <stdio.h>
17#include <string.h> 14#include <string.h>
18#include <unistd.h> 15#include <unistd.h>
19#include <errno.h> 16#include <errno.h>
20 17
21#include "dhcpd.h" 18#include "dhcpd.h"
22#include "debug.h"
23#include "arpping.h" 19#include "arpping.h"
20#include "common.h"
24 21
25/* args: yiaddr - what IP to ping 22/* args: yiaddr - what IP to ping
26 * ip - our ip 23 * ip - our ip
@@ -47,7 +44,7 @@ int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface)
47 44
48 45
49 if ((s = socket (PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP))) == -1) { 46 if ((s = socket (PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP))) == -1) {
50 LOG(LOG_ERR, "Could not open raw socket"); 47 LOG(LOG_ERR, bb_msg_can_not_create_raw_socket);
51 return -1; 48 return -1;
52 } 49 }
53 50
@@ -84,7 +81,7 @@ int arpping(u_int32_t yiaddr, u_int32_t ip, unsigned char *mac, char *interface)
84 FD_SET(s, &fdset); 81 FD_SET(s, &fdset);
85 tm.tv_sec = timeout; 82 tm.tv_sec = timeout;
86 if (select(s + 1, &fdset, (fd_set *) NULL, (fd_set *) NULL, &tm) < 0) { 83 if (select(s + 1, &fdset, (fd_set *) NULL, (fd_set *) NULL, &tm) < 0) {
87 DEBUG(LOG_ERR, "Error on ARPING request: %s", strerror(errno)); 84 DEBUG(LOG_ERR, "Error on ARPING request: %m");
88 if (errno != EINTR) rv = 0; 85 if (errno != EINTR) rv = 0;
89 } else if (FD_ISSET(s, &fdset)) { 86 } else if (FD_ISSET(s, &fdset)) {
90 if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0; 87 if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0;