teach loopback about MPLS. Prerequisite for MPLS tunnels
This commit is contained in:
parent
0cdfe4f5e4
commit
a91123ebd3
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: if_loop.c,v 1.73 2011/04/25 22:20:59 yamt Exp $ */
|
/* $NetBSD: if_loop.c,v 1.74 2011/06/17 09:15:24 kefren Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
|
||||||
@ -65,13 +65,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.73 2011/04/25 22:20:59 yamt Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.74 2011/06/17 09:15:24 kefren Exp $");
|
||||||
|
|
||||||
#include "opt_inet.h"
|
#include "opt_inet.h"
|
||||||
#include "opt_atalk.h"
|
#include "opt_atalk.h"
|
||||||
#include "opt_iso.h"
|
#include "opt_iso.h"
|
||||||
#include "opt_ipx.h"
|
#include "opt_ipx.h"
|
||||||
#include "opt_mbuftrace.h"
|
#include "opt_mbuftrace.h"
|
||||||
|
#include "opt_mpls.h"
|
||||||
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -117,6 +118,11 @@ __KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.73 2011/04/25 22:20:59 yamt Exp $");
|
|||||||
#include <netiso/iso_var.h>
|
#include <netiso/iso_var.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MPLS
|
||||||
|
#include <netmpls/mpls.h>
|
||||||
|
#include <netmpls/mpls_var.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NETATALK
|
#ifdef NETATALK
|
||||||
#include <netatalk/at.h>
|
#include <netatalk/at.h>
|
||||||
#include <netatalk/at_var.h>
|
#include <netatalk/at_var.h>
|
||||||
@ -314,6 +320,18 @@ looutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
|
|||||||
m_freem(m);
|
m_freem(m);
|
||||||
return (EAFNOSUPPORT);
|
return (EAFNOSUPPORT);
|
||||||
}
|
}
|
||||||
|
#ifdef MPLS
|
||||||
|
if (rt != NULL && rt_gettag(rt) != NULL &&
|
||||||
|
rt_gettag(rt)->sa_family == AF_MPLS &&
|
||||||
|
(m->m_flags & (M_MCAST | M_BCAST)) == 0) {
|
||||||
|
union mpls_shim msh;
|
||||||
|
msh.s_addr = MPLS_GETSADDR(rt);
|
||||||
|
if (msh.shim.label != MPLS_LABEL_IMPLNULL) {
|
||||||
|
ifq = &mplsintrq;
|
||||||
|
isr = NETISR_MPLS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
s = splnet();
|
s = splnet();
|
||||||
if (IF_QFULL(ifq)) {
|
if (IF_QFULL(ifq)) {
|
||||||
IF_DROP(ifq);
|
IF_DROP(ifq);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: if_mpls.c,v 1.4 2011/06/16 19:47:31 kefren Exp $ */
|
/* $NetBSD: if_mpls.c,v 1.5 2011/06/17 09:15:24 kefren Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||||
@ -30,7 +30,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.4 2011/06/16 19:47:31 kefren Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.5 2011/06/17 09:15:24 kefren Exp $");
|
||||||
|
|
||||||
#include "opt_inet.h"
|
#include "opt_inet.h"
|
||||||
#include "opt_mpls.h"
|
#include "opt_mpls.h"
|
||||||
@ -396,11 +396,11 @@ mpls_send_frame(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch(ifp->if_type) {
|
switch(ifp->if_type) {
|
||||||
/* only these two are supported for now */
|
/* only these are supported for now */
|
||||||
case IFT_ETHER:
|
case IFT_ETHER:
|
||||||
case IFT_TUNNEL:
|
case IFT_TUNNEL:
|
||||||
return (*ifp->if_output)(ifp, m, rt->rt_gateway, rt);
|
|
||||||
case IFT_LOOP:
|
case IFT_LOOP:
|
||||||
|
return (*ifp->if_output)(ifp, m, rt->rt_gateway, rt);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ENETUNREACH;
|
return ENETUNREACH;
|
||||||
|
Loading…
Reference in New Issue
Block a user