On (06/25/18 03:38), Ka-Cheong Poon wrote: > @@ -1105,8 +1105,27 @@ int rds_sendmsg(struct socket *sock, struct msghdr > *msg, size_t payload_len) > break; > > case sizeof(*sin6): { > - ret = -EPROTONOSUPPORT; > - goto out; > + int addr_type; : : > + daddr = sin6->sin6_addr; > + dport = sin6->sin6_port; > + scope_id = sin6->sin6_scope_id; > + break; > }
In rds_sendmsg, the scopeid passed to rds_conn_create_outgoing may come from the msg_name (if msg_name is a link-local) or may come from the rs_bound_scope_id (for connected socket, change made in Patch 1 of the series). This sounds inconsistent. If I bind to scopeid if1 and then send to fe80::1%if2 (without connect()), we'd create an rds_connection with dev_if set to if2. (first off, its a bit unexpected to be sending to fe80::1%if2 when you are bound to a link-local on if1!) But then, if we got back a response from fe80::1%if2, I think we would not find a matching conn in rds_recv_incoming? 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) Should we always use rs_bound_scope_id for creating the outgoing rds_connection? (you may need something deterministic for this, like "if bound addr is linklocal, return error if daddr has a different scopeid, else use the bound addr's scopeid", plus, "if bound addr is not global, and daddr is link-local, we need a conn with the daddr's scopeid") Also, why is there no IPv6 support in rds_connect? (still looking through the rds-tcp changes, but wanted to get these questions clarified first). --Sowmini