void slip_reroute() { /* Restore the original proxy routing */ proxy_config(orig_local_ip,orig_remote_ip); set_ptp("sl",proxy_iface,orig_remote_ip,metric+1); add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,drmetric+1); local_addr = inet_addr(orig_local_ip); /* If we did routing on the slip link, remove it */ if (do_reroute && link_iface != -1) /* just in case we get called twice */ del_routes("sl",link_iface,local_ip,remote_ip,drmetric); link_iface = -1; }
void dev_reroute() { /* Kill the alternate routing */ if (do_reroute && link_iface != -1) del_routes(device_node,link_iface,local_ip,remote_ip,drmetric); link_iface = -1; /* Restore the original proxy routing */ proxy_config(orig_local_ip,orig_remote_ip); set_ptp("sl",proxy_iface,orig_remote_ip,metric+1); add_routes("sl",proxy_iface,orig_local_ip,orig_remote_ip,drmetric+1); local_addr = inet_addr(orig_local_ip); }
static DBusMessage *set_property(DBusConnection *conn, DBusMessage *msg, void *data) { struct vpn_provider *provider = data; DBusMessageIter iter, value; const char *name; int type; DBG("conn %p", conn); if (dbus_message_iter_init(msg, &iter) == FALSE) return __connman_error_invalid_arguments(msg); if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) return __connman_error_invalid_arguments(msg); dbus_message_iter_get_basic(&iter, &name); dbus_message_iter_next(&iter); if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) return __connman_error_invalid_arguments(msg); dbus_message_iter_recurse(&iter, &value); type = dbus_message_iter_get_arg_type(&value); if (g_str_equal(name, "UserRoutes") == TRUE) { GSList *networks; if (type != DBUS_TYPE_ARRAY) return __connman_error_invalid_arguments(msg); networks = get_user_networks(&value); if (networks != NULL) { del_routes(provider); provider->user_networks = networks; set_user_networks(provider, provider->user_networks); if (handle_routes == FALSE) provider_schedule_changed(provider, USER_ROUTES_CHANGED); } } else return __connman_error_invalid_property(msg); return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); }
static int disable_gateway(struct gateway_data *data, enum connman_ipconfig_type type) { bool active = false; if (type == CONNMAN_IPCONFIG_TYPE_IPV4) { if (data->ipv4_gateway) active = data->ipv4_gateway->active; } else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) { if (data->ipv6_gateway) active = data->ipv6_gateway->active; } else active = true; DBG("type %d active %d", type, active); if (active) return del_routes(data, type); return 0; }
static int disable_gateway(struct gateway_data *data, enum connman_ipconfig_type type) { gboolean active = FALSE; if (type == CONNMAN_IPCONFIG_TYPE_IPV4) { if (data->ipv4_gateway != NULL) active = data->ipv4_gateway->active; } else if (type == CONNMAN_IPCONFIG_TYPE_IPV6) { if (data->ipv6_gateway != NULL) active = data->ipv6_gateway->active; } else active = TRUE; DBG("type %d active %d", type, active); if (active == TRUE) return del_routes(data, type); return 0; }
static DBusMessage *clear_property(DBusConnection *conn, DBusMessage *msg, void *data) { struct vpn_provider *provider = data; const char *name; DBG("conn %p", conn); dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID); if (g_str_equal(name, "UserRoutes") == TRUE) { del_routes(provider); if (handle_routes == FALSE) provider_property_changed(provider, name); } else { return __connman_error_invalid_property(msg); } return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); }