gzip cleanup part #8
[oweals/busybox.git] / networking / udhcp / arpping.c
index 471e36d6209c18091209590af94d457d4dbba9cb..f78fd3fd829a69e0256de6584602a44752ddf2a7 100644 (file)
@@ -15,9 +15,9 @@
 
 struct arpMsg {
        /* Ethernet header */
-       u_char   h_dest[6];                     /* destination ether addr */
-       u_char   h_source[6];                   /* source ether addr */
-       u_short  h_proto;                       /* packet type ID field */
+       uint8_t  h_dest[6];                     /* destination ether addr */
+       uint8_t  h_source[6];                   /* source ether addr */
+       uint16_t h_proto;                       /* packet type ID field */
 
        /* ARP packet */
        uint16_t htype;                         /* hardware type (must be ARPHRD_ETHER) */
@@ -44,9 +44,7 @@ struct arpMsg {
 /* FIXME: match response against chaddr */
 int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
 {
-
        int     timeout = 2;
-       int     optval = 1;
        int     s;                      /* socket */
        int     rv = 1;                 /* return value */
        struct sockaddr addr;           /* for interface name */
@@ -56,12 +54,13 @@ int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
        time_t          prevTime;
 
 
-       if ((s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP))) == -1) {
+       s = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP));
+       if (s == -1) {
                bb_perror_msg(bb_msg_can_not_create_raw_socket);
                return -1;
        }
 
-       if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)) == -1) {
+       if (setsockopt_broadcast(s) == -1) {
                bb_perror_msg("cannot setsocketopt on raw socket");
                close(s);
                return -1;