rxrpc: Don't assume transport address family and size when using it
authorDavid Howells <dhowells@redhat.com>
Thu, 7 Apr 2016 16:23:44 +0000 (17:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Apr 2016 19:34:41 +0000 (15:34 -0400)
Don't assume transport address family and size when using the peer address
to send a packet.  Instead, use the start of the transport address rather
than any particular element of the union and use the transport address
length noted inside the sockaddr_rxrpc struct.

This will be necessary when IPv6 support is introduced.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rxrpc/ar-ack.c
net/rxrpc/ar-connevent.c

index d0eb98e..3cd9264 100644 (file)
@@ -833,8 +833,8 @@ void rxrpc_process_call(struct work_struct *work)
 
        /* there's a good chance we're going to have to send a message, so set
         * one up in advance */
-       msg.msg_name    = &call->conn->trans->peer->srx.transport.sin;
-       msg.msg_namelen = sizeof(call->conn->trans->peer->srx.transport.sin);
+       msg.msg_name    = &call->conn->trans->peer->srx.transport;
+       msg.msg_namelen = call->conn->trans->peer->srx.transport_len;
        msg.msg_control = NULL;
        msg.msg_controllen = 0;
        msg.msg_flags   = 0;
index 4dc6ab8..2915223 100644 (file)
@@ -86,8 +86,8 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
 
        rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED, abort_code);
 
-       msg.msg_name    = &conn->trans->peer->srx.transport.sin;
-       msg.msg_namelen = sizeof(conn->trans->peer->srx.transport.sin);
+       msg.msg_name    = &conn->trans->peer->srx.transport;
+       msg.msg_namelen = conn->trans->peer->srx.transport_len;
        msg.msg_control = NULL;
        msg.msg_controllen = 0;
        msg.msg_flags   = 0;