GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
#include "gnunet_nat_lib.h"
/* Time to wait before stopping NAT, in seconds */
-#define TIMEOUT 30
+#define TIMEOUT 60
struct addr_cls
{
const struct sockaddr *addr;
socklen_t addrlen;
};
-//typedef addr_cls addr_cls;
static void
addr_callback (void *cls, int add_remove,
static int
process_if (void *cls,
const char *name,
- int isDefault,
- const struct sockaddr *addr,
- socklen_t addrlen)
+ int isDefault, const struct sockaddr *addr, socklen_t addrlen)
{
struct addr_cls *data = cls;
data->addrlen = addrlen;
}
+ if (strcmp (name, "eth1") == 0 && addr->sa_family == AF_INET)
+ return GNUNET_SYSERR;
+
+ return GNUNET_OK;
+
+
if (isDefault && addr)
return GNUNET_SYSERR;
else
GNUNET_OS_network_interfaces_list (process_if, &data);
if (!data.addr)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not find a valid interface address!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not find a valid interface address!\n");
exit (GNUNET_SYSERR);
}
else
((struct sockaddr_in6 *) addr)->sin6_port = htons (2086);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Requesting NAT redirection from address %s...\n", GNUNET_a2s (addr, data.addrlen));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Requesting NAT redirection from address %s...\n",
+ GNUNET_a2s (addr, data.addrlen));
nat = GNUNET_NAT_register (sched, addr, data.addrlen, addr_callback, NULL);
GNUNET_free (addr);
- GNUNET_SCHEDULER_add_delayed (sched,
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, TIMEOUT),
- stop, nat);
+ GNUNET_SCHEDULER_add_delayed (sched,
+ GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_SECONDS, TIMEOUT), stop,
+ nat);
}
int