refactor and dnsmasq reconfig