summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-02 03:18:45 (GMT)
committerMarcel Holtmann <marcel@holtmann.org>2014-11-02 03:51:08 (GMT)
commitcb904b0a16305f9b2a98200cc6eb9dc3610278b0 (patch)
tree131593c09e3b67bc9fccdc9c6dc861eeaef055b3
parentf59f419d31ee27c131b44beda5b14b8ce0aaf519 (diff)
downloadlinux-cb904b0a16305f9b2a98200cc6eb9dc3610278b0.tar.xz
ieee802154: add extended address validation helper
This patch introduce an extended address validation helper to check if an extended address is valid or not. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--include/linux/ieee802154.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/ieee802154.h b/include/linux/ieee802154.h
index 6e50a2a..9bba5ca 100644
--- a/include/linux/ieee802154.h
+++ b/include/linux/ieee802154.h
@@ -197,4 +197,18 @@ static inline bool ieee802154_is_valid_psdu_len(const u8 len)
return (len >= IEEE802154_MIN_PSDU_LEN && len <= IEEE802154_MTU);
}
+/**
+ * ieee802154_is_valid_psdu_len - check if extended addr is valid
+ * @addr: extended addr to check
+ */
+static inline bool ieee802154_is_valid_extended_addr(const __le64 addr)
+{
+ /* These EUI-64 addresses are reserved by IEEE. 0xffffffffffffffff
+ * is used internally as extended to short address broadcast mapping.
+ * This is currently a workaround because neighbor discovery can't
+ * deal with short addresses types right now.
+ */
+ return ((addr != 0x0000000000000000) || (addr != 0xffffffffffffffff));
+}
+
#endif /* LINUX_IEEE802154_H */