fastboot: Fix IPv6 connect and -s host parsing

During fastboot connect / disconnect introduction, we
completely broke the IPv6 support (it was considering
all IPv6 addresses as a USB serial).

Makeing sure this problem isn't reproducible anymore
alongside with fixing EXCPECT causing process crash
and improve network serial error detection.

Bug: 271152365
Change-Id: Ic52aa5fff1948a64ac3d2672f3cf4d2b022e5cea
Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
diff --git a/fastboot/util.h b/fastboot/util.h
index bc01473..8a79e13 100644
--- a/fastboot/util.h
+++ b/fastboot/util.h
@@ -18,8 +18,16 @@
 using android::base::Result;
 using android::base::ResultError;
 
-#define EXPECT(result) \
-    (result.ok() ? result.value() : (LOG(FATAL) << result.error().message(), result.value()))
+template <typename T, typename U>
+inline T Expect(Result<T, U> r) {
+    if (r.ok()) {
+        return r.value();
+    }
+
+    LOG(FATAL) << r.error().message();
+
+    return r.value();
+}
 
 using SparsePtr = std::unique_ptr<sparse_file, decltype(&sparse_file_destroy)>;