use DBG_TNC for TNC debugging output

This commit is contained in:
Andreas Steffen
2010-10-09 16:01:19 +02:00
parent db24b600fb
commit ed08f7ce83
13 changed files with 34 additions and 28 deletions
+2 -1
View File
@@ -283,7 +283,7 @@ static void usage(const char *msg)
" [--version]\n" " [--version]\n"
" [--use-syslog]\n" " [--use-syslog]\n"
" [--debug-<type> <level>]\n" " [--debug-<type> <level>]\n"
" <type>: log context type (dmn|mgr|ike|chd|job|cfg|knl|net|enc|tls|lib)\n" " <type>: log context type (dmn|mgr|ike|chd|job|cfg|knl|net|enc|tnc|tls|lib)\n"
" <level>: log verbosity (-1 = silent, 0 = audit, 1 = control,\n" " <level>: log verbosity (-1 = silent, 0 = audit, 1 = control,\n"
" 2 = controlmore, 3 = raw, 4 = private)\n" " 2 = controlmore, 3 = raw, 4 = private)\n"
"\n" "\n"
@@ -355,6 +355,7 @@ int main(int argc, char *argv[])
{ "debug-knl", required_argument, &group, DBG_KNL }, { "debug-knl", required_argument, &group, DBG_KNL },
{ "debug-net", required_argument, &group, DBG_NET }, { "debug-net", required_argument, &group, DBG_NET },
{ "debug-enc", required_argument, &group, DBG_ENC }, { "debug-enc", required_argument, &group, DBG_ENC },
{ "debug-tnc", required_argument, &group, DBG_TNC },
{ "debug-tls", required_argument, &group, DBG_TLS }, { "debug-tls", required_argument, &group, DBG_TLS },
{ "debug-lib", required_argument, &group, DBG_LIB }, { "debug-lib", required_argument, &group, DBG_LIB },
{ 0,0,0,0 } { 0,0,0,0 }
@@ -48,7 +48,7 @@ plugin_t *tnc_imc_plugin_create()
if (libtnc_tncc_Initialize(tnc_config) != TNC_RESULT_SUCCESS) if (libtnc_tncc_Initialize(tnc_config) != TNC_RESULT_SUCCESS)
{ {
free(this); free(this);
DBG1(DBG_IKE, "TNC IMC initialization failed"); DBG1(DBG_TNC, "TNC IMC initialization failed");
return NULL; return NULL;
} }
@@ -45,7 +45,7 @@ plugin_t *tnc_imv_plugin_create()
if (libtnc_tncs_Initialize(tnc_config) != TNC_RESULT_SUCCESS) if (libtnc_tncs_Initialize(tnc_config) != TNC_RESULT_SUCCESS)
{ {
free(this); free(this);
DBG1(DBG_IKE, "TNC IMV initialization failed"); DBG1(DBG_TNC, "TNC IMV initialization failed");
return NULL; return NULL;
} }
+19 -19
View File
@@ -32,13 +32,13 @@ static TNC_Result buffer_batch(u_int32_t id, const char *data, size_t len)
{ {
if (id >= TNC_SEND_BUFFER_SIZE) if (id >= TNC_SEND_BUFFER_SIZE)
{ {
DBG1(DBG_IKE, "TNCCS Batch for Connection ID %u cannot be stored in " DBG1(DBG_TNC, "TNCCS Batch for Connection ID %u cannot be stored in "
"send buffer with size %d", id, TNC_SEND_BUFFER_SIZE); "send buffer with size %d", id, TNC_SEND_BUFFER_SIZE);
return TNC_RESULT_FATAL; return TNC_RESULT_FATAL;
} }
if (tnc_send_buffer[id].ptr) if (tnc_send_buffer[id].ptr)
{ {
DBG1(DBG_IKE, "send buffer slot for Connection ID %u is already " DBG1(DBG_TNC, "send buffer slot for Connection ID %u is already "
"occupied", id); "occupied", id);
return TNC_RESULT_FATAL; return TNC_RESULT_FATAL;
} }
@@ -55,7 +55,7 @@ static bool retrieve_batch(u_int32_t id, chunk_t *batch)
{ {
if (id >= TNC_SEND_BUFFER_SIZE) if (id >= TNC_SEND_BUFFER_SIZE)
{ {
DBG1(DBG_IKE, "TNCCS Batch for Connection ID %u cannot be retrieved from " DBG1(DBG_TNC, "TNCCS Batch for Connection ID %u cannot be retrieved from "
"send buffer with size %d", id, TNC_SEND_BUFFER_SIZE); "send buffer with size %d", id, TNC_SEND_BUFFER_SIZE);
return FALSE; return FALSE;
} }
@@ -128,30 +128,30 @@ METHOD(tls_t, process, status_t,
this->tncs_connection = libtnc_tncs_CreateConnection(NULL); this->tncs_connection = libtnc_tncs_CreateConnection(NULL);
if (!this->tncs_connection) if (!this->tncs_connection)
{ {
DBG1(DBG_IKE, "TNCS CreateConnection failed"); DBG1(DBG_TNC, "TNCS CreateConnection failed");
return FAILED; return FAILED;
} }
DBG1(DBG_IKE, "assigned TNCS Connection ID %u", DBG1(DBG_TNC, "assigned TNCS Connection ID %u",
this->tncs_connection->connectionID); this->tncs_connection->connectionID);
if (libtnc_tncs_BeginSession(this->tncs_connection) != TNC_RESULT_SUCCESS) if (libtnc_tncs_BeginSession(this->tncs_connection) != TNC_RESULT_SUCCESS)
{ {
DBG1(DBG_IKE, "TNCS BeginSession failed"); DBG1(DBG_TNC, "TNCS BeginSession failed");
return FAILED; return FAILED;
} }
} }
conn_id = this->is_server ? this->tncs_connection->connectionID conn_id = this->is_server ? this->tncs_connection->connectionID
: this->tncc_connection->connectionID; : this->tncc_connection->connectionID;
DBG1(DBG_IKE, "received TNCCS Batch (%u bytes) for Connection ID %u:", DBG1(DBG_TNC, "received TNCCS Batch (%u bytes) for Connection ID %u",
buflen, conn_id); buflen, conn_id);
DBG1(DBG_IKE, "%.*s", buflen, buf); DBG3(DBG_TNC, "%.*s", buflen, buf);
if (this->is_server) if (this->is_server)
{ {
if (libtnc_tncs_ReceiveBatch(this->tncs_connection, buf, buflen) != if (libtnc_tncs_ReceiveBatch(this->tncs_connection, buf, buflen) !=
TNC_RESULT_SUCCESS) TNC_RESULT_SUCCESS)
{ {
DBG1(DBG_IKE, "TNCS ReceiveBatch failed"); DBG1(DBG_TNC, "TNCS ReceiveBatch failed");
return FAILED; return FAILED;
} }
} }
@@ -160,7 +160,7 @@ METHOD(tls_t, process, status_t,
if (libtnc_tncc_ReceiveBatch(this->tncc_connection, buf, buflen) != if (libtnc_tncc_ReceiveBatch(this->tncc_connection, buf, buflen) !=
TNC_RESULT_SUCCESS) TNC_RESULT_SUCCESS)
{ {
DBG1(DBG_IKE, "TNCC ReceiveBatch failed"); DBG1(DBG_TNC, "TNCC ReceiveBatch failed");
return FAILED; return FAILED;
} }
} }
@@ -179,14 +179,14 @@ METHOD(tls_t, build, status_t,
this->tncc_connection = libtnc_tncc_CreateConnection(NULL); this->tncc_connection = libtnc_tncc_CreateConnection(NULL);
if (!this->tncc_connection) if (!this->tncc_connection)
{ {
DBG1(DBG_IKE, "TNCC CreateConnection failed"); DBG1(DBG_TNC, "TNCC CreateConnection failed");
return FAILED; return FAILED;
} }
DBG1(DBG_IKE, "assigned TNCC Connection ID %u", DBG1(DBG_TNC, "assigned TNCC Connection ID %u",
this->tncc_connection->connectionID); this->tncc_connection->connectionID);
if (libtnc_tncc_BeginSession(this->tncc_connection) != TNC_RESULT_SUCCESS) if (libtnc_tncc_BeginSession(this->tncc_connection) != TNC_RESULT_SUCCESS)
{ {
DBG1(DBG_IKE, "TNCC BeginSession failed"); DBG1(DBG_TNC, "TNCC BeginSession failed");
return FAILED; return FAILED;
} }
} }
@@ -207,9 +207,9 @@ METHOD(tls_t, build, status_t,
if (batch.len) if (batch.len)
{ {
DBG1(DBG_IKE, "sending TNCCS Batch (%d bytes) for Connection ID %u:", DBG1(DBG_TNC, "sending TNCCS Batch (%d bytes) for Connection ID %u",
batch.len, conn_id); batch.len, conn_id);
DBG1(DBG_IKE, "%.*s", batch.len, batch.ptr); DBG3(DBG_TNC, "%.*s", batch.len, batch.ptr);
memcpy(buf, batch.ptr, len); memcpy(buf, batch.ptr, len);
free_batch(conn_id); free_batch(conn_id);
return ALREADY_DONE; return ALREADY_DONE;
@@ -248,17 +248,17 @@ METHOD(tls_t, is_complete, bool,
switch (rec) switch (rec)
{ {
case TNC_IMV_ACTION_RECOMMENDATION_ALLOW: case TNC_IMV_ACTION_RECOMMENDATION_ALLOW:
DBG1(DBG_IKE, "TNC recommendation is allow"); DBG1(DBG_TNC, "TNC recommendation is allow");
group = "allow"; group = "allow";
break; break;
case TNC_IMV_ACTION_RECOMMENDATION_ISOLATE: case TNC_IMV_ACTION_RECOMMENDATION_ISOLATE:
DBG1(DBG_IKE, "TNC recommendation is isolate"); DBG1(DBG_TNC, "TNC recommendation is isolate");
group = "isolate"; group = "isolate";
break; break;
case TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS: case TNC_IMV_ACTION_RECOMMENDATION_NO_ACCESS:
case TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION: case TNC_IMV_ACTION_RECOMMENDATION_NO_RECOMMENDATION:
default: default:
DBG1(DBG_IKE, "TNC recommendation is none"); DBG1(DBG_TNC, "TNC recommendation is none");
return FALSE; return FALSE;
} }
ike_sa = charon->bus->get_sa(charon->bus); ike_sa = charon->bus->get_sa(charon->bus);
@@ -267,7 +267,7 @@ METHOD(tls_t, is_complete, bool,
auth = ike_sa->get_auth_cfg(ike_sa, FALSE); auth = ike_sa->get_auth_cfg(ike_sa, FALSE);
id = identification_create_from_string(group); id = identification_create_from_string(group);
auth->add(auth, AUTH_RULE_GROUP, id); auth->add(auth, AUTH_RULE_GROUP, id);
DBG1(DBG_IKE, "added group membership '%s'", group); DBG1(DBG_TNC, "added group membership '%s' based on TNC recommendation", group);
} }
return TRUE; return TRUE;
} }
+2
View File
@@ -27,6 +27,7 @@ ENUM(debug_names, DBG_DMN, DBG_LIB,
"KNL", "KNL",
"NET", "NET",
"ENC", "ENC",
"TNC",
"TLS", "TLS",
"LIB", "LIB",
); );
@@ -41,6 +42,7 @@ ENUM(debug_lower_names, DBG_DMN, DBG_LIB,
"knl", "knl",
"net", "net",
"enc", "enc",
"tnc",
"tls", "tls",
"lib", "lib",
); );
+2
View File
@@ -50,6 +50,8 @@ enum debug_t {
DBG_NET, DBG_NET,
/** message encoding/decoding */ /** message encoding/decoding */
DBG_ENC, DBG_ENC,
/** trusted network connect */
DBG_TNC,
/** libtls */ /** libtls */
DBG_TLS, DBG_TLS,
/** libstrongswan */ /** libstrongswan */
@@ -2,7 +2,7 @@
config setup config setup
plutostart=no plutostart=no
charondebug="tls 2" charondebug="tls 2, tnc 3"
conn %default conn %default
ikelifetime=60m ikelifetime=60m
@@ -2,7 +2,7 @@
config setup config setup
plutostart=no plutostart=no
charondebug="tls 2" charondebug="tls 2, tnc 3"
conn %default conn %default
ikelifetime=60m ikelifetime=60m
@@ -2,7 +2,7 @@
config setup config setup
plutostart=no plutostart=no
charondebug="tls 2" charondebug="tls 2, tnc 3"
conn %default conn %default
ikelifetime=60m ikelifetime=60m
@@ -2,7 +2,7 @@
config setup config setup
plutostart=no plutostart=no
charondebug="tls 2" charondebug="tls 2, tnc 3"
conn %default conn %default
ikelifetime=60m ikelifetime=60m
@@ -2,7 +2,7 @@
config setup config setup
plutostart=no plutostart=no
charondebug="tls 2" charondebug="tls 2, tnc 3"
conn %default conn %default
ikelifetime=60m ikelifetime=60m
@@ -2,7 +2,7 @@
config setup config setup
plutostart=no plutostart=no
charondebug="tls 2" charondebug="tls 2, tnc 3"
conn %default conn %default
ikelifetime=60m ikelifetime=60m
@@ -3,6 +3,7 @@
config setup config setup
strictcrlpolicy=no strictcrlpolicy=no
plutostart=no plutostart=no
charondebug="tls 2, tnc 3"
conn %default conn %default
ikelifetime=60m ikelifetime=60m