dbus: Add D-Bus property for current MAC address
Since wpa_supplicant can change MAC address of the interface on its own (with randomization enabled) it makes sense to introduce MACAddress as a property of the interface and send notifications about its change. This allows other applications to just use D-Bus instead of both communicating over D-Bus with wpa_supplicant and listening to Netlink notifications for MAC changes. Signed-off-by: Andrzej Ostruszka <amo@semihalf.com>
This commit is contained in:
parent
12d8b8a91e
commit
1897abad94
8 changed files with 52 additions and 0 deletions
|
@ -2344,6 +2344,9 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
|
|||
case WPAS_DBUS_PROP_BSS_TM_STATUS:
|
||||
prop = "BSSTMStatus";
|
||||
break;
|
||||
case WPAS_DBUS_PROP_MAC_ADDRESS:
|
||||
prop = "MACAddress";
|
||||
break;
|
||||
default:
|
||||
wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
|
||||
__func__, property);
|
||||
|
@ -3939,6 +3942,11 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = {
|
|||
wpas_dbus_setter_mac_address_randomization_mask,
|
||||
NULL
|
||||
},
|
||||
{ "MACAddress", WPAS_DBUS_NEW_IFACE_INTERFACE, "ay",
|
||||
wpas_dbus_getter_mac_address,
|
||||
NULL,
|
||||
NULL,
|
||||
},
|
||||
{ NULL, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ enum wpas_dbus_prop {
|
|||
WPAS_DBUS_PROP_ROAM_COMPLETE,
|
||||
WPAS_DBUS_PROP_SESSION_LENGTH,
|
||||
WPAS_DBUS_PROP_BSS_TM_STATUS,
|
||||
WPAS_DBUS_PROP_MAC_ADDRESS,
|
||||
};
|
||||
|
||||
enum wpas_dbus_bss_prop {
|
||||
|
|
|
@ -4753,6 +4753,27 @@ dbus_bool_t wpas_dbus_getter_mac_address_randomization_mask(
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_mac_address - Get MAC address of an interface
|
||||
* @iter: Pointer to incoming dbus message iter
|
||||
* @error: Location to store error on failure
|
||||
* @user_data: Function specific data
|
||||
* Returns: a list of stations
|
||||
*
|
||||
* Getter for "MACAddress" property.
|
||||
*/
|
||||
dbus_bool_t wpas_dbus_getter_mac_address(
|
||||
const struct wpa_dbus_property_desc *property_desc,
|
||||
DBusMessageIter *iter, DBusError *error, void *user_data)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = user_data;
|
||||
|
||||
return wpas_dbus_simple_array_property_getter(iter, DBUS_TYPE_BYTE,
|
||||
wpa_s->own_addr, ETH_ALEN,
|
||||
error);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_sta_address - Return the address of a connected station
|
||||
* @iter: Pointer to incoming dbus message iter
|
||||
|
|
|
@ -196,6 +196,7 @@ DECLARE_ACCESSOR(wpas_dbus_getter_blobs);
|
|||
DECLARE_ACCESSOR(wpas_dbus_getter_stas);
|
||||
DECLARE_ACCESSOR(wpas_dbus_getter_mac_address_randomization_mask);
|
||||
DECLARE_ACCESSOR(wpas_dbus_setter_mac_address_randomization_mask);
|
||||
DECLARE_ACCESSOR(wpas_dbus_getter_mac_address);
|
||||
DECLARE_ACCESSOR(wpas_dbus_getter_sta_address);
|
||||
DECLARE_ACCESSOR(wpas_dbus_getter_sta_aid);
|
||||
DECLARE_ACCESSOR(wpas_dbus_getter_sta_caps);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue