Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Networking
Reload this Page arp table listing problem
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Networking Hardware/Software related, Modems, Internet connection sharing, IPTables etc.

Reply
 
Thread Tools Display Modes
Old 03-18-2008   #1 (permalink)
Just Joined!
 
Join Date: Mar 2008
Posts: 1
arp table listing problem

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 entrries
/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

The code is
Code:
#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
//EVENTLOG, ERROR, FATAL_ERROR




#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);
//  host_addr.s_addr = ip;
//  printf ("  rt_proxyARPon mss %d.%d.%d.%d\n", NIPQUAD(ip));
//     proxyarp_add_item(host_addr,interface);
   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);
 // host_addr.s_addr = ip;
  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");
}

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
lecatla is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Pingbacks are Off
Refbacks are Off
 

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 07:04 PM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0