aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-09 16:57:01 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-09 16:57:11 +0100
commitfd58a3abc404e67e96901e48436922937ea1d629 (patch)
treeaad2e3619fbac8ad881fde59a6d257a4779be998 /src/nat/nat_api.c
parentc0862506a76c168626ecfd32989fd6718c67ff89 (diff)
downloadgnunet-fd58a3abc404e67e96901e48436922937ea1d629.tar.gz
gnunet-fd58a3abc404e67e96901e48436922937ea1d629.zip
fix issue with NAT logic overwriting port specified by user in manual hole punch; adding some logging
Diffstat (limited to 'src/nat/nat_api.c')
-rw-r--r--src/nat/nat_api.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c
index eec5d3968..dfe7defc9 100644
--- a/src/nat/nat_api.c
+++ b/src/nat/nat_api.c
@@ -52,7 +52,7 @@ struct AddrEntry
52 * Address class of the address. 52 * Address class of the address.
53 */ 53 */
54 enum GNUNET_NAT_AddressClass ac; 54 enum GNUNET_NAT_AddressClass ac;
55 55
56 /** 56 /**
57 * Number of bytes that follow. 57 * Number of bytes that follow.
58 */ 58 */
@@ -70,7 +70,7 @@ struct GNUNET_NAT_Handle
70 * Configuration we use. 70 * Configuration we use.
71 */ 71 */
72 const struct GNUNET_CONFIGURATION_Handle *cfg; 72 const struct GNUNET_CONFIGURATION_Handle *cfg;
73 73
74 /** 74 /**
75 * Message queue for communicating with the NAT service. 75 * Message queue for communicating with the NAT service.
76 */ 76 */
@@ -80,7 +80,7 @@ struct GNUNET_NAT_Handle
80 * Our registration message. 80 * Our registration message.
81 */ 81 */
82 struct GNUNET_MessageHeader *reg; 82 struct GNUNET_MessageHeader *reg;
83 83
84 /** 84 /**
85 * Head of address DLL. 85 * Head of address DLL.
86 */ 86 */
@@ -95,12 +95,12 @@ struct GNUNET_NAT_Handle
95 * Function to call when our addresses change. 95 * Function to call when our addresses change.
96 */ 96 */
97 GNUNET_NAT_AddressCallback address_callback; 97 GNUNET_NAT_AddressCallback address_callback;
98 98
99 /** 99 /**
100 * Function to call when another peer requests connection reversal. 100 * Function to call when another peer requests connection reversal.
101 */ 101 */
102 GNUNET_NAT_ReversalCallback reversal_callback; 102 GNUNET_NAT_ReversalCallback reversal_callback;
103 103
104 /** 104 /**
105 * Closure for the various callbacks. 105 * Closure for the various callbacks.
106 */ 106 */
@@ -136,7 +136,7 @@ static void
136reconnect (struct GNUNET_NAT_Handle *nh) 136reconnect (struct GNUNET_NAT_Handle *nh)
137{ 137{
138 struct AddrEntry *ae; 138 struct AddrEntry *ae;
139 139
140 if (NULL != nh->mq) 140 if (NULL != nh->mq)
141 { 141 {
142 GNUNET_MQ_destroy (nh->mq); 142 GNUNET_MQ_destroy (nh->mq);
@@ -184,7 +184,7 @@ check_connection_reversal_request (void *cls,
184 return GNUNET_OK; 184 return GNUNET_OK;
185} 185}
186 186
187 187
188/** 188/**
189 * Handle connection reversal request. 189 * Handle connection reversal request.
190 * 190 *
@@ -247,7 +247,7 @@ check_address_change_notification (void *cls,
247 return GNUNET_OK; 247 return GNUNET_OK;
248} 248}
249 249
250 250
251/** 251/**
252 * Handle connection reversal request. 252 * Handle connection reversal request.
253 * 253 *
@@ -264,6 +264,8 @@ handle_address_change_notification (void *cls,
264 enum GNUNET_NAT_AddressClass ac; 264 enum GNUNET_NAT_AddressClass ac;
265 struct AddrEntry *ae; 265 struct AddrEntry *ae;
266 266
267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
268 "Received address change notification\n");
267 ac = (enum GNUNET_NAT_AddressClass) ntohl (acn->addr_class); 269 ac = (enum GNUNET_NAT_AddressClass) ntohl (acn->addr_class);
268 if (GNUNET_YES == ntohl (acn->add_remove)) 270 if (GNUNET_YES == ntohl (acn->add_remove))
269 { 271 {
@@ -395,7 +397,7 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
395 size_t len; 397 size_t len;
396 size_t str_len; 398 size_t str_len;
397 char *off; 399 char *off;
398 400
399 len = 0; 401 len = 0;
400 for (unsigned int i=0;i<num_addrs;i++) 402 for (unsigned int i=0;i<num_addrs;i++)
401 len += addrlens[i]; 403 len += addrlens[i];
@@ -569,7 +571,7 @@ test_stun_packet (const void *data,
569 * 571 *
570 * The function does some basic sanity checks on packet size and 572 * The function does some basic sanity checks on packet size and
571 * content, try to extract a bit of information. 573 * content, try to extract a bit of information.
572 * 574 *
573 * At the moment this only processes BIND requests, and returns the 575 * At the moment this only processes BIND requests, and returns the
574 * externally visible address of the request to the rest of the 576 * externally visible address of the request to the rest of the
575 * NAT logic. 577 * NAT logic.
@@ -663,7 +665,7 @@ GNUNET_NAT_test_address (struct GNUNET_NAT_Handle *nh,
663 * @param nh handle (used for configuration) 665 * @param nh handle (used for configuration)
664 * @param local_sa our local address of the peer (IPv4-only) 666 * @param local_sa our local address of the peer (IPv4-only)
665 * @param remote_sa the remote address of the peer (IPv4-only) 667 * @param remote_sa the remote address of the peer (IPv4-only)
666 * @return #GNUNET_SYSERR on error, 668 * @return #GNUNET_SYSERR on error,
667 * #GNUNET_NO if connection reversal is unavailable, 669 * #GNUNET_NO if connection reversal is unavailable,
668 * #GNUNET_OK otherwise (presumably in progress) 670 * #GNUNET_OK otherwise (presumably in progress)
669 */ 671 */