diff options
Diffstat (limited to 'toxcore/TCP_client.c')
-rw-r--r-- | toxcore/TCP_client.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index 58e8de49..d1cd4d66 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c | |||
@@ -227,7 +227,7 @@ static void proxy_socks5_generate_connection_request(TCP_Client_Connection *TCP_ | |||
227 | TCP_conn->last_packet[2] = 0; /* reserved, must be 0 */ | 227 | TCP_conn->last_packet[2] = 0; /* reserved, must be 0 */ |
228 | uint16_t length = 3; | 228 | uint16_t length = 3; |
229 | 229 | ||
230 | if (TCP_conn->ip_port.ip.family == TOX_AF_INET) { | 230 | if (net_family_is_ipv4(TCP_conn->ip_port.ip.family)) { |
231 | TCP_conn->last_packet[3] = 1; /* IPv4 address */ | 231 | TCP_conn->last_packet[3] = 1; /* IPv4 address */ |
232 | ++length; | 232 | ++length; |
233 | memcpy(TCP_conn->last_packet + length, TCP_conn->ip_port.ip.ip.v4.uint8, sizeof(IP4)); | 233 | memcpy(TCP_conn->last_packet + length, TCP_conn->ip_port.ip.ip.v4.uint8, sizeof(IP4)); |
@@ -252,7 +252,7 @@ static void proxy_socks5_generate_connection_request(TCP_Client_Connection *TCP_ | |||
252 | */ | 252 | */ |
253 | static int proxy_socks5_read_connection_response(TCP_Client_Connection *TCP_conn) | 253 | static int proxy_socks5_read_connection_response(TCP_Client_Connection *TCP_conn) |
254 | { | 254 | { |
255 | if (TCP_conn->ip_port.ip.family == TOX_AF_INET) { | 255 | if (net_family_is_ipv4(TCP_conn->ip_port.ip.family)) { |
256 | uint8_t data[4 + sizeof(IP4) + sizeof(uint16_t)]; | 256 | uint8_t data[4 + sizeof(IP4) + sizeof(uint16_t)]; |
257 | int ret = read_TCP_packet(TCP_conn->sock, data, sizeof(data)); | 257 | int ret = read_TCP_packet(TCP_conn->sock, data, sizeof(data)); |
258 | 258 | ||
@@ -696,7 +696,7 @@ TCP_Client_Connection *new_TCP_connection(IP_Port ip_port, const uint8_t *public | |||
696 | return nullptr; | 696 | return nullptr; |
697 | } | 697 | } |
698 | 698 | ||
699 | if (ip_port.ip.family != TOX_AF_INET && ip_port.ip.family != TOX_AF_INET6) { | 699 | if (!net_family_is_ipv4(ip_port.ip.family) && !net_family_is_ipv6(ip_port.ip.family)) { |
700 | return nullptr; | 700 | return nullptr; |
701 | } | 701 | } |
702 | 702 | ||
@@ -707,7 +707,7 @@ TCP_Client_Connection *new_TCP_connection(IP_Port ip_port, const uint8_t *public | |||
707 | proxy_info = &default_proxyinfo; | 707 | proxy_info = &default_proxyinfo; |
708 | } | 708 | } |
709 | 709 | ||
710 | uint8_t family = ip_port.ip.family; | 710 | Family family = ip_port.ip.family; |
711 | 711 | ||
712 | if (proxy_info->proxy_type != TCP_PROXY_NONE) { | 712 | if (proxy_info->proxy_type != TCP_PROXY_NONE) { |
713 | family = proxy_info->ip_port.ip.family; | 713 | family = proxy_info->ip_port.ip.family; |