- if(!(to = lookup_id(to_id)))
- {
- syslog(LOG_ERR, _("Got ANS_KEY from %s (%s) destination %s which does not exist in our connection list"),
- cl->name, cl->hostname, to_id);
- free(from_id); free(to_id); free(datakey);
- return -1;
- }
- send_ans_key(from, to, datakey);
+ send_ans_key(to->nexthop->connection, from, to, key);
+ }
+
+ /* Update our copy of the origin's packet key */
+
+ if(from->key)
+ free(from->key);
+
+ from->key = xstrdup(key);
+ keylength /= 2;
+ hex2bin(from->key, from->key, keylength);
+ from->key[keylength] = '\0';
+
+ from->status.validkey = 1;
+ from->status.waitingforkey = 0;
+
+ flush_queue(from);
+cp
+ return 0;
+}
+
+int send_tcppacket(connection_t *c, vpn_packet_t *packet)
+{
+ int x;
+cp
+ /* Evil hack. */
+
+ x = send_request(c, "%d %hd", PACKET, packet->len);
+
+ if(x)
+ return x;
+cp
+ return send_meta(c, packet->data, packet->len);
+}
+
+int tcppacket_h(connection_t *c)
+{
+ short int len;
+cp
+ if(sscanf(c->buffer, "%*d %hd", &len) != 1)
+ {
+ syslog(LOG_ERR, _("Got bad %s from %s (%s)"), "PACKET", c->name, c->hostname);
+ return -1;