PERFORCE change 167217 for review

Ana Kukec anchie at FreeBSD.org
Tue Aug 11 17:51:04 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=167217

Change 167217 by anchie at anchie_desnimis on 2009/08/11 17:50:33

	Trying to debug kernel panic that appears after the packet is
	received through icmp6_input() and passed to user land through
	netinet6/send.c: send_output().	

Affected files ...

.. //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#13 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#21 edit
.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#22 edit

Differences ...

==== //depot/projects/soc2009/anchie_send/src/sys/net/rtsock.c#13 (text+ko) ====

@@ -1280,7 +1280,9 @@
 			bcopy(data, mtod(n, void *), data_len);
 			printf("rtsock.c: rt_msg3(), nakon bcopy!\n");
 			n->m_len = data_len;
+			printf("Nakon n->m_len = data_len;\n");
 			m->m_next = n;
+			printf("Nakon m->m_next = n;\n");
 		} else if (data_len > 0) {
 			printf("rtsock.c: rt_msg3(), prije bcopy 2!\n");
 			bcopy(data, mtod(m, u_int8_t *) + m->m_len, data_len);
@@ -1289,6 +1291,7 @@
 		}
 		if (m->m_flags & M_PKTHDR)
 			m->m_pkthdr.len += data_len;
+		printf("prije mtod!\n");
 		mtod(m, struct if_announcemsghdr *)->ifan_msglen += data_len;
 		printf("prije rt_dispatch\n");
 		rt_dispatch(m, NULL);

==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#21 (text+ko) ====

@@ -825,37 +825,24 @@
 		break;
 
 	case ND_NEIGHBOR_SOLICIT:
-		printf("icmp6.c, ND_NEIGHBOR_SOLICIT!\n");
-		printf("AK: ip6len = %d\n", ip6len);
-		printf("icmp6len = %d\n", icmp6len);
+		printf("icmp6.c: ND_NEIGHBOR_SOLICIT!\n");
+		printf("icmp6.c: ip6len = %d\n", ip6len);
+		printf("icmp6.c: icmp6len = %d\n", icmp6len);
 		icmp6_ifstat_inc(ifp, ifs6_in_neighborsolicit);
 		if (code != 0)
 			goto badcode;
 		if (icmp6len < sizeof(struct nd_neighbor_solicit))
 			goto badlen;
->>>> ORIGINAL //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#18
-==== THEIRS //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#19
-#if 0
-==== YOURS //anchie_desnimis/gsoc2009-send/src/sys/netinet6/icmp6.c
-
 #if 0
 		if ((n = m_copypacket(m, M_DONTWAIT)) == NULL) {
 #endif
-<<<<
 		if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
 #if 0
 		if ((n = m_dup(m, M_DONTWAIT)) == NULL) {
 #endif
->>>> ORIGINAL //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#18
-
-==== THEIRS //depot/projects/soc2009/anchie_send/src/sys/netinet6/icmp6.c#19
-		if ((n = m_dup(m, M_DONTWAIT)) == NULL) {
-
-==== YOURS //anchie_desnimis/gsoc2009-send/src/sys/netinet6/icmp6.c
-<<<<
 			/* Send incoming SeND/ND packet to user space. */
 			if (send_input_hook != NULL) {
-				printf("send_input_hook 1\n");
+				printf("icmp6.c: send_input_hook 1\n");
 				send_input_hook(m, ifp, SND_IN, ip6len);
 			} else {
 				/* give up local */
@@ -865,7 +852,7 @@
 			goto freeit;
 		}
 		if (send_input_hook != NULL) {
-			printf("send_input_hook 2\n");
+			printf("icmp6.c: send_input_hook 2\n");
 			send_input_hook(n, ifp, SND_IN, ip6len);
 			return (IPPROTO_DONE);
 		} else 

==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#22 (text+ko) ====

@@ -8,6 +8,8 @@
 #include <sys/socket.h>
 #include <sys/mbuf.h>
 
+#include <net/vnet.h>
+
 #include <netinet/in.h>
 #include <netinet/ip6.h>
 #include <netinet/icmp6.h>
@@ -26,7 +28,7 @@
 	struct icmp6_hdr *icmp6;
 	int icmp6len;
 
-	printf("send_output\n");
+	printf("send.c: send_output()\n");
 
 	/* 
 	 * Receive incoming (SEND-protected) or outgoing traffic  
@@ -97,6 +99,24 @@
 
 	ip6 = mtod(m, struct ip6_hdr *);
 
+        struct mbuf *n = m_get(M_NOWAIT, MT_DATA);
+	if (direction == SND_IN) {
+            if (msglen > M_TRAILINGSPACE(m)) {
+                        if (n == NULL) {
+                                printf("rtsock.c: rt_msg3(), m_freem!\n");
+				panic("n==NULL\n");
+                                return (1);
+                        }
+                        printf("send.c: bcopy!\n");
+                        bcopy(ip6, mtod(n, void *), msglen);
+                        printf("send.c: bcopy ok!\n");
+                        n->m_len = msglen;
+                        printf("send.c: msglen set up: n->m_len = data_len;\n");
+                }
+
+		ip6 = mtod(n, struct ip6_hdr *);
+	}
+
 	/* 
 	 * Send incoming or outgoing traffic to the user space either to be
 	 * protected (outgoing) or validated (incoming) according to rfc3971. */


More information about the p4-projects mailing list