+static gboolean wispr_route_request(const char *address, int ai_family,
+ int if_index, gpointer user_data)
+{
+ int result = -1;
+ struct connman_wispr_portal_context *wp_context = user_data;
+ const char *gateway;
+ struct wispr_route *route;
+
+ gateway = __connman_ipconfig_get_gateway_from_index(if_index,
+ wp_context->type);
+
+ DBG("address %s if %d gw %s", address, if_index, gateway);
+
+ if (gateway == NULL)
+ return FALSE;
+
+ route = g_try_new0(struct wispr_route, 1);
+ if (route == 0) {
+ DBG("could not create struct");
+ return FALSE;
+ }
+
+ switch(wp_context->type) {
+ case CONNMAN_IPCONFIG_TYPE_IPV4:
+ result = connman_inet_add_host_route(if_index, address,
+ gateway);
+ break;
+ case CONNMAN_IPCONFIG_TYPE_IPV6:
+ result = connman_inet_add_ipv6_host_route(if_index, address,
+ gateway);
+ break;
+ case CONNMAN_IPCONFIG_TYPE_UNKNOWN:
+ break;
+ }
+
+ if (result < 0) {
+ g_free(route);
+ return FALSE;
+ }
+
+ route->address = g_strdup(address);
+ route->if_index = if_index;
+ wp_context->route_list = g_slist_prepend(wp_context->route_list, route);
+
+ return TRUE;
+}
+