From mboxrd@z Thu Jan 1 00:00:00 1970 From: wangweidong Date: Tue, 19 Nov 2013 03:32:45 +0000 Subject: Re: [PATCH 2/2] ipv6: use sk_v6_copy_addrs when memcpy struct ipv6_pinfo Message-Id: <528ADBDD.9040209@huawei.com> List-Id: References: <1384829247-8624-3-git-send-email-wangweidong1@huawei.com> In-Reply-To: <1384829247-8624-3-git-send-email-wangweidong1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: dccp@vger.kernel.org On 2013/11/19 11:14, Hannes Frederic Sowa wrote: > On Tue, Nov 19, 2013 at 10:47:27AM +0800, Wang Weidong wrote: >> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c >> index 0740f93..83d011e 100644 >> --- a/net/ipv6/tcp_ipv6.c >> +++ b/net/ipv6/tcp_ipv6.c >> @@ -1116,6 +1116,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, >> newtp = tcp_sk(newsk); >> >> memcpy(newnp, np, sizeof(struct ipv6_pinfo)); >> + /* Don't forget copy the rcv_saddr and daddr when >> + * copy ipv6_pinfo. >> + */ >> + sk_v6_copy_addrs(newsk, sk); >> >> ipv6_addr_set_v4mapped(newinet->inet_daddr, &newsk->sk_v6_daddr); >> > > Hmm, how did you spot this? > > Greetings, > > Hannes > When I did the lksctp-tools(1.0.15)/src/func_tests/test_getname_v6, I got a Segmentation fault. So I try to resolve it. I found the sctp_accept will call sctp_v6_create_accept_sk in IPV6, the function will memcpy the ipv6_pinfo, and not copy the sk_v6_rcv_saddr. But the getsockname will read the sk_v6_rcv_saddr, and the value is not true. > > . > From mboxrd@z Thu Jan 1 00:00:00 1970 From: wangweidong Date: Tue, 19 Nov 2013 03:32:45 +0000 Subject: Re: [PATCH 2/2] ipv6: use sk_v6_copy_addrs when memcpy struct ipv6_pinfo Message-Id: <528ADBDD.9040209@huawei.com> List-Id: References: <1384829247-8624-1-git-send-email-wangweidong1@huawei.com> <1384829247-8624-3-git-send-email-wangweidong1@huawei.com> <20131119031408.GQ16541@order.stressinduktion.org> In-Reply-To: <20131119031408.GQ16541@order.stressinduktion.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: davem@davemloft.net, gerrit@erg.abdn.ac.uk, kuznet@ms2.inr.ac.ru, jmorris@namei.org, yoshfuji@linux-ipv6.org, kaber@trash.net, vyasevich@gmail.com, nhorman@tuxdriver.com, dccp@vger.kernel.org, netdev@vger.kernel.org, linux-sctp@vger.kernel.org, dingtianhong@huawei.com On 2013/11/19 11:14, Hannes Frederic Sowa wrote: > On Tue, Nov 19, 2013 at 10:47:27AM +0800, Wang Weidong wrote: >> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c >> index 0740f93..83d011e 100644 >> --- a/net/ipv6/tcp_ipv6.c >> +++ b/net/ipv6/tcp_ipv6.c >> @@ -1116,6 +1116,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, >> newtp = tcp_sk(newsk); >> >> memcpy(newnp, np, sizeof(struct ipv6_pinfo)); >> + /* Don't forget copy the rcv_saddr and daddr when >> + * copy ipv6_pinfo. >> + */ >> + sk_v6_copy_addrs(newsk, sk); >> >> ipv6_addr_set_v4mapped(newinet->inet_daddr, &newsk->sk_v6_daddr); >> > > Hmm, how did you spot this? > > Greetings, > > Hannes > When I did the lksctp-tools(1.0.15)/src/func_tests/test_getname_v6, I got a Segmentation fault. So I try to resolve it. I found the sctp_accept will call sctp_v6_create_accept_sk in IPV6, the function will memcpy the ipv6_pinfo, and not copy the sk_v6_rcv_saddr. But the getsockname will read the sk_v6_rcv_saddr, and the value is not true. > > . > From mboxrd@z Thu Jan 1 00:00:00 1970 From: wangweidong Subject: Re: [PATCH 2/2] ipv6: use sk_v6_copy_addrs when memcpy struct ipv6_pinfo Date: Tue, 19 Nov 2013 11:32:45 +0800 Message-ID: <528ADBDD.9040209@huawei.com> References: <1384829247-8624-1-git-send-email-wangweidong1@huawei.com> <1384829247-8624-3-git-send-email-wangweidong1@huawei.com> <20131119031408.GQ16541@order.stressinduktion.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit To: , , , , , , , , , , , Return-path: Received: from szxga03-in.huawei.com ([119.145.14.66]:7796 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751784Ab3KSDdb (ORCPT ); Mon, 18 Nov 2013 22:33:31 -0500 In-Reply-To: <20131119031408.GQ16541@order.stressinduktion.org> Sender: netdev-owner@vger.kernel.org List-ID: On 2013/11/19 11:14, Hannes Frederic Sowa wrote: > On Tue, Nov 19, 2013 at 10:47:27AM +0800, Wang Weidong wrote: >> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c >> index 0740f93..83d011e 100644 >> --- a/net/ipv6/tcp_ipv6.c >> +++ b/net/ipv6/tcp_ipv6.c >> @@ -1116,6 +1116,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, >> newtp = tcp_sk(newsk); >> >> memcpy(newnp, np, sizeof(struct ipv6_pinfo)); >> + /* Don't forget copy the rcv_saddr and daddr when >> + * copy ipv6_pinfo. >> + */ >> + sk_v6_copy_addrs(newsk, sk); >> >> ipv6_addr_set_v4mapped(newinet->inet_daddr, &newsk->sk_v6_daddr); >> > > Hmm, how did you spot this? > > Greetings, > > Hannes > When I did the lksctp-tools(1.0.15)/src/func_tests/test_getname_v6, I got a Segmentation fault. So I try to resolve it. I found the sctp_accept will call sctp_v6_create_accept_sk in IPV6, the function will memcpy the ipv6_pinfo, and not copy the sk_v6_rcv_saddr. But the getsockname will read the sk_v6_rcv_saddr, and the value is not true. > > . >