Hi, >> Whenever we send A(AAA) records, let's also include reverse lookup ones. >> This should be extended in the future by adding IPv6. > > Ping. Any opinions on this?
Go for it.
>> @@ -210,6 +210,38 @@ dns_reply_a(struct interface *iface, int ttl)
>> freeifaddrs(ifap);
>> }
>>
>> +static void
>> +dns_reply_rev_lookup(struct interface *iface, int ttl)
>> +{
>> + char name[32];
>> + int len;
>> +
>> + if (!iface->v6) {
>> + struct in_addr rev_v4_addr;
>> +
>> + /* PTR recored starts with IP with reversed octets order */
>> + memcpy(&rev_v4_addr, &iface->v4_addr, sizeof(iface->v4_addr));
>> + rev_v4_addr.s_addr = bswap_32(rev_v4_addr.s_addr);
>
> Is there some more appropriate solution for this than bswap_32?
I prefer the more explicit variant:
- make "rev_v4_addr" unsigned char
- use asprintf(&ptr, "%u.%u.%u.%u.in-addr.arpa",
rev_v4_addr[3], rev_v4_addr[2],
rev_v4_addr[1], rev_v4_addr[0]);
This also makes dealing with IPv6 later easier.
~ Jo
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Lede-dev mailing list [email protected] http://lists.infradead.org/mailman/listinfo/lede-dev
