Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Aug 2003 19:02:06 +0100
From:      Bruce M Simpson <bms@spc.org>
To:        "Khoa A. To" <takhoa@rice.edu>
Cc:        FreeBSD_Net <freebsd-net@FreeBSD.ORG>
Subject:   Re: Reversed MAC lookup inside FreeBSD kernel?
Message-ID:  <20030829180206.GK1417@spc.org>
In-Reply-To: <GAENJNNFCGNNIHDFIDFAMEKLCAAA.takhoa@rice.edu>
References:  <20030829154401.GA417@newluxor.skynet.org> <GAENJNNFCGNNIHDFIDFAMEKLCAAA.takhoa@rice.edu>

index | next in thread | previous in thread | raw e-mail

On Fri, Aug 29, 2003 at 11:17:16AM -0500, Khoa A. To wrote:
> I need to get a translation of MAC addresses to IP addresses in the kernel.
> I saw some postings about how to translate MAC to IP in the user level, but
> they seem to require the host to send a packet to that MAC address and some
> other ways that also require the host to actually send some request packets
> out.  All my MAC-IP addresses are already set statically using "arp -s" in
> the ARP table.  When I'm in the kernel, how do I get a hold of the ARP table
> and do some kind of reversed search to get the IP address out?

ARP information is held in the routing table.
Look at the output of netstat -arn and look for routes containing the L
flag (LLINFO). If you need to walk through the routing table, look at how
rtalloc() does it. 'struct rtentry' should be pretty self explanatory...

BMS


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030829180206.GK1417>