agent: Improve DNS parser. Fixes #39.