Date: Wed, 23 Jan 2002 15:23:56 +0200 From: Ruslan Ermilov <ru@FreeBSD.ORG> To: Kenneth Stailey <kstailey@yahoo.com> Cc: freebsd-doc@FreeBSD.ORG Subject: Re: ARP documentation? Message-ID: <20020123152356.G66702@sunbay.com> In-Reply-To: <20020123130347.87045.qmail@web10004.mail.yahoo.com> References: <20020123130347.87045.qmail@web10004.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 23, 2002 at 05:03:47AM -0800, Kenneth Stailey wrote: > Between route(4) and arp(4) manual pages is it really possible to find out how > to write a C program that adds an ARP table entry? > > route(4) offers some general advice: > > Messages are formed by a header followed by a small number of sockaddrs > > [...] > > all other messages use the rt_msghdr header. > > etc. So you know what header to use and that there's supposed to be some > sockaddrs after it. The EEXIST, ESRCH and ENOBUFS are documented but it never > bothers to mention EINVAL which is what you get back if you don't fill out the > parameters correctly in the undocumented way. > > It doesn't really talk about what paramters to use for ARP at all. The string > "arp" does not occur in this man page ever. > > The arp(4) page is a bigger joke. It tells you to use arp(8). So is the > correct way to add an ARP table entry from a C program to use > system("/usr/sbin/arp -blah")? > ARP entries are stored in the routing table with RTF_LLINFO flag set. So you can easily manipulate with the ARP entries through the route(8) command (having supplied the necessary flags) which is much more powerful than arp(8). With recent route(8) code, you can create both published types of ARP entries, and you can tell your kernel to resolve a single IP address through an ARP on a particular interface, and you can also tell your kernel to resolve through an ARP an arbitrary IP network, which your host is NOT required to be a member of, as it is with arp(8). For a good practical example of manipulating ARP programmatically, please look at the route(8) and arp(8) code, and buy a Steven's "TCP/IP Illustrated Vol. 2" book which documents this all in detail (ISBN 0-201-63354-X, costs about $60 USD). Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020123152356.G66702>