diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2012-12-23 22:16:30 +0100 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2012-12-23 22:16:30 +0100 |
commit | 9787b9f2e0177cba553330d9d7a6c4ede8e71708 (patch) | |
tree | 75cad811fae27150834f8b638f9c59d989b9e880 | |
parent | ef33a4ab82994b24f984c2dd02ea034498b24ad3 (diff) | |
download | strongswan-9787b9f2e0177cba553330d9d7a6c4ede8e71708.tar.bz2 strongswan-9787b9f2e0177cba553330d9d7a6c4ede8e71708.tar.xz |
Send empty CDATA batch if TNC client has no data to send
-rw-r--r-- | src/libcharon/plugins/tnccs_20/tnccs_20.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/src/libcharon/plugins/tnccs_20/tnccs_20.c b/src/libcharon/plugins/tnccs_20/tnccs_20.c index e1ba56642..6239b152d 100644 --- a/src/libcharon/plugins/tnccs_20/tnccs_20.c +++ b/src/libcharon/plugins/tnccs_20/tnccs_20.c @@ -646,28 +646,40 @@ METHOD(tls_t, build, status_t, if (this->batch_type == PB_BATCH_NONE) { - if (this->is_server && state == PB_STATE_SERVER_WORKING) + if (this->is_server) { - if (this->state_machine->get_empty_cdata(this->state_machine)) - { - check_and_build_recommendation(this); - } - else + if (state == PB_STATE_SERVER_WORKING) { - DBG2(DBG_TNC, "no recommendation available yet, " - "sending empty PB-TNC SDATA batch"); - this->batch_type = PB_BATCH_SDATA; + if (this->state_machine->get_empty_cdata(this->state_machine)) + { + check_and_build_recommendation(this); + } + else + { + DBG2(DBG_TNC, "no recommendation available yet, " + "sending empty PB-TNC SDATA batch"); + this->batch_type = PB_BATCH_SDATA; + } } } else - { - /** - * In the DECIDED state and if no CRETRY is under way, - * a PB-TNC client replies with an empty CLOSE batch. - */ - if (state == PB_STATE_DECIDED) + { + switch (state) { - this->batch_type = PB_BATCH_CLOSE; + case PB_STATE_CLIENT_WORKING: + DBG2(DBG_TNC, "no client data to send, " + "sending empty PB-TNC CDATA batch"); + this->batch_type = PB_BATCH_CDATA; + break; + case PB_STATE_DECIDED: + /** + * In the DECIDED state and if no CRETRY is under way, + * a PB-TNC client replies with an empty CLOSE batch. + */ + this->batch_type = PB_BATCH_CLOSE; + break; + default: + break; } } } |