From owner-p4-projects@FreeBSD.ORG Mon Oct 6 22:07:01 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9EBBB1065694; Mon, 6 Oct 2008 22:07:01 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 480E2106568A for ; Mon, 6 Oct 2008 22:07:01 +0000 (UTC) (envelope-from rfrench@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 35B048FC27 for ; Mon, 6 Oct 2008 22:07:01 +0000 (UTC) (envelope-from rfrench@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m96M713P059401 for ; Mon, 6 Oct 2008 22:07:01 GMT (envelope-from rfrench@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m96M71jp059399 for perforce@freebsd.org; Mon, 6 Oct 2008 22:07:01 GMT (envelope-from rfrench@FreeBSD.org) Date: Mon, 6 Oct 2008 22:07:01 GMT Message-Id: <200810062207.m96M71jp059399@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rfrench@FreeBSD.org using -f From: Ryan French To: Perforce Change Reviews Cc: Subject: PERFORCE change 151074 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Oct 2008 22:07:01 -0000 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 +#include #endif /*MPLS*/ #include @@ -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) ====