Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2008 22:07:01 GMT
From:      Ryan French <rfrench@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 151074 for review
Message-ID:  <200810062207.m96M71jp059399@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=151074

Change 151074 by rfrench@rfrench_mpls on 2008/10/06 22:06:34

		Basic MPLS receiving/decoding/sending is now working. There is still a lot of work to go but for now when a packet is received using one of the labels in mpls-needle.conf then the packet has one of the 3 operations (swap, pop, push) performed on it and the packet is then sent back out. At the moment routing has not been implemented and when the packet is sent back out it is sent using the MAC broadcast address. Setting up routing tables is the next step, and then looking at implementing LDP and from there to ingress/egress routing.	

Affected files ...

.. //depot/projects/soc2008/rfrench_mpls/net/if_ethersubr.c#10 edit
.. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_input.c#12 edit
.. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_shim.c#4 edit

Differences ...

==== //depot/projects/soc2008/rfrench_mpls/net/if_ethersubr.c#10 (text+ko) ====

@@ -100,6 +100,7 @@
 
 #ifdef MPLS
 #include <netmpls/mpls.h>
+#include <netinet/if_ether.h>
 #endif /*MPLS*/
 
 #include <security/mac/mac_framework.h>
@@ -262,6 +263,13 @@
 	  }
 #endif /* NETATALK */
 
+#ifdef MPLS
+	case AF_MPLS:
+		type = htons(ETHERTYPE_MPLS);
+		bcopy(ifp->if_broadcastaddr, edst, ETHER_ADDR_LEN);	
+		break;
+#endif /* MPLS */
+
 	case pseudo_AF_HDRCMPLT:
 		hdrcmplt = 1;
 		eh = (struct ether_header *)dst->sa_data;

==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_input.c#12 (text+ko) ====

@@ -36,6 +36,7 @@
 #ifdef MPLS_DEBUG
 #define MPLS_LABEL_GET(l)       ((ntohl((l) & MPLS_LABEL_MASK)) >> MPLS_LABEL_OFFSET)
 #define MPLS_TTL_GET(l)         (ntohl((l) & MPLS_TTL_MASK))
+#define MPLS_LABEL_SET(l)	(htonl((l) << MPLS_LABEL_OFFSET))
 #endif
 
 void create_fake_entry(struct sockaddr_mpls *);
@@ -57,19 +58,19 @@
 	if (MPLS_LABEL_GET(smpls->smpls_in_label) == 44) {
 		smpls->smpls_operation = 1;
 		smpls->smpls_out_exp = 14;
-		smpls->smpls_out_label = 66;
+		smpls->smpls_out_label = MPLS_LABEL_SET(66);
 		smpls->smpls_out_ifindex = smpls->smpls_in_ifindex;
 	}
 	if (MPLS_LABEL_GET(smpls->smpls_in_label) == 55) {
 		smpls->smpls_operation = 2;
 		smpls->smpls_out_exp = 14;
-		smpls->smpls_out_label = 44;
+		smpls->smpls_out_label = MPLS_LABEL_SET(44);
 		smpls->smpls_out_ifindex = smpls->smpls_in_ifindex;
 	}
 	if (MPLS_LABEL_GET(smpls->smpls_in_label) == 66) {
 		smpls->smpls_operation = 3;
 		smpls->smpls_out_exp = 14;
-		smpls->smpls_out_label = 1000;
+		smpls->smpls_out_label = MPLS_LABEL_SET(1000);
 		smpls->smpls_out_ifindex = smpls->smpls_in_ifindex;
 	}
 }

==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_shim.c#4 (text+ko) ====




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810062207.m96M71jp059399>