svn commit: r210806 - projects/sv/sys/net

Attilio Rao attilio at FreeBSD.org
Tue Aug 3 15:53:30 UTC 2010


Author: attilio
Date: Tue Aug  3 15:53:29 2010
New Revision: 210806
URL: http://svn.freebsd.org/changeset/base/210806

Log:
  Add some debugging aid and confirm revision does the same thing
  as above-mentioned functions

Modified:
  projects/sv/sys/net/netdump_client.c

Modified: projects/sv/sys/net/netdump_client.c
==============================================================================
--- projects/sv/sys/net/netdump_client.c	Tue Aug  3 15:40:42 2010	(r210805)
+++ projects/sv/sys/net/netdump_client.c	Tue Aug  3 15:53:29 2010	(r210806)
@@ -762,6 +762,15 @@ nd_handle_ip(struct mbuf **mb)
 		ip = mtod(m, struct ip *);
 	}
 
+#ifdef INVARIANTS
+	if (((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET ||
+	    (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) &&
+	    (m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK) == 0) {
+		NETDDEBUG("nd_handle_ip: Bad IP header (RFC1122)\n");
+		return;
+	}
+#endif
+
 	/* Checksum */
 	if (m->m_pkthdr.csum_flags & CSUM_IP_CHECKED) {
 		if (!(m->m_pkthdr.csum_flags & CSUM_IP_VALID)) {


More information about the svn-src-projects mailing list