rxrpc: Don't store the rxrpc header in the Tx queue sk_buffs
Don't store the rxrpc protocol header in sk_buffs on the transmit queue, but rather generate it on the fly and pass it to kernel_sendmsg() as a separate iov. This reduces the amount of storage required. Note that the security header is still stored in the sk_buff as it may get encrypted along with the data (and doesn't change with each transmission). Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -80,12 +80,10 @@ static int rxkad_init_connection_security(struct rxrpc_connection *conn)
|
||||
case RXRPC_SECURITY_AUTH:
|
||||
conn->size_align = 8;
|
||||
conn->security_size = sizeof(struct rxkad_level1_hdr);
|
||||
conn->header_size += sizeof(struct rxkad_level1_hdr);
|
||||
break;
|
||||
case RXRPC_SECURITY_ENCRYPT:
|
||||
conn->size_align = 8;
|
||||
conn->security_size = sizeof(struct rxkad_level2_hdr);
|
||||
conn->header_size += sizeof(struct rxkad_level2_hdr);
|
||||
break;
|
||||
default:
|
||||
ret = -EKEYREJECTED;
|
||||
@@ -161,7 +159,7 @@ static int rxkad_secure_packet_auth(const struct rxrpc_call *call,
|
||||
|
||||
_enter("");
|
||||
|
||||
check = sp->hdr.seq ^ sp->hdr.callNumber;
|
||||
check = sp->hdr.seq ^ call->call_id;
|
||||
data_size |= (u32)check << 16;
|
||||
|
||||
hdr.data_size = htonl(data_size);
|
||||
@@ -205,7 +203,7 @@ static int rxkad_secure_packet_encrypt(const struct rxrpc_call *call,
|
||||
|
||||
_enter("");
|
||||
|
||||
check = sp->hdr.seq ^ sp->hdr.callNumber;
|
||||
check = sp->hdr.seq ^ call->call_id;
|
||||
|
||||
rxkhdr.data_size = htonl(data_size | (u32)check << 16);
|
||||
rxkhdr.checksum = 0;
|
||||
@@ -277,7 +275,7 @@ static int rxkad_secure_packet(struct rxrpc_call *call,
|
||||
/* calculate the security checksum */
|
||||
x = (call->cid & RXRPC_CHANNELMASK) << (32 - RXRPC_CIDSHIFT);
|
||||
x |= sp->hdr.seq & 0x3fffffff;
|
||||
call->crypto_buf[0] = htonl(sp->hdr.callNumber);
|
||||
call->crypto_buf[0] = htonl(call->call_id);
|
||||
call->crypto_buf[1] = htonl(x);
|
||||
|
||||
sg_init_one(&sg, call->crypto_buf, 8);
|
||||
|
Reference in New Issue
Block a user