+ /* If we ourselves have indirectdata flag set, we should send only to our uplink! */
+
+ if(myself->flags & EXPORTINDIRECTDATA)
+ {
+ for(cl = conn_list; cl != NULL && !cl->status.outgoing; cl = cl->next);
+ if(!cl)
+ { /* No open outgoing connection has been found. */
+ if(debug_lvl > 3)
+ syslog(LOG_NOTICE, _("There is no remote host I can send this packet to!"));
+ return -1;
+ }
+ }
+ else
+
+ /* If indirectdata flag is set for the destination we just looked up,
+ * then real_ip is actually the vpn_ip of the gateway tincd
+ * it is behind.
+ */
+
+ if(cl->flags & INDIRECTDATA)
+ {
+ if((cl = lookup_conn(cl->vpn_ip)) == NULL)
+ {
+ if(debug_lvl > 3)
+ {
+ syslog(LOG_NOTICE, _("Indirect look up " IP_ADDR_S " in connection list failed!"),
+ IP_ADDR_V(to));
+ }
+
+ /* Gateway tincd dead? Should we kill it? (GS) */
+
+ return -1;
+ }
+ if(cl->flags & INDIRECTDATA) /* This should not happen */
+ if(debug_lvl > 3)
+ {
+ syslog(LOG_NOTICE, _("double indirection for " IP_ADDR_S),
+ IP_ADDR_V(to));
+ }
+ return -1;
+ }
+