mirror of
https://github.com/coturn/coturn.git
synced 2025-11-01 07:21:04 +01:00
Mobility ticket retransmission fixed.
This commit is contained in:
parent
e8e571778a
commit
4f94e42494
@ -1,6 +1,7 @@
|
|||||||
08/22/2014 Oleg Moskalenko <mom040267@gmail.com>
|
08/22/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||||
Version 4.1.2.2 'Vitari':
|
Version 4.1.2.2 'Vitari':
|
||||||
- SHA-256 memory leak fixed.
|
- SHA-256 memory leak fixed.
|
||||||
|
- Mobility ticket retransmission fixed.
|
||||||
|
|
||||||
08/14/2014 Oleg Moskalenko <mom040267@gmail.com>
|
08/14/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||||
Version 4.1.2.1 'Vitari':
|
Version 4.1.2.1 'Vitari':
|
||||||
|
|||||||
@ -665,6 +665,11 @@ static int clnet_allocate(int verbose,
|
|||||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "refresh sent\n");
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "refresh sent\n");
|
||||||
}
|
}
|
||||||
refresh_sent = 1;
|
refresh_sent = 1;
|
||||||
|
|
||||||
|
if(clnet_info->s_mobile_id[0]) {
|
||||||
|
usleep(10000);
|
||||||
|
send_buffer(clnet_info, &message, 0,0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
perror("send");
|
perror("send");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -682,6 +687,10 @@ static int clnet_allocate(int verbose,
|
|||||||
|
|
||||||
int len = recv_buffer(clnet_info, &message, 1, 0);
|
int len = recv_buffer(clnet_info, &message, 1, 0);
|
||||||
|
|
||||||
|
if(clnet_info->s_mobile_id[0]) {
|
||||||
|
len = recv_buffer(clnet_info, &message, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
|
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
|
||||||
|
|||||||
@ -1411,9 +1411,6 @@ static int handle_turn_refresh(turn_turnserver *server,
|
|||||||
if(!(*(server->mobility))) {
|
if(!(*(server->mobility))) {
|
||||||
*err_code = 405;
|
*err_code = 405;
|
||||||
*reason = (const u08bits *)"Mobility forbidden";
|
*reason = (const u08bits *)"Mobility forbidden";
|
||||||
} if(is_allocation_valid(a)) {
|
|
||||||
*err_code = 400;
|
|
||||||
*reason = (const u08bits *)"Mobility ticket cannot be used for a stable, already established allocation";
|
|
||||||
} else {
|
} else {
|
||||||
int smid_len = stun_attr_get_len(sar);
|
int smid_len = stun_attr_get_len(sar);
|
||||||
if(smid_len>0 && (((size_t)smid_len)<sizeof(smid))) {
|
if(smid_len>0 && (((size_t)smid_len)<sizeof(smid))) {
|
||||||
@ -1421,6 +1418,10 @@ static int handle_turn_refresh(turn_turnserver *server,
|
|||||||
if(smid_val) {
|
if(smid_val) {
|
||||||
ns_bcopy(smid_val, smid, (size_t)smid_len);
|
ns_bcopy(smid_val, smid, (size_t)smid_len);
|
||||||
mid = string_to_mobile_id(smid);
|
mid = string_to_mobile_id(smid);
|
||||||
|
if(is_allocation_valid(a) && (mid != ss->old_mobile_id)) {
|
||||||
|
*err_code = 400;
|
||||||
|
*reason = (const u08bits *)"Mobility ticket cannot be used for a stable, already established allocation";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*err_code = 400;
|
*err_code = 400;
|
||||||
@ -1610,6 +1611,7 @@ static int handle_turn_refresh(turn_turnserver *server,
|
|||||||
//Use new buffer and redefine ss:
|
//Use new buffer and redefine ss:
|
||||||
nbh = ioa_network_buffer_allocate(server->e);
|
nbh = ioa_network_buffer_allocate(server->e);
|
||||||
ss = orig_ss;
|
ss = orig_ss;
|
||||||
|
ss->old_mobile_id = mid;
|
||||||
size_t len = ioa_network_buffer_get_size(nbh);
|
size_t len = ioa_network_buffer_get_size(nbh);
|
||||||
|
|
||||||
turn_report_allocation_set(&(ss->alloc), lifetime, 1);
|
turn_report_allocation_set(&(ss->alloc), lifetime, 1);
|
||||||
@ -1699,10 +1701,18 @@ static int handle_turn_refresh(turn_turnserver *server,
|
|||||||
|
|
||||||
size_t len = ioa_network_buffer_get_size(nbh);
|
size_t len = ioa_network_buffer_get_size(nbh);
|
||||||
stun_init_success_response_str(STUN_METHOD_REFRESH, ioa_network_buffer_data(nbh), &len, tid);
|
stun_init_success_response_str(STUN_METHOD_REFRESH, ioa_network_buffer_data(nbh), &len, tid);
|
||||||
u32bits lt = nswap32(lifetime);
|
|
||||||
|
|
||||||
|
if(ss->s_mobile_id[0]) {
|
||||||
|
stun_attr_add_str(ioa_network_buffer_data(nbh), &len,
|
||||||
|
STUN_ATTRIBUTE_MOBILITY_TICKET,
|
||||||
|
(u08bits*)ss->s_mobile_id,strlen(ss->s_mobile_id));
|
||||||
|
ioa_network_buffer_set_size(nbh,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
u32bits lt = nswap32(lifetime);
|
||||||
stun_attr_add_str(ioa_network_buffer_data(nbh), &len, STUN_ATTRIBUTE_LIFETIME,
|
stun_attr_add_str(ioa_network_buffer_data(nbh), &len, STUN_ATTRIBUTE_LIFETIME,
|
||||||
(const u08bits*) <, 4);
|
(const u08bits*) <, 4);
|
||||||
|
|
||||||
ioa_network_buffer_set_size(nbh,len);
|
ioa_network_buffer_set_size(nbh,len);
|
||||||
|
|
||||||
*resp_constructed = 1;
|
*resp_constructed = 1;
|
||||||
|
|||||||
@ -97,6 +97,7 @@ struct _ts_ur_super_session {
|
|||||||
/* Mobile */
|
/* Mobile */
|
||||||
int is_mobile;
|
int is_mobile;
|
||||||
mobile_id_t mobile_id;
|
mobile_id_t mobile_id;
|
||||||
|
mobile_id_t old_mobile_id;
|
||||||
char s_mobile_id[33];
|
char s_mobile_id[33];
|
||||||
/* Realm */
|
/* Realm */
|
||||||
realm_options_t realm_options;
|
realm_options_t realm_options;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user