aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-07-07 21:41:29 +0000
committerChristian Grothoff <christian@grothoff.org>2015-07-07 21:41:29 +0000
commit3d1b8b823e1d10ebcf94e02868c6e24b762a07fc (patch)
treee1f466eae520fd1ea8148bba7b53d6fcaf30f1b5 /src
parente99757657ac5245b22203026e15441cd5c662a4f (diff)
downloadgnunet-3d1b8b823e1d10ebcf94e02868c6e24b762a07fc.tar.gz
gnunet-3d1b8b823e1d10ebcf94e02868c6e24b762a07fc.zip
do not add our virtual interfaces to our HELLO
Diffstat (limited to 'src')
-rw-r--r--src/nat/nat.c54
1 files changed, 51 insertions, 3 deletions
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
69 * given in the configuration (i.e. hole-punched DynDNS setup). 69 * given in the configuration (i.e. hole-punched DynDNS setup).
70 */ 70 */
71 LAL_EXTERNAL_IP, 71 LAL_EXTERNAL_IP,
72 72
73 /** 73 /**
74 * Address was obtained by an external STUN server 74 * Address was obtained by an external STUN server
75 */ 75 */
@@ -664,10 +664,13 @@ process_hostname_ip (void *cls,
664 * @return #GNUNET_OK to continue iterating 664 * @return #GNUNET_OK to continue iterating
665 */ 665 */
666static int 666static int
667process_interfaces (void *cls, const char *name, int isDefault, 667process_interfaces (void *cls,
668 const char *name,
669 int isDefault,
668 const struct sockaddr *addr, 670 const struct sockaddr *addr,
669 const struct sockaddr *broadcast_addr, 671 const struct sockaddr *broadcast_addr,
670 const struct sockaddr *netmask, socklen_t addrlen) 672 const struct sockaddr *netmask,
673 socklen_t addrlen)
671{ 674{
672 const static struct in6_addr any6 = IN6ADDR_ANY_INIT; 675 const static struct in6_addr any6 = IN6ADDR_ANY_INIT;
673 struct GNUNET_NAT_Handle *h = cls; 676 struct GNUNET_NAT_Handle *h = cls;
@@ -677,6 +680,51 @@ process_interfaces (void *cls, const char *name, int isDefault,
677 char buf[INET6_ADDRSTRLEN]; 680 char buf[INET6_ADDRSTRLEN];
678 unsigned int i; 681 unsigned int i;
679 int have_any; 682 int have_any;
683 char *tun_if;
684
685 /* skip virtual interfaces created by GNUnet-vpn */
686 if (GNUNET_OK ==
687 GNUNET_CONFIGURATION_get_value_string (h->cfg,
688 "vpn",
689 "IFNAME",
690 &tun_if))
691 {
692 if (0 == strcmp (name,
693 tun_if))
694 {
695 GNUNET_free (tun_if);
696 return GNUNET_OK;
697 }
698 }
699 /* skip virtual interfaces created by GNUnet-dns */
700 if (GNUNET_OK ==
701 GNUNET_CONFIGURATION_get_value_string (h->cfg,
702 "dns",
703 "IFNAME",
704 &tun_if))
705 {
706 if (0 == strcmp (name,
707 tun_if))
708 {
709 GNUNET_free (tun_if);
710 return GNUNET_OK;
711 }
712 }
713 /* skip virtual interfaces created by GNUnet-exit */
714 if (GNUNET_OK ==
715 GNUNET_CONFIGURATION_get_value_string (h->cfg,
716 "exit",
717 "EXIT_IFNAME",
718 &tun_if))
719 {
720 if (0 == strcmp (name,
721 tun_if))
722 {
723 GNUNET_free (tun_if);
724 return GNUNET_OK;
725 }
726 }
727
680 728
681 switch (addr->sa_family) 729 switch (addr->sa_family)
682 { 730 {