Move some host lookup stuff to util module for reuse.
Add GW and route parsing for extended metadata.