Module Name: src Committed By: kefren Date: Fri Jun 17 09:15:24 UTC 2011
Modified Files: src/sys/net: if_loop.c if_mpls.c Log Message: teach loopback about MPLS. Prerequisite for MPLS tunnels To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/net/if_loop.c cvs rdiff -u -r1.4 -r1.5 src/sys/net/if_mpls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_loop.c diff -u src/sys/net/if_loop.c:1.73 src/sys/net/if_loop.c:1.74 --- src/sys/net/if_loop.c:1.73 Mon Apr 25 22:20:59 2011 +++ src/sys/net/if_loop.c Fri Jun 17 09:15:24 2011 @@ -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. @@ -65,13 +65,14 @@ */ #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_atalk.h" #include "opt_iso.h" #include "opt_ipx.h" #include "opt_mbuftrace.h" +#include "opt_mpls.h" #include <sys/param.h> @@ -117,6 +118,11 @@ #include <netiso/iso_var.h> #endif +#ifdef MPLS +#include <netmpls/mpls.h> +#include <netmpls/mpls_var.h> +#endif + #ifdef NETATALK #include <netatalk/at.h> #include <netatalk/at_var.h> @@ -314,6 +320,18 @@ m_freem(m); 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(); if (IF_QFULL(ifq)) { IF_DROP(ifq); Index: src/sys/net/if_mpls.c diff -u src/sys/net/if_mpls.c:1.4 src/sys/net/if_mpls.c:1.5 --- src/sys/net/if_mpls.c:1.4 Thu Jun 16 19:47:31 2011 +++ src/sys/net/if_mpls.c Fri Jun 17 09:15:24 2011 @@ -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. @@ -30,7 +30,7 @@ */ #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_mpls.h" @@ -396,11 +396,11 @@ } switch(ifp->if_type) { - /* only these two are supported for now */ + /* only these are supported for now */ case IFT_ETHER: case IFT_TUNNEL: - return (*ifp->if_output)(ifp, m, rt->rt_gateway, rt); case IFT_LOOP: + return (*ifp->if_output)(ifp, m, rt->rt_gateway, rt); break; default: return ENETUNREACH;