コード例 #1
0
ファイル: peer.c プロジェクト: jasonabele/connman
static int start_dhcp_client(struct connman_peer *peer)
{
	if (peer->sub_device)
		__connman_ipconfig_set_index(peer->ipconfig,
				connman_device_get_index(peer->sub_device));

	__connman_ipconfig_enable(peer->ipconfig);

	return __connman_dhcp_start(peer->ipconfig, NULL, dhcp_callback, peer);
}
コード例 #2
0
/**
 * connman_network_set_index:
 * @network: network structure
 * @index: index number
 *
 * Set index number of network
 */
void connman_network_set_index(struct connman_network *network, int index)
{
	struct connman_service *service;
	struct connman_ipconfig *ipconfig;

	service = __connman_service_lookup_from_network(network);
	if (service == NULL)
		goto done;

	ipconfig = __connman_service_get_ip4config(service);

	DBG("index %d service %p ip4config %p", network->index,
		service, ipconfig);

	if (network->index < 0 && ipconfig == NULL) {

		ipconfig = __connman_service_get_ip4config(service);
		if (ipconfig == NULL)
			/*
			 * This is needed for plugins that havent set their
			 * ipconfig layer yet, due to not being able to get
			 * a network index prior to creating a service.
			 */
			__connman_service_create_ip4config(service, index);
		else
			__connman_ipconfig_set_index(ipconfig, index);

	} else {
		/* If index changed, the index of ipconfig must be reset. */
		if (ipconfig == NULL)
			goto done;

		__connman_ipconfig_set_index(ipconfig, index);
	}

done:
	network->index = index;
}