- if(debug_lvl > 2)
- syslog(LOG_DEBUG, "Sending add host to " IP_ADDR_S,
- IP_ADDR_V(cl->vpn_ip));
+ real_ip = new_host->real_ip;
+ hostname = new_host->real_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->real_hostname;
+ }
+
+ if(debug_lvl > 1)
+ syslog(LOG_DEBUG, _("Sending ADD_HOST for %s (%s) to %s (%s)"),
+ new_host->vpn_hostname, hostname, cl->vpn_hostname, cl->real_hostname);