Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2005 15:11:35 -0800
From:      Peter Heerboth <pheerboth@apple.com>
To:        Olivier Nicole <on@cs.ait.ac.th>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Resolving MAC address
Message-ID:  <4d6157b283e8c2187a339c0a40d8eec3@apple.com>
In-Reply-To: <200503240358.j2O3wb4I099605@banyan.cs.ait.ac.th>
References:  <200503240339.j2O3dpoN099306@banyan.cs.ait.ac.th> <42423976.7000608@schluting.com> <200503240358.j2O3wb4I099605@banyan.cs.ait.ac.th>

next in thread | previous in thread | raw e-mail | index | archive | help
One thing you can try if you want to avoid needing super user 
privileges is to send a small UDP packet to the given IP, which will 
force the kernel to ARP for the address if it is not already present.  
Then you can check the routing table through sysctl() by passing in 
{CTL_NET, PF_ROUTE, 0, AF_INET,NET_RT_FLAGS,RTF_LLINFO} for the name 
parameter and searching through the route message list.  All sending 
the UDP packet will do is force the kernel to arp, it doesn't actually 
matter if the other side is filtering or not.

On Mar 23, 2005, at 7:58 PM, Olivier Nicole wrote:

>>> ? (10.0.0.1) at 00:e0:29:ad:5a:aa on em0 [ethernet]
>>>
>>> will do the trick, but it is a bit too heavy for the purpose, I'd
>>> prefer a solution that only send an ARP request.
>>>
>>
>> If you just want to avoid the DNS lookup, you can use arp -an.
>> Its much faster :)
>
> Thanks. Off course I use arp -n to avoid DNS resolution.
>
> But what i really want to avoid is sending any IP/ICMP packet when the
> ARP resolution is all I need. (And some people even filter out the
> ICMP echo request packets (Windows XP firewall), so I have to wait for
> the time out).
>
> Olivier
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"



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