Actions
Bug #16964
closedRemoving ipv6 entries fails with dns_nsupdate due to name lookup
Description
When I try to remove the IPv6 address from a host, the smart proxy fails to update the DNS server.
- The dns_nsupdate proxy can't delete the IPv6 PTR record. The do_remove method in dns_nsupdate/dns_nsupdate_main.rb is calling dns_find (dns_common/dns_common.rb) which can handle only IPv4 reverse addresses. It takes the first four segments of the IPv6 address and tries a reverse lookup on them which will most likely fail (but might not). There's already a ptr_to_ip method in dns_common/dns_common.rb, using it to check whether key is a PTR should solve the problem, e.g.
def dns_find key begin resolver.getname(ptr_to_ip(key)).to_s rescue Proxy::Dns::Error resolver.getaddress(key).to_s end rescue Resolv::ResolvError false end
I think the dns_find method should also take the record type into account. If there's an existing A, but no AAAA record and you try to delete the AAAA record it will still do it because the lookup finds the A record. - Unlike the do_create method, the do_remove method does not have an ensure block which closes the forked nsupdate process. If the exception is triggered (which happened to me because of 2.) then you end up with a lot of nsupdate zombie processes.
Actions