diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-06 18:36:50 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-06 18:36:50 +0000 |
commit | 3538b9a8822421b7c8596a33a917dcf2f99c92b7 (patch) | |
tree | 768c23fe79bb81583de7376a4d744632d888d303 /networking/udhcp/arpping.c | |
parent | 5d725462d44268f9a86030daaa6f6396d32f796c (diff) | |
download | busybox-w32-3538b9a8822421b7c8596a33a917dcf2f99c92b7.tar.gz busybox-w32-3538b9a8822421b7c8596a33a917dcf2f99c92b7.tar.bz2 busybox-w32-3538b9a8822421b7c8596a33a917dcf2f99c92b7.zip |
Implement optional syslog logging using ordinary
bb_xx_msg calls, and convert networking/* to it.
The rest of bbox will be converted gradually.
Diffstat (limited to 'networking/udhcp/arpping.c')
-rw-r--r-- | networking/udhcp/arpping.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/networking/udhcp/arpping.c b/networking/udhcp/arpping.c index 6e254f604..587339f9b 100644 --- a/networking/udhcp/arpping.c +++ b/networking/udhcp/arpping.c | |||
@@ -43,13 +43,13 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) | |||
43 | time_t prevTime; | 43 | time_t prevTime; |
44 | 44 | ||
45 | 45 | ||
46 | 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) { |
47 | LOG(LOG_ERR, bb_msg_can_not_create_raw_socket); | 47 | bb_perror_msg(bb_msg_can_not_create_raw_socket); |
48 | return -1; | 48 | return -1; |
49 | } | 49 | } |
50 | 50 | ||
51 | if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)) == -1) { | 51 | if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)) == -1) { |
52 | LOG(LOG_ERR, "Could not setsocketopt on raw socket"); | 52 | bb_perror_msg("Could not setsocketopt on raw socket"); |
53 | close(s); | 53 | close(s); |
54 | return -1; | 54 | return -1; |
55 | } | 55 | } |
@@ -81,14 +81,14 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) | |||
81 | FD_SET(s, &fdset); | 81 | FD_SET(s, &fdset); |
82 | tm.tv_sec = timeout; | 82 | tm.tv_sec = timeout; |
83 | 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) { |
84 | DEBUG(LOG_ERR, "Error on ARPING request: %m"); | 84 | bb_perror_msg("Error on ARPING request"); |
85 | if (errno != EINTR) rv = 0; | 85 | if (errno != EINTR) rv = 0; |
86 | } else if (FD_ISSET(s, &fdset)) { | 86 | } else if (FD_ISSET(s, &fdset)) { |
87 | if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0; | 87 | if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0; |
88 | if (arp.operation == htons(ARPOP_REPLY) && | 88 | if (arp.operation == htons(ARPOP_REPLY) && |
89 | memcmp(arp.tHaddr, mac, 6) == 0 && | 89 | memcmp(arp.tHaddr, mac, 6) == 0 && |
90 | *((uint32_t *) arp.sInaddr) == yiaddr) { | 90 | *((uint32_t *) arp.sInaddr) == yiaddr) { |
91 | DEBUG(LOG_INFO, "Valid arp reply receved for this address"); | 91 | DEBUG("Valid arp reply received for this address"); |
92 | rv = 0; | 92 | rv = 0; |
93 | break; | 93 | break; |
94 | } | 94 | } |
@@ -97,6 +97,6 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface) | |||
97 | prevTime = uptime(); | 97 | prevTime = uptime(); |
98 | } | 98 | } |
99 | close(s); | 99 | close(s); |
100 | DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V"); | 100 | DEBUG("%salid arp replies for this address", rv ? "No v" : "V"); |
101 | return rv; | 101 | return rv; |
102 | } | 102 | } |