[mDNS][DNS] Move dup code into common file