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