Use a bunch of weak symbols to determine which network components
are present. This works in userspace as opposed relying in link sets, which fail miserably. Later, when the networking stack becomes modularized, we can move to a dynamic scheme like with file systems. Also, this change allows us to do proper autoconfig, namely attach the loopback interface iff it is present.
This commit is contained in:
parent
8027ac8f1f
commit
f731c31fa4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rump_net.c,v 1.7 2009/03/18 10:22:45 cegger Exp $ */
|
||||
/* $NetBSD: rump_net.c,v 1.8 2009/05/28 00:02:16 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
|
||||
@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.7 2009/03/18 10:22:45 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.8 2009/05/28 00:02:16 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
@ -35,17 +35,38 @@ __KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.7 2009/03/18 10:22:45 cegger Exp $");
|
||||
#include <sys/socketvar.h>
|
||||
|
||||
#include <net/radix.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include "rump_net_private.h"
|
||||
|
||||
void nocomponent(void);
|
||||
void nocomponent() {}
|
||||
__weak_alias(rump_net_net_init,nocomponent);
|
||||
__weak_alias(rump_net_inet_init,nocomponent);
|
||||
__weak_alias(rump_net_local_init,nocomponent);
|
||||
__weak_alias(rump_net_sockin_init,nocomponent);
|
||||
__weak_alias(rump_net_virtif_init,nocomponent);
|
||||
|
||||
void
|
||||
rump_net_init(void)
|
||||
{
|
||||
|
||||
mbinit();
|
||||
domaininit();
|
||||
rn_init();
|
||||
|
||||
domaininit(false);
|
||||
/*
|
||||
* Add rest of the domains we failed to add in domaininit()
|
||||
* due to linkset lossage.
|
||||
*/
|
||||
rump_net_inet_init();
|
||||
rump_net_local_init();
|
||||
rump_net_sockin_init();
|
||||
rump_net_virtif_init();
|
||||
/* Note: should be last due to calling of rn_init() */
|
||||
rump_net_net_init();
|
||||
|
||||
soinit();
|
||||
soinit2();
|
||||
|
||||
rump_netisr_init();
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rump_net_private.h,v 1.2 2009/05/27 23:41:20 pooka Exp $ */
|
||||
/* $NetBSD: rump_net_private.h,v 1.3 2009/05/28 00:02:16 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
|
||||
@ -31,6 +31,19 @@
|
||||
void rump_net_init(void);
|
||||
void rump_netisr_init(void);
|
||||
|
||||
#define DOMAINADD(dom) \
|
||||
do { \
|
||||
if (!pffinddomain(dom.dom_family)) { \
|
||||
domain_attach(&dom); \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
void rump_net_net_init(void);
|
||||
void rump_net_inet_init(void);
|
||||
void rump_net_local_init(void);
|
||||
void rump_net_sockin_init(void);
|
||||
void rump_net_virtif_init(void);
|
||||
|
||||
void rump_dummyif_create(void);
|
||||
|
||||
#endif /* _SYS_RUMP_NET_PRIVATE_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.1 2009/02/08 16:28:35 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.2 2009/05/28 00:02:16 pooka Exp $
|
||||
#
|
||||
|
||||
.PATH: ${.CURDIR}/../../../../kern
|
||||
@ -6,6 +6,7 @@
|
||||
LIB= rumpnet_local
|
||||
|
||||
SRCS= uipc_proto.c uipc_usrreq.c
|
||||
SRCS+= component.c
|
||||
|
||||
CFLAGS+= -Wno-pointer-sign
|
||||
|
||||
|
47
sys/rump/net/lib/liblocal/component.c
Normal file
47
sys/rump/net/lib/liblocal/component.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* $NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
|
||||
*
|
||||
* Development of this software was supported by The Nokia Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/protosw.h>
|
||||
|
||||
#include <net/route.h>
|
||||
|
||||
#include "rump_net_private.h"
|
||||
|
||||
void
|
||||
rump_net_local_init()
|
||||
{
|
||||
extern struct domain unixdomain;
|
||||
|
||||
DOMAINADD(unixdomain);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.4 2009/02/03 00:33:26 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.5 2009/05/28 00:02:16 pooka Exp $
|
||||
#
|
||||
|
||||
.PATH: ${.CURDIR}/../../../../net
|
||||
@ -8,6 +8,7 @@ LIB= rumpnet_net
|
||||
# iffy stuff
|
||||
SRCS= if.c if_loop.c route.c rtsock.c raw_usrreq.c raw_cb.c \
|
||||
if_media.c link_proto.c net_stats.c if_ethersubr.c
|
||||
SRCS+= component.c
|
||||
|
||||
CPPFLAGS+= -I${.CURDIR}/opt -I${.CURDIR}/../libnetinet/opt
|
||||
|
||||
|
49
sys/rump/net/lib/libnet/component.c
Normal file
49
sys/rump/net/lib/libnet/component.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* $NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
|
||||
*
|
||||
* Development of this software was supported by The Nokia Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/protosw.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/route.h>
|
||||
|
||||
#include "rump_net_private.h"
|
||||
|
||||
void
|
||||
rump_net_net_init()
|
||||
{
|
||||
extern struct domain routedomain;
|
||||
|
||||
loopattach(0);
|
||||
DOMAINADD(routedomain);
|
||||
}
|
49
sys/rump/net/lib/libnetinet/component.c
Normal file
49
sys/rump/net/lib/libnetinet/component.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* $NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
|
||||
*
|
||||
* Development of this software was supported by The Nokia Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/protosw.h>
|
||||
|
||||
#include <net/route.h>
|
||||
|
||||
#include "rump_net_private.h"
|
||||
|
||||
void
|
||||
rump_net_inet_init()
|
||||
{
|
||||
extern struct domain arpdomain, inetdomain, inet6domain;
|
||||
|
||||
DOMAINADD(arpdomain);
|
||||
DOMAINADD(inetdomain);
|
||||
DOMAINADD(inet6domain);
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
# $NetBSD: Makefile,v 1.2 2009/01/26 10:43:21 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.3 2009/05/28 00:02:16 pooka Exp $
|
||||
#
|
||||
|
||||
LIB= rumpnet_sockin
|
||||
|
||||
SRCS= sockin.c
|
||||
SRCS+= component.c
|
||||
|
||||
CPPFLAGS+= -I${RUMPTOP}/librump/rumpkern
|
||||
|
||||
|
47
sys/rump/net/lib/libsockin/component.c
Normal file
47
sys/rump/net/lib/libsockin/component.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* $NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
|
||||
*
|
||||
* Development of this software was supported by The Nokia Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/05/28 00:02:16 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/protosw.h>
|
||||
|
||||
#include <net/route.h>
|
||||
|
||||
#include "rump_net_private.h"
|
||||
|
||||
void
|
||||
rump_net_sockin_init()
|
||||
{
|
||||
extern struct domain sockindomain;
|
||||
|
||||
DOMAINADD(sockindomain);
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
# $NetBSD: Makefile,v 1.2 2008/10/16 09:24:51 pooka Exp $
|
||||
# $NetBSD: Makefile,v 1.3 2009/05/28 00:02:17 pooka Exp $
|
||||
#
|
||||
|
||||
LIB= rumpnet_virtif
|
||||
|
||||
SRCS= if_virt.c
|
||||
SRCS+= component.c
|
||||
|
||||
CPPFLAGS+= -I${.CURDIR}/../../../librump/rumpkern
|
||||
|
||||
|
46
sys/rump/net/lib/libvirtif/component.c
Normal file
46
sys/rump/net/lib/libvirtif/component.c
Normal file
@ -0,0 +1,46 @@
|
||||
/* $NetBSD: component.c,v 1.1 2009/05/28 00:02:17 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
|
||||
*
|
||||
* Development of this software was supported by The Nokia Foundation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: component.c,v 1.1 2009/05/28 00:02:17 pooka Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/domain.h>
|
||||
#include <sys/protosw.h>
|
||||
|
||||
#include <net/route.h>
|
||||
|
||||
#include "rump_net_private.h"
|
||||
|
||||
void
|
||||
rump_net_virtif_init()
|
||||
{
|
||||
|
||||
rump_dummyif_create();
|
||||
}
|
Loading…
Reference in New Issue
Block a user