From owner-p4-projects@FreeBSD.ORG Thu Apr 1 11:34:10 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3B2EB106564A; Thu, 1 Apr 2010 11:34:10 +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 F3B851065673 for ; Thu, 1 Apr 2010 11:34:09 +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 C723F8FC12 for ; Thu, 1 Apr 2010 11:34:09 +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 o31BY9TJ036382 for ; Thu, 1 Apr 2010 11:34:09 GMT (envelope-from anchie@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o31BY9l0036380 for perforce@freebsd.org; Thu, 1 Apr 2010 11:34:09 GMT (envelope-from anchie@FreeBSD.org) Date: Thu, 1 Apr 2010 11:34:09 GMT Message-Id: <201004011134.o31BY9l0036380@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 176401 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: Thu, 01 Apr 2010 11:34:10 -0000 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;