Networking Forums

Networking Forums > Computer Networking > Linux Networking > arp listing problem

Reply
Thread Tools Display Modes

arp listing problem

 
 
En Effet
Guest
Posts: n/a

 
      03-25-2008, 07:10 PM
Hi

I made a little soft to create arp entries, check the arp table and
destroy each entry.

The arp listing produced is wrong for one entry. This entry exists
really (can be deleted one time, another try is wrong).

Exemple:

creating 15 entries
/sbin/arp -Ds 10.1.1.5 eth0 pub
/sbin/arp -Ds 10.1.1.6 eth0 pub
/sbin/arp -Ds 10.1.1.7 eth0 pub
/sbin/arp -Ds 10.1.1.8 eth0 pub
/sbin/arp -Ds 10.1.1.9 eth0 pub
/sbin/arp -Ds 10.1.1.10 eth0 pub
/sbin/arp -Ds 10.1.1.11 eth0 pub
/sbin/arp -Ds 10.1.1.12 eth0 pub
/sbin/arp -Ds 10.1.1.13 eth0 pub
/sbin/arp -Ds 10.1.1.14 eth0 pub
/sbin/arp -Ds 10.1.1.15 eth0 pub
/sbin/arp -Ds 10.1.1.16 eth0 pub
/sbin/arp -Ds 10.1.1.17 eth0 pub
/sbin/arp -Ds 10.1.1.18 eth0 pub
/sbin/arp -Ds 10.1.1.19 eth0 pub
check inputs
Address HWtype HWaddress Flags Mask Iface
10.1.1.5 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.6 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.7 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.8 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.9 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.10 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.11 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.12 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.13 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.14 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.15 * * MP eth0

10.1.1.16 (10.1.1.16) -- no entry

Address HWtype HWaddress Flags Mask Iface
10.1.1.17 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.18 * * MP eth0
Address HWtype HWaddress Flags Mask Iface
10.1.1.19 * * MP eth0
Sleep 3 sec
Delete entries
/sbin/arp -i eth0 -d 10.1.1.5 pub
/sbin/arp -i eth0 -d 10.1.1.6 pub
/sbin/arp -i eth0 -d 10.1.1.7 pub
/sbin/arp -i eth0 -d 10.1.1.8 pub
/sbin/arp -i eth0 -d 10.1.1.9 pub
/sbin/arp -i eth0 -d 10.1.1.10 pub
/sbin/arp -i eth0 -d 10.1.1.11 pub
/sbin/arp -i eth0 -d 10.1.1.12 pub
/sbin/arp -i eth0 -d 10.1.1.13 pub
/sbin/arp -i eth0 -d 10.1.1.14 pub
/sbin/arp -i eth0 -d 10.1.1.15 pub
/sbin/arp -i eth0 -d 10.1.1.16 pub
/sbin/arp -i eth0 -d 10.1.1.17 pub
/sbin/arp -i eth0 -d 10.1.1.18 pub
/sbin/arp -i eth0 -d 10.1.1.19 pub


For 15 entries the 12 th entry is wrongly displayed as missing,
For 20 entries the 13th entry is wrongly displayed as missing,
21 -> 14th etc

Done with kernel 2.6.12 on mdk but reproduced on redhat.
Is there a bug in the linux code?
Thanks for your test on any other distributions

Bye



The code is
///////////////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>

#include <net/if_arp.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <string.h>
#include <errno.h>
#include <assert.h>

#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || __GLIBC__ > 2

#include <netinet/if_ether.h>
#include <netpacket/packet.h>

#else

#include <linux/if_ether.h>
#include <linux/if_packet.h>

#endif

#define ERROR printf
#define FATAL_ERROR printf
#define DbgRtLib printf
#define EVENTLOG printf

#define NIPQUAD(addr) \
((unsigned char *)&addr)[0], \
((unsigned char *)&addr)[1], \
((unsigned char *)&addr)[2], \
((unsigned char *)&addr)[3]


int main(int argc, const char* argv[])
{
int i;
struct in_addr host_addr;
char cmd[1024];
u_int32_t msIP,omsIP;
u_int32_t ip;
struct sockaddr eth;

//initial values
omsIP = 0x0A010104;
int ii = 15;
char interface[] = "eth0";
//

if (argc == 1)
{
printf("call with arptest count\n");
return 0;
}
ii = atoi( argv[1]);
printf ("arp test with the command line arp \n");
printf(" creating %d entries\n",ii);
msIP=omsIP;
for (i = 0; i < ii; i++)
{
//proxyarp_add_item(struct in_addr host_addr, char const *interface)
msIP++;
ip = htonl(msIP);
sprintf(cmd,"/sbin/arp -Ds %d.%d.%d.%d %s pub",
NIPQUAD(ip),interface);
printf (" %s \n",cmd);
system(cmd);
}

printf("check inputs\n");
msIP=omsIP;

for (i = 0; i<ii; i++)
{
msIP++;
ip = htonl(msIP);

sprintf(cmd,"/sbin/arp -n -i %s %d.%d.%d.%d",interface, NIPQUAD(ip));
system(cmd);
}

printf("Sleep 3 sec\n");
sleep(3);

printf("Delete entries\n");
msIP=omsIP;

for (i = 0; i<ii; i++)
{
msIP++;
ip = htonl(msIP);
sprintf(cmd,"/sbin/arp -i %s -d %d.%d.%d.%d
pub",interface,NIPQUAD(ip));
printf (" %s \n",cmd);
system(cmd);

}

printf("\n");
}
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is format verbose FTP listing ? Borneq Linux Networking 2 02-08-2007 03:37 PM
Listing all IPs and their assigned names? boe Windows Networking 6 02-17-2005 07:18 PM
User listing bigbrian Home Networking 0 11-26-2004 11:49 AM
E-Bay listing: Cisco 2620 Wsando Network Routers 0 09-02-2004 03:34 PM
Network Listing Capt. Len Windows Networking 0 08-10-2003 09:00 PM



1 2 3 4 5 6 7 8 9 10 11