All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/5] util: add util_is_valid_sta_address
@ 2020-03-19 22:58 James Prestwood
  2020-03-19 22:58 ` [PATCH v3 2/5] station: support full MAC randomization and override James Prestwood
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: James Prestwood @ 2020-03-19 22:58 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

Checks that that address is neither broadcast or group
---
 src/util.c | 5 +++++
 src/util.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/src/util.c b/src/util.c
index 0c41ceb5..13b01c81 100644
--- a/src/util.c
+++ b/src/util.c
@@ -166,6 +166,11 @@ bool util_is_broadcast_address(const uint8_t *addr)
 	return !memcmp(addr, bcast_addr, 6);
 }
 
+bool util_is_valid_sta_address(const uint8_t *addr)
+{
+	return !util_is_broadcast_address(addr) && !util_is_group_address(addr);
+}
+
 /* This function assumes that identity is not bigger than 253 bytes */
 const char *util_get_domain(const char *identity)
 {
diff --git a/src/util.h b/src/util.h
index dfd1c847..edc6e777 100644
--- a/src/util.h
+++ b/src/util.h
@@ -38,6 +38,7 @@ const char *util_address_to_string(const uint8_t *addr);
 bool util_string_to_address(const char *str, uint8_t *addr);
 bool util_is_group_address(const uint8_t *addr);
 bool util_is_broadcast_address(const uint8_t *addr);
+bool util_is_valid_sta_address(const uint8_t *addr);
 
 const char *util_get_domain(const char *identity);
 const char *util_get_username(const char *identity);
-- 
2.21.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-19 23:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-19 22:58 [PATCH v3 1/5] util: add util_is_valid_sta_address James Prestwood
2020-03-19 22:58 ` [PATCH v3 2/5] station: support full MAC randomization and override James Prestwood
2020-03-19 22:59 ` [PATCH v3 3/5] netdev: honor handshake->spa if set James Prestwood
2020-03-19 22:59 ` [PATCH v3 4/5] doc: document AlwaysRandomizeAddress and AddressOverride James Prestwood
2020-03-19 22:59 ` [PATCH v3 5/5] auto-t: add test for AddressRandomization option James Prestwood
2020-03-19 23:02 ` [PATCH v3 1/5] util: add util_is_valid_sta_address Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.