if_ether.c revision 8426
1/*
2 * Copyright (c) 1982, 1986, 1988, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 *	@(#)if_ether.c	8.1 (Berkeley) 6/10/93
34 * $Id: if_ether.c,v 1.15 1995/05/09 13:35:44 davidg Exp $
35 */
36
37/*
38 * Ethernet address resolution protocol.
39 * TODO:
40 *	add "inuse/lock" bit (or ref. count) along with valid bit
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/malloc.h>
46#include <sys/mbuf.h>
47#include <sys/socket.h>
48#include <sys/time.h>
49#include <sys/kernel.h>
50#include <sys/errno.h>
51#include <sys/ioctl.h>
52#include <sys/syslog.h>
53
54#include <net/if.h>
55#include <net/if_dl.h>
56#include <net/route.h>
57#include <net/netisr.h>
58
59#include <netinet/in.h>
60#include <netinet/in_systm.h>
61#include <netinet/in_var.h>
62#include <netinet/ip.h>
63#include <netinet/if_ether.h>
64
65#define SIN(s) ((struct sockaddr_in *)s)
66#define SDL(s) ((struct sockaddr_dl *)s)
67#define SRP(s) ((struct sockaddr_inarp *)s)
68
69/*
70 * ARP trailer negotiation.  Trailer protocol is not IP specific,
71 * but ARP request/response use IP addresses.
72 */
73#define ETHERTYPE_IPTRAILERS ETHERTYPE_TRAIL
74
75
76/* timer values */
77int	arpt_prune = (5*60*1);	/* walk list every 5 minutes */
78int	arpt_keep = (20*60);	/* once resolved, good for 20 more minutes */
79int	arpt_down = 20;		/* once declared down, don't send for 20 secs */
80#define	rt_expire rt_rmx.rmx_expire
81
82static	void arprequest __P((struct arpcom *, u_long *, u_long *, u_char *));
83static	void arptfree __P((struct llinfo_arp *));
84static	void arptimer __P((void *));
85static	struct llinfo_arp *arplookup __P((u_long, int, int));
86static	void in_arpinput __P((struct mbuf *));
87
88struct	llinfo_arp llinfo_arp = {&llinfo_arp, &llinfo_arp};
89struct	ifqueue arpintrq = {0, 0, 0, 50};
90int	arp_inuse, arp_allocated, arp_intimer;
91int	arp_maxtries = 5;
92int	useloopback = 1;	/* use loopback interface for local traffic */
93int	arpinit_done = 0;
94
95#ifdef	ARP_PROXYALL
96int	arp_proxyall = 1;
97#endif
98
99/*
100 * Timeout routine.  Age arp_tab entries periodically.
101 */
102/* ARGSUSED */
103static void
104arptimer(ignored_arg)
105	void *ignored_arg;
106{
107	int s = splnet();
108	register struct llinfo_arp *la = llinfo_arp.la_next;
109
110	timeout(arptimer, (caddr_t)0, arpt_prune * hz);
111	while (la != &llinfo_arp) {
112		register struct rtentry *rt = la->la_rt;
113		la = la->la_next;
114		if (rt->rt_expire && rt->rt_expire <= time.tv_sec)
115			arptfree(la->la_prev); /* timer has expired, clear */
116	}
117	splx(s);
118}
119
120/*
121 * Parallel to llc_rtrequest.
122 */
123static void
124arp_rtrequest(req, rt, sa)
125	int req;
126	register struct rtentry *rt;
127	struct sockaddr *sa;
128{
129	register struct sockaddr *gate = rt->rt_gateway;
130	register struct llinfo_arp *la = (struct llinfo_arp *)rt->rt_llinfo;
131	static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK};
132
133	if (!arpinit_done) {
134		arpinit_done = 1;
135		timeout(arptimer, (caddr_t)0, hz);
136	}
137	if (rt->rt_flags & RTF_GATEWAY)
138		return;
139	switch (req) {
140
141	case RTM_ADD:
142		/*
143		 * XXX: If this is a manually added route to interface
144		 * such as older version of routed or gated might provide,
145		 * restore cloning bit.
146		 */
147		if ((rt->rt_flags & RTF_HOST) == 0 &&
148		    SIN(rt_mask(rt))->sin_addr.s_addr != 0xffffffff)
149			rt->rt_flags |= RTF_CLONING;
150#if 0
151		/*
152		 * Actually, all IP gateway routes should have the cloning
153		 * flag turned on.  We can't do this yet because the expiration
154		 * stuff isn't working yet.
155		 */
156		if (rt->rt_flags & RTF_GATEWAY) {
157			rt->rt_flags |= RTF_CLONING;
158		}
159#endif
160		if (rt->rt_flags & RTF_CLONING) {
161			/*
162			 * Case 1: This route should come from a route to iface.
163			 */
164			rt_setgate(rt, rt_key(rt),
165					(struct sockaddr *)&null_sdl);
166			gate = rt->rt_gateway;
167			SDL(gate)->sdl_type = rt->rt_ifp->if_type;
168			SDL(gate)->sdl_index = rt->rt_ifp->if_index;
169			rt->rt_expire = time.tv_sec;
170			break;
171		}
172		/* Announce a new entry if requested. */
173		if (rt->rt_flags & RTF_ANNOUNCE)
174			arprequest((struct arpcom *)rt->rt_ifp,
175			    &SIN(rt_key(rt))->sin_addr.s_addr,
176			    &SIN(rt_key(rt))->sin_addr.s_addr,
177			    (u_char *)LLADDR(SDL(gate)));
178		/*FALLTHROUGH*/
179	case RTM_RESOLVE:
180		if (gate->sa_family != AF_LINK ||
181		    gate->sa_len < sizeof(null_sdl)) {
182			log(LOG_DEBUG, "arp_rtrequest: bad gateway value\n");
183			break;
184		}
185		SDL(gate)->sdl_type = rt->rt_ifp->if_type;
186		SDL(gate)->sdl_index = rt->rt_ifp->if_index;
187		if (la != 0)
188			break; /* This happens on a route change */
189		/*
190		 * Case 2:  This route may come from cloning, or a manual route
191		 * add with a LL address.
192		 */
193		R_Malloc(la, struct llinfo_arp *, sizeof(*la));
194		rt->rt_llinfo = (caddr_t)la;
195		if (la == 0) {
196			log(LOG_DEBUG, "arp_rtrequest: malloc failed\n");
197			break;
198		}
199		arp_inuse++, arp_allocated++;
200		Bzero(la, sizeof(*la));
201		la->la_rt = rt;
202		rt->rt_flags |= RTF_LLINFO;
203		insque(la, &llinfo_arp);
204		if (SIN(rt_key(rt))->sin_addr.s_addr ==
205		    (IA_SIN(rt->rt_ifa))->sin_addr.s_addr) {
206		    /*
207		     * This test used to be
208		     *	if (loif.if_flags & IFF_UP)
209		     * It allowed local traffic to be forced
210		     * through the hardware by configuring the loopback down.
211		     * However, it causes problems during network configuration
212		     * for boards that can't receive packets they send.
213		     * It is now necessary to clear "useloopback" and remove
214		     * the route to force traffic out to the hardware.
215		     */
216			rt->rt_expire = 0;
217			Bcopy(((struct arpcom *)rt->rt_ifp)->ac_enaddr,
218				LLADDR(SDL(gate)), SDL(gate)->sdl_alen = 6);
219			if (useloopback)
220				rt->rt_ifp = loif;
221
222		}
223		break;
224
225	case RTM_DELETE:
226		if (la == 0)
227			break;
228		arp_inuse--;
229		remque(la);
230		rt->rt_llinfo = 0;
231		rt->rt_flags &= ~RTF_LLINFO;
232		if (la->la_hold)
233			m_freem(la->la_hold);
234		Free((caddr_t)la);
235	}
236}
237
238/*
239 * Broadcast an ARP packet, asking who has addr on interface ac.
240 */
241void
242arpwhohas(ac, addr)
243	register struct arpcom *ac;
244	register struct in_addr *addr;
245{
246	arprequest(ac, &ac->ac_ipaddr.s_addr, &addr->s_addr, ac->ac_enaddr);
247}
248
249/*
250 * Broadcast an ARP request. Caller specifies:
251 *	- arp header source ip address
252 *	- arp header target ip address
253 *	- arp header source ethernet address
254 */
255static void
256arprequest(ac, sip, tip, enaddr)
257	register struct arpcom *ac;
258	register u_long *sip, *tip;
259	register u_char *enaddr;
260{
261	register struct mbuf *m;
262	register struct ether_header *eh;
263	register struct ether_arp *ea;
264	struct sockaddr sa;
265
266	if ((m = m_gethdr(M_DONTWAIT, MT_DATA)) == NULL)
267		return;
268	m->m_len = sizeof(*ea);
269	m->m_pkthdr.len = sizeof(*ea);
270	MH_ALIGN(m, sizeof(*ea));
271	ea = mtod(m, struct ether_arp *);
272	eh = (struct ether_header *)sa.sa_data;
273	bzero((caddr_t)ea, sizeof (*ea));
274	(void)memcpy(eh->ether_dhost, etherbroadcastaddr, sizeof(eh->ether_dhost));
275	eh->ether_type = ETHERTYPE_ARP;		/* if_output will swap */
276	ea->arp_hrd = htons(ARPHRD_ETHER);
277	ea->arp_pro = htons(ETHERTYPE_IP);
278	ea->arp_hln = sizeof(ea->arp_sha);	/* hardware address length */
279	ea->arp_pln = sizeof(ea->arp_spa);	/* protocol address length */
280	ea->arp_op = htons(ARPOP_REQUEST);
281	(void)memcpy(ea->arp_sha, enaddr, sizeof(ea->arp_sha));
282	(void)memcpy(ea->arp_spa, sip, sizeof(ea->arp_spa));
283	(void)memcpy(ea->arp_tpa, tip, sizeof(ea->arp_tpa));
284	sa.sa_family = AF_UNSPEC;
285	sa.sa_len = sizeof(sa);
286	(*ac->ac_if.if_output)(&ac->ac_if, m, &sa, (struct rtentry *)0);
287}
288
289/*
290 * Resolve an IP address into an ethernet address.  If success,
291 * desten is filled in.  If there is no entry in arptab,
292 * set one up and broadcast a request for the IP address.
293 * Hold onto this mbuf and resend it once the address
294 * is finally resolved.  A return value of 1 indicates
295 * that desten has been filled in and the packet should be sent
296 * normally; a 0 return indicates that the packet has been
297 * taken over here, either now or for later transmission.
298 */
299int
300arpresolve(ac, rt, m, dst, desten, rt0)
301	register struct arpcom *ac;
302	register struct rtentry *rt;
303	struct mbuf *m;
304	register struct sockaddr *dst;
305	register u_char *desten;
306	struct rtentry *rt0;
307{
308	register struct llinfo_arp *la;
309	struct sockaddr_dl *sdl;
310
311	if (m->m_flags & M_BCAST) {	/* broadcast */
312		(void)memcpy(desten, etherbroadcastaddr, sizeof(etherbroadcastaddr));
313		return (1);
314	}
315	if (m->m_flags & M_MCAST) {	/* multicast */
316		ETHER_MAP_IP_MULTICAST(&SIN(dst)->sin_addr, desten);
317		return(1);
318	}
319	if (rt)
320		la = (struct llinfo_arp *)rt->rt_llinfo;
321	else {
322		la = arplookup(SIN(dst)->sin_addr.s_addr, 1, 0);
323		if (la)
324			rt = la->la_rt;
325	}
326	if (la == 0 || rt == 0) {
327		log(LOG_DEBUG, "arpresolve: can't allocate llinfo\n");
328		m_freem(m);
329		return (0);
330	}
331	sdl = SDL(rt->rt_gateway);
332	/*
333	 * Check the address family and length is valid, the address
334	 * is resolved; otherwise, try to resolve.
335	 */
336	if ((rt->rt_expire == 0 || rt->rt_expire > time.tv_sec) &&
337	    sdl->sdl_family == AF_LINK && sdl->sdl_alen != 0) {
338		(void)memcpy(desten, LLADDR(sdl), sdl->sdl_alen);
339		return 1;
340	}
341	/*
342	 * There is an arptab entry, but no ethernet address
343	 * response yet.  Replace the held mbuf with this
344	 * latest one.
345	 */
346	if (la->la_hold)
347		m_freem(la->la_hold);
348	la->la_hold = m;
349	if (rt->rt_expire) {
350		rt->rt_flags &= ~RTF_REJECT;
351		if (la->la_asked == 0 || rt->rt_expire != time.tv_sec) {
352			rt->rt_expire = time.tv_sec;
353			if (la->la_asked++ < arp_maxtries)
354				arpwhohas(ac, &(SIN(dst)->sin_addr));
355			else {
356				rt->rt_flags |= RTF_REJECT;
357				rt->rt_expire += arpt_down;
358				la->la_asked = 0;
359			}
360
361		}
362	}
363	return (0);
364}
365
366/*
367 * Common length and type checks are done here,
368 * then the protocol-specific routine is called.
369 */
370void
371arpintr(void)
372{
373	register struct mbuf *m;
374	register struct arphdr *ar;
375	int s;
376
377	while (arpintrq.ifq_head) {
378		s = splimp();
379		IF_DEQUEUE(&arpintrq, m);
380		splx(s);
381		if (m == 0 || (m->m_flags & M_PKTHDR) == 0)
382			panic("arpintr");
383		if (m->m_len >= sizeof(struct arphdr) &&
384		    (ar = mtod(m, struct arphdr *)) &&
385		    ntohs(ar->ar_hrd) == ARPHRD_ETHER &&
386		    m->m_len >=
387		      sizeof(struct arphdr) + 2 * ar->ar_hln + 2 * ar->ar_pln)
388
389			    switch (ntohs(ar->ar_pro)) {
390
391			    case ETHERTYPE_IP:
392			    case ETHERTYPE_IPTRAILERS:
393				    in_arpinput(m);
394				    continue;
395			    }
396		m_freem(m);
397	}
398}
399
400NETISR_SET(NETISR_ARP, arpintr);
401
402/*
403 * ARP for Internet protocols on 10 Mb/s Ethernet.
404 * Algorithm is that given in RFC 826.
405 * In addition, a sanity check is performed on the sender
406 * protocol address, to catch impersonators.
407 * We no longer handle negotiations for use of trailer protocol:
408 * Formerly, ARP replied for protocol type ETHERTYPE_TRAIL sent
409 * along with IP replies if we wanted trailers sent to us,
410 * and also sent them in response to IP replies.
411 * This allowed either end to announce the desire to receive
412 * trailer packets.
413 * We no longer reply to requests for ETHERTYPE_TRAIL protocol either,
414 * but formerly didn't normally send requests.
415 */
416static void
417in_arpinput(m)
418	struct mbuf *m;
419{
420	register struct ether_arp *ea;
421	register struct arpcom *ac = (struct arpcom *)m->m_pkthdr.rcvif;
422	struct ether_header *eh;
423	register struct llinfo_arp *la = 0;
424	register struct rtentry *rt;
425	struct in_ifaddr *ia, *maybe_ia = 0;
426	struct sockaddr_dl *sdl;
427	struct sockaddr sa;
428	struct in_addr isaddr, itaddr, myaddr;
429	int op;
430
431	ea = mtod(m, struct ether_arp *);
432	op = ntohs(ea->arp_op);
433	(void)memcpy(&isaddr, ea->arp_spa, sizeof (isaddr));
434	(void)memcpy(&itaddr, ea->arp_tpa, sizeof (itaddr));
435	for (ia = in_ifaddr; ia; ia = ia->ia_next)
436		if (ia->ia_ifp == &ac->ac_if) {
437			maybe_ia = ia;
438			if ((itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) ||
439			     (isaddr.s_addr == ia->ia_addr.sin_addr.s_addr))
440				break;
441		}
442	if (maybe_ia == 0)
443		goto out;
444	myaddr = ia ? ia->ia_addr.sin_addr : maybe_ia->ia_addr.sin_addr;
445	if (!bcmp((caddr_t)ea->arp_sha, (caddr_t)ac->ac_enaddr,
446	    sizeof (ea->arp_sha)))
447		goto out;	/* it's from me, ignore it. */
448	if (!bcmp((caddr_t)ea->arp_sha, (caddr_t)etherbroadcastaddr,
449	    sizeof (ea->arp_sha))) {
450		log(LOG_ERR,
451		    "arp: ether address is broadcast for IP address %s!\n",
452		    inet_ntoa(isaddr));
453		goto out;
454	}
455	if (isaddr.s_addr == myaddr.s_addr) {
456		log(LOG_ERR,
457		   "duplicate IP address %s! sent from ethernet address: %s\n",
458		   inet_ntoa(isaddr), ether_sprintf(ea->arp_sha));
459		itaddr = myaddr;
460		goto reply;
461	}
462	la = arplookup(isaddr.s_addr, itaddr.s_addr == myaddr.s_addr, 0);
463	if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) {
464		if (sdl->sdl_alen &&
465		    bcmp((caddr_t)ea->arp_sha, LLADDR(sdl), sdl->sdl_alen))
466			log(LOG_INFO, "arp info overwritten for %s by %s\n",
467			    inet_ntoa(isaddr), ether_sprintf(ea->arp_sha));
468		(void)memcpy(LLADDR(sdl), ea->arp_sha, sizeof(ea->arp_sha));
469		sdl->sdl_alen = sizeof(ea->arp_sha);
470		if (rt->rt_expire)
471			rt->rt_expire = time.tv_sec + arpt_keep;
472		rt->rt_flags &= ~RTF_REJECT;
473		la->la_asked = 0;
474		if (la->la_hold) {
475			(*ac->ac_if.if_output)(&ac->ac_if, la->la_hold,
476				rt_key(rt), rt);
477			la->la_hold = 0;
478		}
479	}
480reply:
481	if (op != ARPOP_REQUEST) {
482	out:
483		m_freem(m);
484		return;
485	}
486	if (itaddr.s_addr == myaddr.s_addr) {
487		/* I am the target */
488		(void)memcpy(ea->arp_tha, ea->arp_sha, sizeof(ea->arp_sha));
489		(void)memcpy(ea->arp_sha, ac->ac_enaddr, sizeof(ea->arp_sha));
490	} else {
491		la = arplookup(itaddr.s_addr, 0, SIN_PROXY);
492		if (la == NULL) {
493#ifdef ARP_PROXYALL
494			struct sockaddr_in sin;
495
496			if(!arp_proxyall) goto out;
497
498			bzero(&sin, sizeof sin);
499			sin.sin_family = AF_INET;
500			sin.sin_len = sizeof sin;
501			sin.sin_addr = itaddr;
502
503			rt = rtalloc1((struct sockaddr *)&sin, 0, 0UL);
504			if( !rt )
505				goto out;
506			/*
507			 * Don't send proxies for nodes on the same interface
508			 * as this one came out of, or we'll get into a fight
509			 * over who claims what Ether address.
510			 */
511			if(rt->rt_ifp == &ac->ac_if) {
512				rtfree(rt);
513				goto out;
514			}
515			(void)memcpy(ea->arp_tha, ea->arp_sha, sizeof(ea->arp_sha));
516			(void)memcpy(ea->arp_sha, ac->ac_enaddr, sizeof(ea->arp_sha));
517			rtfree(rt);
518#ifdef DEBUG_PROXY
519			printf("arp: proxying for %s\n",
520			       inet_ntoa(itaddr));
521#endif
522#else
523			goto out;
524#endif
525		} else {
526			rt = la->la_rt;
527			(void)memcpy(ea->arp_tha, ea->arp_sha, sizeof(ea->arp_sha));
528			sdl = SDL(rt->rt_gateway);
529			(void)memcpy(ea->arp_sha, LLADDR(sdl), sizeof(ea->arp_sha));
530		}
531	}
532
533	(void)memcpy(ea->arp_tpa, ea->arp_spa, sizeof(ea->arp_spa));
534	(void)memcpy(ea->arp_spa, &itaddr, sizeof(ea->arp_spa));
535	ea->arp_op = htons(ARPOP_REPLY);
536	ea->arp_pro = htons(ETHERTYPE_IP); /* let's be sure! */
537	eh = (struct ether_header *)sa.sa_data;
538	(void)memcpy(eh->ether_dhost, ea->arp_tha, sizeof(eh->ether_dhost));
539	eh->ether_type = ETHERTYPE_ARP;
540	sa.sa_family = AF_UNSPEC;
541	sa.sa_len = sizeof(sa);
542	(*ac->ac_if.if_output)(&ac->ac_if, m, &sa, (struct rtentry *)0);
543	return;
544}
545
546/*
547 * Free an arp entry.
548 */
549static void
550arptfree(la)
551	register struct llinfo_arp *la;
552{
553	register struct rtentry *rt = la->la_rt;
554	register struct sockaddr_dl *sdl;
555	if (rt == 0)
556		panic("arptfree");
557	if (rt->rt_refcnt > 0 && (sdl = SDL(rt->rt_gateway)) &&
558	    sdl->sdl_family == AF_LINK) {
559		sdl->sdl_alen = 0;
560		la->la_asked = 0;
561		rt->rt_flags &= ~RTF_REJECT;
562		return;
563	}
564	rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0, rt_mask(rt),
565			0, (struct rtentry **)0);
566}
567/*
568 * Lookup or enter a new address in arptab.
569 */
570static struct llinfo_arp *
571arplookup(addr, create, proxy)
572	u_long addr;
573	int create, proxy;
574{
575	register struct rtentry *rt;
576	static struct sockaddr_inarp sin = {sizeof(sin), AF_INET };
577	const char *why = 0;
578
579	sin.sin_addr.s_addr = addr;
580	sin.sin_other = proxy ? SIN_PROXY : 0;
581	rt = rtalloc1((struct sockaddr *)&sin, create, 0UL);
582	if (rt == 0)
583		return (0);
584	rt->rt_refcnt--;
585
586	if(rt->rt_flags & RTF_GATEWAY)
587		why = "host is not on local network";
588	else if((rt->rt_flags & RTF_LLINFO) == 0)
589		why = "could not allocate llinfo";
590	else if(rt->rt_gateway->sa_family != AF_LINK)
591		why = "gateway route is not ours";
592
593	if(why && create) {
594		log(LOG_DEBUG, "arplookup %s failed: %s\n",
595		    inet_ntoa(sin.sin_addr), why);
596		return 0;
597	} else if(why) {
598		return 0;
599	}
600	return ((struct llinfo_arp *)rt->rt_llinfo);
601}
602
603int
604arpioctl(cmd, data)
605	int cmd;
606	caddr_t data;
607{
608	return (EOPNOTSUPP);
609}
610
611void
612arp_ifinit(ac, ifa)
613	struct arpcom *ac;
614	struct ifaddr *ifa;
615{
616	ac->ac_ipaddr = IA_SIN(ifa)->sin_addr;
617	arpwhohas(ac, &ac->ac_ipaddr);
618	ifa->ifa_rtrequest = arp_rtrequest;
619	ifa->ifa_flags |= RTF_CLONING;
620}
621