- memset(&tmp, 0, sizeof(tmp));
- tmp.type = ADD_HOST;
- tmp.real_ip = new_host->real_ip;
- tmp.vpn_ip = new_host->vpn_ip;
- tmp.vpn_mask = new_host->vpn_mask;
- tmp.portnr = new_host->port;
+ real_ip = new_host->real_ip;
+ hostname = new_host->hostname;
+ flags = new_host->flags;
+
+ /* If we need to propagate information about a new host that wants us to export
+ * it's indirectdata flag, we set the INDIRECTDATA flag and unset the EXPORT...
+ * flag, and set it's real_ip to our vpn_ip, so that net.c send_packet() will
+ * work correctly.
+ */
+
+ if(flags & EXPORTINDIRECTDATA)
+ {
+ flags &= ~EXPORTINDIRECTDATA;
+ flags |= INDIRECTDATA;
+ real_ip = myself->vpn_ip;
+ hostname = myself->hostname;
+ }
+
+ if(debug_lvl > 1)
+ syslog(LOG_DEBUG, _("Sending ADD_HOST for " IP_ADDR_S " (%s) to " IP_ADDR_S " (%s)"),
+ IP_ADDR_V(new_host->vpn_ip), hostname, IP_ADDR_V(cl->vpn_ip), cl->hostname);