PERFORCE change 151074 for review

Ryan French rfrench at FreeBSD.org
Mon Oct 6 22:07:01 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=151074

Change 151074 by rfrench at 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) ====



More information about the p4-projects mailing list