Use the PhysicalTechnology for VPN connections.

When a VPN connection is used to download an update, the Type property
is decoded as kNetUnknown, allowing by default the update over that
connection. If the VPN connection runs over a Cellular connection,
the device policy or user setting should be checked.

This patch retrieves the PhysicalTechnology property, when present,
for VPN connections instead of the Type property, effectively using
the real connection type instead of the unknown VPN type.

BUG=chromium:210775
TEST=sudo ./update_engine_unittests

Change-Id: I39506724ca24bf14360fe00129be1eb9ff2c460c
Reviewed-on: https://gerrit.chromium.org/gerrit/61926
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
diff --git a/connection_manager.cc b/connection_manager.cc
index b4bda0c..bbba9f7 100644
--- a/connection_manager.cc
+++ b/connection_manager.cc
@@ -134,12 +134,26 @@
                                       flimflam::kFlimflamServiceInterface,
                                       &hash_table));
 
-  GValue* value = (GValue*)g_hash_table_lookup(hash_table, "Type");
+  GValue* value = (GValue*)g_hash_table_lookup(hash_table,
+                                               flimflam::kTypeProperty);
   const char* type_str = NULL;
   bool success = false;
   if (value != NULL && (type_str = g_value_get_string(value)) != NULL) {
-    *out_type = ParseConnectionType(type_str);
     success = true;
+    if (!strcmp(type_str, flimflam::kTypeVPN)) {
+      value = (GValue*)g_hash_table_lookup(hash_table,
+                                           shill::kPhysicalTechnologyProperty);
+      if (value != NULL && (type_str = g_value_get_string(value)) != NULL) {
+        *out_type = ParseConnectionType(type_str);
+      } else {
+        LOG(ERROR) << "No PhysicalTechnology property found for a VPN"
+                   << " connection (service: " << path << "). Returning default"
+                   << " kNetUnknown value.";
+        *out_type = kNetUnknown;
+      }
+    } else {
+      *out_type = ParseConnectionType(type_str);
+    }
   }
   g_hash_table_unref(hash_table);
   return success;