*
* This can be implemented using different methods, and we allow
* the main service to be notified about changes to what we believe
- * is our external IPv4 address.
+ * is our external IPv4 address.
*
* Note that this is explicitly only about NATed systems; if one
* of our network interfaces has a global IP address this does
* not count as "external".
*
- * TODO:
- * - implement NEW logic for external IP detection based on traceroute!
- *
* @file nat/gnunet-service-nat_externalip.c
* @brief Functions for monitoring external IPv4 addresses
* @author Christian Grothoff
* Kept in DLL.
*/
struct GN_ExternalIPMonitor *prev;
-
+
/**
* Function to call when we believe our external IPv4 address changed.
*/
/**
* Tell relevant clients about a change in our external
* IPv4 address.
- *
+ *
* @param add #GNUNET_YES to add, #GNUNET_NO to remove
* @param v4 the external address that changed
*/
* We learn our current external IP address. If it changed,
* notify all of our applicable clients. Also re-schedule
* #run_external_ip with an appropriate timeout.
- *
+ *
* @param cls NULL
* @param addr the address, NULL on errors
* @param result #GNUNET_NAT_ERROR_SUCCESS on success, otherwise the specific error code
enum GNUNET_NAT_StatusCode result)
{
char buf[INET_ADDRSTRLEN];
-
+
probe_external_ip_op = NULL;
GNUNET_SCHEDULER_cancel (probe_external_ip_task);
probe_external_ip_task
if (0 != mini_external_ipv4.s_addr)
notify_monitors_external_ipv4_change (GNUNET_NO,
&mini_external_ipv4);
- mini_external_ipv4.s_addr = 0;
+ mini_external_ipv4.s_addr = 0;
break;
}
}
NULL);
return;
}
- if (GNUNET_NO == have_nat)
+ if (GNUNET_NO == have_nat)
{
if (NULL != probe_external_ip_task)
{
{
/* try to read more */
eh->off += ret;
- eh->task
+ eh->task
= GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
eh->r,
&read_external_ipv4,
GNUNET_DISK_PIPE_END_WRITE);
eh->r = GNUNET_DISK_pipe_handle (eh->opipe,
GNUNET_DISK_PIPE_END_READ);
- eh->task
+ eh->task
= GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
eh->r,
&read_external_ipv4,
{
(void) GNUNET_OS_process_kill (eh->eip,
SIGKILL);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_OS_process_wait (eh->eip));
GNUNET_OS_process_destroy (eh->eip);
}
if (NULL != eh->opipe)
sizeof (pstr),
"%u",
(unsigned int) mini->port);
- mini->map_cmd
+ mini->map_cmd
= GNUNET_OS_command_run (&process_map_output,
mini,
MAP_TIMEOUT,
struct GNUNET_NAT_MiniHandle *mini = cls;
int ac;
- mini->refresh_task
+ mini->refresh_task
= GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ,
&do_refresh,
mini);
mini->refresh_cmd = NULL;
ac = GNUNET_YES;
}
- mini->refresh_cmd
+ mini->refresh_cmd
= GNUNET_OS_command_run (&process_refresh_output,
mini,
MAP_TIMEOUT,
0,
GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED);
if (NULL == mini->refresh_task)
- mini->refresh_task
+ mini->refresh_task
= GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ,
&do_refresh,
mini);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Unmapping port %u with UPnP\n",
ntohs (mini->current_addr.sin_port));
- mini->unmap_cmd
+ mini->unmap_cmd
= GNUNET_OS_command_run (&process_unmap_output,
mini,
UNMAP_TIMEOUT,