diff options
author | James Prestwood <prestwoj@gmail.com> | 2020-03-19 15:58:58 -0700 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2020-03-18 18:15:16 -0500 |
commit | 33251ccd20a28b9497aca2076d53ce6801f459b7 (patch) | |
tree | 53a73f597b04f1d920129a73696d324eb7f11720 | |
parent | 66657a57069225fb05ede9a5fd61736862c2a997 (diff) | |
download | iwd-33251ccd20a28b9497aca2076d53ce6801f459b7.tar.gz |
util: add util_is_valid_sta_address
Checks that that address is neither broadcast or group
-rw-r--r-- | src/util.c | 5 | ||||
-rw-r--r-- | src/util.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index 0c41ceb5c..13b01c81f 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 dfd1c847e..edc6e777d 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); |