editted tap_thread() to only work for IPv4