+
+ /* Now we can add the name to the id tree */
+
+ id_add(cl);
+
+ /* And uhr... cl->port just changed so we have to unlink it from the connection tree and re-insert... */
+
+ node = avl_unlink(connection_tree, cl);
+ cl->port = port;
+ avl_insert_node(connection_tree, node);
+
+ /* Read in the public key, so that we can send a metakey */
+
+ if(read_rsa_public_key(cl))
+ return -1;
+
+ cl->allow_request = METAKEY;
+cp
+ return send_metakey(cl);
+}
+
+int ack_h(connection_t *cl)
+{
+ config_t const *cfg;
+ connection_t *old, *p;
+ subnet_t *subnet;
+ avl_node_t *node, *node2;
+cp
+ /* Okay, before we active the connection, we check if there is another entry
+ in the connection list with the same name. If so, it presumably is an
+ old connection that has timed out but we don't know it yet.
+ */
+
+ while((old = lookup_id(cl->name)))
+ {
+ if(debug_lvl >= DEBUG_CONNECTIONS)
+ syslog(LOG_NOTICE, _("Removing old entry for %s at %s in favour of new connection from %s"),
+ cl->name, old->hostname, cl->hostname);
+
+ terminate_connection(old);
+ }
+
+ /* Activate this connection */
+
+ cl->allow_request = ALL;
+ cl->status.active = 1;
+ cl->nexthop = cl;
+ cl->cipher_pkttype = EVP_bf_cbc();
+ cl->cipher_pktkeylength = cl->cipher_pkttype->key_len + cl->cipher_pkttype->iv_len;
+
+ if(debug_lvl >= DEBUG_CONNECTIONS)
+ syslog(LOG_NOTICE, _("Connection with %s (%s) activated"), cl->name, cl->hostname);
+
+cp
+ /* Check some options */
+
+ if((cfg = get_config_val(cl->config, config_indirectdata)))