+int send_tcppacket(connection_t *cl, vpn_packet_t *packet)
+{
+ int x;
+
+ x = send_request(cl->nexthop, "%d %hd", PACKET, packet->len);
+
+ if(x)
+ return x;
+
+ return send_meta(cl->nexthop, packet->data, packet->len);
+}
+
+int tcppacket_h(connection_t *cl)
+{
+ vpn_packet_t packet;
+ char *p;
+ int todo, x;
+
+ if(sscanf(cl->buffer, "%*d %hd", packet.len) != 1)
+ {
+ syslog(LOG_ERR, _("Got bad PACKET from %s (%s)"), cl->name, cl->hostname);
+ return -1;
+ }
+
+ /* Evil hack. */
+
+ p = packet.data;
+ todo = packet.len;
+
+ while(todo)
+ {
+ x = read(cl->meta_socket, p, todo);
+ if(x<0)
+ {
+ syslog(LOG_ERR, _("Error during reception of PACKET from %s (%s): %m"), cl->name, cl->hostname);
+ return -1;
+ }
+
+ todo -= x;
+ p += x;
+ }
+
+ return receive_packet(cl, &packet);
+}
+