add TLS handshake packet size to debug output

This commit is contained in:
Andreas Steffen
2010-08-18 22:07:27 +02:00
parent ba31fe1fd6
commit ee346b54c1
+7 -5
View File
@@ -124,8 +124,8 @@ static status_t process_handshake(private_tls_fragmentation_t *this,
if (this->input.len == this->inpos) if (this->input.len == this->inpos)
{ /* message completely defragmented, process */ { /* message completely defragmented, process */
msg = tls_reader_create(this->input); msg = tls_reader_create(this->input);
DBG2(DBG_IKE, "received TLS %N message", DBG2(DBG_IKE, "received TLS %N message (%u bytes)",
tls_handshake_type_names, this->type); tls_handshake_type_names, this->type, 4 + this->input.len);
status = this->handshake->process(this->handshake, this->type, msg); status = this->handshake->process(this->handshake, this->type, msg);
msg->destroy(msg); msg->destroy(msg);
chunk_free(&this->input); chunk_free(&this->input);
@@ -202,6 +202,7 @@ METHOD(tls_fragmentation_t, process, status_t,
METHOD(tls_fragmentation_t, build, status_t, METHOD(tls_fragmentation_t, build, status_t,
private_tls_fragmentation_t *this, tls_content_type_t *type, chunk_t *data) private_tls_fragmentation_t *this, tls_content_type_t *type, chunk_t *data)
{ {
chunk_t hs_data;
tls_handshake_type_t hs_type; tls_handshake_type_t hs_type;
tls_writer_t *writer, *msg; tls_writer_t *writer, *msg;
status_t status = INVALID_STATE; status_t status = INVALID_STATE;
@@ -242,10 +243,11 @@ METHOD(tls_fragmentation_t, build, status_t,
switch (status) switch (status)
{ {
case NEED_MORE: case NEED_MORE:
DBG2(DBG_IKE, "sending TLS %N message", hs_data = writer->get_buf(writer);
tls_handshake_type_names, hs_type);
msg->write_uint8(msg, hs_type); msg->write_uint8(msg, hs_type);
msg->write_data24(msg, writer->get_buf(writer)); msg->write_data24(msg, hs_data);
DBG2(DBG_IKE, "sending TLS %N message (%u bytes)",
tls_handshake_type_names, hs_type, 4 + hs_data.len);
break; break;
case INVALID_STATE: case INVALID_STATE:
*type = TLS_HANDSHAKE; *type = TLS_HANDSHAKE;