From owner-p4-projects@FreeBSD.ORG Mon Mar 29 20:03:03 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B0F0D1065670; Mon, 29 Mar 2010 20:03:03 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CDA7106566B for ; Mon, 29 Mar 2010 20:03:03 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4A7B88FC14 for ; Mon, 29 Mar 2010 20:03:03 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o2TK33ch012142 for ; Mon, 29 Mar 2010 20:03:03 GMT (envelope-from anchie@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o2TK33vn012140 for perforce@freebsd.org; Mon, 29 Mar 2010 20:03:03 GMT (envelope-from anchie@FreeBSD.org) Date: Mon, 29 Mar 2010 20:03:03 GMT Message-Id: <201003292003.o2TK33vn012140@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to anchie@FreeBSD.org using -f From: Ana Kukec To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 176257 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2010 20:03:03 -0000 http://p4web.freebsd.org/chv.cgi?CH=176257 Change 176257 by anchie@anchie_malimis on 2010/03/29 20:02:52 Partial cleanup. Tring to get read of panic in soreceive_generic() after sbappendrecord_locked() on SEND socket. Affected files ... .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#35 edit Differences ... ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#35 (text+ko) ==== @@ -210,19 +210,19 @@ sosend_rcv(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td) { - struct ifnet *ifp; + //struct ifnet *ifp = NULL; struct snd_hdr *snd_hdr; - int if_index; printf("sosend_rcv \n"); snd_hdr = mtod(m, struct snd_hdr *); - if_index = snd_hdr->ifidx; printf("direction: %d, ifidx: %d \n", snd_hdr->direction, snd_hdr->ifidx); + //send_ifnet_setbyindex(snd_hdr->ifidx, ifp); #if 0 ifnet_setbyindex(snd_hdr->ifidx, ifp); m_adj(n, sizeof(struct snd_hdr)); - send_output_hook(m, ifp, snd_hdr->direction); + if (ifp) + send_output_hook(m, ifp, snd_hdr->direction); #endif return 0; @@ -235,9 +235,10 @@ send_sendso_input(struct socket *s, struct mbuf *m, int direction, int msglen) { u_int len; - void *data; struct ip6_hdr *ip6; struct snd_hdr *snd_hdr; + +printf("send_sendso_input \n"); /* * Make sure to clear any possible internally embedded scope before @@ -252,26 +253,19 @@ 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_PREPEND(m, SEND_HDR_LEN, M_DONTWAIT); + if (m == NULL) { + m_freem(m); + return (ENOBUFS); + } - m_copydata(m, 0, msglen, data); + m->m_flags &= M_PKTHDR; +printf("MLEN: %d, MHLEN: %d, SEND_HDR_LEN: %d \n", MLEN, MHLEN, SEND_HDR_LEN); - M_PREPEND(m, SEND_HDR_LEN, M_DONTWAIT); - if ((m == NULL && (m = m_pullup(m, len + SEND_HDR_LEN)) == NULL)) { - m_freem(m); - return (ENOBUFS); - } - snd_hdr = mtod(m, struct snd_hdr *); - snd_hdr->direction = direction; - snd_hdr->ifidx = -1; + snd_hdr = mtod(m, struct snd_hdr *); + snd_hdr->direction = direction; + snd_hdr->ifidx = -1; +printf("direction: %d \n", snd_hdr->direction); /* * Send incoming or outgoing traffic to the user space either to be @@ -281,11 +275,9 @@ SOCKBUF_LOCK(&s->so_rcv); sbappendrecord_locked(&s->so_rcv, m); sorwakeup_locked(s); +printf("Nakon sorwakeup \n"); return 0; - } - - m_freem(m); - free(data, M_SEND); + } return -1; } @@ -301,9 +293,8 @@ } struct pr_usrreqs send_usrreqs = { - // Read sys/kern/uipc_socket.c .pru_attach = send_uattach, - .pru_send = sosend_rcv, + .pru_send = sosend_rcv, .pru_detach = send_close }; @@ -325,7 +316,6 @@ error = pf_proto_register(PF_INET, &send_protosw); if (error != 0) break; -printf("pf_proto_register() OK\n"); send_output_hook = send_output; send_input_hook = send_input;