ike-config: Ignore unrequested virtual IP addresses
authorTobias Brunner <tobias@strongswan.org>
Thu, 28 Mar 2019 17:44:08 +0000 (18:44 +0100)
committerTobias Brunner <tobias@strongswan.org>
Thu, 4 Apr 2019 09:06:20 +0000 (11:06 +0200)
But forward them to handlers in case they requested them.

src/libcharon/sa/ikev2/tasks/ike_config.c

index 4a8acb9..fdccda5 100644 (file)
@@ -42,6 +42,11 @@ struct private_ike_config_t {
        bool initiator;
 
        /**
+        * Did we request a virtual IP?
+        */
+       bool vip_requested;
+
+       /**
         * Received list of virtual IPs, host_t*
         */
        linked_list_t *vips;
@@ -149,6 +154,12 @@ static void process_attribute(private_ike_config_t *this,
                        /* fall */
                case INTERNAL_IP6_ADDRESS:
                {
+                       if (this->initiator && !this->vip_requested)
+                       {
+                               handle_attribute(this, ca);
+                               return;
+                       }
+
                        addr = ca->get_chunk(ca);
                        if (addr.len == 0)
                        {
@@ -270,6 +281,7 @@ METHOD(task_t, build_i, status_t,
                                cp->add_attribute(cp, build_vip(host));
                        }
                        enumerator->destroy(enumerator);
+                       this->vip_requested = TRUE;
                }
 
                enumerator = charon->attributes->create_initiator_enumerator(