]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Synchronize IKEv1 DPD sequence numbers
authorMartin Willi <martin@revosec.ch>
Fri, 20 Jan 2012 11:23:46 +0000 (12:23 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:38 +0000 (17:31 +0100)
src/libcharon/plugins/ha/ha_ike.c

index 09899a8f69a82d301ef61bd42650d577c8a155c7..c8ad0f84519c308c9bdc9fa06348113951ae7b23 100644 (file)
@@ -323,6 +323,36 @@ METHOD(listener_t, message_hook, bool,
                        }
                }
        }
+       if (plain && ike_sa->get_version(ike_sa) == IKEV1 &&
+               message->get_exchange_type(message) == INFORMATIONAL_V1)
+       {
+               ha_message_t *m;
+               notify_payload_t *notify;
+               chunk_t data;
+               u_int32_t seq;
+
+               notify = message->get_notify(message, DPD_R_U_THERE);
+               if (notify)
+               {
+                       data = notify->get_notification_data(notify);
+                       if (data.len == 4)
+                       {
+                               seq = untoh32(data.ptr);
+                               if (incoming)
+                               {
+                                       m = ha_message_create(HA_IKE_MID_RESPONDER);
+                               }
+                               else
+                               {
+                                       m = ha_message_create(HA_IKE_MID_INITIATOR);
+                               }
+                               m->add_attribute(m, HA_IKE_ID, ike_sa->get_id(ike_sa));
+                               m->add_attribute(m, HA_MID, seq + 1);
+                               this->socket->push(this->socket, m);
+                               this->cache->cache(this->cache, ike_sa, m);
+                       }
+               }
+       }
        return TRUE;
 }