Store the peer's current address as additional known address on the IKE_SA.
authorTobias Brunner <tobias@strongswan.org>
Fri, 9 Mar 2012 09:03:08 +0000 (10:03 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 9 Mar 2012 09:08:41 +0000 (10:08 +0100)
This allows to switch back to the original address after switching to
any of the additional addresses.

src/libcharon/sa/tasks/ike_mobike.c

index da8834c..0539b7d 100644 (file)
@@ -136,6 +136,10 @@ static void process_payloads(private_ike_mobike_t *this, message_t *message)
                                {       /* an ADDITIONAL_*_ADDRESS means replace, so flush once */
                                        this->ike_sa->remove_additional_addresses(this->ike_sa);
                                        first = FALSE;
+                                       /* add the peer's current address to the list */
+                                       host = this->ike_sa->get_other_host(this->ike_sa);
+                                       this->ike_sa->add_additional_address(this->ike_sa,
+                                                                                                                host->clone(host));
                                }
                                data = notify->get_notification_data(notify);
                                host = host_create_from_chunk(family, data, 0);
@@ -152,6 +156,10 @@ static void process_payloads(private_ike_mobike_t *this, message_t *message)
                        case NO_ADDITIONAL_ADDRESSES:
                        {
                                this->ike_sa->remove_additional_addresses(this->ike_sa);
+                               /* add the peer's current address to the list */
+                               host = this->ike_sa->get_other_host(this->ike_sa);
+                               this->ike_sa->add_additional_address(this->ike_sa,
+                                                                                                        host->clone(host));
                                this->addresses_updated = TRUE;
                                break;
                        }