Changes for Mirage DNS support

Ongoing, not for merging just yet, but review welcome