Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net teach loopback about MPLS. Prerequisite for MPLS tun...



details:   https://anonhg.NetBSD.org/src/rev/b20a68851877
branches:  trunk
changeset: 766156:b20a68851877
user:      kefren <kefren%NetBSD.org@localhost>
date:      Fri Jun 17 09:15:24 2011 +0000

description:
teach loopback about MPLS. Prerequisite for MPLS tunnels

diffstat:

 sys/net/if_loop.c |  22 ++++++++++++++++++++--
 sys/net/if_mpls.c |   8 ++++----
 2 files changed, 24 insertions(+), 6 deletions(-)

diffs (88 lines):

diff -r cfd1914bbc2a -r b20a68851877 sys/net/if_loop.c
--- a/sys/net/if_loop.c Fri Jun 17 05:18:10 2011 +0000
+++ b/sys/net/if_loop.c Fri Jun 17 09:15:24 2011 +0000
@@ -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);
diff -r cfd1914bbc2a -r b20a68851877 sys/net/if_mpls.c
--- a/sys/net/if_mpls.c Fri Jun 17 05:18:10 2011 +0000
+++ b/sys/net/if_mpls.c Fri Jun 17 09:15:24 2011 +0000
@@ -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:
+       case IFT_LOOP:
                return (*ifp->if_output)(ifp, m, rt->rt_gateway, rt);
-       case IFT_LOOP:
                break;
        default:
                return ENETUNREACH;



Home | Main Index | Thread Index | Old Index