Subject: Re: Mofiying Kernel
To: Rajnish Madan <rajnishm@delhi.tcs.co.in>
From: Bill Studenmund <wrstuden@zembu.com>
List: tech-kern
Date: 12/15/2000 10:22:40
On Fri, 15 Dec 2000, Rajnish Madan wrote:

> Hi,
> 
> I am absolutely new to Kernel programming...:-(((
> I want to modify the Kernel of NetBSD1.4.1, especially the "in_arpinput()".
> 
> I will be setting the Ethernet Card to promiscuous mode and listen on for 
> some MAC addresses, which we call V-MAC addresses. Actually we map each
> V-MAC with an IP Addr. For the ARP request for a particular IP Addr(we are intersted in)
> I need to send back the V-MAC rather than the physical MAC Address.
> 
> As i dig into the kernel code, i figured out that the some modifications need
> to be made in "in_arpinput" function and corresponding header file, may be
> sockaddr_dl, to support different V-MAC addresses.
> 
> Is my understanding correct? , if its correct than other doubts are scratching
> my brain. How to use ioctl to modify the Data Structure. Is there some implications for this...

Let me make sure I understand the question you are asking:

Background: you are wanting to add support for listening for packets
destined for a Virtual MAC address - a MAC address other than the one on
the relevant NIC. There will be an IP address assosciated with this V-MAC.

As part of that, you want ARP to work right - when a machine asks for the
MAC for the virtual IP (VIP), you want the VMAC to be sent back.

If you don't mind the fact that the response will come from the real MAC
of the card (which should not hurt anything), you don't need to change the
kernel. Look at man arp, especially the -s option.

     -s hostname ether_addr
             Create an ARP entry for the host called hostname with the Ether-
             net address ether_addr.  The Ethernet address is given as six hex
             bytes separated by colons.  The entry will be permanent unless
             the word temp is given in the command.  If the word pub is given,
             the entry will be "published"; i.e., this system will act as an
             ARP server, responding to requests for hostname even though the
             host address is not its own.

Sounds like what you want is to make the kernel an ARP server. :-)

Take care,

Bill