Index: cpukit/libnetworking/net/if.c
===================================================================
--- cpukit/libnetworking/net/if.c	(revision c834daa71682d2dedae8d4d55005d053aa03c3c3)
+++ cpukit/libnetworking/net/if.c	(revision a3c06e11e0f79f27a13228f743011a7f8d1077f0)
@@ -11,8 +11,4 @@
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
@@ -31,5 +27,9 @@
  * SUCH DAMAGE.
  *
- *	@(#)if.c	8.3 (Berkeley) 1/4/94
+ *	@(#)if.c	8.5 (Berkeley) 1/9/95
+ * $FreeBSD: src/sys/net/if.c,v 1.226 2005/04/15 01:51:26 cperciva Exp $
+ */
+
+/*
  * $Id$
  */
@@ -58,9 +58,9 @@
  */
 
-static int ifconf __P((int, caddr_t));
-       void ifinit __P((void *));
-static void if_qflush __P((struct ifqueue *));
-static void if_slowtimo __P((void *));
-static void link_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+static int ifconf(u_long, caddr_t);
+       void ifinit(void *);
+static void if_qflush(struct ifqueue *);
+static void if_slowtimo(void *);
+static void link_rtrequest(int, struct rtentry *, struct sockaddr *);
 
 SYSINIT(interfaces, SI_SUB_PROTO_IF, SI_ORDER_FIRST, ifinit, NULL)
@@ -83,5 +83,5 @@
 	void *dummy;
 {
-	register struct ifnet *ifp;
+	struct ifnet *ifp;
 
 	for (ifp = ifnet; ifp; ifp = ifp->if_next)
@@ -100,13 +100,12 @@
  */
 void
-if_attach(ifp)
-	struct ifnet *ifp;
+if_attach(struct ifnet *ifp)
 {
 	unsigned socksize, ifasize;
 	int namelen, masklen;
 	char workbuf[64];
-	register struct ifnet **p = &ifnet;
-	register struct sockaddr_dl *sdl;
-	register struct ifaddr *ifa;
+	struct ifnet **p = &ifnet;
+	struct sockaddr_dl *sdl;
+	struct ifaddr *ifa;
 	static int if_indexlim = 8;
 
@@ -169,9 +168,8 @@
 /*ARGSUSED*/
 struct ifaddr *
-ifa_ifwithaddr(addr)
-	register struct sockaddr *addr;
-{
-	register struct ifnet *ifp;
-	register struct ifaddr *ifa;
+ifa_ifwithaddr(struct sockaddr *addr)
+{
+	struct ifnet *ifp;
+	struct ifaddr *ifa;
 
 #define	equal(a1, a2) \
@@ -194,9 +192,8 @@
 /*ARGSUSED*/
 struct ifaddr *
-ifa_ifwithdstaddr(addr)
-	register struct sockaddr *addr;
-{
-	register struct ifnet *ifp;
-	register struct ifaddr *ifa;
+ifa_ifwithdstaddr(struct sockaddr *addr)
+{
+	struct ifnet *ifp;
+	struct ifaddr *ifa;
 
 	for (ifp = ifnet; ifp; ifp = ifp->if_next)
@@ -216,9 +213,8 @@
  */
 struct ifaddr *
-ifa_ifwithnet(addr)
-	struct sockaddr *addr;
-{
-	register struct ifnet *ifp;
-	register struct ifaddr *ifa;
+ifa_ifwithnet(struct sockaddr *addr)
+{
+	struct ifnet *ifp;
+	struct ifaddr *ifa;
 	struct ifaddr *ifa_maybe = (struct ifaddr *) 0;
 	u_int af = addr->sa_family;
@@ -226,5 +222,5 @@
 
 	if (af == AF_LINK) {
-	    register struct sockaddr_dl *sdl = (struct sockaddr_dl *)addr;
+	    struct sockaddr_dl *sdl = (struct sockaddr_dl *)addr;
 	    if (sdl->sdl_index && sdl->sdl_index <= if_index)
 		return (ifnet_addrs[sdl->sdl_index - 1]);
@@ -232,5 +228,5 @@
 	for (ifp = ifnet; ifp; ifp = ifp->if_next) {
 		for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next) {
-			register char *cp, *cp2, *cp3;
+			char *cp, *cp2, *cp3;
 
 			if (ifa->ifa_addr->sa_family != af)
@@ -265,8 +261,16 @@
 				cp2 = ifa->ifa_addr->sa_data;
 				cp3 = ifa->ifa_netmask->sa_data;
-				cplim = ifa->ifa_netmask->sa_len + (char *)ifa->ifa_netmask;
+				cplim = ifa->ifa_netmask->sa_len 
+					+ (char *)ifa->ifa_netmask;
 				while (cp3 < cplim)
 					if ((*cp++ ^ *cp2++) & *cp3++)
-						goto next;
+						goto next; /* next address! */
+				/*
+				 * If the netmask of what we just found
+				 * is more specific than what we had before
+				 * (if we had one) then remember the new one
+				 * before continuing to search
+				 * for an even better one.
+				 */
 				if (ifa_maybe == 0 ||
 				    rn_refines((caddr_t)ifa->ifa_netmask,
@@ -284,11 +288,9 @@
  */
 struct ifaddr *
-ifaof_ifpforaddr(addr, ifp)
-	struct sockaddr *addr;
-	register struct ifnet *ifp;
-{
-	register struct ifaddr *ifa;
-	register char *cp, *cp2, *cp3;
-	register char *cplim;
+ifaof_ifpforaddr(struct sockaddr *addr, struct ifnet *ifp)
+{
+	struct ifaddr *ifa;
+	char *cp, *cp2, *cp3;
+	char *cplim;
 	struct ifaddr *ifa_maybe = 0;
 	u_int af = addr->sa_family;
@@ -333,10 +335,7 @@
  */
 static void
-link_rtrequest(cmd, rt, sa)
-	int cmd;
-	register struct rtentry *rt;
-	struct sockaddr *sa;
-{
-	register struct ifaddr *ifa;
+link_rtrequest(int cmd, struct rtentry *rt, struct sockaddr *sa)
+{
+	struct ifaddr *ifa;
 	struct sockaddr *dst;
 	struct ifnet *ifp;
@@ -361,8 +360,7 @@
  */
 void
-if_down(ifp)
-	register struct ifnet *ifp;
-{
-	register struct ifaddr *ifa;
+if_down(struct ifnet *ifp)
+{
+	struct ifaddr *ifa;
 
 	ifp->if_flags &= ~IFF_UP;
@@ -380,6 +378,5 @@
  */
 void
-if_up(ifp)
-	register struct ifnet *ifp;
+if_up(struct ifnet *ifp)
 {
 
@@ -387,5 +384,5 @@
 	microtime(&ifp->if_lastchange);
 #ifdef notyet
-	register struct ifaddr *ifa;
+	struct ifaddr *ifa;
 	/* this has no effect on IP, and will kill all iso connections XXX */
 	for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
@@ -399,8 +396,7 @@
  */
 static void
-if_qflush(ifq)
-	register struct ifqueue *ifq;
-{
-	register struct mbuf *m, *n;
+if_qflush(struct ifqueue *ifq)
+{
+	struct mbuf *m, *n;
 
 	n = ifq->ifq_head;
@@ -420,8 +416,7 @@
  */
 static void
-if_slowtimo(arg)
-	void *arg;
-{
-	register struct ifnet *ifp;
+if_slowtimo(void *arg)
+{
+	struct ifnet *ifp;
 	int s = splimp();
 
@@ -441,9 +436,8 @@
  */
 struct ifnet *
-ifunit(name)
-	register char *name;
-{
-	register char *cp;
-	register struct ifnet *ifp;
+ifunit(char *name)
+{
+	char *cp;
+	struct ifnet *ifp;
 	int unit;
 	unsigned len;
@@ -482,12 +476,8 @@
  */
 int
-ifioctl(so, cmd, data, p)
-	struct socket *so;
-	int cmd;
-	caddr_t data;
-	struct proc *p;
-{
-	register struct ifnet *ifp;
-	register struct ifreq *ifr;
+ifioctl(struct socket *so, int cmd, caddr_t data, struct proc *p)
+{
+	struct ifnet *ifp;
+	struct ifreq *ifr;
 	int error;
 
@@ -687,7 +677,5 @@
  */
 int
-ifpromisc(ifp, pswitch)
-	struct ifnet *ifp;
-	int pswitch;
+ifpromisc(struct ifnet *ifp, int pswitch)
 {
 	struct ifreq ifr;
@@ -722,11 +710,9 @@
 /*ARGSUSED*/
 static int
-ifconf(cmd, data)
-	int cmd;
-	caddr_t data;
-{
-	register struct ifconf *ifc = (struct ifconf *)data;
-	register struct ifnet *ifp = ifnet;
-	register struct ifaddr *ifa;
+ifconf(u_long cmd, caddr_t data)
+{
+	struct ifconf *ifc = (struct ifconf *)data;
+	struct ifnet *ifp = ifnet;
+	struct ifaddr *ifa;
 	struct ifreq ifr, *ifrp;
 	int space = ifc->ifc_len, error = 0;
@@ -753,5 +739,5 @@
 		} else
 		    for ( ; space > sizeof (ifr) && ifa; ifa = ifa->ifa_next) {
-			register struct sockaddr *sa = ifa->ifa_addr;
+			struct sockaddr *sa = ifa->ifa_addr;
 #ifdef COMPAT_43
 			if (cmd == OSIOCGIFCONF) {
Index: cpukit/libnetworking/net/if.h
===================================================================
--- cpukit/libnetworking/net/if.h	(revision c834daa71682d2dedae8d4d55005d053aa03c3c3)
+++ cpukit/libnetworking/net/if.h	(revision a3c06e11e0f79f27a13228f743011a7f8d1077f0)
@@ -246,5 +246,5 @@
 #define	IFF_PROMISC	0x100		/* receive all packets */
 #define	IFF_ALLMULTI	0x200		/* receive all multicast packets */
-#define	IFF_OACTIVE	0x400		/* transmission in progress */
+#define	IFF_OACTIVE	0x400		/* tx hardware queue is full */
 #define	IFF_SIMPLEX	0x800		/* can't hear own transmissions */
 #define	IFF_LINK0	0x1000		/* per link layer defined bit */
@@ -512,5 +512,4 @@
 int	ifioctl(struct socket *, int, caddr_t, struct proc *);
 int	ifpromisc(struct ifnet *, int);
-struct	ifnet *ifunit(char *);
 
 struct	ifaddr *ifa_ifwithaddr(struct sockaddr *);
Index: cpukit/libnetworking/sys/mbuf.h
===================================================================
--- cpukit/libnetworking/sys/mbuf.h	(revision c834daa71682d2dedae8d4d55005d053aa03c3c3)
+++ cpukit/libnetworking/sys/mbuf.h	(revision a3c06e11e0f79f27a13228f743011a7f8d1077f0)
@@ -11,9 +11,5 @@
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -32,7 +28,11 @@
  *
  *	@(#)mbuf.h	8.5 (Berkeley) 2/19/95
+ * $FreeBSD: src/sys/sys/mbuf.h,v 1.169 2005/03/17 19:34:57 jmg Exp $
+ */
+
+/*
  * $Id$
  */
-
+ 
 #ifndef _SYS_MBUF_H_
 #define _SYS_MBUF_H_
@@ -64,9 +64,11 @@
  */
 #define	mtod(m,t)	((t)((m)->m_data))
-#define	dtom(x)		((struct mbuf *)((long)(x) & ~(MSIZE-1)))
+#define	dtom(x)		((struct mbuf *)((intptr_t)(x) & ~(MSIZE-1)))
 #define	mtocl(x)	(((u_long)(x) - (u_long)mbutl) >> MCLSHIFT)
 #define	cltom(x)	((caddr_t)((u_long)mbutl + ((u_long)(x) << MCLSHIFT)))
 
-/* header at beginning of each mbuf: */
+/*
+ * Header present at the beginning of every mbuf.
+ */
 struct m_hdr {
 	struct	mbuf *mh_next;		/* next buffer in chain */
@@ -74,9 +76,11 @@
 	caddr_t	mh_data;		/* location of data */
 	int	mh_len;			/* amount of data in this mbuf */
+	int	mh_flags;		/* flags; see below */
 	short	mh_type;		/* type of data in this mbuf */
-	short	mh_flags;		/* flags; see below */
-};
-
-/* record/packet header in first mbuf of chain; valid if M_PKTHDR set */
+};
+
+/*
+ * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set.
+ */
 struct	pkthdr {
 	struct	ifnet *rcvif;		/* rcv interface */
@@ -84,5 +88,7 @@
 };
 
-/* description of external storage mapped into mbuf, valid if M_EXT set */
+/*
+ * Description of external storage mapped into mbuf; valid only if M_EXT is set.
+ */
 struct m_ext {
 	caddr_t	ext_buf;		/* start of buffer */
@@ -94,4 +100,8 @@
 };
 
+/*
+ * The core of the mbuf object along with some shortcut defines for
+ * practical purposes.
+ */
 struct mbuf {
 	struct	m_hdr m_hdr;
