Date: Wed, 1 Oct 2008 20:36:35 GMT From: Ryan French <rfrench@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 150765 for review Message-ID: <200810012036.m91KaZIH084815@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=150765 Change 150765 by rfrench@rfrench_mpls on 2008/10/01 20:36:18 Changed the AF_MPLS protocol define to 40 and replaced the AF_VENDOR00 as pointed out by Andrew Thompson (thanks). I am currently adding a function to mpls_input that will create a psuedo route entry for a packet just so I can prove that the pop(), push() and swap() functions are working for my dissertation. This will be removed once I have real routing setup. Affected files ... .. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_input.c#9 edit .. //depot/projects/soc2008/rfrench_mpls/sys/socket.h#3 edit Differences ... ==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_input.c#9 (text+ko) ==== @@ -45,11 +45,35 @@ mtx_init(&mplsintrq.ifq_mtx, "mpls_inq", NULL, MTX_DEF); netisr_register(NETISR_MPLS, mpls_input, &mplsintrq, 0); #ifdef MPLS_DEBUG - printf("mpls initialised\n"); + printf("MPLS initialised\n"); #endif } void +create_fake_entry(sockaddr_mpls *smpls) +{ + if (MPLS_LABEL_GET(smpls->smpls_in_label) == 44) { + smpls->smpls_operation = 1; + smpls->smpls_out_exp = 14; + smpls->smpls_out_label = 441; + smpls->smpls_out_ifindex = smpls->smpls_in_ifindex; + } + if (MPLS_LABEL_GET(smpls->smpls_in_label) == 45) { + smpls->smpls_operation = 1; + smpls->smpls_out_exp = 14; + smpls->smpls_out_label = 551; + smpls->smpls_out_ifindex = smpls->smpls_in_ifindex; + } + if (MPLS_LABEL_GET(smpls->smpls_in_label) == 66) { + smpls->smpls_operation = 1; + smpls->smpls_out_exp = 14; + smpls->smpls_out_label = 661; + smpls->smpls_out_ifindex = smpls->smpls_in_ifindex; + } +} + + +void mplsintr(void) { struct mbuf *m; @@ -138,18 +162,24 @@ #endif rt = rtalloc1(smplstosa(smpls),1, 0); + +//Uncoment this section when routing has been setup +// if (rt == NULL) { +// /* no entry for this label */ +// #ifdef MPLS_DEBUG +// printf("MPLS_DEBUG: label not found\n"); +// #endif +// m_freem(m); +// goto done; +// } - if (rt == NULL) { - /* no entry for this label */ -#ifdef MPLS_DEBUG - printf("MPLS_DEBUG: label not found\n"); + rt->rt_use++; + smpls = satosmpls(rt_key(rt)); + +#ifdef MPLS_DEBUG /* Remove this once routing has been setup */ + smpls = create_fake_entry(smpls); #endif - m_freem(m); - goto done; - } - rt->rt_use++; - smpls = satosmpls(rt_key(rt)); #ifdef MPLS_DEBUG printf("route af %d len %d in_label %d in_ifindex %d\n", smpls->smpls_family, smpls->smpls_len, @@ -166,15 +196,9 @@ hasbos = MPLS_BOS_ISSET(shim->shim_label); m = mpls_shim_pop(m); if (hasbos) { -// #if NMPE > 0 -// if (rt->rt_ifp->if_type == IFT_MPLS) { -// mpe_input(m, rt->rt_ifp, smpls, ttl); -// goto done; -// } -// #endif - /* last label but we have no clue so drop */ - m_freem(m); - goto done; + /* last label but we have no clue so drop */ + m_freem(m); + goto done; } break; case MPLS_OP_PUSH: ==== //depot/projects/soc2008/rfrench_mpls/sys/socket.h#3 (text+ko) ==== @@ -215,7 +215,8 @@ * even numbered constants for FreeBSD until 134 as odd numbered AF_ * constants 39-133 are now reserved for vendors. */ -#define AF_MPLS 39 /* MPLS protocol family */ +#define AF_VENDOR00 39 +#define AF_MPLS 40 /* MPLS protocol */ #define AF_VENDOR01 41 #define AF_VENDOR02 43 #define AF_VENDOR03 45
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810012036.m91KaZIH084815>