Date: Mon, 29 Mar 2010 20:03:03 GMT From: Ana Kukec <anchie@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 176257 for review Message-ID: <201003292003.o2TK33vn012140@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003292003.o2TK33vn012140>