static int session_policy_config_cb(struct connman_session *session, struct connman_session_config *config, void *user_data, int err) { struct creation_data *creation_data = user_data; struct session_info *info, *info_last; DBusMessage *reply; DBG("session %p config %p", session, config); if (err < 0) goto err; session->policy_config = config; session->mark = session_mark++; session->index = -1; err = init_firewall_session(session); if (err < 0) goto err; err = init_routing_table(session); if (err < 0) goto err; info = session->info; info_last = session->info_last; if (session->policy_config->ecall) ecall_session = session; info->state = CONNMAN_SESSION_STATE_DISCONNECTED; info->config.type = apply_policy_on_type( session->policy_config->type, creation_data->type); info->config.priority = session->policy_config->priority; info->config.roaming_policy = session->policy_config->roaming_policy; session->user_allowed_bearers = creation_data->allowed_bearers; creation_data->allowed_bearers = NULL; apply_policy_on_bearers( session->policy_config->allowed_bearers, session->user_allowed_bearers, &info->config.allowed_bearers); g_hash_table_replace(session_hash, session->session_path, session); DBG("add %s", session->session_path); if (!g_dbus_register_interface(connection, session->session_path, CONNMAN_SESSION_INTERFACE, session_methods, NULL, NULL, session, NULL)) { connman_error("Failed to register %s", session->session_path); g_hash_table_remove(session_hash, session->session_path); err = -EINVAL; goto err; } reply = g_dbus_create_reply(creation_data->pending, DBUS_TYPE_OBJECT_PATH, &session->session_path, DBUS_TYPE_INVALID); g_dbus_send_message(connection, reply); creation_data->pending = NULL; info_last->state = info->state; info_last->config.priority = info->config.priority; info_last->config.roaming_policy = info->config.roaming_policy; info_last->config.allowed_bearers = info->config.allowed_bearers; session->append_all = true; cleanup_creation_data(creation_data); session_activate(session); return 0; err: reply = __connman_error_failed(creation_data->pending, -err); g_dbus_send_message(connection, reply); creation_data->pending = NULL; cleanup_session(session); cleanup_creation_data(creation_data); return err; }
static void update_routing_table(struct connman_session *session) { cleanup_routing_table(session); init_routing_table(session); add_default_route(session); }