arp listing problem
- From: En Effet <jp@xxxxxxxxxxx>
- Date: Tue, 25 Mar 2008 21:10:52 +0100
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");
}
.
- Prev by Date: Re: resolv.conf, bind9 and unresolvable local address
- Next by Date: Re: Two Network cards
- Previous by thread: resolv.conf, bind9 and unresolvable local address
- Next by thread: Disable sending ICMPV6 redirects on IPV6
- Index(es):