RE: mac address lookup

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

 



neigh_lookup pneigh_lookup

J. Schulist

On Tue, 5 Jun 2001, Amit Kucheria wrote:

> This might seem like a dumb question, but can i call ioctl() inside the
> kernel ?
> 

That would not work well. The way I would do it is use the already
EXPORTed functions neigh_lookup(), neigh_update(), located in
linux/net/core/neighbor.c. The ARP table arp_tbl is also already
EXPORTed. So you should have all the information you need to to an ARP
lookup from your driver.

One should be able to use similar code as in arp_req_get and arp_req_set.

Jay

> I need to use the IP->MAC function inside the kernel for a pseudo device
> driver that i am writing.
> 
> The userlevel programs like 'arp' are using ioctl(SIOCGIFHWADDR) etc.
> which is being handled in *static* functions like arp_req_get,
> arp_req_set.
> 
> Currently the only solution i see (if i dont want to modify arp.c) is to
> copy these routines into my device driver code.
> 
> On a related note, can i call arp_ioctl() (the function which handles
> ioctl calls) with proper parameters in my device driver ? What would
> happen to the copy_from_user() call in arp_ioctl() ?
> 
> Regards,
> Amit
> 
> On Tue, 5 Jun 2001, J. Schulist wrote:
> 
> > 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
> > > > > > A user space program could get this info by an `ioctl
> > > > > (SIOCGIFHWADDR).' If
> 
> -- 
> ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
>                   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