LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-19-2010, 10:52 AM   #1
bostan
LQ Newbie
 
Registered: Feb 2010
Posts: 14

Rep: Reputation: 0
Issues with using ioctl and SIOCGARP to get ARP entry on Linux Kernal


Hi ,
I am using Linux 2.6 Fedora 12.
I am using ioctl(s,SIOCGARP,&areq,sizeof(struct arpreq) ) command to query the kernel to get the mac address for a given IP address.
What I have seen is whenever I query the kernel to get the MAC I do get the MAC but for some reason after the ARP age out I don't see the arp entry again back when I get the new packet. If I commented out the IOCTL code after ARP age-out when next packet comes from the SRC IP Kernel do add it back to the ARP table.
Does anybody has seen this issue ?
Any help is appreciated.
-Thanks
 
Old 08-04-2014, 09:59 AM   #2
boatbodger
LQ Newbie
 
Registered: Jan 2014
Posts: 2

Rep: Reputation: Disabled
ioctl SIOCGARP returning -1 error

Did you ever get to the bottom of this? I am seeing the same problem (albeit Fedora 14).
For my application, I need to find the MAC address of an incoming packet, and - bizzarely - the kernel does not seem to glean MAC from incoming packets - only as a result of ARP.

My not-so-elegant workaround is to set the arp cache timer up to something quite large and then run an IP scan just before the arp cache entry would time out. I'd love to find a better way...
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ARP entry ddomiray Linux - Newbie 2 10-26-2009 01:26 PM
How can we Enhance TCP/IP stack for SR kernal in Linux by using ARP? laxmii.s Linux - Newbie 4 07-04-2008 03:32 PM
arp cache entry............. shrishailnk Linux - Networking 2 04-22-2006 02:44 PM
How to create an proxyarp entry in arp table by using arp command? himalayas Linux - Networking 0 06-04-2003 04:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration