提交 ae36806a 编写于 作者: M Marcelo Ricardo Leitner 提交者: David S. Miller

sctp: allow authenticating DATA chunks that are bundled with COOKIE_ECHO

Currently, we can ask to authenticate DATA chunks and we can send DATA
chunks on the same packet as COOKIE_ECHO, but if you try to combine
both, the DATA chunk will be sent unauthenticated and peer won't accept
it, leading to a communication failure.

This happens because even though the data was queued after it was
requested to authenticate DATA chunks, it was also queued before we
could know that remote peer can handle authenticating, so
sctp_auth_send_cid() returns false.

The fix is whenever we set up an active key, re-check send queue for
chunks that now should be authenticated. As a result, such packet will
now contain COOKIE_ECHO + AUTH + DATA chunks, in that order.
Reported-by: NLiu Wei <weliu@redhat.com>
Signed-off-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: NNeil Horman <nhorman@tuxdriver.com>
Acked-by: NVlad Yasevich <vyasevich@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fb05e7a8
...@@ -381,13 +381,14 @@ int sctp_auth_asoc_copy_shkeys(const struct sctp_endpoint *ep, ...@@ -381,13 +381,14 @@ int sctp_auth_asoc_copy_shkeys(const struct sctp_endpoint *ep,
} }
/* Public interface to creat the association shared key. /* Public interface to create the association shared key.
* See code above for the algorithm. * See code above for the algorithm.
*/ */
int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp) int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp)
{ {
struct sctp_auth_bytes *secret; struct sctp_auth_bytes *secret;
struct sctp_shared_key *ep_key; struct sctp_shared_key *ep_key;
struct sctp_chunk *chunk;
/* If we don't support AUTH, or peer is not capable /* If we don't support AUTH, or peer is not capable
* we don't need to do anything. * we don't need to do anything.
...@@ -410,6 +411,14 @@ int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp) ...@@ -410,6 +411,14 @@ int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp)
sctp_auth_key_put(asoc->asoc_shared_key); sctp_auth_key_put(asoc->asoc_shared_key);
asoc->asoc_shared_key = secret; asoc->asoc_shared_key = secret;
/* Update send queue in case any chunk already in there now
* needs authenticating
*/
list_for_each_entry(chunk, &asoc->outqueue.out_chunk_list, list) {
if (sctp_auth_send_cid(chunk->chunk_hdr->type, asoc))
chunk->auth = 1;
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册