summaryrefslogtreecommitdiff
path: root/include/net/mac802154.h
diff options
context:
space:
mode:
authorAlexander Aring <aar@pengutronix.de>2016-07-07 00:32:26 +0300
committerMarcel Holtmann <marcel@holtmann.org>2016-07-08 14:23:12 +0300
commit0ea0b9af9b7599ada307258dc841f4300873e8a1 (patch)
tree2e1dbb0b9a48df37158355cdf8fae2ccc10a9171 /include/net/mac802154.h
parent19580cc1ed299c736b56b45c7576b477f185f8f5 (diff)
downloadlinux-0ea0b9af9b7599ada307258dc841f4300873e8a1.tar.xz
ieee802154: 6lowpan: fix intra pan id check
The RIOT-OS stack does send intra-pan frames but don't set the intra pan flag inside the mac header. It seems this is valid frame addressing but inefficient. Anyway this patch adds a new function for intra pan addressing, doesn't matter if intra pan flag or source and destination are the same. The newly introduction function will be used to check on intra pan addressing for 6lowpan. Signed-off-by: Alexander Aring <aar@pengutronix.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net/mac802154.h')
-rw-r--r--include/net/mac802154.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index ec01b35bc969..d757edd0b0b7 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -346,6 +346,25 @@ static inline unsigned char *ieee802154_skb_src_pan(__le16 fc,
}
/**
+ * ieee802154_skb_is_intra_pan_addressing - checks whenever the mac addressing
+ * is an intra pan communication
+ * @fc: mac header frame control field
+ * @skb: skb where the source and destination pan should be get from
+ */
+static inline bool ieee802154_skb_is_intra_pan_addressing(__le16 fc,
+ const struct sk_buff *skb)
+{
+ unsigned char *dst_pan = ieee802154_skb_dst_pan(fc, skb),
+ *src_pan = ieee802154_skb_src_pan(fc, skb);
+
+ /* if one is NULL is no intra pan addressing */
+ if (!dst_pan || !src_pan)
+ return false;
+
+ return !memcmp(dst_pan, src_pan, IEEE802154_PAN_ID_LEN);
+}
+
+/**
* ieee802154_be64_to_le64 - copies and convert be64 to le64
* @le64_dst: le64 destination pointer
* @be64_src: be64 source pointer