Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rxrpc: Don't assume transport address family and size when using it

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>

authored by

David Howells and committed by
David S. Miller
6dd050f8 843099ca

+4 -4
+2 -2
net/rxrpc/ar-ack.c
··· 833 833 834 834 /* there's a good chance we're going to have to send a message, so set 835 835 * one up in advance */ 836 - msg.msg_name = &call->conn->trans->peer->srx.transport.sin; 837 - msg.msg_namelen = sizeof(call->conn->trans->peer->srx.transport.sin); 836 + msg.msg_name = &call->conn->trans->peer->srx.transport; 837 + msg.msg_namelen = call->conn->trans->peer->srx.transport_len; 838 838 msg.msg_control = NULL; 839 839 msg.msg_controllen = 0; 840 840 msg.msg_flags = 0;
+2 -2
net/rxrpc/ar-connevent.c
··· 86 86 87 87 rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED, abort_code); 88 88 89 - msg.msg_name = &conn->trans->peer->srx.transport.sin; 90 - msg.msg_namelen = sizeof(conn->trans->peer->srx.transport.sin); 89 + msg.msg_name = &conn->trans->peer->srx.transport; 90 + msg.msg_namelen = conn->trans->peer->srx.transport_len; 91 91 msg.msg_control = NULL; 92 92 msg.msg_controllen = 0; 93 93 msg.msg_flags = 0;