pike.git
/
lib
/
modules
/
Protocols.pmod
/
DNS.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Protocols.pmod/DNS.pmod:1491:
//! @elem array(string) aliases //! DNS name(s). //! @endarray //! //! @note //! Prior to Pike 7.7 this function only returned IPv4 addresses. //! array gethostbyname(string s) { mapping a_records = low_gethostbyname(s, T_A);
-
mapping a6_records = low_gethostbyname(s, T_A6);
+
mapping aaaa_records = low_gethostbyname(s, T_AAAA); #if 0 werror("a_records: %O\n"
-
"a6_records: %O\n"
+
"aaaa_records: %O\n",
-
a_records,
a6_records,
aaaa_records);
+
a_records, aaaa_records);
#endif /* 0 */ array(string) names=({}); array(string) ips=({}); if (a_records) { foreach(a_records->an, mapping x) { if(x->name) names+=({x->name}); if(x->a) ips+=({x->a}); } }
-
// Prefer a6 to aaaa.
-
if (a6_records) {
-
foreach(a6_records->an, mapping x)
-
{
-
if(x->name)
-
names+=({x->name});
-
if(x->a6)
-
ips+=({x->a6});
-
}
-
}
+
if (aaaa_records) { foreach(aaaa_records->an, mapping x) { if(x->name) names+=({x->name}); if(x->aaaa) ips+=({x->aaaa}); } }