aboutsummaryrefslogtreecommitdiffstats
path: root/src/libimcv/plugins/imc_os
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2014-10-05 18:40:24 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2014-10-05 18:43:55 +0200
commita5dfe7a29a2967d671e6f39cd696dc5a56567f2f (patch)
tree8a1c8f201a95f638c4692d28cc770f41e8ca1a1d /src/libimcv/plugins/imc_os
parentfc47211740b2ef5eebd010e7469f612c018ccf52 (diff)
downloadstrongswan-a5dfe7a29a2967d671e6f39cd696dc5a56567f2f.tar.bz2
strongswan-a5dfe7a29a2967d671e6f39cd696dc5a56567f2f.tar.xz
OS IMV proposes IF-M segmentation contract
The OS IMV sends a TCG IF-M Segmentation contract request. All IETF standard attributes support segmentation. Additionally the IETF Installed Packages standard attributes supports incremental processing while segments are received.
Diffstat (limited to 'src/libimcv/plugins/imc_os')
-rw-r--r--src/libimcv/plugins/imc_os/imc_os.c62
1 files changed, 8 insertions, 54 deletions
diff --git a/src/libimcv/plugins/imc_os/imc_os.c b/src/libimcv/plugins/imc_os/imc_os.c
index 785280c28..86d2e09ca 100644
--- a/src/libimcv/plugins/imc_os/imc_os.c
+++ b/src/libimcv/plugins/imc_os/imc_os.c
@@ -30,7 +30,6 @@
#include <ita/ita_attr.h>
#include <ita/ita_attr_get_settings.h>
#include <ita/ita_attr_settings.h>
-#include <ita/ita_attr_angel.h>
#include <ita/ita_attr_device_id.h>
#include <tncif_pa_subtypes.h>
@@ -341,69 +340,24 @@ static void add_device_id(imc_msg_t *msg)
*/
static void add_installed_packages(imc_state_t *state, imc_msg_t *msg)
{
- pa_tnc_attr_t *attr = NULL, *attr_angel;
+ pa_tnc_attr_t *attr;
ietf_attr_installed_packages_t *attr_cast;
enumerator_t *enumerator;
chunk_t name, version;
- size_t max_attr_size, attr_size, entry_size;
- bool first = TRUE;
- /**
- * Compute the maximum IETF Installed Packages attribute size
- * leaving space for an additional ITA Angel attribute
- */
- max_attr_size = state->get_max_msg_len(state) -
- PA_TNC_HEADER_SIZE - PA_TNC_ATTR_HEADER_SIZE;
-
- /* At least one IETF Installed Packages attribute is sent */
attr = ietf_attr_installed_packages_create();
- attr_size = PA_TNC_ATTR_HEADER_SIZE + IETF_INSTALLED_PACKAGES_MIN_SIZE;
enumerator = os->create_package_enumerator(os);
- if (enumerator)
+ while (enumerator->enumerate(enumerator, &name, &version))
{
- while (enumerator->enumerate(enumerator, &name, &version))
- {
- DBG2(DBG_IMC, "package '%.*s' (%.*s)",
- name.len, name.ptr, version.len, version.ptr);
-
- entry_size = 2 + name.len + version.len;
- if (attr_size + entry_size > max_attr_size)
- {
- if (first)
- {
- /**
- * Send an ITA Start Angel attribute to the IMV signalling
- * that multiple ITA Installed Package attributes follow.
- */
- attr_angel = ita_attr_angel_create(TRUE);
- msg->add_attribute(msg, attr_angel);
- first = FALSE;
- }
- msg->add_attribute(msg, attr);
-
- /* create the next IETF Installed Packages attribute */
- attr = ietf_attr_installed_packages_create();
- attr_size = PA_TNC_ATTR_HEADER_SIZE +
- IETF_INSTALLED_PACKAGES_MIN_SIZE;
- }
- attr_cast = (ietf_attr_installed_packages_t*)attr;
- attr_cast->add(attr_cast, name, version);
- attr_size += entry_size;
- }
- enumerator->destroy(enumerator);
+ DBG2(DBG_IMC, "package '%.*s' (%.*s)",
+ name.len, name.ptr, version.len, version.ptr);
+ attr_cast = (ietf_attr_installed_packages_t*)attr;
+ attr_cast->add(attr_cast, name, version);
}
- msg->add_attribute(msg, attr);
+ enumerator->destroy(enumerator);
- if (!first)
- {
- /**
- * If we sent an ITA Start Angel attribute in the first place,
- * terminate by appending a matching ITA Stop Angel attribute.
- */
- attr_angel = ita_attr_angel_create(FALSE);
- msg->add_attribute(msg, attr_angel);
- }
+ msg->add_attribute(msg, attr);
}
/**