Add contracts to net/dns functions.