mirror of
				https://github.com/coturn/coturn.git
				synced 2025-10-31 06:51:30 +01:00 
			
		
		
		
	fixes
This commit is contained in:
		
							parent
							
								
									0856920e29
								
							
						
					
					
						commit
						79ff9f7dfa
					
				| @ -1478,18 +1478,20 @@ ioa_socket_handle create_ioa_socket_from_fd(ioa_engine_handle e, | ||||
| 	ret->magic = SOCKET_MAGIC; | ||||
| 
 | ||||
| 	ret->fd = fd; | ||||
| 	ret->family = local_addr->ss.sa_family; | ||||
| 	ret->st = st; | ||||
| 	ret->sat = sat; | ||||
| 	ret->e = e; | ||||
| 
 | ||||
| 	if (local_addr) { | ||||
| 		ret->family = local_addr->ss.sa_family; | ||||
| 		ret->bound = 1; | ||||
| 		addr_cpy(&(ret->local_addr), local_addr); | ||||
| 	} | ||||
| 
 | ||||
| 	if (remote_addr) { | ||||
| 		ret->connected = 1; | ||||
| 		if(!(ret->family)) | ||||
| 			ret->family = remote_addr->ss.sa_family; | ||||
| 		addr_cpy(&(ret->remote_addr), remote_addr); | ||||
| 	} | ||||
| 
 | ||||
| @ -1895,10 +1897,7 @@ ioa_addr* get_local_addr_from_ioa_socket(ioa_socket_handle s) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	{ | ||||
| 	  static ioa_addr lbad_addr; | ||||
| 	  return &lbad_addr; | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
| 
 | ||||
| ioa_addr* get_remote_addr_from_ioa_socket(ioa_socket_handle s) | ||||
| @ -1910,10 +1909,7 @@ ioa_addr* get_remote_addr_from_ioa_socket(ioa_socket_handle s) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	{ | ||||
| 	  static ioa_addr rbad_addr; | ||||
| 	  return &rbad_addr; | ||||
| 	} | ||||
| 	return NULL; | ||||
| } | ||||
| 
 | ||||
| int get_local_mtu_ioa_socket(ioa_socket_handle s) | ||||
|  | ||||
| @ -866,12 +866,14 @@ int stun_set_binding_response_str(u08bits* buf, size_t *len, stun_tid* tid, | ||||
| 		} else { | ||||
| 			old_stun_init_success_response_str(STUN_METHOD_BINDING, buf, len, tid, cookie); | ||||
| 		} | ||||
| 		if(!old_stun) { | ||||
| 		if(!old_stun && reflexive_addr) { | ||||
| 			if (stun_attr_add_addr_str(buf, len, STUN_ATTRIBUTE_XOR_MAPPED_ADDRESS, reflexive_addr) < 0) | ||||
| 				return -1; | ||||
| 		} | ||||
| 		if (stun_attr_add_addr_str(buf, len, STUN_ATTRIBUTE_MAPPED_ADDRESS, reflexive_addr) < 0) | ||||
| 			return -1; | ||||
| 		if(reflexive_addr) { | ||||
| 			if (stun_attr_add_addr_str(buf, len, STUN_ATTRIBUTE_MAPPED_ADDRESS, reflexive_addr) < 0) | ||||
| 				return -1; | ||||
| 		} | ||||
| 	} else if (!old_stun) { | ||||
| 		stun_init_error_response_str(STUN_METHOD_BINDING, buf, len, error_code, reason, tid); | ||||
| 	} else { | ||||
|  | ||||
| @ -1395,7 +1395,7 @@ static int handle_turn_refresh(turn_turnserver *server, | ||||
| 		int i; | ||||
| 		for(i = 0;i<ALLOC_PROTOCOLS_NUMBER; ++i) { | ||||
| 			if(a->relay_sessions[i].s && !ioa_socket_tobeclosed(a->relay_sessions[i].s)) { | ||||
| 				int family = get_local_addr_from_ioa_socket(a->relay_sessions[i].s)->ss.sa_family; | ||||
| 				int family = get_ioa_socket_address_family(a->relay_sessions[i].s); | ||||
| 				if(AF_INET == family) { | ||||
| 					af4c = 1; | ||||
| 				} else if(AF_INET6 == family) { | ||||
| @ -2045,6 +2045,11 @@ static void tcp_peer_accept_connection(ioa_socket_handle s, void *arg) | ||||
| 
 | ||||
| 		allocation *a = &(ss->alloc); | ||||
| 		ioa_addr *peer_addr = get_remote_addr_from_ioa_socket(s); | ||||
| 		if(!peer_addr) { | ||||
| 			close_ioa_socket(s); | ||||
| 			FUNCEND; | ||||
| 			return; | ||||
| 		} | ||||
| 
 | ||||
| 		tcp_connection *tc = get_tcp_connection_by_peer(a, peer_addr); | ||||
| 		if(tc) { | ||||
| @ -2731,7 +2736,7 @@ static int handle_turn_binding(turn_turnserver *server, | ||||
| 
 | ||||
| 		; | ||||
| 
 | ||||
| 	} else if(ss->client_socket) { | ||||
| 	} else if(ss->client_socket && get_remote_addr_from_ioa_socket(ss->client_socket)) { | ||||
| 
 | ||||
| 		size_t len = ioa_network_buffer_get_size(nbh); | ||||
| 		if (stun_set_binding_response_str(ioa_network_buffer_data(nbh), &len, tid, | ||||
| @ -4301,8 +4306,8 @@ static int create_relay_connection(turn_turnserver* server, | ||||
| 		} | ||||
| 
 | ||||
| 		/* RFC6156: do not use DF when IPv6 is involved: */ | ||||
| 		if((get_local_addr_from_ioa_socket(newelem->s)->ss.sa_family == AF_INET6) || | ||||
| 		   (get_local_addr_from_ioa_socket(ss->client_socket)->ss.sa_family == AF_INET6)) | ||||
| 		if((get_ioa_socket_address_family(newelem->s) == AF_INET6) || | ||||
| 		   (get_ioa_socket_address_family(ss->client_socket) == AF_INET6)) | ||||
| 			set_do_not_use_df(newelem->s); | ||||
| 
 | ||||
| 		if(get_ioa_socket_type(newelem->s) != TCP_SOCKET) { | ||||
| @ -4318,7 +4323,7 @@ static int create_relay_connection(turn_turnserver* server, | ||||
| 		ioa_timer_handle ev = set_ioa_timer(server->e, lifetime, 0, | ||||
| 				client_ss_allocation_timeout_handler, newelem, 0, | ||||
| 				"client_ss_allocation_timeout_handler"); | ||||
| 		set_allocation_lifetime_ev(a, server->ctime + lifetime, ev, get_local_addr_from_ioa_socket(newelem->s)->ss.sa_family); | ||||
| 		set_allocation_lifetime_ev(a, server->ctime + lifetime, ev, get_ioa_socket_address_family(newelem->s)); | ||||
| 
 | ||||
| 		set_ioa_socket_session(newelem->s, ss); | ||||
| 	} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user