Date: Thu, 1 Apr 2010 11:34:09 GMT From: Ana Kukec <anchie@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 176401 for review Message-ID: <201004011134.o31BY9l0036380@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=176401 Change 176401 by anchie@anchie_malimis on 2010/04/01 11:33:21 Got rid of the bug in netinet6/nd6.c: nd_option() -- NDP option len was not set properly. Now, both basic scenarion and router scenario work well. The code with the native SEND socket is still partially mixed with the the code with the routing socket. There might be also some mem leakages (netinet6/send.c when copying and moving new mbuf header to the old mbuf chain, etc..). Affected files ... .. //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#39 edit Differences ... ==== //depot/projects/soc2009/anchie_send/src/sys/netinet6/send.c#39 (text+ko) ==== @@ -162,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; @@ -176,10 +176,12 @@ struct ifnet *ifp; struct snd_hdr *snd_hdr; - printf("sosend_rcv, mbuf len: %d \n", m->m_len); +printf("sosend_rcv, mbuf len: %d \n", m->m_len); snd_hdr = mtod(m, struct snd_hdr *); - printf("direction: %d, ifidx: %d \n", snd_hdr->direction, snd_hdr->ifidx); + + int mlen = m->m_len; + int mpkthdrlen = m->m_pkthdr.len; struct mbuf *m0; m0 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); @@ -189,8 +191,12 @@ } m_move_pkthdr(m, m0); + m->m_len = mlen; + m->m_pkthdr.len = mpkthdrlen; + ifp = ifnet_byindex_ref(snd_hdr->ifidx); m_adj(m, SEND_HDR_LEN); + m_fixhdr(m); if (ifp) { int error = send_output(m, ifp, snd_hdr->direction); printf("error: %d\n", error); @@ -224,7 +230,7 @@ len = m_length(m, NULL); if (len != msglen) printf("XXX-BZ %s: (m)len=%u (ip6)msglen=%d", __func__, len, msglen); - + m = m_prepend(m, SEND_HDR_LEN, M_PKTHDR|M_DONTWAIT); if (m == NULL) { printf("m_prepend() failed!\n"); @@ -255,17 +261,17 @@ send_close(struct socket *so) { if (V_send_so) - V_send_so = NULL; + V_send_so = NULL; } struct pr_usrreqs send_usrreqs = { .pru_attach = send_uattach, - .pru_send = sosend_rcv, + .pru_send = sosend_rcv, .pru_detach = send_close }; struct protosw send_protosw = { - .pr_type = SOCK_RAW, + .pr_type = SOCK_RAW, .pr_protocol = IPPROTO_SEND, .pr_usrreqs = &send_usrreqs }; @@ -282,20 +288,12 @@ error = pf_proto_register(PF_INET, &send_protosw); if (error != 0) break; - - send_output_hook = send_output; - send_input_hook = send_input; - send_sendso_input_hook = send_sendso_input; break; - case MOD_UNLOAD: if (V_send_so != NULL) return (EINVAL); error = pf_proto_unregister(PF_INET, IPPROTO_SEND, SOCK_RAW); - send_input_hook = NULL; - send_output_hook = NULL; - send_sendso_input_hook = NULL; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004011134.o31BY9l0036380>