mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 08:10:08 +01:00
libnm-util: add *_remove_*_by_value() functions for '802-11-wireless' setting
nm_setting_wired_remove_mac_blacklist_item_by_value() Also add missing function nm_setting_wired_clear_mac_blacklist_items() and notify about mac-address-blacklist changes.
This commit is contained in:
parent
ca0aa8139c
commit
de646d9588
3 changed files with 65 additions and 2 deletions
|
|
@ -539,6 +539,7 @@ global:
|
|||
nm_setting_wireless_add_mac_blacklist_item;
|
||||
nm_setting_wireless_add_seen_bssid;
|
||||
nm_setting_wireless_ap_security_compatible;
|
||||
nm_setting_wireless_clear_mac_blacklist_items;
|
||||
nm_setting_wireless_error_get_type;
|
||||
nm_setting_wireless_error_quark;
|
||||
nm_setting_wireless_get_band;
|
||||
|
|
@ -561,6 +562,7 @@ global:
|
|||
nm_setting_wireless_get_type;
|
||||
nm_setting_wireless_new;
|
||||
nm_setting_wireless_remove_mac_blacklist_item;
|
||||
nm_setting_wireless_remove_mac_blacklist_item_by_value;
|
||||
nm_setting_wireless_security_add_group;
|
||||
nm_setting_wireless_security_add_pairwise;
|
||||
nm_setting_wireless_security_add_proto;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2007 - 2013 Red Hat, Inc.
|
||||
* (C) Copyright 2007 - 2014 Red Hat, Inc.
|
||||
* (C) Copyright 2007 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
|
|
@ -533,6 +533,7 @@ nm_setting_wireless_add_mac_blacklist_item (NMSettingWireless *setting, const ch
|
|||
|
||||
priv->mac_address_blacklist = g_slist_append (priv->mac_address_blacklist,
|
||||
g_ascii_strup (mac, -1));
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -559,6 +560,61 @@ nm_setting_wireless_remove_mac_blacklist_item (NMSettingWireless *setting, guint
|
|||
|
||||
g_free (elt->data);
|
||||
priv->mac_address_blacklist = g_slist_delete_link (priv->mac_address_blacklist, elt);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_wireless_remove_mac_blacklist_item_by_value:
|
||||
* @setting: the #NMSettingWireless
|
||||
* @mac: the MAC address string (hex-digits-and-colons notation) to remove from
|
||||
* the blacklist
|
||||
*
|
||||
* Removes the MAC address @mac from the blacklist.
|
||||
*
|
||||
* Returns: %TRUE if the MAC address was found and removed; %FALSE if it was not.
|
||||
*
|
||||
* Since: 0.9.10
|
||||
**/
|
||||
gboolean
|
||||
nm_setting_wireless_remove_mac_blacklist_item_by_value (NMSettingWireless *setting, const char *mac)
|
||||
{
|
||||
NMSettingWirelessPrivate *priv;
|
||||
GSList *iter;
|
||||
guint8 buf[32];
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_WIRELESS (setting), FALSE);
|
||||
g_return_val_if_fail (mac != NULL, FALSE);
|
||||
|
||||
if (!nm_utils_hwaddr_aton (mac, ARPHRD_ETHER, buf))
|
||||
return FALSE;
|
||||
|
||||
priv = NM_SETTING_WIRELESS_GET_PRIVATE (setting);
|
||||
for (iter = priv->mac_address_blacklist; iter; iter = g_slist_next (iter)) {
|
||||
if (!strcasecmp (mac, (char *) iter->data)) {
|
||||
priv->mac_address_blacklist = g_slist_delete_link (priv->mac_address_blacklist, iter);
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_wireless_clear_mac_blacklist_items:
|
||||
* @setting: the #NMSettingWireless
|
||||
*
|
||||
* Removes all blacklisted MAC addresses.
|
||||
*
|
||||
* Since: 0.9.10
|
||||
**/
|
||||
void
|
||||
nm_setting_wireless_clear_mac_blacklist_items (NMSettingWireless *setting)
|
||||
{
|
||||
g_return_if_fail (NM_IS_SETTING_WIRELESS (setting));
|
||||
|
||||
g_slist_free_full (NM_SETTING_WIRELESS_GET_PRIVATE (setting)->mac_address_blacklist, g_free);
|
||||
NM_SETTING_WIRELESS_GET_PRIVATE (setting)->mac_address_blacklist = NULL;
|
||||
g_object_notify (G_OBJECT (setting), NM_SETTING_WIRELESS_MAC_ADDRESS_BLACKLIST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* (C) Copyright 2007 - 2011 Red Hat, Inc.
|
||||
* (C) Copyright 2007 - 2014 Red Hat, Inc.
|
||||
* (C) Copyright 2007 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
|
|
@ -145,6 +145,11 @@ gboolean nm_setting_wireless_add_mac_blacklist_item (NMSettingWire
|
|||
NM_AVAILABLE_IN_0_9_10
|
||||
void nm_setting_wireless_remove_mac_blacklist_item (NMSettingWireless *setting,
|
||||
guint32 idx);
|
||||
NM_AVAILABLE_IN_0_9_10
|
||||
gboolean nm_setting_wireless_remove_mac_blacklist_item_by_value (NMSettingWireless *setting,
|
||||
const char *mac);
|
||||
NM_AVAILABLE_IN_0_9_10
|
||||
void nm_setting_wireless_clear_mac_blacklist_items (NMSettingWireless *setting);
|
||||
|
||||
guint32 nm_setting_wireless_get_mtu (NMSettingWireless *setting);
|
||||
gboolean nm_setting_wireless_get_hidden (NMSettingWireless *setting);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue