summaryrefslogtreecommitdiff
path: root/net/ieee802154
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2023-03-10 17:53:46 +0300
committerStefan Schmidt <stefan@datenfreihafen.org>2023-03-23 23:51:30 +0300
commitd021d218f6d924ff5417c64b2e41d184e4bb32d3 (patch)
tree4e0ebf71655196d8bdfb7fcfe28e166acfa024b3 /net/ieee802154
parent26f88e4ebd4fbe96fb4326408e2af05644716d76 (diff)
downloadlinux-d021d218f6d924ff5417c64b2e41d184e4bb32d3.tar.xz
mac802154: Handle received BEACON_REQ
When performing an active scan, devices emit BEACON_REQ which must be answered by other PANs receiving the request, unless they are already passively sending beacons. Answering a beacon request becomes a duty when the user tells us to send beacons and the request provides an interval of 15. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Alexander Aring <aahringo@redhat.com> Link: https://lore.kernel.org/r/20230310145346.1397068-5-miquel.raynal@bootlin.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
Diffstat (limited to 'net/ieee802154')
-rw-r--r--net/ieee802154/header_ops.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/ieee802154/header_ops.c b/net/ieee802154/header_ops.c
index a5ff1017a4b2..41a556be1017 100644
--- a/net/ieee802154/header_ops.c
+++ b/net/ieee802154/header_ops.c
@@ -307,6 +307,19 @@ ieee802154_hdr_pull(struct sk_buff *skb, struct ieee802154_hdr *hdr)
}
EXPORT_SYMBOL_GPL(ieee802154_hdr_pull);
+int ieee802154_mac_cmd_pl_pull(struct sk_buff *skb,
+ struct ieee802154_mac_cmd_pl *mac_pl)
+{
+ if (!pskb_may_pull(skb, sizeof(*mac_pl)))
+ return -EINVAL;
+
+ memcpy(mac_pl, skb->data, sizeof(*mac_pl));
+ skb_pull(skb, sizeof(*mac_pl));
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(ieee802154_mac_cmd_pl_pull);
+
int
ieee802154_hdr_peek_addrs(const struct sk_buff *skb, struct ieee802154_hdr *hdr)
{