diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-03-10 15:53:46 +0100 |
---|---|---|
committer | Stefan Schmidt <stefan@datenfreihafen.org> | 2023-03-23 21:51:30 +0100 |
commit | d021d218f6d924ff5417c64b2e41d184e4bb32d3 (patch) | |
tree | 4e0ebf71655196d8bdfb7fcfe28e166acfa024b3 /net/ieee802154/header_ops.c | |
parent | ieee802154: Add support for allowing to answer BEACON_REQ (diff) | |
download | linux-d021d218f6d924ff5417c64b2e41d184e4bb32d3.tar.xz linux-d021d218f6d924ff5417c64b2e41d184e4bb32d3.zip |
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/header_ops.c')
-rw-r--r-- | net/ieee802154/header_ops.c | 13 |
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) { |