Dns rebase

Hi @rbgarga @Whizkidzz ,

Referring to #544 , this is my attempt at rebasing this patch set.  Please let me know if something isn't correct.

Thanks