Example #1
0
static int mk3_disable(struct connman_device *device) {

	int err = 0;
	struct mk3_data *mk3 = NULL;

	DBG("device %p", device);

	g_return_val_if_fail(device, -ENODEV);

	mk3 = connman_device_get_data(device);
	if(!mk3) {

		connman_error("Could not get device data");
		return -ENODEV;
	}

	DBG("device %p data %p", device, mk3);
	err = connman_inet_ifdown(mk3->index);
	if(err < 0) {

		connman_error("QMI device could not getting down with ifdown");
		return err;
	}

	delete_network(mk3);

	return 0;
}
Example #2
0
/**
* @brief Disable qmi device and delete the associated network
*/
static int qmi_disable(struct connman_device *device)
{
	int err = 0;
	struct qmi_data *qmi = NULL;

	DBG("device %p", device);

	g_return_val_if_fail(device, -ENODEV);

	qmi = connman_device_get_data(device);
	if(!qmi) {

		connman_error("Could not get device data");
		return -ENODEV;
	}

	DBG("device %p data %p", device, qmi);
	/* Remove qmi network interface */
	err = connman_inet_ifdown(qmi->index);
	if(err < 0) {

		connman_error("QMI device could not getting down with ifdown");
		return err;
	}

	/* Delete associated qmi network */
	delete_network(qmi);

	return 0;
}
Example #3
0
static int ethernet_disable(struct connman_device *device)
{
	struct ethernet_data *ethernet = connman_device_get_data(device);

	_DBG_ETHERNET("device %p", device);

	return connman_inet_ifdown(ethernet->index);
}
Example #4
0
int __connman_bridge_disable(const char *name)
{
	int index;

	index = connman_inet_ifindex(name);
	if (index < 0)
		return index;

	return connman_inet_ifdown(index);
}
Example #5
0
static void disable_tethering(struct connman_technology *technology,
                              const char *bridge)
{
    GList *list;

    for (list = cdc_interface_list; list; list = list->next) {
        int index = GPOINTER_TO_INT(list->data);

        connman_inet_remove_from_bridge(index, bridge);

        connman_inet_ifdown(index);

        connman_technology_tethering_notify(technology, FALSE);
    }
}
Example #6
0
static void cleanup_devices(void)
{
	/*
	 * Check what interfaces are currently up and if connman is
	 * suppose to handle the interface, then cleanup the mess
	 * related to that interface. There might be weird routes etc
	 * that are related to that interface and that might confuse
	 * connmand. So in this case we just turn the interface down
	 * so that kernel removes routes/addresses automatically and
	 * then proceed the startup.
	 *
	 * Note that this cleanup must be done before rtnl/detect code
	 * has activated interface watches.
	 */

	char **interfaces;
	int i;

	interfaces = __connman_inet_get_running_interfaces();

	if (interfaces == NULL)
		return;

	for (i = 0; interfaces[i] != NULL; i++) {
		connman_bool_t filtered;
		int index;

		filtered = __connman_device_isfiltered(interfaces[i]);
		if (filtered == TRUE)
			continue;

		index = connman_inet_ifindex(interfaces[i]);
		if (index < 0)
			continue;

		DBG("cleaning up %s index %d", interfaces[i], index);

		connman_inet_ifdown(index);

		/*
		 * ConnMan will turn the interface UP automatically so
		 * no need to do it here.
		 */
	}

	g_strfreev(interfaces);
}
Example #7
0
static int mbm_disable(struct connman_device *device)
{
	struct mbm_data *data = connman_device_get_data(device);
	int index;

	_DBG_MBM("device %p", device);

	g_at_chat_send(data->chat, "AT+CFUN=4", NULL,
					cfun_callback, NULL, NULL);

	index = connman_device_get_index(device);
	connman_inet_ifdown(index);

	g_at_chat_unref(data->chat);
	data->chat = NULL;

	return -EINPROGRESS;
}
Example #8
0
static void remove_interface_reply(DBusPendingCall *call, void *user_data)
{
	struct supplicant_task *task = user_data;
	DBusMessage *reply;

	_DBG_SUPPLICANT("task %p", task);

	reply = dbus_pending_call_steal_reply(call);

	connman_device_set_powered(task->device, FALSE);

	connman_device_unref(task->device);

	connman_inet_ifdown(task->ifindex);

	free_task(task);

	dbus_message_unref(reply);
}
Example #9
0
static void cleanup_devices(void)
{
	/*
	 * Check what interfaces are currently up and if connman is
	 * suppose to handle the interface, then cleanup the mess

         * related to that interface. There might be weird routes etc
	 * that are related to that interface and that might confuse
	 * connmand. So in this case we just turn the interface down
	 * so that kernel removes routes/addresses automatically and
	 * then proceed the startup.
	 *
	 * Note that this cleanup must be done before rtnl/detect code
	 * has activated interface watches.
	 */

	char **interfaces;
	int i;

	interfaces = __connman_inet_get_running_interfaces();

	if (!interfaces)
		return;

	for (i = 0; interfaces[i]; i++) {
		bool filtered;
		int index;
		struct sockaddr_in sin_addr, sin_mask;

		filtered = __connman_device_isfiltered(interfaces[i]);
		if (filtered)
			continue;

		index = connman_inet_ifindex(interfaces[i]);
		if (index < 0)
			continue;

		if (!__connman_inet_get_address_netmask(index, &sin_addr,
							&sin_mask)) {
			char *address = g_strdup(inet_ntoa(sin_addr.sin_addr));
			char *netmask = g_strdup(inet_ntoa(sin_mask.sin_addr));

			if (__connman_config_address_provisioned(address,
								netmask)) {
				DBG("Skip %s which is already provisioned "
					"with %s/%s", interfaces[i], address,
					netmask);
				g_free(address);
				g_free(netmask);
				continue;
			}

			g_free(address);
			g_free(netmask);
		}

		DBG("cleaning up %s index %d", interfaces[i], index);

		connman_inet_ifdown(index);

		/*
		 * ConnMan will turn the interface UP automatically so
		 * no need to do it here.
		 */
	}

	g_strfreev(interfaces);
}