From 3d1b8b823e1d10ebcf94e02868c6e24b762a07fc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 7 Jul 2015 21:41:29 +0000 Subject: do not add our virtual interfaces to our HELLO --- src/nat/nat.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) (limited to 'src/nat') diff --git a/src/nat/nat.c b/src/nat/nat.c index cc78b7045..3fcfbd2f1 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c @@ -69,7 +69,7 @@ enum LocalAddressSource * given in the configuration (i.e. hole-punched DynDNS setup). */ LAL_EXTERNAL_IP, - + /** * Address was obtained by an external STUN server */ @@ -664,10 +664,13 @@ process_hostname_ip (void *cls, * @return #GNUNET_OK to continue iterating */ static int -process_interfaces (void *cls, const char *name, int isDefault, +process_interfaces (void *cls, + const char *name, + int isDefault, const struct sockaddr *addr, const struct sockaddr *broadcast_addr, - const struct sockaddr *netmask, socklen_t addrlen) + const struct sockaddr *netmask, + socklen_t addrlen) { const static struct in6_addr any6 = IN6ADDR_ANY_INIT; struct GNUNET_NAT_Handle *h = cls; @@ -677,6 +680,51 @@ process_interfaces (void *cls, const char *name, int isDefault, char buf[INET6_ADDRSTRLEN]; unsigned int i; int have_any; + char *tun_if; + + /* skip virtual interfaces created by GNUnet-vpn */ + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (h->cfg, + "vpn", + "IFNAME", + &tun_if)) + { + if (0 == strcmp (name, + tun_if)) + { + GNUNET_free (tun_if); + return GNUNET_OK; + } + } + /* skip virtual interfaces created by GNUnet-dns */ + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (h->cfg, + "dns", + "IFNAME", + &tun_if)) + { + if (0 == strcmp (name, + tun_if)) + { + GNUNET_free (tun_if); + return GNUNET_OK; + } + } + /* skip virtual interfaces created by GNUnet-exit */ + if (GNUNET_OK == + GNUNET_CONFIGURATION_get_value_string (h->cfg, + "exit", + "EXIT_IFNAME", + &tun_if)) + { + if (0 == strcmp (name, + tun_if)) + { + GNUNET_free (tun_if); + return GNUNET_OK; + } + } + switch (addr->sa_family) { -- cgit v1.2.3