From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ka-Cheong Poon Subject: Re: [PATCH net-next 2/3] rds: Enable RDS IPv6 support Date: Tue, 26 Jun 2018 13:30:41 +0800 Message-ID: <43b790c2-8da6-9f18-ae23-ca55388e8b26@oracle.com> References: <7f4f460079d3d78a18f7d759488048798e99c4db.1529922794.git.ka-cheong.poon@oracle.com> <20180625170317.GA28578@oracle.com> <25e1afda-7497-7f08-815a-286cf775bc09@oracle.com> <20180625175006.GI14823@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, santosh.shilimkar@oracle.com, davem@davemloft.net, rds-devel@oss.oracle.com To: Sowmini Varadhan Return-path: Received: from aserp2120.oracle.com ([141.146.126.78]:33812 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbeFZFa5 (ORCPT ); Tue, 26 Jun 2018 01:30:57 -0400 In-Reply-To: <20180625175006.GI14823@oracle.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 06/26/2018 01:50 AM, Sowmini Varadhan wrote: >> If a socket is bound, I guess the scope_id should be used. So >> if a socket is not bound to a link local address and the socket >> is used to sent to a link local peer, it should fail. > > PF_RDS sockets *MUST* alwasy be bound. See > Documentation/networking/rds.txt: > " Sockets must be bound before you can send or receive data. > This is needed because binding also selects a transport and > attaches it to the socket. Once bound, the transport assignment > does not change." > > Also, rds_sendmsg checks this (from net-next, your version > has the equivalent ipv6_addr_any etc check): > > if (daddr == 0 || rs->rs_bound_addr == 0) { > release_sock(sk); > ret = -ENOTCONN; /* XXX not a great errno */ > goto out; > } I think you misunderstood what I wrote. The above is in response to your original question: -- > And this is even more confusing because the fastpath in rds_sendmsg > does not take the bound_scope_id into consideration at all: > 1213 if (rs->rs_conn && ipv6_addr_equal(&rs->rs_conn->c_faddr, &daddr)) > 1214 conn = rs->rs_conn; > 1215 else { > 1216 conn = rds_conn_create_outgoing( /* .. */, scope_id) > so if I erroneously passed a msg_name on a connected rds socket, what > would happen? (see also question about rds_connect() itself, below)