Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Nov 2008 06:40:33 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r184553 - user/kmacy/HEAD_fast_xmit/sys/net
Message-ID:  <200811020640.mA26eXl3030964@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Sun Nov  2 06:40:33 2008
New Revision: 184553
URL: http://svn.freebsd.org/changeset/base/184553

Log:
  add debugging to INVARIANTS

Modified:
  user/kmacy/HEAD_fast_xmit/sys/net/flowtable.c
  user/kmacy/HEAD_fast_xmit/sys/net/flowtable.h

Modified: user/kmacy/HEAD_fast_xmit/sys/net/flowtable.c
==============================================================================
--- user/kmacy/HEAD_fast_xmit/sys/net/flowtable.c	Sun Nov  2 03:02:56 2008	(r184552)
+++ user/kmacy/HEAD_fast_xmit/sys/net/flowtable.c	Sun Nov  2 06:40:33 2008	(r184553)
@@ -14,6 +14,7 @@
 #include <sys/mbuf.h>
 #include <sys/smp.h>
 #include <sys/socket.h>
+#include <sys/syslog.h>
 
 #include <net/route.h> 
 #include <net/vnet.h>
@@ -531,12 +532,20 @@ route_to_rtentry_info(struct route *ro, 
 	ri->ri_flags = rt->rt_flags;
 	ri->ri_mtu = rt->rt_rmx.rmx_mtu;
 
+	
 	if ((rt->rt_flags & RTF_GATEWAY) && !IN_MULTICAST(sin->sin_addr.s_addr))
 		memcpy(&ri->ri_dst, rt->rt_gateway, sizeof(struct sockaddr));
 	else
 		memcpy(&ri->ri_dst, sin, sizeof(struct sockaddr_in));
 	
 	if (desten) {
+#ifdef INVARIANTS
+		int i;
+		
+		for (i = 0; i < 3; i++)
+			if (((uint16_t *)desten)[i] == 0)
+				panic("bad juju with the MAC addr dude");
+#endif		
 		memcpy(ri->ri_desten, desten, ETHER_ADDR_LEN);
 		ri->ri_flags |= RTF_DESTEN_VALID;
 	}
@@ -594,7 +603,6 @@ flowtable_lookup(struct flowtable *ft, s
 	hash = ipv4_flow_lookup_hash_internal(m, &ro, key,
 	    &flags, &proto);
 
-	
 	/*
 	 * Ports are zero and this isn't a transmit cache
 	 * - thus not a protocol for which we need to keep 
@@ -640,6 +648,12 @@ uncached:
 	if (ro.ro_rt == NULL) 
 		error = ENETUNREACH;
 	else {
+#ifdef INVARIANTS		
+		log(LOG_DEBUG, "destination address=%s proto=%d hash=%x "
+		    "rt_flags=%lx",
+		    inet_ntoa(((struct sockaddr_in*)&ro.ro_dst)->sin_addr), proto, hash,
+		    ro.ro_rt->rt_flags);
+#endif
 		if (ro.ro_rt->rt_flags & RTF_GATEWAY)
 			error = arpresolve(ro.ro_rt->rt_ifp, ro.ro_rt,
 			    NULL, ro.ro_rt->rt_gateway, desten);

Modified: user/kmacy/HEAD_fast_xmit/sys/net/flowtable.h
==============================================================================
--- user/kmacy/HEAD_fast_xmit/sys/net/flowtable.h	Sun Nov  2 03:02:56 2008	(r184552)
+++ user/kmacy/HEAD_fast_xmit/sys/net/flowtable.h	Sun Nov  2 06:40:33 2008	(r184553)
@@ -18,7 +18,7 @@ struct rtentry_info {
 	int			ri_flags;
 	int			ri_mtu;
 	u_char			ri_desten[ETHER_ADDR_LEN];
-	struct sockaddr_in	ri_dst; /* rt_gateway if RTF_GATEWAY */
+	struct sockaddr		ri_dst; /* rt_gateway if RTF_GATEWAY */
 };
 
 struct rtentry_info6 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811020640.mA26eXl3030964>