shill: routing_table: Don't create pinned routes without gateway

When we ask for a route, ignore those without a gateway since
local routes do not require a gateway (and end up confusing the
table).

BUG=chromium-os:29911
TEST=New unit tests

Change-Id: Iea6930741c73ef0eddfbf98e5f183d2c1af5b18c
Reviewed-on: https://gerrit.chromium.org/gerrit/21433
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
diff --git a/routing_table.cc b/routing_table.cc
index b75b683..7855edc 100644
--- a/routing_table.cc
+++ b/routing_table.cc
@@ -358,13 +358,18 @@
     }
 
     if (route_queries_.front().sequence == message.seq()) {
-      SLOG(Route, 2) << __func__ << ": Adding host route to "
-                     << entry.dst.ToString();
-      RoutingTableEntry add_entry(entry);
-      add_entry.from_rtnl = false;
-      add_entry.tag = route_queries_.front().tag;
-      route_queries_.pop();
-      AddRoute(interface_index, add_entry);
+      if (entry.gateway.IsDefault()) {
+        SLOG(Route, 2) << __func__ << ": Ignoring route result with no gateway "
+                       << "since we don't need to plumb these.";
+      } else {
+        SLOG(Route, 2) << __func__ << ": Adding host route to "
+                       << entry.dst.ToString();
+        RoutingTableEntry add_entry(entry);
+        add_entry.from_rtnl = false;
+        add_entry.tag = route_queries_.front().tag;
+        route_queries_.pop();
+        AddRoute(interface_index, add_entry);
+      }
     }
     return;
   } else if (message.route_status().protocol != RTPROT_BOOT) {