RE: mac address lookup

From: Amit Kucheria (amitk@ittc.ukans.edu)
Date: Tue Jun 05 2001 - 14:02:30 EST


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

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
____________________________________________________

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



This archive was generated by hypermail 2b29 : Thu Jun 07 2001 - 21:01:15 EST