move common code to dnscommon