Add librumpnet_netmpls that provides MPLS features into rump kernels

ok'ed pooka@
This commit is contained in:
kefren 2013-07-18 15:59:27 +00:00
parent ef965bff9b
commit d7758422de
8 changed files with 101 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netisr.c,v 1.5 2010/12/30 16:19:39 pooka Exp $ */
/* $NetBSD: netisr.c,v 1.6 2013/07/18 15:59:27 kefren Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netisr.c,v 1.5 2010/12/30 16:19:39 pooka Exp $");
__KERNEL_RCSID(0, "$NetBSD: netisr.c,v 1.6 2013/07/18 15:59:27 kefren Exp $");
#include <sys/param.h>
#include <sys/intr.h>
@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: netisr.c,v 1.5 2010/12/30 16:19:39 pooka Exp $");
#include <netinet/if_inarp.h>
#include <netinet/ip6.h>
#include <netinet6/ip6_var.h>
#include <netmpls/mpls_var.h>
#include <net/netisr.h>
#include <rump/rumpuser.h>
@ -63,11 +64,12 @@ __netisr_stub(void)
__weak_alias(ipintr,__netisr_stub);
__weak_alias(arpintr,__netisr_stub);
__weak_alias(ip6intr,__netisr_stub);
__weak_alias(mplsintr,__netisr_stub);
void
rump_netisr_init(void)
{
void *iphand, *arphand, *ip6hand, *sym;
void *iphand, *arphand, *ip6hand, *mplshand, *sym;
iphand = ipintr;
if ((sym = rumpuser_dl_globalsym("rumpns_ipintr")) != NULL)
@ -80,6 +82,10 @@ rump_netisr_init(void)
ip6hand = ip6intr;
if ((sym = rumpuser_dl_globalsym("rumpns_ip6intr")) != NULL)
ip6hand = sym;
mplshand = mplsintr;
if ((sym = rumpuser_dl_globalsym("rumpns_mplsintr")) != NULL)
mplshand = sym;
netisrs[NETISR_IP] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
(void (*)(void *))iphand, NULL);
@ -87,4 +93,6 @@ rump_netisr_init(void)
(void (*)(void *))arphand, NULL);
netisrs[NETISR_IPV6] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
(void (*)(void *))ip6hand, NULL);
netisrs[NETISR_MPLS] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
(void (*)(void *))mplshand, NULL);
}

View File

@ -1,7 +1,8 @@
# $NetBSD: Makefile.rumpnetcomp,v 1.5 2012/08/15 17:56:58 rmind Exp $
# $NetBSD: Makefile.rumpnetcomp,v 1.6 2013/07/18 15:59:27 kefren Exp $
#
RUMPNETCOMP= agr bridge net net80211 netbt netinet npf local shmif virtif
RUMPNETCOMP= agr bridge net net80211 netbt netinet netmpls npf
RUMPNETCOMP+= local shmif virtif
RUMPNETSOCKIN= sockin

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.17 2013/06/01 10:54:24 pooka Exp $
# $NetBSD: Makefile,v 1.18 2013/07/18 15:59:28 kefren Exp $
#
.PATH: ${.CURDIR}/../../../../net ${.CURDIR}/../../../../compat/common
@ -15,6 +15,7 @@ CPPFLAGS+= -I${.CURDIR}/opt -I${.CURDIR}/../libnetinet/opt
CPPFLAGS+= -DCOMPAT_OIFREQ -DCOMPAT_OIFDATA
.include "${.CURDIR}/../libnetinet/Makefile.inc"
.include "${.CURDIR}/../libnetmpls/Makefile.inc"
.include <bsd.lib.mk>
.include <bsd.klinks.mk>

View File

@ -1,3 +1,3 @@
/* $NetBSD: opt_mpls.h,v 1.1 2010/06/26 14:24:28 kefren Exp $ */
/* $NetBSD: opt_mpls.h,v 1.2 2013/07/18 15:59:28 kefren Exp $ */
/* XXX: dummy */
#define MPLS 1

View File

@ -0,0 +1,14 @@
# $NetBSD: Makefile,v 1.1 2013/07/18 15:59:28 kefren Exp $
#
.PATH: ${.CURDIR}/../../../../net ${.CURDIR}/../../../../netmpls
LIB= rumpnet_netmpls
SRCS= mpls_ttl.c if_mpls.c
SRCS+= component.c
CPPFLAGS+= -I${.CURDIR}/../libnet/opt
.include <bsd.lib.mk>
.include <bsd.klinks.mk>

View File

@ -0,0 +1,6 @@
# $NetBSD: Makefile.inc,v 1.1 2013/07/18 15:59:28 kefren Exp $
#
.PATH: ${.CURDIR}/../../../../netmpls
SRCS+= mpls_proto.c

View File

@ -0,0 +1,59 @@
/* $NetBSD: component.c,v 1.1 2013/07/18 15:59:28 kefren Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
*
* Development of this software was supported by The Nokia Foundation
*
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* All rights reserved.
*
* 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 2013/07/18 15:59:28 kefren Exp $");
#include <sys/param.h>
#include <sys/domain.h>
#include <sys/protosw.h>
#include <net/if.h>
#include <net/route.h>
#include "rump_private.h"
#include "rump_net_private.h"
void ifmplsattach(int);
RUMP_COMPONENT(RUMP_COMPONENT_NET)
{
extern struct domain mplsdomain;
DOMAINADD(mplsdomain);
}
RUMP_COMPONENT(RUMP_COMPONENT_NET_IF)
{
ifmplsattach(0);
}

View File

@ -0,0 +1,4 @@
# $NetBSD: shlib_version,v 1.1 2013/07/18 15:59:28 kefren Exp $
#
major=0
minor=0