aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-02-27 15:23:32 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-02-27 15:23:32 +0000
commitc1c6696c6b32012a29a6f77feb71a824f2c767ac (patch)
tree241acd35e04712b28533fba674334c90ae7df633 /src
parentb3a4d46c665b2e11700c4d1b8d898dbe8fd3b3f5 (diff)
downloadgnunet-c1c6696c6b32012a29a6f77feb71a824f2c767ac.tar.gz
gnunet-c1c6696c6b32012a29a6f77feb71a824f2c767ac.zip
- improved nat handling
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_udp.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 6f190de20..7141563a2 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -762,6 +762,8 @@ udp_plugin_get_session (void *cls,
762{ 762{
763 struct Session * s = NULL; 763 struct Session * s = NULL;
764 struct Plugin * plugin = cls; 764 struct Plugin * plugin = cls;
765 struct IPv6UdpAddress * udp_a6;
766 struct IPv4UdpAddress * udp_a4;
765 767
766 GNUNET_assert (plugin != NULL); 768 GNUNET_assert (plugin != NULL);
767 GNUNET_assert (address != NULL); 769 GNUNET_assert (address != NULL);
@@ -775,14 +777,23 @@ udp_plugin_get_session (void *cls,
775 return NULL; 777 return NULL;
776 } 778 }
777 779
778 if ((address->address_length == sizeof (struct IPv4UdpAddress)) && 780 if (address->address_length == sizeof (struct IPv4UdpAddress))
779 (plugin->sockv4 == NULL)) 781 {
780 return NULL; 782 if (plugin->sockv4 == NULL)
781 783 return NULL;
782 if ((address->address_length == sizeof (struct IPv6UdpAddress)) && 784 udp_a4 = (struct IPv4UdpAddress *) address->address;
783 (plugin->sockv6 == NULL)) 785 if (udp_a4->u4_port == 0)
784 return NULL; 786 return NULL;
787 }
785 788
789 if (address->address_length == sizeof (struct IPv6UdpAddress))
790 {
791 if (plugin->sockv6 == NULL)
792 return NULL;
793 udp_a6 = (struct IPv6UdpAddress *) address->address;
794 if (udp_a6->u6_port == 0)
795 return NULL;
796 }
786 797
787 /* check if session already exists */ 798 /* check if session already exists */
788 struct SessionCompareContext cctx; 799 struct SessionCompareContext cctx;