xref: /freebsd/sys/net/if_loop.c (revision c3aac50f284c6cca5b4f2eb46aaa13812cb8b630)
1df8bae1dSRodney W. Grimes /*
2df8bae1dSRodney W. Grimes  * Copyright (c) 1982, 1986, 1993
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
6df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
7df8bae1dSRodney W. Grimes  * are met:
8df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
9df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
10df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
11df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
12df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
13df8bae1dSRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
14df8bae1dSRodney W. Grimes  *    must display the following acknowledgement:
15df8bae1dSRodney W. Grimes  *	This product includes software developed by the University of
16df8bae1dSRodney W. Grimes  *	California, Berkeley and its contributors.
17df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
18df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
19df8bae1dSRodney W. Grimes  *    without specific prior written permission.
20df8bae1dSRodney W. Grimes  *
21df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
32df8bae1dSRodney W. Grimes  *
33df8bae1dSRodney W. Grimes  *	@(#)if_loop.c	8.1 (Berkeley) 6/10/93
34c3aac50fSPeter Wemm  * $FreeBSD$
35df8bae1dSRodney W. Grimes  */
36df8bae1dSRodney W. Grimes 
37df8bae1dSRodney W. Grimes /*
38df8bae1dSRodney W. Grimes  * Loopback interface driver for protocol testing and timing.
39df8bae1dSRodney W. Grimes  */
40f5fea3ddSPaul Traina #include "loop.h"
41f5fea3ddSPaul Traina #if NLOOP > 0
42df8bae1dSRodney W. Grimes 
437262d3e4SEivind Eklund #include "opt_atalk.h"
441d5e9e22SEivind Eklund #include "opt_inet.h"
45430df5f4SEivind Eklund #include "opt_ipx.h"
46430df5f4SEivind Eklund 
47df8bae1dSRodney W. Grimes #include <sys/param.h>
48df8bae1dSRodney W. Grimes #include <sys/systm.h>
49df8bae1dSRodney W. Grimes #include <sys/kernel.h>
50df8bae1dSRodney W. Grimes #include <sys/mbuf.h>
51df8bae1dSRodney W. Grimes #include <sys/socket.h>
5251a53488SBruce Evans #include <sys/sockio.h>
53df8bae1dSRodney W. Grimes 
54df8bae1dSRodney W. Grimes #include <net/if.h>
55df8bae1dSRodney W. Grimes #include <net/if_types.h>
56df8bae1dSRodney W. Grimes #include <net/netisr.h>
57df8bae1dSRodney W. Grimes #include <net/route.h>
58df8bae1dSRodney W. Grimes #include <net/bpf.h>
59df8bae1dSRodney W. Grimes 
60df8bae1dSRodney W. Grimes #ifdef	INET
61df8bae1dSRodney W. Grimes #include <netinet/in.h>
62df8bae1dSRodney W. Grimes #include <netinet/in_var.h>
63df8bae1dSRodney W. Grimes #endif
64df8bae1dSRodney W. Grimes 
65cc6a66f2SJulian Elischer #ifdef IPX
66cc6a66f2SJulian Elischer #include <netipx/ipx.h>
67cc6a66f2SJulian Elischer #include <netipx/ipx_if.h>
68cc6a66f2SJulian Elischer #endif
69cc6a66f2SJulian Elischer 
70df8bae1dSRodney W. Grimes #ifdef NS
71df8bae1dSRodney W. Grimes #include <netns/ns.h>
72df8bae1dSRodney W. Grimes #include <netns/ns_if.h>
73df8bae1dSRodney W. Grimes #endif
74df8bae1dSRodney W. Grimes 
75df8bae1dSRodney W. Grimes #ifdef ISO
76df8bae1dSRodney W. Grimes #include <netiso/iso.h>
77df8bae1dSRodney W. Grimes #include <netiso/iso_var.h>
78df8bae1dSRodney W. Grimes #endif
79df8bae1dSRodney W. Grimes 
80655929bfSJulian Elischer #ifdef NETATALK
81655929bfSJulian Elischer #include <netatalk/at.h>
82655929bfSJulian Elischer #include <netatalk/at_var.h>
83655929bfSJulian Elischer #endif NETATALK
84655929bfSJulian Elischer 
856b5ca0d8SDag-Erling Smørgrav #include "bpf.h"
866b5ca0d8SDag-Erling Smørgrav #if NBPF > 0
87ed7509acSJulian Elischer #include <net/bpfdesc.h>
88ed7509acSJulian Elischer #endif
89df8bae1dSRodney W. Grimes 
90ecbb00a2SDoug Rabson static int loioctl __P((struct ifnet *, u_long, caddr_t));
913bda9f9bSPoul-Henning Kamp static void lortrequest __P((int, struct rtentry *, struct sockaddr *));
923bda9f9bSPoul-Henning Kamp 
934590fd3aSDavid Greenman static void loopattach __P((void *));
94b6f5c0b8SBruce Evans PSEUDO_SET(loopattach, if_loop);
95b6f5c0b8SBruce Evans 
96ed7509acSJulian Elischer static int looutput __P((struct ifnet *ifp,
97ed7509acSJulian Elischer 		struct mbuf *m, struct sockaddr *dst, struct rtentry *rt));
98ed7509acSJulian Elischer 
99db8889c6SDavid Greenman #ifdef TINY_LOMTU
100df8bae1dSRodney W. Grimes #define	LOMTU	(1024+512)
101db8889c6SDavid Greenman #else
102af78195eSDavid Greenman #define LOMTU	16384
103db8889c6SDavid Greenman #endif
104df8bae1dSRodney W. Grimes 
105f5fea3ddSPaul Traina struct	ifnet loif[NLOOP];
106df8bae1dSRodney W. Grimes 
107df8bae1dSRodney W. Grimes /* ARGSUSED */
108b6f5c0b8SBruce Evans static void
109d841aaa7SBruce Evans loopattach(dummy)
110d841aaa7SBruce Evans 	void *dummy;
111df8bae1dSRodney W. Grimes {
112f5fea3ddSPaul Traina 	register struct ifnet *ifp;
113f5fea3ddSPaul Traina 	register int i = 0;
114df8bae1dSRodney W. Grimes 
115f5fea3ddSPaul Traina 	for (ifp = loif; i < NLOOP; ifp++) {
116df8bae1dSRodney W. Grimes 	    ifp->if_name = "lo";
117f5fea3ddSPaul Traina 	    ifp->if_unit = i++;
118df8bae1dSRodney W. Grimes 	    ifp->if_mtu = LOMTU;
119df8bae1dSRodney W. Grimes 	    ifp->if_flags = IFF_LOOPBACK | IFF_MULTICAST;
120df8bae1dSRodney W. Grimes 	    ifp->if_ioctl = loioctl;
121df8bae1dSRodney W. Grimes 	    ifp->if_output = looutput;
122df8bae1dSRodney W. Grimes 	    ifp->if_type = IFT_LOOP;
123eff12882SDmitrij Tejblum 	    ifp->if_snd.ifq_maxlen = ifqmaxlen;
124df8bae1dSRodney W. Grimes 	    if_attach(ifp);
1256b5ca0d8SDag-Erling Smørgrav #if NBPF > 0
1269b44ff22SGarrett Wollman 	    bpfattach(ifp, DLT_NULL, sizeof(u_int));
127df8bae1dSRodney W. Grimes #endif
128df8bae1dSRodney W. Grimes 	}
129f5fea3ddSPaul Traina }
130df8bae1dSRodney W. Grimes 
131ed7509acSJulian Elischer static int
132df8bae1dSRodney W. Grimes looutput(ifp, m, dst, rt)
133df8bae1dSRodney W. Grimes 	struct ifnet *ifp;
134df8bae1dSRodney W. Grimes 	register struct mbuf *m;
135df8bae1dSRodney W. Grimes 	struct sockaddr *dst;
136df8bae1dSRodney W. Grimes 	register struct rtentry *rt;
137df8bae1dSRodney W. Grimes {
138ed7509acSJulian Elischer 	if ((m->m_flags & M_PKTHDR) == 0)
139ed7509acSJulian Elischer 		panic("looutput no HDR");
140ed7509acSJulian Elischer 
141ed7509acSJulian Elischer 	if (rt && rt->rt_flags & (RTF_REJECT|RTF_BLACKHOLE)) {
142ed7509acSJulian Elischer 		m_freem(m);
143ed7509acSJulian Elischer 		return (rt->rt_flags & RTF_BLACKHOLE ? 0 :
144ed7509acSJulian Elischer 		        rt->rt_flags & RTF_HOST ? EHOSTUNREACH : ENETUNREACH);
145ed7509acSJulian Elischer 	}
146ed7509acSJulian Elischer 	ifp->if_opackets++;
147ed7509acSJulian Elischer 	ifp->if_obytes += m->m_pkthdr.len;
148201c2527SJulian Elischer #if 1	/* XXX */
149201c2527SJulian Elischer 	switch (dst->sa_family) {
150201c2527SJulian Elischer 	case AF_INET:
151201c2527SJulian Elischer 	case AF_IPX:
152201c2527SJulian Elischer 	case AF_NS:
153201c2527SJulian Elischer 	case AF_ISO:
154201c2527SJulian Elischer 	case AF_APPLETALK:
15505b3ccefSJulian Elischer 		break;
156201c2527SJulian Elischer 	default:
157201c2527SJulian Elischer 		printf("looutput: af=%d unexpected", dst->sa_family);
158201c2527SJulian Elischer 		m_freem(m);
159201c2527SJulian Elischer 		return (EAFNOSUPPORT);
160201c2527SJulian Elischer 	}
161201c2527SJulian Elischer #endif
162ed7509acSJulian Elischer 	return(if_simloop(ifp, m, dst, 0));
163ed7509acSJulian Elischer }
164ed7509acSJulian Elischer 
165ed7509acSJulian Elischer /*
166ed7509acSJulian Elischer  * if_simloop()
167ed7509acSJulian Elischer  *
168ed7509acSJulian Elischer  * This function is to support software emulation of hardware loopback,
169ed7509acSJulian Elischer  * i.e., for interfaces with the IFF_SIMPLEX attribute. Since they can't
170ed7509acSJulian Elischer  * hear their own broadcasts, we create a copy of the packet that we
171ed7509acSJulian Elischer  * would normally receive via a hardware loopback.
172ed7509acSJulian Elischer  *
173ed7509acSJulian Elischer  * This function expects the packet to include the media header of length hlen.
174ed7509acSJulian Elischer  */
175ed7509acSJulian Elischer 
176ed7509acSJulian Elischer int
177ed7509acSJulian Elischer if_simloop(ifp, m, dst, hlen)
178ed7509acSJulian Elischer 	struct ifnet *ifp;
179ed7509acSJulian Elischer 	register struct mbuf *m;
180ed7509acSJulian Elischer 	struct sockaddr *dst;
181ed7509acSJulian Elischer 	int hlen;
182ed7509acSJulian Elischer {
183df8bae1dSRodney W. Grimes 	int s, isr;
184df8bae1dSRodney W. Grimes 	register struct ifqueue *ifq = 0;
185df8bae1dSRodney W. Grimes 
186df8bae1dSRodney W. Grimes 	if ((m->m_flags & M_PKTHDR) == 0)
1876b1214b0SJulian Elischer 		panic("if_simloop: no HDR");
188ed7509acSJulian Elischer 	m->m_pkthdr.rcvif = ifp;
1896b5ca0d8SDag-Erling Smørgrav #if NBPF > 0
190963e4c2aSGarrett Wollman 	/* BPF write needs to be handled specially */
191963e4c2aSGarrett Wollman 	if (dst->sa_family == AF_UNSPEC) {
192963e4c2aSGarrett Wollman 		dst->sa_family = *(mtod(m, int *));
193963e4c2aSGarrett Wollman 		m->m_len -= sizeof(int);
194963e4c2aSGarrett Wollman 		m->m_pkthdr.len -= sizeof(int);
195963e4c2aSGarrett Wollman 		m->m_data += sizeof(int);
196963e4c2aSGarrett Wollman 	}
197963e4c2aSGarrett Wollman 
198f5fea3ddSPaul Traina 	if (ifp->if_bpf) {
199ed7509acSJulian Elischer 		struct mbuf m0, *n = m;
200ed7509acSJulian Elischer 		u_int af = dst->sa_family;
201ed7509acSJulian Elischer 
202ed7509acSJulian Elischer 		if (ifp->if_bpf->bif_dlt == DLT_NULL) {
203df8bae1dSRodney W. Grimes 			/*
204df8bae1dSRodney W. Grimes 			 * We need to prepend the address family as
205df8bae1dSRodney W. Grimes 			 * a four byte field.  Cons up a dummy header
206df8bae1dSRodney W. Grimes 			 * to pacify bpf.  This is safe because bpf
207df8bae1dSRodney W. Grimes 			 * will only read from the mbuf (i.e., it won't
208df8bae1dSRodney W. Grimes 			 * try to free it or keep a pointer a to it).
209df8bae1dSRodney W. Grimes 			 */
210df8bae1dSRodney W. Grimes 			m0.m_next = m;
211df8bae1dSRodney W. Grimes 			m0.m_len = 4;
212df8bae1dSRodney W. Grimes 			m0.m_data = (char *)&af;
213ed7509acSJulian Elischer 			n = &m0;
214ed7509acSJulian Elischer 		}
215ed7509acSJulian Elischer 		bpf_mtap(ifp, n);
216df8bae1dSRodney W. Grimes 	}
217df8bae1dSRodney W. Grimes #endif
218df8bae1dSRodney W. Grimes 
219ed7509acSJulian Elischer 	/* Strip away media header */
2203a43ad8fSDoug Rabson 	if (hlen > 0) {
2213a43ad8fSDoug Rabson #ifdef __alpha__
2223a43ad8fSDoug Rabson 		/* The alpha doesn't like unaligned data.
2233a43ad8fSDoug Rabson 		 * We move data down in the first mbuf */
2243a43ad8fSDoug Rabson 		if (hlen & 3) {
2253a43ad8fSDoug Rabson 			bcopy(m->m_data + hlen, m->m_data, m->m_len - hlen);
2263a43ad8fSDoug Rabson 			m->m_len -= hlen;
2273a43ad8fSDoug Rabson 			if (m->m_flags & M_PKTHDR)
2283a43ad8fSDoug Rabson 				m->m_pkthdr.len -= hlen;
2293a43ad8fSDoug Rabson 		} else
2303a43ad8fSDoug Rabson #endif
231ed7509acSJulian Elischer 		m_adj(m, hlen);
2323a43ad8fSDoug Rabson 	}
233ed7509acSJulian Elischer 
234df8bae1dSRodney W. Grimes 	switch (dst->sa_family) {
235df8bae1dSRodney W. Grimes #ifdef INET
236df8bae1dSRodney W. Grimes 	case AF_INET:
237df8bae1dSRodney W. Grimes 		ifq = &ipintrq;
238df8bae1dSRodney W. Grimes 		isr = NETISR_IP;
239df8bae1dSRodney W. Grimes 		break;
240df8bae1dSRodney W. Grimes #endif
241cc6a66f2SJulian Elischer #ifdef IPX
242cc6a66f2SJulian Elischer 	case AF_IPX:
243cc6a66f2SJulian Elischer 		ifq = &ipxintrq;
244cc6a66f2SJulian Elischer 		isr = NETISR_IPX;
245cc6a66f2SJulian Elischer 		break;
246cc6a66f2SJulian Elischer #endif
247df8bae1dSRodney W. Grimes #ifdef NS
248df8bae1dSRodney W. Grimes 	case AF_NS:
249df8bae1dSRodney W. Grimes 		ifq = &nsintrq;
250df8bae1dSRodney W. Grimes 		isr = NETISR_NS;
251df8bae1dSRodney W. Grimes 		break;
252df8bae1dSRodney W. Grimes #endif
253df8bae1dSRodney W. Grimes #ifdef ISO
254df8bae1dSRodney W. Grimes 	case AF_ISO:
255df8bae1dSRodney W. Grimes 		ifq = &clnlintrq;
256df8bae1dSRodney W. Grimes 		isr = NETISR_ISO;
257df8bae1dSRodney W. Grimes 		break;
258df8bae1dSRodney W. Grimes #endif
259655929bfSJulian Elischer #ifdef NETATALK
260655929bfSJulian Elischer 	case AF_APPLETALK:
261655929bfSJulian Elischer 	        ifq = &atintrq2;
262655929bfSJulian Elischer 		isr = NETISR_ATALK;
263655929bfSJulian Elischer 		break;
264655929bfSJulian Elischer #endif NETATALK
265df8bae1dSRodney W. Grimes 	default:
2666b1214b0SJulian Elischer 		printf("if_simloop: can't handle af=%d\n", dst->sa_family);
267df8bae1dSRodney W. Grimes 		m_freem(m);
268df8bae1dSRodney W. Grimes 		return (EAFNOSUPPORT);
269df8bae1dSRodney W. Grimes 	}
270df8bae1dSRodney W. Grimes 	s = splimp();
271df8bae1dSRodney W. Grimes 	if (IF_QFULL(ifq)) {
272df8bae1dSRodney W. Grimes 		IF_DROP(ifq);
273df8bae1dSRodney W. Grimes 		m_freem(m);
274df8bae1dSRodney W. Grimes 		splx(s);
275df8bae1dSRodney W. Grimes 		return (ENOBUFS);
276df8bae1dSRodney W. Grimes 	}
277df8bae1dSRodney W. Grimes 	IF_ENQUEUE(ifq, m);
278df8bae1dSRodney W. Grimes 	schednetisr(isr);
279df8bae1dSRodney W. Grimes 	ifp->if_ipackets++;
280df8bae1dSRodney W. Grimes 	ifp->if_ibytes += m->m_pkthdr.len;
281df8bae1dSRodney W. Grimes 	splx(s);
282df8bae1dSRodney W. Grimes 	return (0);
283df8bae1dSRodney W. Grimes }
284df8bae1dSRodney W. Grimes 
285df8bae1dSRodney W. Grimes /* ARGSUSED */
2863bda9f9bSPoul-Henning Kamp static void
287df8bae1dSRodney W. Grimes lortrequest(cmd, rt, sa)
288df8bae1dSRodney W. Grimes 	int cmd;
289df8bae1dSRodney W. Grimes 	struct rtentry *rt;
290df8bae1dSRodney W. Grimes 	struct sockaddr *sa;
291df8bae1dSRodney W. Grimes {
2925eb1d25aSGarrett Wollman 	if (rt) {
2935eb1d25aSGarrett Wollman 		rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; /* for ISO */
2945eb1d25aSGarrett Wollman 		/*
2955eb1d25aSGarrett Wollman 		 * For optimal performance, the send and receive buffers
2965eb1d25aSGarrett Wollman 		 * should be at least twice the MTU plus a little more for
2975eb1d25aSGarrett Wollman 		 * overhead.
2985eb1d25aSGarrett Wollman 		 */
2995eb1d25aSGarrett Wollman 		rt->rt_rmx.rmx_recvpipe =
3005eb1d25aSGarrett Wollman 			rt->rt_rmx.rmx_sendpipe = 3 * LOMTU;
3015eb1d25aSGarrett Wollman 	}
302df8bae1dSRodney W. Grimes }
303df8bae1dSRodney W. Grimes 
304df8bae1dSRodney W. Grimes /*
305df8bae1dSRodney W. Grimes  * Process an ioctl request.
306df8bae1dSRodney W. Grimes  */
307df8bae1dSRodney W. Grimes /* ARGSUSED */
3083bda9f9bSPoul-Henning Kamp static int
309df8bae1dSRodney W. Grimes loioctl(ifp, cmd, data)
310df8bae1dSRodney W. Grimes 	register struct ifnet *ifp;
311ecbb00a2SDoug Rabson 	u_long cmd;
312df8bae1dSRodney W. Grimes 	caddr_t data;
313df8bae1dSRodney W. Grimes {
314df8bae1dSRodney W. Grimes 	register struct ifaddr *ifa;
31590fd8c38SDavid Greenman 	register struct ifreq *ifr = (struct ifreq *)data;
316df8bae1dSRodney W. Grimes 	register int error = 0;
317df8bae1dSRodney W. Grimes 
318df8bae1dSRodney W. Grimes 	switch (cmd) {
319df8bae1dSRodney W. Grimes 
320df8bae1dSRodney W. Grimes 	case SIOCSIFADDR:
321b8dc74a3SGarrett Wollman 		ifp->if_flags |= IFF_UP | IFF_RUNNING;
322df8bae1dSRodney W. Grimes 		ifa = (struct ifaddr *)data;
323df8bae1dSRodney W. Grimes 		ifa->ifa_rtrequest = lortrequest;
324df8bae1dSRodney W. Grimes 		/*
325df8bae1dSRodney W. Grimes 		 * Everything else is done at a higher level.
326df8bae1dSRodney W. Grimes 		 */
327df8bae1dSRodney W. Grimes 		break;
328df8bae1dSRodney W. Grimes 
329df8bae1dSRodney W. Grimes 	case SIOCADDMULTI:
330df8bae1dSRodney W. Grimes 	case SIOCDELMULTI:
331df8bae1dSRodney W. Grimes 		if (ifr == 0) {
332df8bae1dSRodney W. Grimes 			error = EAFNOSUPPORT;		/* XXX */
333df8bae1dSRodney W. Grimes 			break;
334df8bae1dSRodney W. Grimes 		}
335df8bae1dSRodney W. Grimes 		switch (ifr->ifr_addr.sa_family) {
336df8bae1dSRodney W. Grimes 
337df8bae1dSRodney W. Grimes #ifdef INET
338df8bae1dSRodney W. Grimes 		case AF_INET:
339df8bae1dSRodney W. Grimes 			break;
340df8bae1dSRodney W. Grimes #endif
341df8bae1dSRodney W. Grimes 
342df8bae1dSRodney W. Grimes 		default:
343df8bae1dSRodney W. Grimes 			error = EAFNOSUPPORT;
344df8bae1dSRodney W. Grimes 			break;
345df8bae1dSRodney W. Grimes 		}
346df8bae1dSRodney W. Grimes 		break;
347df8bae1dSRodney W. Grimes 
34890fd8c38SDavid Greenman 	case SIOCSIFMTU:
34990fd8c38SDavid Greenman 		ifp->if_mtu = ifr->ifr_mtu;
35090fd8c38SDavid Greenman 		break;
35190fd8c38SDavid Greenman 
352ce42f1fbSPoul-Henning Kamp 	case SIOCSIFFLAGS:
353ce42f1fbSPoul-Henning Kamp 		break;
354ce42f1fbSPoul-Henning Kamp 
355df8bae1dSRodney W. Grimes 	default:
356df8bae1dSRodney W. Grimes 		error = EINVAL;
357df8bae1dSRodney W. Grimes 	}
358df8bae1dSRodney W. Grimes 	return (error);
359df8bae1dSRodney W. Grimes }
360f5fea3ddSPaul Traina #endif /* NLOOP > 0 */
361