mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
hwsim: Use an array of addresses for radio_info_rec.addrs
Make accessing the addrs field easier by converting it from a flat buffer concatenation of the 2 addresses to an array of 2 arrays of 6 bytes.
This commit is contained in:
parent
c537953f11
commit
6280a6c72d
@ -255,7 +255,7 @@ struct radio_info_rec {
|
|||||||
bool custom_regdom;
|
bool custom_regdom;
|
||||||
uint32_t regdom_idx;
|
uint32_t regdom_idx;
|
||||||
int channels;
|
int channels;
|
||||||
uint8_t addrs[ETH_ALEN * 2];
|
uint8_t addrs[2][ETH_ALEN];
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -392,8 +392,7 @@ static bool parse_addresses(const uint8_t *buf, size_t len,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!util_string_to_address(addr, rec->addrs +
|
if (!util_string_to_address(addr, rec->addrs[addr_idx])) {
|
||||||
(addr_idx * ETH_ALEN))) {
|
|
||||||
l_error("Can't parse hwsim wiphy %s address from sysfs",
|
l_error("Can't parse hwsim wiphy %s address from sysfs",
|
||||||
rec->name);
|
rec->name);
|
||||||
return false;
|
return false;
|
||||||
@ -567,7 +566,7 @@ static void get_radio_callback(struct l_genl_msg *msg, void *user_data)
|
|||||||
} else {
|
} else {
|
||||||
/* Emit property change events */
|
/* Emit property change events */
|
||||||
|
|
||||||
if (memcmp(prev_rec.addrs, rec->addrs, sizeof(rec->addrs)))
|
if (memcmp(&prev_rec.addrs, &rec->addrs, sizeof(rec->addrs)))
|
||||||
l_dbus_property_changed(dbus, path,
|
l_dbus_property_changed(dbus, path,
|
||||||
HWSIM_RADIO_INTERFACE,
|
HWSIM_RADIO_INTERFACE,
|
||||||
"Addresses");
|
"Addresses");
|
||||||
@ -1055,8 +1054,8 @@ static bool radio_property_get_addresses(struct l_dbus *dbus,
|
|||||||
|
|
||||||
l_dbus_message_builder_enter_array(builder, "s");
|
l_dbus_message_builder_enter_array(builder, "s");
|
||||||
|
|
||||||
for (i = 0; i < sizeof(rec->addrs); i += ETH_ALEN) {
|
for (i = 0; i < sizeof(rec->addrs) / ETH_ALEN; i++) {
|
||||||
const char *str = util_address_to_string(rec->addrs + i);
|
const char *str = util_address_to_string(rec->addrs[i]);
|
||||||
|
|
||||||
l_dbus_message_builder_append_basic(builder, 's', str);
|
l_dbus_message_builder_append_basic(builder, 's', str);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user