Remove code for protocols we don't properly support. (Most of this could
[oweals/busybox.git] / networking / ping.c
index 47b9f8f52ae49b5eb78387230fc5efefffc865b1..7fe52ab39e005408bdcf8afcf46ebfe329554a0a 100644 (file)
@@ -17,7 +17,7 @@
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/times.h>
-#include <sys/signal.h>
+#include <signal.h>
 
 #include <netinet/in.h>
 #include <netinet/ip.h>
 #include "busybox.h"
 
 
-static const int DEFDATALEN = 56;
-static const int MAXIPLEN = 60;
-static const int MAXICMPLEN = 76;
-static const int MAXPACKET = 65468;
-#define        MAX_DUP_CHK     (8 * 128)
-static const int MAXWAIT = 10;
-static const int PINGINTERVAL = 1;             /* second */
+enum {
+       DEFDATALEN = 56,
+       MAXIPLEN = 60,
+       MAXICMPLEN = 76,
+       MAXPACKET = 65468,
+       MAX_DUP_CHK = (8 * 128),
+       MAXWAIT = 10,
+       PINGINTERVAL = 1                /* second */
+};
 
 #define O_QUIET         (1 << 0)
 
@@ -106,7 +108,7 @@ static void ping(const char *host)
        pkt->icmp_type = ICMP_ECHO;
        pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet));
 
-       c = sendto(pingsock, packet, sizeof(packet), 0,
+       c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0,
                           (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
 
        if (c < 0 || c != sizeof(packet))
@@ -200,7 +202,7 @@ static void sendping(int junk)
 {
        struct icmp *pkt;
        int i;
-       char packet[datalen + sizeof(struct icmp)];
+       char packet[datalen + ICMP_MINLEN];
 
        pkt = (struct icmp *) packet;