"Scott C. Best" wrote:

> Heya. Actually, yea, gatping is a play on Gatling. :)
> It essentially sends out 256 minimum-sized icmp echo requests,
> ignoring the responses, so as to get a freshened-up ARP
> table.

In compiling gatping (0.2), I get lots of interesting things :-/

# make
gcc -s -O2 -Wall -o gatping gatping.c
gatping.c: In function `main':
gatping.c:106: warning: unused variable `buf'
gatping.c:104: warning: unused variable `j'
gatping.c:104: warning: unused variable `i'
gatping.c:143: warning: control reaches end of non-void function
gatping.c: In function `send_ping':
gatping.c:183: warning: control reaches end of non-void function
gatping.c: In function `make_target_list':
gatping.c:217: warning: implicit declaration of function `inet_aton'
gatping.c:218: warning: implicit declaration of function `inet_ntoa'
gatping.c:218: warning: assignment makes pointer from integer without a
cast
gatping.c:192: warning: unused variable `j'
gatping.c:191: warning: unused variable `buflen'
gatping.c:236: warning: control reaches end of non-void function
gatping.c: In function `search_arp':
gatping.c:248: warning: unused variable `testbuf'
gatping.c:246: warning: unused variable `m'
gatping.c:246: warning: unused variable `k'
gatping.c:246: warning: unused variable `j'
gatping.c:246: warning: unused variable `i'
gatping.c:288: warning: control reaches end of non-void function
gatping.c: In function `in_cksum':
gatping.c:295: warning: unused variable `answer'
gatping.c:307: warning: control reaches end of non-void function

I created a patch to fix most of them; it is attached.  I also created a
minimal Makefile to allow a make.

I've also created a lrp/* directory for gatping (but not Echoware)..

I've also created a gatping package - also included.
diff -uNr EchoWare_0.46.orig/gatping_0.2/Makefile EchoWare_0.46/gatping_0.2/Makefile
--- EchoWare_0.46.orig/gatping_0.2/Makefile     Wed Dec 31 18:00:00 1969
+++ EchoWare_0.46/gatping_0.2/Makefile  Thu Oct 25 15:47:23 2001
@@ -0,0 +1,8 @@
+CC = gcc
+
+gatping:
+       gcc -s -O2 -Wall -o gatping gatping.c
+
+clean:
+       rm -f core *~ gatping
+
Binary files EchoWare_0.46.orig/gatping_0.2/gatping and 
EchoWare_0.46/gatping_0.2/gatping differ
diff -uNr EchoWare_0.46.orig/gatping_0.2/gatping.c EchoWare_0.46/gatping_0.2/gatping.c
--- EchoWare_0.46.orig/gatping_0.2/gatping.c    Sun Dec  3 19:20:50 2000
+++ EchoWare_0.46/gatping_0.2/gatping.c Thu Oct 25 15:45:37 2001
@@ -19,6 +19,8 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#include <sys/socket.h>
+#include <arpa/inet.h>
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 /* these next two may be a problem - fping source complains about them */
@@ -90,10 +92,10 @@
 int            arp_table       ; /* the arp pseudo file        */
 
 /* function prototypes */
-int send_ping ( )      ;
-int make_target_list ()        ;
+void send_ping ( )     ;
+void make_target_list ()       ;
 int in_cksum ( u_short *p, int n )     ;
-int search_arp ()              ;
+void search_arp ()             ;
 
 
 /*  main program */
@@ -101,9 +103,10 @@
        {
 
        
-       int             i, j, k         ; /* misc counters */
+       //int           i, j, k         ; /* misc counters */
+       int             k               ; /* misc counters */
        struct protoent *proto          ;
-       char            *buf            ;
+       //char          *buf            ;
 
        ident = getpid() & 0xFFFF       ;
        proto = getprotobyname ( "icmp" )       ;
@@ -140,6 +143,7 @@
        search_arp ()   ;
        /* clean up and exit */
 
+       return 0;
        }       ; /* main */
 
 
@@ -147,7 +151,7 @@
 
 /* send_ping -- sends a single ping packet to a supplied address */
 /* pretty much right from fping */
-int send_ping ( int s  ,  HOST_ENTRY *h )
+void send_ping ( int s  ,  HOST_ENTRY *h )
        {
        char            *buffer         ;
        struct icmp     *icp            ;
@@ -184,12 +188,13 @@
 
 
 /* make_target_list -- creates a list of addresses to ping */
-int make_target_list ( )
+void make_target_list ( )
        {
 
        char            addrbuf[24]     ;
-       int             buflen          ;
-       int             i, j, k, m              ;
+       //int           buflen          ;
+       //int           i, j, k, m              ;
+       int             i, k, m         ;
        HOST_ENTRY      *p              ;
        char            * testbuf       ;
        char            hoststring[6]           ;
@@ -206,7 +211,7 @@
 
        /* read in an IP address in dotted-quad form */
        /* while ( ( buflen = ( read ( ping_file, addrbuf, 16 ) ) ) > 0 ) */
-       /*      { */
+       /*      < */
                k++             ;
                /* printf ( "Read in as: %s", addrbuf ) ;*/
                /* allocate space for a new host entry  */
@@ -238,14 +243,14 @@
 
 /* search_arp -- processes the arp table to find valid entries */
 /* puts them in a linked list and writes the results to a file */
-int search_arp ( )     
+void search_arp ( )    
        {
 
         char            arpbuf[100]     ;
         int             buflen          ;
-        int             i, j, k, m              ;
+        //int             i, j, k, m              ;
        VALID_HOST      *p              ;
-        char            * testbuf       ;
+        //char            * testbuf       ;
 
        /* open the arp pseudo-file for reading */
        arp_table = open ("/proc/net/arp",O_RDONLY,0644 )    ;
@@ -292,7 +297,7 @@
 
 int in_cksum(u_short *p, int n)
        {
-       register u_short answer;
+       //register u_short answer;
        register long sum = 0;
        u_short odd_byte = 0;
 

gatping.lrp

Reply via email to