net/ieee802154/nl-mac.c
Source file repositories/reference/linux-study-clean/net/ieee802154/nl-mac.c
File Facts
- System
- Linux kernel
- Corpus path
net/ieee802154/nl-mac.c- Extension
.c- Size
- 34943 bytes
- Lines
- 1336
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/gfp.hlinux/kernel.hlinux/if_arp.hlinux/netdevice.hlinux/ieee802154.hnet/netlink.hnet/genetlink.hnet/sock.hlinux/nl802154.hlinux/export.hnet/af_ieee802154.hnet/ieee802154_netdev.hnet/cfg802154.hieee802154.h
Detected Declarations
struct llsec_dump_datafunction nla_put_hwaddrfunction nla_get_hwaddrfunction nla_put_shortaddrfunction nla_get_shortaddrfunction ieee802154_nl_start_confirmfunction ieee802154_nl_fill_ifacefunction ieee802154_associate_reqfunction ieee802154_associate_respfunction ieee802154_disassociate_reqfunction ieee802154_start_reqfunction ieee802154_scan_reqfunction ieee802154_list_ifacefunction ieee802154_dump_ifacefunction ieee802154_set_macparamsfunction ieee802154_llsec_parse_key_idfunction ieee802154_llsec_fill_key_idfunction ieee802154_llsec_getparamsfunction ieee802154_llsec_setparamsfunction ieee802154_llsec_dump_tablefunction for_each_netdevfunction ieee802154_nl_llsec_changefunction ieee802154_llsec_parse_keyfunction llsec_add_keyfunction ieee802154_llsec_add_keyfunction llsec_remove_keyfunction ieee802154_llsec_del_keyfunction ieee802154_nl_fill_keyfunction llsec_iter_keysfunction list_for_each_entryfunction ieee802154_llsec_dump_keysfunction llsec_parse_devfunction llsec_add_devfunction ieee802154_llsec_add_devfunction llsec_del_devfunction ieee802154_llsec_del_devfunction ieee802154_nl_fill_devfunction llsec_iter_devsfunction list_for_each_entryfunction ieee802154_llsec_dump_devsfunction llsec_add_devkeyfunction ieee802154_llsec_add_devkeyfunction llsec_del_devkeyfunction ieee802154_llsec_del_devkeyfunction ieee802154_nl_fill_devkeyfunction llsec_iter_devkeysfunction list_for_each_entryfunction list_for_each_entry
Annotated Snippet
struct llsec_dump_data {
struct sk_buff *skb;
int s_idx, s_idx2;
int portid;
int nlmsg_seq;
struct net_device *dev;
struct ieee802154_mlme_ops *ops;
struct ieee802154_llsec_table *table;
};
static int
ieee802154_llsec_dump_table(struct sk_buff *skb, struct netlink_callback *cb,
int (*step)(struct llsec_dump_data *))
{
struct net *net = sock_net(skb->sk);
struct net_device *dev;
struct llsec_dump_data data;
int idx = 0;
int first_dev = cb->args[0];
int rc;
for_each_netdev(net, dev) {
if (idx < first_dev || dev->type != ARPHRD_IEEE802154)
goto skip;
data.ops = ieee802154_mlme_ops(dev);
if (!data.ops->llsec)
goto skip;
data.skb = skb;
data.s_idx = cb->args[1];
data.s_idx2 = cb->args[2];
data.dev = dev;
data.portid = NETLINK_CB(cb->skb).portid;
data.nlmsg_seq = cb->nlh->nlmsg_seq;
data.ops->llsec->lock_table(dev);
data.ops->llsec->get_table(data.dev, &data.table);
rc = step(&data);
data.ops->llsec->unlock_table(dev);
if (rc < 0)
break;
skip:
idx++;
}
cb->args[0] = idx;
return skb->len;
}
static int
ieee802154_nl_llsec_change(struct sk_buff *skb, struct genl_info *info,
int (*fn)(struct net_device*, struct genl_info*))
{
struct net_device *dev = NULL;
int rc = -EINVAL;
dev = ieee802154_nl_get_dev(info);
if (!dev)
return -ENODEV;
if (!ieee802154_mlme_ops(dev)->llsec)
rc = -EOPNOTSUPP;
else
rc = fn(dev, info);
dev_put(dev);
return rc;
}
static int
ieee802154_llsec_parse_key(struct genl_info *info,
struct ieee802154_llsec_key *key)
{
u8 frames;
u32 commands[256 / 32];
memset(key, 0, sizeof(*key));
if (!info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES] ||
!info->attrs[IEEE802154_ATTR_LLSEC_KEY_BYTES])
return -EINVAL;
frames = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES]);
if ((frames & BIT(IEEE802154_FC_TYPE_MAC_CMD)) &&
!info->attrs[IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS])
return -EINVAL;
Annotation
- Immediate include surface: `linux/gfp.h`, `linux/kernel.h`, `linux/if_arp.h`, `linux/netdevice.h`, `linux/ieee802154.h`, `net/netlink.h`, `net/genetlink.h`, `net/sock.h`.
- Detected declarations: `struct llsec_dump_data`, `function nla_put_hwaddr`, `function nla_get_hwaddr`, `function nla_put_shortaddr`, `function nla_get_shortaddr`, `function ieee802154_nl_start_confirm`, `function ieee802154_nl_fill_iface`, `function ieee802154_associate_req`, `function ieee802154_associate_resp`, `function ieee802154_disassociate_req`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.