diff options
Diffstat (limited to 'src/nat')
-rw-r--r-- | src/nat/nat.c | 11 | ||||
-rw-r--r-- | src/nat/nat_stun.c | 10 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/nat/nat.c b/src/nat/nat.c index 270365425..42fe843e3 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c | |||
@@ -1115,9 +1115,16 @@ static void stun_request_callback(void *cls, | |||
1115 | 1115 | ||
1116 | struct GNUNET_NAT_Handle *h = cls; | 1116 | struct GNUNET_NAT_Handle *h = cls; |
1117 | 1117 | ||
1118 | if(NULL == cls) | ||
1119 | return; | ||
1120 | |||
1118 | h->waiting_stun = GNUNET_NO; | 1121 | h->waiting_stun = GNUNET_NO; |
1119 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1122 | |
1123 | if(result != GNUNET_OK) | ||
1124 | { | ||
1125 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
1120 | "Error processing a STUN request"); | 1126 | "Error processing a STUN request"); |
1127 | } | ||
1121 | 1128 | ||
1122 | }; | 1129 | }; |
1123 | 1130 | ||
@@ -1131,7 +1138,7 @@ static void stun_request_callback(void *cls, | |||
1131 | * @return GNUNET_NO if it can't decode, GNUNET_YES if is a packet | 1138 | * @return GNUNET_NO if it can't decode, GNUNET_YES if is a packet |
1132 | */ | 1139 | */ |
1133 | int | 1140 | int |
1134 | GNUNET_NAT_try_decode_stun_packet(void *cls, const uint8_t *data, size_t len) | 1141 | GNUNET_NAT_try_decode_stun_packet(void *cls, const void *data, size_t len) |
1135 | { | 1142 | { |
1136 | struct GNUNET_NAT_Handle *h = cls; | 1143 | struct GNUNET_NAT_Handle *h = cls; |
1137 | struct sockaddr_in answer; | 1144 | struct sockaddr_in answer; |
diff --git a/src/nat/nat_stun.c b/src/nat/nat_stun.c index 5e502c29e..5fff40656 100644 --- a/src/nat/nat_stun.c +++ b/src/nat/nat_stun.c | |||
@@ -334,7 +334,7 @@ stun_get_mapped(struct StunState *st, struct stun_attr *attr,struct sockaddr_in | |||
334 | * @return, GNUNET_OK on OK, GNUNET_NO if the packet is invalid ( not a stun packet) | 334 | * @return, GNUNET_OK on OK, GNUNET_NO if the packet is invalid ( not a stun packet) |
335 | */ | 335 | */ |
336 | int | 336 | int |
337 | GNUNET_NAT_stun_handle_packet(const uint8_t *data, size_t len,struct sockaddr_in *arg) | 337 | GNUNET_NAT_stun_handle_packet(const void *data, size_t len, struct sockaddr_in *arg) |
338 | { | 338 | { |
339 | struct stun_header *hdr = (struct stun_header *)data; | 339 | struct stun_header *hdr = (struct stun_header *)data; |
340 | struct stun_attr *attr; | 340 | struct stun_attr *attr; |
@@ -463,8 +463,9 @@ stun_dns_callback (void *cls, | |||
463 | 463 | ||
464 | if( GNUNET_NO == request->dns_success){ | 464 | if( GNUNET_NO == request->dns_success){ |
465 | LOG (GNUNET_ERROR_TYPE_INFO, "Empty request\n"); | 465 | LOG (GNUNET_ERROR_TYPE_INFO, "Empty request\n"); |
466 | clean(request); | ||
467 | request->cb(request->cb_cls, GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); | 466 | request->cb(request->cb_cls, GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); |
467 | clean(request); | ||
468 | |||
468 | } | 469 | } |
469 | return; | 470 | return; |
470 | } | 471 | } |
@@ -474,8 +475,9 @@ stun_dns_callback (void *cls, | |||
474 | 475 | ||
475 | if( GNUNET_NO == request->dns_success){ | 476 | if( GNUNET_NO == request->dns_success){ |
476 | LOG (GNUNET_ERROR_TYPE_INFO, "Error resolving host %s\n", request->stun_server); | 477 | LOG (GNUNET_ERROR_TYPE_INFO, "Error resolving host %s\n", request->stun_server); |
477 | clean(request); | ||
478 | request->cb(request->cb_cls, GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); | 478 | request->cb(request->cb_cls, GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); |
479 | clean(request); | ||
480 | |||
479 | } | 481 | } |
480 | 482 | ||
481 | return; | 483 | return; |
@@ -503,8 +505,8 @@ stun_dns_callback (void *cls, | |||
503 | (const struct sockaddr *) &server, sizeof (server))) | 505 | (const struct sockaddr *) &server, sizeof (server))) |
504 | { | 506 | { |
505 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "Fail to sendto"); | 507 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "Fail to sendto"); |
506 | clean(request); | ||
507 | request->cb(request->cb_cls, GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); | 508 | request->cb(request->cb_cls, GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR); |
509 | clean(request); | ||
508 | return; | 510 | return; |
509 | } | 511 | } |
510 | 512 | ||