未验证 提交 40443808 编写于 作者: H Huiliang.liu 提交者: GitHub

Fix DNS lookup issue for pure IPv6 addresses in URLs (#10331)

*Problem:
getDnsCachedAddress() always returns empty string if the hostname only
has IPv6 addresses

*Root cause:
Array hostinfo[] is redeclared in code section for IPv6, so the real
lookup result never returns.

*How to reproduce:
You can reproduce this issue even you don't have pure IPv6 environment
1. Assign a IPv6 address for your default net device
   sudo ip -6 addr add 2401::1234/128 dev ${netdev}
2. Add the address to /etc/hosts with a dummy hostname, for example
   2401::1234/128	ipv6host
3. Create external table using the dummy hostname
   create external table test_ext_ipv6(a int) location('gpfdist://ipv6host:8080/data_file') format 'csv';
4. Launch gpfdist
5. Run test SQL
   select * from test_ext_ipv6
   Then an error will be reported with an empty address in url:
   ERROR:  connection with gpfdist failed for "gpfdist://ipv6host:8080/data_file", effective url: "http://:8080/data_file"
Co-authored-by: NPeifeng Qiu <pqiu@pivotal.io>
上级 8190ed40
......@@ -1292,8 +1292,6 @@ getDnsCachedAddress(char *name, int port, int elevel, bool use_cache)
if (((!use_cache && !hostinfo[0]) || (use_cache && e == NULL))
&& addrs->ai_family == AF_INET6)
{
char hostinfo[NI_MAXHOST];
addr = addrs;
/* Get a text representation of the IP address */
pg_getnameinfo_all((struct sockaddr_storage *) addr->ai_addr, addr->ai_addrlen,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册