diff options
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r-- | toxcore/net_crypto.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 1fcd434e..875c639f 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1778,6 +1778,9 @@ int add_tcp_relay_peer(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port, | |||
1778 | ip_port.ip.family = AF_INET6; | 1778 | ip_port.ip.family = AF_INET6; |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | if (ip_port.ip.family != AF_INET && ip_port.ip.family != AF_INET6) | ||
1782 | return -1; | ||
1783 | |||
1781 | uint32_t i; | 1784 | uint32_t i; |
1782 | 1785 | ||
1783 | for (i = 0; i < conn->num_tcp_relays; ++i) { | 1786 | for (i = 0; i < conn->num_tcp_relays; ++i) { |
@@ -1817,6 +1820,15 @@ int add_tcp_relay_peer(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port, | |||
1817 | */ | 1820 | */ |
1818 | int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, uint8_t *public_key) | 1821 | int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, uint8_t *public_key) |
1819 | { | 1822 | { |
1823 | if (ip_port.ip.family == TCP_INET) { | ||
1824 | ip_port.ip.family = AF_INET; | ||
1825 | } else if (ip_port.ip.family == TCP_INET6) { | ||
1826 | ip_port.ip.family = AF_INET6; | ||
1827 | } | ||
1828 | |||
1829 | if (ip_port.ip.family != AF_INET && ip_port.ip.family != AF_INET6) | ||
1830 | return -1; | ||
1831 | |||
1820 | if (tcp_connection_check(c, public_key) != 0) | 1832 | if (tcp_connection_check(c, public_key) != 0) |
1821 | return -1; | 1833 | return -1; |
1822 | 1834 | ||