Bug: TCP client only accepts IPv4 addresses, not hostnames #194

Closed
opened 2026-07-30 18:35:03 +02:00 by TapTap · 0 comments
Owner

Severity: low
Category: bug
Location: src/shared/transport_tcp.c:134-148, src/shared/transport_tls.c:134-140

Description:
client_connect() and client_connect_tls() use inet_pton(AF_INET, host, ...). This only accepts IPv4 dotted-quad addresses. Hostnames and IPv6 literals cause an immediate connection failure with Could not convert host address!.

Suggested fix:
Replace inet_pton(AF_INET, ...) with getaddrinfo(). Use AI_NUMERICHOST only when a numeric address is required, otherwise allow DNS resolution. Update Client/Server structs to use struct sockaddr_storage for IPv6 support (see also IPv6 feature issue).

Labels: bug, quality

**Severity:** low **Category:** bug **Location:** `src/shared/transport_tcp.c:134-148`, `src/shared/transport_tls.c:134-140` **Description:** `client_connect()` and `client_connect_tls()` use `inet_pton(AF_INET, host, ...)`. This only accepts IPv4 dotted-quad addresses. Hostnames and IPv6 literals cause an immediate connection failure with `Could not convert host address!`. **Suggested fix:** Replace `inet_pton(AF_INET, ...)` with `getaddrinfo()`. Use `AI_NUMERICHOST` only when a numeric address is required, otherwise allow DNS resolution. Update `Client`/`Server` structs to use `struct sockaddr_storage` for IPv6 support (see also IPv6 feature issue). **Labels:** bug, quality
TapTap added the bugqualityneeds-triage labels 2026-07-30 18:35:03 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#194