net_stub.c revision 1.7.2.2 1 1.7.2.2 mjf /* $NetBSD: net_stub.c,v 1.7.2.2 2009/01/17 13:29:37 mjf Exp $ */
2 1.7.2.2 mjf
3 1.7.2.2 mjf /*
4 1.7.2.2 mjf * Copyright (c) 2008 Antti Kantee. All Rights Reserved.
5 1.7.2.2 mjf *
6 1.7.2.2 mjf * Redistribution and use in source and binary forms, with or without
7 1.7.2.2 mjf * modification, are permitted provided that the following conditions
8 1.7.2.2 mjf * are met:
9 1.7.2.2 mjf * 1. Redistributions of source code must retain the above copyright
10 1.7.2.2 mjf * notice, this list of conditions and the following disclaimer.
11 1.7.2.2 mjf * 2. Redistributions in binary form must reproduce the above copyright
12 1.7.2.2 mjf * notice, this list of conditions and the following disclaimer in the
13 1.7.2.2 mjf * documentation and/or other materials provided with the distribution.
14 1.7.2.2 mjf *
15 1.7.2.2 mjf * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16 1.7.2.2 mjf * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 1.7.2.2 mjf * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 1.7.2.2 mjf * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 1.7.2.2 mjf * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 1.7.2.2 mjf * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 1.7.2.2 mjf * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 1.7.2.2 mjf * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 1.7.2.2 mjf * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 1.7.2.2 mjf * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 1.7.2.2 mjf * SUCH DAMAGE.
26 1.7.2.2 mjf */
27 1.7.2.2 mjf
28 1.7.2.2 mjf #include <sys/cdefs.h>
29 1.7.2.2 mjf __KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.7.2.2 2009/01/17 13:29:37 mjf Exp $");
30 1.7.2.2 mjf
31 1.7.2.2 mjf #include <sys/param.h>
32 1.7.2.2 mjf #include <sys/protosw.h>
33 1.7.2.2 mjf #include <sys/socketvar.h>
34 1.7.2.2 mjf
35 1.7.2.2 mjf #include <net/if.h>
36 1.7.2.2 mjf #include <net/route.h>
37 1.7.2.2 mjf
38 1.7.2.2 mjf #include <compat/sys/socket.h>
39 1.7.2.2 mjf #include <compat/sys/sockio.h>
40 1.7.2.2 mjf
41 1.7.2.2 mjf int __rumpnet_stub(void);
42 1.7.2.2 mjf int
43 1.7.2.2 mjf __rumpnet_stub(void)
44 1.7.2.2 mjf {
45 1.7.2.2 mjf
46 1.7.2.2 mjf panic("rumpnet stubs only, linking against librumpnet_net required");
47 1.7.2.2 mjf }
48 1.7.2.2 mjf __weak_alias(rtioctl,__rumpnet_stub);
49 1.7.2.2 mjf __weak_alias(rt_walktree,__rumpnet_stub);
50 1.7.2.2 mjf __weak_alias(rtrequest,__rumpnet_stub);
51 1.7.2.2 mjf __weak_alias(rtrequest,__rumpnet_stub);
52 1.7.2.2 mjf __weak_alias(ifioctl,__rumpnet_stub);
53 1.7.2.2 mjf __weak_alias(ifunit,__rumpnet_stub);
54 1.7.2.2 mjf __weak_alias(ifreq_setaddr,__rumpnet_stub);
55 1.7.2.2 mjf
56 1.7.2.2 mjf struct ifnet_head ifnet;
57 1.7.2.2 mjf
58 1.7.2.2 mjf u_long
59 1.7.2.2 mjf compat_cvtcmd(u_long cmd)
60 1.7.2.2 mjf {
61 1.7.2.2 mjf
62 1.7.2.2 mjf return cmd;
63 1.7.2.2 mjf }
64 1.7.2.2 mjf
65 1.7.2.2 mjf int
66 1.7.2.2 mjf compat_ifconf(u_long cmd, void *data)
67 1.7.2.2 mjf {
68 1.7.2.2 mjf
69 1.7.2.2 mjf return EOPNOTSUPP;
70 1.7.2.2 mjf }
71 1.7.2.2 mjf
72 1.7.2.2 mjf int
73 1.7.2.2 mjf compat_ifioctl(struct socket *so, u_long ocmd, u_long cmd, void *data,
74 1.7.2.2 mjf struct lwp *l)
75 1.7.2.2 mjf {
76 1.7.2.2 mjf struct ifreq *ifr = data;
77 1.7.2.2 mjf struct ifnet *ifp = ifunit(ifr->ifr_name);
78 1.7.2.2 mjf
79 1.7.2.2 mjf if (!ifp)
80 1.7.2.2 mjf return ENXIO;
81 1.7.2.2 mjf
82 1.7.2.2 mjf return (*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
83 1.7.2.2 mjf (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)ifp, l);
84 1.7.2.2 mjf }
85