s4:dns_server: split out dns_common_replace()