connection_valid_for_wired (NMConnection *connection,
                            NMSettingConnection *s_con,
                            NMDevice *device,
                            gpointer specific_object)
{
	NMDeviceEthernet *ethdev = NM_DEVICE_ETHERNET (device);
	NMSettingWired *s_wired;
	const char *str_mac;
	struct ether_addr *bin_mac;
	const char *connection_type;
	const GByteArray *setting_mac;
	gboolean is_pppoe = FALSE;

	connection_type = nm_setting_connection_get_connection_type (s_con);
	if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
		is_pppoe = TRUE;
	
	if (!is_pppoe && strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME))
		return FALSE;

	s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED));
	if (!is_pppoe && !s_wired)
		return FALSE;

	if (s_wired) {
		/* Match MAC address */
		setting_mac = nm_setting_wired_get_mac_address (s_wired);
		if (!setting_mac)
			return TRUE;

		str_mac = nm_device_ethernet_get_hw_address (ethdev);
		g_return_val_if_fail (str_mac != NULL, FALSE);

		bin_mac = ether_aton (str_mac);
		g_return_val_if_fail (bin_mac != NULL, FALSE);

		if (memcmp (bin_mac->ether_addr_octet, setting_mac->data, ETH_ALEN))
			return FALSE;
	}

	return TRUE;
}
connection_valid_for_wired (NMConnection *connection,
                            NMSettingConnection *s_con,
                            NMDevice *device,
                            gpointer specific_object)
{
	NMDeviceEthernet *ethdev = NM_DEVICE_ETHERNET (device);
	NMSettingWired *s_wired;
	const char *str_mac;
	struct ether_addr *bin_mac;
	const char *connection_type;
	const GByteArray *setting_mac;
	gboolean is_pppoe = FALSE;

	connection_type = nm_setting_connection_get_connection_type (s_con);
	if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
		is_pppoe = TRUE;
	
	if (!is_pppoe && strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME))
		return FALSE;

	s_wired = NM_SETTING_WIRED (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED));
	if (!is_pppoe && !s_wired)
		return FALSE;

	if (s_wired) {
		 
		setting_mac = nm_setting_wired_get_mac_address (s_wired);
		if (!setting_mac)
			return TRUE;

		str_mac = nm_device_ethernet_get_hw_address (ethdev);
		g_return_val_if_fail (str_mac != NULL, FALSE);

		bin_mac = ether_aton (str_mac);
		g_return_val_if_fail (bin_mac != NULL, FALSE);

		if (memcmp (bin_mac->ether_addr_octet, setting_mac->data, ETH_ALEN))
			return FALSE;
	}

	return TRUE;
}