RE: mac address lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 5 Jun 2001, Amit Kucheria wrote:

> Isnt it ARP ? i am providing an IP address as input and expect a MAC
> address as output.
> 
> I went through the code in the kernel for ARP but i cant put my finger on
> a fn that would provide this functionality to other routines.
> 
> arp_req_get() kind of does it but is defined as static in arp.c
> I dont want to redo the whole thing.
> 

You can access the kernel arp table by using the existing ioctls. It is
very simple. There are some good examples in the "arp" command source, you
can find it in the net-tools package.

On a related topic RTnetlink ARP features to add and delete entries. Along
with dumping an entire kernel ARP table. But it fails to provide a
facility to lookup just one ARP entry. (RTM_GETNEIGH without
NLM_F_DUMP). Does anyone know why this basic feature is not implemented
yet?

Jay Schulist

> On Tue, 5 Jun 2001, Brad Bonkoski wrote:
> 
> > Isn't this the same as RARP?  Or Reverse ARP?
> > That code is in the kernel.
> > -Brad
> >
> > > -----Original Message-----
> > > From: Amit Kucheria [mailto:amitk@ittc.ukans.edu]
> > > Sent: Tuesday, June 05, 2001 10:48 AM
> > > To: linux-net@vger.kernel.org
> > > Subject: mac address lookup
> > >
> > >
> > > Hi all,
> > >
> > > I need a function in the ARP/ethernet code which gives me the
> > > mac address
> > > of a machine given its IP address. Is there any such function in the
> > > kernel ?
> > >
> > > The reason i need the function is because my device is not
> > > accessing the
> > > neighbour tables directly. I tried tracing the 'ioctl'
> > > suggestion below,
> > > but it wont work for me.
> > >
> > > Regards,
> > > Amit
> > >
> > > On Mon, 28 May 2001, Sarada Seshadri wrote:
> > >
> > > >
> > > > > What is the way to read the /proc filesystem from the kernel ?
> > > > >
> > > > > I cannot "ping" the machine since i am writing this code
> > > in the kernel. It
> > > > > should just look for the mac address of an ethernet
> > > device and return it.
> > > >
> > > > A user space program could get this info by an `ioctl
> > > (SIOCGIFHWADDR).' If
> > > > you look at the corresponding kernel code you could find a clue.
> > > >
> > > > -Sarada
> > >
> > > --
> > > ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
> > >                   Amit Kucheria
> > >           EECS Grad. Research Assistant
> > >            Team Niehaus || Room # 245E
> > >          University of Kansas @ Lawrence
> > >    (R)+1-(785)-830 8521 ||| (O)+1-(785)-864 7774
> > > ____________________________________________________
> > >
> > >
> > > -
> > > : send the line "unsubscribe
> > > linux-net" in
> > > the body of a message to majordomo@vger.kernel.org
> > >
> >
> 
> -- 
> ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
>                   Amit Kucheria
>           EECS Grad. Research Assistant
>            Team Niehaus || Room # 245E
>          University of Kansas @ Lawrence
>    (R)+1-(785)-830 8521 ||| (O)+1-(785)-864 7774
> ____________________________________________________
> 
> 
> -
> : send the line "unsubscribe linux-net" in
> the body of a message to majordomo@vger.kernel.org
> 

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux