improve GetIpAddr and add tests
add Makefile.am for test dir