PERFORCE change 176322 for review

Ana Kukec anchie at FreeBSD.org
Tue Mar 30 23:50:18 UTC 2010


http://p4web.freebsd.org/chv.cgi?CH=176322

Change 176322 by anchie at anchie_malimis on 2010/03/30 23:50:16

	Partial cleanup.	

Affected files ...

.. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#38 edit

Differences ...

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

@@ -154,48 +154,6 @@
 }
 
 static int
-send_input(struct mbuf *m, struct ifnet *ifp, int direction, int msglen)
-{
-	u_int len;
-	void *data;
-	struct ip6_hdr *ip6;
-
-	/*
-	 * Make sure to clear any possible internally embedded scope before 
-	 * passing the packet to userspace for SeND cryptographic signature
-	 * validation to succeed.
-	 */
-	ip6 = mtod(m, struct ip6_hdr *);
-	in6_clearscope(&ip6->ip6_src);
-	in6_clearscope(&ip6->ip6_dst); 
-
-	len = m_length(m, NULL);
-	if (len != msglen)
-		printf("XXX-BZ %s: (m)len=%u (ip6)msglen=%d", __func__, len, msglen);
-
-	/*
-	 * XXX-BZ we can save the alloc/free here if not relying on rtsock.c:rt_msg3()
-	 * but using a version operating on mbuf-to-mbuf copy.
-	 */
-	data = malloc(msglen, M_SEND, M_NOWAIT);
-	if (data == NULL) {
-		m_freem(m);
-		return (ENOBUFS);
-	}
-	
-	m_copydata(m, 0, msglen, data);
-
-	/* 
-	 * Send incoming or outgoing traffic to the user space either to be
-	 * protected (outgoing) or validated (incoming) according to rfc3971. */
-	rt_securendmsg(ifp, direction, data, msglen);
-
-	free(data, M_SEND);
-
-	return (0);
-}
-
-static int
 send_uattach(struct socket *so, int proto, struct thread *td)
 {
 
@@ -204,7 +162,7 @@
 		return (EEXIST);
 
 	/* XXX: Revisit this, hardocoded! */
-	so->so_snd.sb_hiwat = 8192;
+	//so->so_snd.sb_hiwat = 8192;
 
 	V_send_so = so;
  
@@ -232,7 +190,7 @@
 	m_move_pkthdr(m, m0);
 
 	ifp = ifnet_byindex_ref(snd_hdr->ifidx);
-	m_adj(m, sizeof(struct snd_hdr));
+	m_adj(m, SEND_HDR_LEN);
 	if (ifp) {
 		int error = send_output(m, ifp, snd_hdr->direction);
 		printf("error: %d\n", error);
@@ -296,23 +254,20 @@
 static void
 send_close(struct socket *so)
 {
-    /* XXX-AK: Memory leakage! */
-    if (V_send_so)
-    	V_send_so = NULL;
-    printf("pru_detach: send_close\n");
-    //soisdisconnected(so);
+	if (V_send_so)
+	V_send_so = NULL;
 }
 
 struct pr_usrreqs send_usrreqs = {
-    .pru_attach =		send_uattach,
-    .pru_send =			sosend_rcv,
-    .pru_detach =		send_close
+	.pru_attach =		send_uattach,
+	.pru_send =			sosend_rcv,
+	.pru_detach =		send_close
 };
 
 struct protosw send_protosw = {
-    .pr_type =			SOCK_RAW,
-    .pr_protocol =		IPPROTO_SEND,
-    .pr_usrreqs =		&send_usrreqs
+	.pr_type =			SOCK_RAW,
+	.pr_protocol =		IPPROTO_SEND,
+	.pr_usrreqs =		&send_usrreqs
 };
 
 static int


More information about the p4-projects mailing list