PERFORCE change 151504 for review
Ryan French
rfrench at FreeBSD.org
Fri Oct 17 22:13:05 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=151504
Change 151504 by rfrench at rfrench_mpls on 2008/10/17 22:12:14
Went through and did some clean up of the code, removing left over code that was no longer needed, and added ina a few copyright notices e.t.c. to my mpls files.
Affected files ...
.. //depot/projects/soc2008/rfrench_mpls/net/if_ethersubr.c#12 edit
.. //depot/projects/soc2008/rfrench_mpls/net/netisr.c#3 edit
.. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls.h#7 edit
.. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_input.c#14 edit
.. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_proto.c#8 edit
.. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_raw.c#6 edit
.. //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_shim.c#5 edit
Differences ...
==== //depot/projects/soc2008/rfrench_mpls/net/if_ethersubr.c#12 (text+ko) ====
@@ -819,29 +819,8 @@
#ifdef MPLS
case ETHERTYPE_MPLS:
printf("MPLS packet received\n");
-// if (rt)
-// dst = rt_key(rt);
-// else
-// senderr(EHOSTUNREACH);
-//
-// switch (dst->sa_family) {
-// case AF_LINK:
-// if (((struct sockaddr_dl *) dst)->sdl_alen <
-// sizeof(edst))
-// senderr(EHOSTUNREACH);
-// bcopy(LLADDR(((struct sockaddr_dl *)dst)), edst,
-// sizeof(edst));
-// break;
-// case AF_INET:
-// if (!arpresolve(ac, rt, m, dst, edst))
-// return (0); /* if not yet resolved */
-// break;
-// default:
-// senderr(EHOSTUNREACH);
-// }
/* XXX handling for simplex devices in case of M/BCAST ?? */
if (m->m_flags && (M_BCAST | M_MCAST))
-// isr = NETISR_MPLS_MCAST;
isr = NETISR_MPLS;
else
isr = NETISR_MPLS;
==== //depot/projects/soc2008/rfrench_mpls/net/netisr.c#3 (text+ko) ====
@@ -150,17 +150,7 @@
void
netisr_dispatch(int num, struct mbuf *m)
{
-#ifdef MPLS_DEBUG
- if(num == 4)
- printf("entered dispatch\n");
-#endif
-
struct netisr *ni;
-
-#ifdef MPLS_DEBUG
- if(num == 4 || num == 5)
- printf("netisr num = %d\n", num);
-#endif
isrstat.isrs_count++; /* XXX redundant */
KASSERT(!(num < 0 || num >= (sizeof(netisrs)/sizeof(*netisrs))),
@@ -194,11 +184,7 @@
*/
ni->ni_handler(m);
} else {
- isrstat.isrs_deferred++;
-#ifdef MPLS_DEBUG
- if (m == NULL)
- printf("m is NULL\n");
-#endif
+ isrstat.isrs_deferred++;
if (IF_HANDOFF(ni->ni_queue, m, NULL))
schednetisr(num);
}
==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls.h#7 (text+ko) ====
@@ -3,6 +3,9 @@
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
* All rights reserved.
*
+ * Copyright (c) 2008 Ryan James French
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -84,14 +87,14 @@
*/
struct sockaddr_mpls {
- u_int8_t smpls_len; /* length */
- u_int8_t smpls_family; /* AF_MPLS */
+ u_int8_t smpls_len; /* length */
+ u_int8_t smpls_family; /* AF_MPLS */
u_int8_t smpls_operation;
- u_int8_t smpls_out_exp; /* outgoing exp value */
- u_int32_t smpls_out_label; /* outgoing MPLS label */
+ u_int8_t smpls_out_exp; /* outgoing exp value */
+ u_int32_t smpls_out_label; /* outgoing MPLS label */
u_int16_t smpls_out_ifindex;
u_int16_t smpls_in_ifindex;
- u_int32_t smpls_in_label; /* MPLS label 20 bits*/
+ u_int32_t smpls_in_label; /* MPLS label 20 bits*/
//#if MPLS_MCAST
// u_int8_t smpls_mcexp;
// u_int8_t smpls_pad2[2];
==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_input.c#14 (text+ko) ====
@@ -2,6 +2,9 @@
/*
* Copyright (c) 2008 Claudio Jeker <claudio at openbsd.org>
*
+ * Copyright (c) 2008 Ryan James French
+ * All rights reserved.
+ *
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
@@ -105,6 +108,7 @@
return;
}
+ //Remove comments once routing has been implemented
/* drop all broadcast and multicast packets */
//if (m->m_flags & (M_BCAST | M_MCAST)) {
// m_freem(m);
@@ -154,7 +158,7 @@
/* uncomment below once routing is implemented */
//rt = rtalloc1(smplstosa(smpls),1, 0);
-//Uncomment this section when routing has been setup
+//Uncomment this section when routing has been implemented
// if (rt == NULL) {
// /* no entry for this label */
// #ifdef MPLS_DEBUG
@@ -209,7 +213,7 @@
/* refetch label */
shim = mtod(m, struct shim_hdr *);
- /* Remove once routing is implemented */
+ /* Remove comments once routing is implemented */
// ifp = rt->rt_ifp;
if (smpls->smpls_out_ifindex)
==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_proto.c#8 (text+ko) ====
@@ -3,6 +3,9 @@
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
* All rights reserved.
*
+ * Copyright (c) 2008 Ryan James French
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_raw.c#6 (text+ko) ====
@@ -3,6 +3,9 @@
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
* All rights reserved.
*
+ * Copyright (c) 2008 Ryan James French
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -55,16 +58,10 @@
u_long mpls_raw_recvspace = MPLS_RAW_RCVQ;
int mpls_enable = 1;
-// SYSCTL_INT( _net_mpls, MPLSCTL_ENABLE, enable, CTLFLAG_RW,
-// &mpls_enable, 0, "Enable the MPLS protocol");
int mpls_defttl = 255;
-// SYSCTL_INT( _net_mpls, MPLSCTL_DEFTTL, ttl, CTLFLAG_RW,
-// &mpls_defttl, 0, "Maximum TTL on MPLS packets");
int mpls_inkloop = 16;
-// SYSCTL_INT( _net_mpls, MPLSCTL_MAXINKLOOP, inkloop, CTLFLAG_RW,
-// &mpls_inkloop, 0, "Set MPLS Max Ink Loop");
int mpls_push_expnull_ip = 0;
int mpls_push_expnull_ip6 = 0;
@@ -119,72 +116,3 @@
.pru_soreceive = pru_soreceive_notsupp,
.pru_sopoll = pru_sopoll_notsupp
};
-
-// int
-// mpls_raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
-// struct mbuf *control, struct proc *p)
-// {
-// int error = 0;
-//
-// #ifdef MPLS_DEBUG
-// printf("mpls_raw_usrreq: called! (reqid=%d).\n", req);
-// #endif /* MPLS_DEBUG */
-//
-// if (req == PRU_CONTROL)
-// return (mpls_control(so, (u_long)m, (caddr_t)nam,
-// (struct ifnet *)control));
-//
-// switch (req) {
-// case PRU_ATTACH:
-// if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
-// error = soreserve(so, mpls_raw_sendspace,
-// mpls_raw_recvspace);
-// if (error)
-// break;
-// }
-// break;
-//
-// case PRU_DETACH:
-// case PRU_BIND:
-// case PRU_LISTEN:
-// case PRU_CONNECT:
-// case PRU_CONNECT2:
-// case PRU_DISCONNECT:
-// case PRU_SHUTDOWN:
-// case PRU_RCVD:
-// case PRU_SEND:
-// case PRU_SENSE:
-// case PRU_RCVOOB:
-// case PRU_SENDOOB:
-// case PRU_SOCKADDR:
-// case PRU_PEERADDR:
-// error = EOPNOTSUPP;
-// break;
-//
-// default:
-// panic("rip_usrreq");
-// }
-//
-// return (error);
-// }
-
-// int
-// mpls_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
-// size_t newlen)
-// {
-// if (name[0] >= MPLSCTL_MAXID)
-// return EOPNOTSUPP;
-//
-// /* Almost all sysctl names at this level are terminal. */
-// if (namelen != 1 && name[0] != MPLSCTL_IFQUEUE)
-// return (ENOTDIR);
-//
-// switch (name[0]) {
-// case MPLSCTL_IFQUEUE:
-// return (sysctl_ifq(name + 1, namelen - 1,
-// oldp, oldlenp, newp, newlen, &mplsintrq));
-// default:
-// return sysctl_int_arr(mplsctl_vars, name, namelen,
-// oldp, oldlenp, newp, newlen);
-// }
-// }
==== //depot/projects/soc2008/rfrench_mpls/netmpls/mpls_shim.c#5 (text+ko) ====
@@ -3,6 +3,9 @@
* Copyright (C) 1999, 2000 and 2001 AYAME Project, WIDE Project.
* All rights reserved.
*
+ * Copyright (c) 2008 Ryan James French
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
More information about the p4-projects
mailing list