Skip to content

Commit 26a991e

Browse files
committed
fix: ip to string function not accepting tcp families
1 parent 712861f commit 26a991e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

toxcore/network.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,11 @@ static int make_family(Family tox_family)
264264
{
265265
switch (tox_family.value) {
266266
case TOX_AF_INET:
267+
case TCP_INET:
267268
return AF_INET;
268269

269270
case TOX_AF_INET6:
271+
case TCP_INET6:
270272
return AF_INET6;
271273

272274
case TOX_AF_UNSPEC:
@@ -1878,14 +1880,14 @@ bool ip_parse_addr(const IP *ip, char *address, size_t length)
18781880
return false;
18791881
}
18801882

1881-
if (net_family_is_ipv4(ip->family)) {
1883+
if (net_family_is_ipv4(ip->family) || net_family_is_tcp_ipv4(ip->family)) {
18821884
struct in_addr addr;
18831885
assert(make_family(ip->family) == AF_INET);
18841886
fill_addr4(&ip->ip.v4, &addr);
18851887
return inet_ntop4(&addr, address, length) != nullptr;
18861888
}
18871889

1888-
if (net_family_is_ipv6(ip->family)) {
1890+
if (net_family_is_ipv6(ip->family) || net_family_is_tcp_ipv6(ip->family)) {
18891891
struct in6_addr addr;
18901892
assert(make_family(ip->family) == AF_INET6);
18911893
fill_addr6(&ip->ip.v6, &addr);

0 commit comments

Comments
 (0)