コード例 #1
0
ファイル: dhcp.c プロジェクト: sameo/connman-stable
static void ipv4ll_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
{
	struct connman_dhcp *dhcp = user_data;
	char *address, *netmask;
	struct connman_service *service;
	struct connman_ipconfig *ipconfig;
	unsigned char prefixlen;

	DBG("IPV4LL available");

	service = __connman_service_lookup_from_network(dhcp->network);
	if (service == NULL)
		return;

	ipconfig = __connman_service_get_ip4config(service);
	if (ipconfig == NULL)
		return;

	address = g_dhcp_client_get_address(dhcp_client);
	netmask = g_dhcp_client_get_netmask(dhcp_client);

	prefixlen = __connman_ipconfig_netmask_prefix_len(netmask);

	connman_ipconfig_set_method(ipconfig, CONNMAN_IPCONFIG_METHOD_DHCP);
	__connman_ipconfig_set_local(ipconfig, address);
	__connman_ipconfig_set_prefixlen(ipconfig, prefixlen);
	__connman_ipconfig_set_gateway(ipconfig, NULL);

	dhcp_valid(dhcp);

	g_free(address);
	g_free(netmask);
}
コード例 #2
0
static void ipv4ll_available_cb(GDHCPClient *dhcp_client, gpointer user_data)
{
	struct connman_dhcp *dhcp = user_data;
	char *address, *netmask;
	struct connman_service *service;
	struct connman_ipconfig *ipconfig;
	unsigned char prefixlen;

	DBG("IPV4LL available");

#if defined TIZEN_EXT
	/*
	 * Description: When DHCP is failed,
	 *              most of naive users cannot understand auto-generated IP
	 *              (IPV4 link local) and serious troubles to make Internet connection.
	 */
	dhcp_invalidate(dhcp, TRUE);

	service = __connman_service_lookup_from_network(dhcp->network);
	if (service == NULL)
		return;

	__connman_service_ipconfig_indicate_state(service,
			CONNMAN_SERVICE_STATE_IDLE,
			CONNMAN_IPCONFIG_TYPE_IPV4);
	__connman_service_ipconfig_indicate_state(service,
			CONNMAN_SERVICE_STATE_IDLE,
			CONNMAN_IPCONFIG_TYPE_IPV6);

	return;
#endif

	service = __connman_service_lookup_from_network(dhcp->network);
	if (service == NULL)
		return;

	ipconfig = __connman_service_get_ip4config(service);
	if (ipconfig == NULL)
		return;

	address = g_dhcp_client_get_address(dhcp_client);
	netmask = g_dhcp_client_get_netmask(dhcp_client);

	prefixlen = __connman_ipconfig_netmask_prefix_len(netmask);

	connman_ipconfig_set_method(ipconfig, CONNMAN_IPCONFIG_METHOD_DHCP);
	__connman_ipconfig_set_local(ipconfig, address);
	__connman_ipconfig_set_prefixlen(ipconfig, prefixlen);
	__connman_ipconfig_set_gateway(ipconfig, NULL);

	dhcp_valid(dhcp);

	g_free(address);
	g_free(netmask);
}
コード例 #3
0
ファイル: dhcp.c プロジェクト: Pillar1989/connman
static void ipv4ll_available_cb(GDHCPClient *ipv4ll_client, gpointer user_data)
{
	struct connman_dhcp *dhcp = user_data;
	char *address, *netmask;
	unsigned char prefixlen;

	DBG("IPV4LL available");

	address = g_dhcp_client_get_address(ipv4ll_client);
	netmask = g_dhcp_client_get_netmask(ipv4ll_client);

	prefixlen = connman_ipaddress_calc_netmask_len(netmask);

	__connman_ipconfig_set_method(dhcp->ipconfig,
						CONNMAN_IPCONFIG_METHOD_DHCP);
	__connman_ipconfig_set_local(dhcp->ipconfig, address);
	__connman_ipconfig_set_prefixlen(dhcp->ipconfig, prefixlen);
	__connman_ipconfig_set_gateway(dhcp->ipconfig, NULL);

	dhcp_valid(dhcp);

	g_free(address);
	g_free(netmask);
}