Commit 32b1804
fix IPv6 proxy connectivity
The proxy code path in ConnectionSocket::openConnection() hardcoded
socket(AF_INET, ...) before the proxy address was parsed. When the
proxy address is an IPv6 literal, the later inet_pton(AF_INET6, ...)
fills socketAddress6 and flips ipv6 = true, but the subsequent
openConnectionInternal() then calls connect() with sockaddr_in6 on an
AF_INET fd and fails with EAFNOSUPPORT. Likewise onHostNameResolved()
only tried inet_pton(AF_INET, ...), so proxy hostnames the Android
delegate resolved to an IPv6 address also failed.
Move socket() creation into openConnectionInternal() so it uses the
final ipv6 flag, pre-init socketAddress6.sin6_family/sin6_port in the
proxy branch, and derive ipv6 in onHostNameResolved() by cascading
inet_pton(AF_INET) -> inet_pton(AF_INET6) on the resolved IP.
Ports DrKLO/Telegram PR DrKLO#1959 with light cleanup (hoisted ip.empty()
short-circuit, no parameter shadow). Drop on next rebase once upstream
merges.
Fixes bugs.telegram.org/c/16335, /c/19197, /c/29697, /c/60319.1 parent 5ec2a64 commit 32b1804
1 file changed
Lines changed: 21 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | 499 | | |
505 | 500 | | |
506 | 501 | | |
| |||
524 | 519 | | |
525 | 520 | | |
526 | 521 | | |
| 522 | + | |
| 523 | + | |
527 | 524 | | |
528 | 525 | | |
529 | 526 | | |
| |||
567 | 564 | | |
568 | 565 | | |
569 | 566 | | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | 567 | | |
576 | 568 | | |
577 | 569 | | |
| |||
613 | 605 | | |
614 | 606 | | |
615 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
616 | 613 | | |
617 | 614 | | |
618 | 615 | | |
| |||
1150 | 1147 | | |
1151 | 1148 | | |
1152 | 1149 | | |
1153 | | - | |
| 1150 | + | |
| 1151 | + | |
1154 | 1152 | | |
1155 | 1153 | | |
1156 | | - | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1157 | 1165 | | |
1158 | 1166 | | |
1159 | 1167 | | |
1160 | 1168 | | |
1161 | 1169 | | |
1162 | | - | |
| 1170 | + | |
1163 | 1171 | | |
1164 | 1172 | | |
1165 | 1173 | | |
0 commit comments