Support of HCD Firewall Setting PA-TNC attribute
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sun, 17 May 2015 15:04:46 +0000 (17:04 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 18 Aug 2015 19:25:38 +0000 (21:25 +0200)
src/libimcv/ietf/ietf_attr.c
src/libimcv/ietf/ietf_attr_port_filter.c
src/libimcv/ietf/ietf_attr_port_filter.h
src/libimcv/plugins/imc_scanner/imc_scanner.c
src/libimcv/pwg/pwg_attr.c

index d0f0439..575cc72 100644 (file)
@@ -62,7 +62,8 @@ pa_tnc_attr_t* ietf_attr_create_from_data(u_int32_t type, size_t length,
                case IETF_ATTR_OPERATIONAL_STATUS:
                        return ietf_attr_op_status_create_from_data(length, value);
                case IETF_ATTR_PORT_FILTER:
-                       return ietf_attr_port_filter_create_from_data(length, value);
+                       return ietf_attr_port_filter_create_from_data(length, value,
+                                                                       pen_type_create(PEN_IETF, type));
                case IETF_ATTR_INSTALLED_PACKAGES:
                        return ietf_attr_installed_packages_create_from_data(length, value);
                case IETF_ATTR_PA_TNC_ERROR:
index 4682440..6f7ff54 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2014 Andreas Steffen
+ * Copyright (C) 2011-2015 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -236,7 +236,7 @@ METHOD(ietf_attr_port_filter_t, create_port_enumerator, enumerator_t*,
 /**
  * Described in header.
  */
-pa_tnc_attr_t *ietf_attr_port_filter_create(void)
+pa_tnc_attr_t *ietf_attr_port_filter_create(pen_type_t type)
 {
        private_ietf_attr_port_filter_t *this;
 
@@ -256,7 +256,7 @@ pa_tnc_attr_t *ietf_attr_port_filter_create(void)
                        .add_port = _add_port,
                        .create_port_enumerator = _create_port_enumerator,
                },
-               .type = { PEN_IETF, IETF_ATTR_PORT_FILTER },
+               .type = type,
                .ports = linked_list_create(),
                .ref = 1,
        );
@@ -268,7 +268,7 @@ pa_tnc_attr_t *ietf_attr_port_filter_create(void)
  * Described in header.
  */
 pa_tnc_attr_t *ietf_attr_port_filter_create_from_data(size_t length,
-                                                                                                         chunk_t data)
+                                                                               chunk_t data, pen_type_t type)
 {
        private_ietf_attr_port_filter_t *this;
 
@@ -288,7 +288,7 @@ pa_tnc_attr_t *ietf_attr_port_filter_create_from_data(size_t length,
                        .add_port = _add_port,
                        .create_port_enumerator = _create_port_enumerator,
                },
-               .type = {PEN_IETF, IETF_ATTR_PORT_FILTER },
+               .type = type,
                .length = length,
                .value = chunk_clone(data),
                .ports = linked_list_create(),
index d383b19..e6c5a3f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2014 Andreas Steffen
+ * Copyright (C) 2011-2015 Andreas Steffen
  * HSR Hochschule fuer Technik Rapperswil
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -61,16 +61,18 @@ struct ietf_attr_port_filter_t {
 /**
  * Creates an ietf_attr_port_filter_t object
  *
+ * @param type                         Vendor ID / Attribute Type
  */
-pa_tnc_attr_t* ietf_attr_port_filter_create(void);
+pa_tnc_attr_t* ietf_attr_port_filter_create(pen_type_t type);
 
 /**
  * Creates an ietf_attr_port_filter_t object from received data
  *
  * @param length                       Total length of attribute value
  * @param value                                Unparsed attribute value (might be a segment)
+ * @param type                         Vendor ID / Attribute Type
  */
 pa_tnc_attr_t* ietf_attr_port_filter_create_from_data(size_t length,
-                                                                                                         chunk_t value);
+                                                                               chunk_t value, pen_type_t type);
 
 #endif /** IETF_ATTR_PORT_FILTER_H_ @}*/
index 0478841..10e8faf 100644 (file)
@@ -241,7 +241,8 @@ static TNC_Result add_port_filter(imc_msg_t *msg)
        pa_tnc_attr_t *attr;
        ietf_attr_port_filter_t *attr_port_filter;
 
-       attr = ietf_attr_port_filter_create();
+       attr = ietf_attr_port_filter_create(pen_type_create(PEN_IETF,
+                                                                               IETF_ATTR_PORT_FILTER));
        attr->set_noskip_flag(attr, TRUE);
        attr_port_filter = (ietf_attr_port_filter_t*)attr;
        if (!do_netstat(attr_port_filter))
index 9056a28..bbc8e02 100644 (file)
@@ -15,7 +15,9 @@
 
 #include "pwg_attr.h"
 
-#include <generic/generic_attr_bool.h>
+#include "generic/generic_attr_bool.h"
+#include "ietf/ietf_attr_port_filter.h"
+
 
 ENUM_BEGIN(pwg_attr_names,     PWG_HCD_ATTRS_NATURAL_LANG,
                                                        PWG_HCD_VENDOR_SMI_CODE,
@@ -81,11 +83,13 @@ pa_tnc_attr_t* pwg_attr_create_from_data(u_int32_t type, size_t length, chunk_t
                case PWG_HCD_PSTN_FAX_ENABLED:
                        return generic_attr_bool_create_from_data(length, value,
                                                                        pen_type_create(PEN_PWG, type));
+               case PWG_HCD_FIREWALL_SETTING:
+                       return ietf_attr_port_filter_create_from_data(length, value,
+                                                                       pen_type_create(PEN_PWG, type));
                case PWG_HCD_ATTRS_NATURAL_LANG:
                case PWG_HCD_MACHINE_TYPE_MODEL:
                case PWG_HCD_VENDOR_NAME:
                case PWG_HCD_VENDOR_SMI_CODE:
-               case PWG_HCD_FIREWALL_SETTING:
                case PWG_HCD_TIME_SOURCE:
                case PWG_HCD_FIRMWARE_NAME:
                case PWG_HCD_FIRMWARE_PATCHES: