Updated to properly delete unused IPv6 AAAA records.

Martin Sheppard requested to merge mpshep/samba:dyndns-AAAA-fix into master

Net ads dns register has a bug where it will delete all the existing A records before registering new A and AAAA records in dynamic DNS, but it doesn't delete existing AAAA records. Therefore, the IPv6 addresses for a machine can build up and old ones may never be cleaned up.

Windows will send a Dynamic DNS Update packet that looks like:

  • Ensure No CNAME Records exist for the name (abort update if they do)
  • Delete any existing A Records
  • Delete any existing AAAA Records
  • Add list of current A Records
  • Add list of current AAAA Records

Samba sends the same packet, except it is missing the "Delete any existing AAAA Records" command in the packet.

This changes dns_create_update_request to add the extra command into the packet and allows old IPv6 addresses to be removed just like IPv4 addresses are already.

dns_create_probe is also updated to add checks for there being no A records and/or no AAAA records registered if none should be registered. This is necessary to ensure samba knows it has to send am update if the last IPv6 address or last IPv4 address is removed from a host.

I have built and tested the patch and it has the desired effect on the resulting DNS entries in a Windows domain.

Edited by Martin Sheppard

Merge request reports