2008-01-19 Dan Williams <dcbw@redhat.com>
* src/nm-device-802-3-ethernet.c - (real_get_best_connection): collapse find_best_connection() into this function git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3251 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2008-01-19 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/nm-device-802-3-ethernet.c
|
||||||
|
- (real_get_best_connection): collapse find_best_connection() into this
|
||||||
|
function
|
||||||
|
|
||||||
2008-01-18 Dan Williams <dcbw@redhat.com>
|
2008-01-18 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/nm-device-802-3-ethernet.c
|
* src/nm-device-802-3-ethernet.c
|
||||||
|
@@ -341,54 +341,40 @@ real_can_interrupt_activation (NMDevice *dev)
|
|||||||
return interrupt;
|
return interrupt;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct BestConnectionInfo {
|
|
||||||
NMDevice8023Ethernet *self;
|
|
||||||
NMConnection *found;
|
|
||||||
} BestConnectionInfo;
|
|
||||||
|
|
||||||
static void
|
|
||||||
find_best_connection (gpointer data, gpointer user_data)
|
|
||||||
{
|
|
||||||
BestConnectionInfo *info = (BestConnectionInfo *) user_data;
|
|
||||||
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (info->self);
|
|
||||||
NMConnection *connection = NM_CONNECTION (data);
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingWired *s_wired;
|
|
||||||
|
|
||||||
if (info->found)
|
|
||||||
return;
|
|
||||||
|
|
||||||
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
|
||||||
if (s_con == NULL)
|
|
||||||
return;
|
|
||||||
if (strcmp (s_con->type, NM_SETTING_WIRED_SETTING_NAME))
|
|
||||||
return;
|
|
||||||
if (!s_con->autoconnect)
|
|
||||||
return;
|
|
||||||
|
|
||||||
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
|
|
||||||
g_return_if_fail (s_wired != NULL);
|
|
||||||
|
|
||||||
if (s_wired->mac_address) {
|
|
||||||
if (memcmp (s_wired->mac_address->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
info->found = connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NMConnection *
|
static NMConnection *
|
||||||
real_get_best_connection (NMDevice *dev,
|
real_get_best_connection (NMDevice *dev,
|
||||||
GSList *connections,
|
GSList *connections,
|
||||||
char **specific_object)
|
char **specific_object)
|
||||||
{
|
{
|
||||||
NMDevice8023Ethernet * self = NM_DEVICE_802_3_ETHERNET (dev);
|
NMDevice8023Ethernet *self = NM_DEVICE_802_3_ETHERNET (dev);
|
||||||
BestConnectionInfo find_info;
|
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (self);
|
||||||
|
GSList *iter;
|
||||||
|
|
||||||
memset (&find_info, 0, sizeof (BestConnectionInfo));
|
for (iter = connections; iter; iter = g_slist_next (iter)) {
|
||||||
find_info.self = self;
|
NMConnection *connection = NM_CONNECTION (iter->data);
|
||||||
g_slist_foreach (connections, find_best_connection, &find_info);
|
NMSettingConnection *s_con;
|
||||||
return find_info.found;
|
NMSettingWired *s_wired;
|
||||||
|
|
||||||
|
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
||||||
|
g_assert (s_con);
|
||||||
|
|
||||||
|
if (strcmp (s_con->type, NM_SETTING_WIRED_SETTING_NAME))
|
||||||
|
continue;
|
||||||
|
if (!s_con->autoconnect)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
|
||||||
|
if (!s_wired)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (s_wired->mac_address) {
|
||||||
|
if (memcmp (s_wired->mac_address->data, priv->hw_addr.ether_addr_octet, ETH_ALEN))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user