apply maximum RADIUS attribute size to outbound EAP messages
authorAndreas Steffen <andreas.steffen@strongswan.org>
Fri, 9 Mar 2012 09:20:44 +0000 (10:20 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 13 Mar 2012 15:27:17 +0000 (16:27 +0100)
src/libcharon/plugins/tnc_pdp/tnc_pdp.c

index 6daae8f..1ef87f2 100644 (file)
@@ -189,6 +189,15 @@ static void send_response(private_tnc_pdp_t *this,
        if (eap)
        {
                data = eap->get_data(eap);
+               DBG3(DBG_CFG, "%N payload %B", eap_type_names, this->type, &data);
+
+               /* fragment data suitable for RADIUS */
+               while (data.len > MAX_RADIUS_ATTRIBUTE_SIZE)
+               {
+                       response->add(response, RAT_EAP_MESSAGE,
+                                                 chunk_create(data.ptr,MAX_RADIUS_ATTRIBUTE_SIZE));
+                       data = chunk_skip(data, MAX_RADIUS_ATTRIBUTE_SIZE);
+               }
                response->add(response, RAT_EAP_MESSAGE, data);
        }
        response->set_identifier(response, request->get_identifier(request));