From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v3 1/5] util: add util_is_valid_sta_address
Date: Thu, 19 Mar 2020 15:58:58 -0700 [thread overview]
Message-ID: <20200319225902.16249-1-prestwoj@gmail.com> (raw)
[-- 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
next reply other threads:[~2020-03-19 22:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 22:58 James Prestwood [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200319225902.16249-1-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox