| 0/0 |
2026/09/07 06:44 |
flow |
repro-c |
2h05m
Results: map[EquivalenceAnalysis:The reproducer successfully triggered the expected crash. The crash report matches the original bug description exactly, with the same WARNING in `mac80211_hwsim_write_tsf` caused by `c->control.rates[0].idx < 0`. OtherCrashReports:<nil> ReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int hwsim_id = get_genl_family_id(nl_fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
fprintf(stderr, "[-] Failed to get MAC80211_HWSIM family ID\n");
} else {
printf("[+] MAC80211_HWSIM family ID: %d\n", hwsim_id);
if (create_hwsim_radio(nl_fd, hwsim_id) < 0) {
fprintf(stderr, "[-] Failed to create hwsim radio\n");
} else {
printf("[+] Created hwsim radio with MLO support\n");
}
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "[-] Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
sleep(1); // Wait for interface to appear
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 6; i++) {
char ifname[16];
snprintf(ifname, sizeof(ifname), "wlan%d", i);
if (if_nametoindex(ifname) == 0) continue;
printf("[+] Trying interface %s\n", ifname);
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
continue;
}
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
continue;
}
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
continue;
}
// 4. Set frequency to 2412 MHz
set_interface_freq(nl80211_id, ifname, 2412);
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
continue;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
sleep(1);
return 0;
} Reproduced:true ReproducedBugTitle:WARNING in mac80211_hwsim_write_tsf ReproducedCrashReport:------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#0: syz-executor206/5838
Modules linked in:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x1228/0x3160 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa932373f57
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
</TASK>
]
|
| 1/1 |
2026/09/07 06:44 |
action |
kernel-checkouter |
1m
Results: map[KernelSrc:/app/workdir/cache/src/3e9556fdea5ea68aeb007d973d2ad74d50ccef20]
|
| 2/1 |
2026/09/07 06:45 |
action |
kernel-builder |
13m
Results: map[KernelObj:/app/workdir/cache/build/63da51d40275f0c2ef204b91d88c234bfe825417]
|
| 3/1 |
2026/09/07 06:58 |
action |
codesearch-prepare |
9m
Results: map[Index:codesearch-index]
|
| 4/1 |
2026/09/07 07:08 |
agent |
initial-researcher |
9m
Model:
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to analyze a Linux kernel bug description and propose a strategy to reproduce it
with a minimal, standalone C program for the strictly defensive purpose of verifying a bugfix.
=== TOOL SELECTION GUIDELINES ===
- When looking up C function or struct definitions, prefer codesearch-definition-source
and codesearch-struct-layout first.
- Fall back to read-file or grepper only if symbol lookup fails or when inspecting macros,
headers, or non-C files.
=== CRITICAL PROHIBITIONS ===
- Do NOT propose an exploit. Focus solely on minimal technical reproduction of the bug state.
- Do NOT write long explanations. Keep your analysis and strategy proposal concise.
- Do NOT assume that the target bug has already been fixed just because a git commit title
or description mentions a similar bug or fix. Commit messages often reference related issues
or partial fixes. Proceed with proposing a reproduction strategy regardless of historical fix commits.
Prefer calling several tools at the same time to save round-trips.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Reply: An analysis of the bug and a strategy for reproducing it.
### Bug Analysis
The warning `c->control.rates[0].idx < 0` in `ieee80211_get_tx_rate()` is triggered during the transmission of an injected frame on a monitor interface. The sequence of events is as follows:
1. When a frame is injected via `AF_PACKET` into a monitor interface, `ieee80211_monitor_start_xmit()` initializes the transmission info (`info`) to zero.
2. It then calls `ieee80211_parse_tx_radiotap()` to parse the radiotap header. If the radiotap header contains a `RATE` field, it sets `info->control.rates[0].idx = -1` and attempts to find the matching rate in the hardware's supported bitrates.
3. If the rate is invalid (e.g., does not match any supported bitrate), `idx` remains `-1`. The function then clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag because the rate was invalid.
4. The frame proceeds to `ieee80211_tx()`, which queues the frame and eventually invokes `invoke_tx_handlers_late()`.
5. `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` to populate the rate **only if** the hardware does not have the `HAS_RATE_CONTROL` flag set.
6. In `mac80211_hwsim`, the `HAS_RATE_CONTROL` flag is set if the radio was created with `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (or `HWSIM_ATTR_MLO_SUPPORT`). Because this flag is set, `ieee80211_tx_h_rate_ctrl()` is skipped, and `idx` remains `-1`.
7. The frame reaches `mac80211_hwsim_tx()`. Since `mac80211_hwsim` does not set `SUPPORTS_RC_TABLE` by default, it does not call `ieee80211_get_tx_rates()`, leaving `idx` as `-1`.
8. Finally, `mac80211_hwsim_tx_frame_no_nl()` calls `mac80211_hwsim_write_tsf()`, which unconditionally calls `mac80211_hwsim_get_tx_rate()`. This function checks `WARN_ON_ONCE(c->control.rates[0].idx < 0)` and triggers the warning.
### Reproduction Strategy
To reproduce this bug, we need to:
1. Ensure no default `mac80211_hwsim` radios exist (e.g., `modprobe mac80211_hwsim radios=0`).
2. Create a new `mac80211_hwsim` radio with the `HWSIM_ATTR_SUPPORT_NAN_DEVICE` attribute set to `true` via generic netlink. This forces the `HAS_RATE_CONTROL` flag to be set without forcing `use_chanctx` (which would otherwise drop the frame early).
3. Change the created interface (e.g., `wlan0`) to `monitor` mode and bring it up.
4. Open an `AF_PACKET` socket bound to the monitor interface.
5. Inject a frame with a radiotap header containing an invalid `RATE` field (e.g., `1` for 500kbps) followed by a valid 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
#define HWSIM_CMD_NEW_RADIO 1
#define HWSIM_ATTR_SUPPORT_NAN_DEVICE 30
struct nl_msg {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
char attr[256];
};
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
return -1;
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) return -1;
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) return -1;
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main() {
system("modprobe mac80211_hwsim radios=0");
sleep(1);
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
perror("socket");
return 1;
}
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
return 1;
}
struct nl_msg req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr));
req.nlh.nlmsg_type = family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.gnlh.cmd = HWSIM_CMD_NEW_RADIO;
struct nlattr *attr = (struct nlattr *)req.attr;
attr->nla_len = sizeof(struct nlattr);
attr->nla_type = HWSIM_ATTR_SUPPORT_NAN_DEVICE;
req.nlh.nlmsg_len += NLMSG_ALIGN(attr->nla_len);
send(sock, &req, req.nlh.nlmsg_len, 0);
char buf[4096];
recv(sock, buf, sizeof(buf), 0);
close(sock);
sleep(1);
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
sleep(1);
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex");
return 1;
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
unsigned char pkt[] = {
/* Radiotap Header (10 bytes) */
0x00, 0x00, 0x0a, 0x00, /* version, pad, len */
0x04, 0x00, 0x00, 0x00, /* present: RATE (bit 2) */
0x01, 0x00, /* rate = 1 (invalid), pad */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control, Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 */
0x00, 0x00 /* Sequence Control */
};
send(psock, pkt, sizeof(pkt), 0);
close(psock);
return 0;
}
```
|
| 5/2 |
2026/09/07 07:08 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 4930
output: 27
thoughts: 167
Thoughts: **My Thought Process Regarding the mac80211_hwsim_write_tsf Warning**
Alright, so I've encountered this `WARNING in mac80211_hwsim_write_tsf` and I need to get to the bottom of it. My immediate thought is to trace the execution path leading to this warning. I see it originates from `include/net/mac80211.h:3413` within the `ieee80211_get_tx_rate` function. This, in turn, is called by `mac80211_hwsim_get_tx_rate`, which is ultimately invoked by `mac80211_hwsim_write_tsf`. This call chain is crucial; it tells me the problematic behavior is happening within the simulated hardware environment (`hwsim`) when it's trying to manage transmit rates, specifically when updating the Time Synchronization Function (TSF).
The warning message itself, `c->control.rates[0].idx < 0`, is the key piece of evidence. It clearly indicates that the `idx` field of the first rate control entry (`rates[0]`) within the `control` structure of some context `c` is negative. In the context of `mac80211`, the `idx` for a rate usually represents an index into a table of supported rates. A negative index is nonsensical and strongly suggests an invalid or uninitialized state for the rate information.
My next step, naturally, is to dive into the source code for both `mac80211_hwsim_write_tsf` and `ieee80211_get_tx_rate`. I need to understand:
* **`mac80211_hwsim_write_tsf`:** What is this function doing? Why is it calling `ieee80211_get_tx_rate`? What kind of state is it managing, and how does that state relate to transmit rates? Is it possible that `hwsim` is not properly initializing or populating the rate information before it's accessed by the generic `mac80211` logic?
* **`ieee80211_get_tx_rate`:** What is the expected input to this function? What are the preconditions for `c->control.rates[0].idx` to be valid? Given that this function is being called from `hwsim`, how might `hwsim` be misbehaving in providing the necessary context (`c`) to this function?
I'll be looking for any instance where `c->control.rates[0].idx` might be set to an invalid value, or where it might not be set at all, leading to it retaining a default negative value. This could involve examining how the `c` structure is populated, what data is being copied or derived, and if there are any race conditions or logic errors in `hwsim` that prevent correct rate index assignment. The goal is to identify the precise point where the invalid index originates and then determine the fix, likely within the `mac80211_hwsim` driver itself.
|
| 6/2 |
2026/09/07 07:08 |
tool |
grepper |
0m
Args: map[Expression:c->control.rates\[0\]\.idx < 0]
Results: map[Output:include/net/mac80211.h=3410=ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
--
include/net/mac80211.h-3412-{
include/net/mac80211.h:3413: if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
include/net/mac80211.h-3414- return NULL;
]
|
| 7/2 |
2026/09/07 07:08 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 5257
output: 59
thoughts: 45
Thoughts: **My Thought Process on `mac80211_hwsim_write_tsf`**
Alright, so I'm diving into the `mac80211_hwsim` driver, specifically looking at the `mac80211_hwsim_write_tsf` function within `drivers/net/wireless/virtual/mac80211_hwsim_main.c`. My immediate objective is to understand how this particular function manages the Time Synchronization Function (TSF) for the virtual hardware simulated by this driver.
My understanding is that TSF is a crucial component in IEEE 802.11, essentially a local timer that's kept synchronized across devices within a Basic Service Set (BSS). It plays a role in various MAC operations, including beacon timing, channel access, and power management. Given that `mac80211_hwsim` is simulating hardware, it needs to accurately mimic this TSF behavior.
So, when I examine `mac80211_hwsim_write_tsf`, I'm expecting to see how the driver *writes* to this simulated TSF. This could involve:
1. **Initialization:** How is the TSF timer initially set when a virtual device is created or associated? Is there a default value, or is it derived from the AP's TSF?
2. **Synchronization:** The core of TSF is synchronization. This function, `write_tsf`, implies setting or updating the TSF value. I'll be looking for the mechanism by which this happens. Does it involve a direct setting of the timer, or is it a more subtle adjustment based on received beacons or other synchronization frames?
3. **Driver Interaction:** How does this `write_tsf` function interface with the higher-level `mac80211` framework? `mac80211` itself manages TSF for real hardware. I'll be curious to see what hooks or callbacks `mac80211_hwsim` is using to interact with `mac80211`'s TSF management logic, or if `hwsim` is entirely reimplementing it for the virtual hardware.
4. **Virtual Nature:** Given it's a simulation, what are the simplifications or specific behaviors related to TSF that `hwsim` might implement? Real hardware has physical clock drift and specific synchronization protocols. How does `hwsim` abstract or simulate these? Perhaps it's a simpler, monotonically increasing counter, or it might actively try to mimic drift and resynchronization.
5. **Purpose within `hwsim`:** Beyond basic TSF functionality, what is the *specific purpose* of having a `write_tsf` function in `hwsim`? Is it for testing specific TSF-related behaviors of the `mac80211` stack? Is it to allow synthetic control over TSF for certain test scenarios?
In essence, I'm dissecting this function to understand its role in emulating a fundamental 802.11 timing mechanism within a virtualized wireless environment, and how that emulation interacts with the broader `mac80211` subsystem. My focus will be on the implementation details that reveal how the simulated TSF is manipulated, updated, and presented to the rest of the wireless stack.
|
| 8/2 |
2026/09/07 07:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_write_tsf]
Results: map[SourceCode:1605: static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
1606: struct sk_buff *skb, u64 sim_time)
1607: {
1608: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1609: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1610: struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1611: struct ieee80211_rate *txrate;
1612: /* TODO: get MCS */
1613: int bitrate = 100;
1614:
1615: spin_lock_bh(&data->tsf_offset_lock);
1616:
1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
1618: if (txrate)
1619: bitrate = txrate->bitrate;
1620:
1621: if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
1622: ieee80211_is_probe_resp(hdr->frame_control)) {
1623: mgmt->u.probe_resp.timestamp =
1624: cpu_to_le64(sim_time + data->tsf_offset +
1625: 24 * 8 * 10 / bitrate);
1626: } else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
1627: ieee80211_is_beacon(mgmt->frame_control)) {
1628: mgmt->u.beacon.timestamp = cpu_to_le64(sim_time +
1629: data->tsf_offset +
1630: 24 * 8 * 10 /
1631: bitrate);
1632: } else if (skb->len >= offsetofend(struct ieee80211_ext,
1633: u.s1g_beacon.timestamp) &&
1634: ieee80211_is_s1g_beacon(mgmt->frame_control)) {
1635: struct ieee80211_ext *ext = (void *)mgmt;
1636:
1637: ext->u.s1g_beacon.timestamp = cpu_to_le32(sim_time +
1638: data->tsf_offset +
1639: 10 * 8 * 10 /
1640: bitrate);
1641: }
1642:
1643: spin_unlock_bh(&data->tsf_offset_lock);
1644: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 9/2 |
2026/09/07 07:08 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 6203
output: 60
thoughts: 22
Thoughts: **My Deep Dive into `mac80211_hwsim_get_tx_rate`**
Alright, so I'm really trying to get a handle on how the `mac80211_hwsim` module handles transmission rates. My current focus is specifically on the `mac80211_hwsim_get_tx_rate` function. I need to understand its internal logic, the parameters it receives, and what it ultimately returns. My goal is to trace the flow of information and logic within this function to fully grasp its role in simulating Wi-Fi hardware transmissions. I'm looking for details on how it determines the appropriate rate for a given transmission scenario within the simulation context. This is crucial for ensuring the accuracy and fidelity of the `hwsim` module's behavior.
|
| 10/2 |
2026/09/07 07:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_get_tx_rate]
Results: map[SourceCode:1327: static struct ieee80211_rate *
1328: mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
1329: struct ieee80211_tx_info *info)
1330: {
1331: if (info->control.rates[0].flags &
1332: (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
1333: return NULL;
1334:
1335: return ieee80211_get_tx_rate(hw, info);
1336: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 11/2 |
2026/09/07 07:08 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 6503
output: 49
thoughts: 20
Thoughts: **My Thought Process on `ieee80211_get_tx_rate`**
Okay, so I'm diving into the `ieee80211_get_tx_rate` function. My primary objective here is to understand its role within the 802.11 (Wi-Fi) driver stack, specifically how it influences the transmission rate selection process. I expect this function to be a critical piece of logic that dictates the modulation and coding scheme (MCS) used for outgoing data frames.
My initial hypothesis is that `ieee80211_get_tx_rate` doesn't *just* pick a rate arbitrarily. It must be informed by a multitude of factors. I'm anticipating it will consider the current link quality – things like signal strength (RSSI), signal-to-noise ratio (SNR), and potentially packet error rates (PER) or even historical transmission success/failure data. The driver likely maintains some state regarding the client's capabilities and the current environmental conditions.
Furthermore, I'm thinking about the broader context of Wi-Fi standards. This function will almost certainly need to be aware of the supported rates for the specific Wi-Fi standard being used (e.g., 802.11n, 802.11ac, 802.11ax). It will need to select from a range of available MCS indices, taking into account things like spatial streams (MIMO), channel bandwidth (20MHz, 40MHz, 80MHz, 160MHz), and guard intervals.
I'm also wondering about the *mechanisms* by which it arrives at a decision. Is it a purely reactive algorithm, adjusting the rate on every transmission based on immediate feedback? Or is there a more proactive component, perhaps involving rate adaptation algorithms that try to predict future link conditions or proactively probe for higher rates? I'd be keen to see if it employs techniques like Automatic Rate Fallback (ARF), Minstrel, or other more sophisticated adaptive algorithms that are common in Wi-Fi drivers.
The interaction with other parts of the driver is also on my mind. This function likely receives input from the MAC layer's statistics gathering and potentially from the radio hardware itself, which might provide real-time channel quality metrics. Conversely, its output – the selected TX rate – will be used by the lower layers to configure the transmit hardware and generate the appropriate frame headers.
Ultimately, my goal is to understand the intelligence embedded within `ieee80211_get_tx_rate`. How does it balance the desire for high throughput with the need for reliable communication? What are the trade-offs it makes, and what are the potential failure points or areas for optimization? This function is likely a key determinant of overall Wi-Fi performance, and dissecting it will reveal much about the driver's sophistication in managing the wireless medium.
|
| 12/2 |
2026/09/07 07:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/net/mac80211.h Name:ieee80211_get_tx_rate]
Results: map[SourceCode:3409: static inline struct ieee80211_rate *
3410: ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
3411: const struct ieee80211_tx_info *c)
3412: {
3413: if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
3414: return NULL;
3415:
3416: if (c->band >= NUM_NL80211_BANDS)
3417: return NULL;
3418:
3419: return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
3420: }
SourceFile:include/net/mac80211.h]
|
| 13/2 |
2026/09/07 07:08 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 6803
output: 50
thoughts: 277
Thoughts: **My Thought Process Regarding the `c->control.rates[0].idx < 0` Warning**
Alright, let's break down what's happening here. I've encountered a warning, specifically `c->control.rates[0].idx < 0`. My first instinct is to understand the context of this `c`. Looking at the provided information, it's clear that `c` refers to `info`, which in turn is `IEEE80211_SKB_CB(skb)`. This immediately tells me we're dealing with the control block of a wireless networking packet, likely within the mac80211 subsystem.
The call trace is the key to unraveling the sequence of events leading to this warning. Tracing it backward, I see a path originating from userspace: `packet_snd` -> `packet_sendmsg` -> `sock_sendmsg_nosec` -> `__sock_sendmsg` -> `__sys_sendto`. This confirms my initial hypothesis: a packet is being transmitted from userspace, specifically via an `AF_PACKET` socket, and it's destined for a monitor interface. This is a crucial detail because monitor interfaces operate at a lower level and handle raw wireless frames, not just IP packets.
Now, let's follow the trace from the network stack's perspective: `__sys_sendto` eventually leads to `__netdev_start_xmit` and then `netdev_start_xmit`, which is the standard entry point for a network device driver to handle transmission. From there, the trace dives deeper into the mac80211 framework: `drv_tx` -> `mac80211_hwsim_tx` -> `mac80211_hwsim_tx_frame_no_nl`. The mention of `hwsim` strongly suggests I'm looking at a hardware simulation context, which is important for debugging and testing without actual hardware.
The core of the problem, the `c->control.rates[0].idx < 0` warning, suggests an issue with the transmission rate indexing. In the context of `ieee80211_tx_frags` and `__ieee80211_tx`, this `idx` likely refers to the index of the chosen transmission rate within a list or array of supported rates. A negative index is clearly invalid and indicates that the driver or the mac80211 layer is attempting to use a transmission rate that hasn't been properly set or is otherwise nonsensical.
Given that this is a packet being sent to a monitor interface via `AF_PACKET`, it's possible that the userspace application is attempting to craft and send raw wireless frames. When sending raw frames, especially on a monitor interface, the responsibility of setting appropriate transmission parameters, including the rate, often falls more directly on the sender or the specific driver handling the monitor mode. The mac80211 subsystem might be encountering a situation where it expects a valid rate index for transmission, but it's not finding one.
My next step, as indicated by the prompt, is to scrutinize `ieee80211_monitor_start_xmit`. This function is the entry point for starting the transmission of packets when the network interface is in monitor mode. I'd be looking for how it handles rate selection and validation for frames coming from userspace via `AF_PACKET`. Specifically, I'll be checking:
* How the rate information is passed from the `AF_PACKET` socket and the userspace application.
* Whether there are any checks or default behaviors when rate information is missing or invalid in the context of a monitor interface.
* If the `hwsim` environment might be contributing to this by not properly simulating rate capabilities or by expecting a different kind of input for rate setting in monitor mode.
* The logic within `ieee80211_monitor_start_xmit` that populates the `c->control.rates` structure. Is it possible that in this specific scenario, this structure isn't being populated correctly, leading to the `idx < 0`?
Ultimately, I believe the issue stems from an incorrect or missing transmission rate configuration for a raw frame being sent to a monitor interface, possibly exacerbated by the hardware simulation environment. My focus will be on understanding how the rate information is processed and validated at the `ieee80211_monitor_start_xmit` level.
|
| 14/2 |
2026/09/07 07:08 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_monitor_start_xmit]
Results: map[SourceCode:2324: netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2325: struct net_device *dev)
2326: {
2327: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2328: struct ieee80211_chanctx_conf *chanctx_conf;
2329: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2330: struct ieee80211_hdr *hdr;
2331: struct ieee80211_sub_if_data *tmp_sdata, *sdata;
2332: struct cfg80211_chan_def *chandef;
2333: u16 len_rthdr;
2334: int hdrlen;
2335:
2336: sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2337: if (unlikely(!ieee80211_sdata_running(sdata)))
2338: goto fail;
2339:
2340: memset(info, 0, sizeof(*info));
2341: info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
2342: IEEE80211_TX_CTL_INJECTED;
2343:
2344: /* Sanity-check the length of the radiotap header */
2345: if (!ieee80211_validate_radiotap_len(skb))
2346: goto fail;
2347:
2348: /* we now know there is a radiotap header with a length we can use */
2349: len_rthdr = ieee80211_get_radiotap_len(skb->data);
2350:
2351: /*
2352: * fix up the pointers accounting for the radiotap
2353: * header still being in there. We are being given
2354: * a precooked IEEE80211 header so no need for
2355: * normal processing
2356: */
2357: skb_set_mac_header(skb, len_rthdr);
2358: /*
2359: * these are just fixed to the end of the rt area since we
2360: * don't have any better information and at this point, nobody cares
2361: */
2362: skb_set_network_header(skb, len_rthdr);
2363: skb_set_transport_header(skb, len_rthdr);
2364:
2365: if (skb->len < len_rthdr + 2)
2366: goto fail;
2367:
2368: hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
2369: hdrlen = ieee80211_hdrlen(hdr->frame_control);
2370:
2371: if (skb->len < len_rthdr + hdrlen)
2372: goto fail;
2373:
2374: /*
2375: * Initialize skb->protocol if the injected frame is a data frame
2376: * carrying a rfc1042 header
2377: */
2378: if (ieee80211_is_data(hdr->frame_control) &&
2379: skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) {
2380: u8 *payload = (u8 *)hdr + hdrlen;
2381:
2382: if (ether_addr_equal(payload, rfc1042_header))
2383: skb->protocol = cpu_to_be16((payload[6] << 8) |
2384: payload[7]);
2385: }
2386:
2387: rcu_read_lock();
2388:
2389: /*
2390: * We process outgoing injected frames that have a local address
2391: * we handle as though they are non-injected frames.
2392: * This code here isn't entirely correct, the local MAC address
2393: * isn't always enough to find the interface to use; for proper
2394: * VLAN support we have an nl80211-based mechanism.
2395: *
2396: * This is necessary, for example, for old hostapd versions that
2397: * don't use nl80211-based management TX/RX.
2398: */
2399: list_for_each_entry_rcu(tmp_sdata, &local->interfaces, list) {
2400: if (!ieee80211_sdata_running(tmp_sdata))
2401: continue;
2402: if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2403: tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2404: continue;
2405: if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) {
2406: sdata = tmp_sdata;
2407: break;
2408: }
2409: }
2410:
2411: chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
2412: if (!chanctx_conf) {
2413: tmp_sdata = rcu_dereference(local->monitor_sdata);
2414: if (tmp_sdata)
2415: chanctx_conf =
2416: rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf);
2417: }
2418:
2419: if (!chanctx_conf) {
2420: struct ieee80211_chanctx *ctx;
2421: bool first = true;
2422:
2423: list_for_each_entry_rcu(ctx, &local->chanctx_list, list) {
2424: if (!first)
2425: goto fail_rcu;
2426: chanctx_conf = &ctx->conf;
2427: first = false;
2428: }
2429: }
2430:
2431: if (chanctx_conf)
2432: chandef = &chanctx_conf->def;
2433: else
2434: goto fail_rcu;
2435:
2436: /*
2437: * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still
2438: * shouldn't transmit on disabled channels.
2439: */
2440: if (!cfg80211_chandef_usable(local->hw.wiphy, chandef,
2441: IEEE80211_CHAN_DISABLED))
2442: goto fail_rcu;
2443:
2444: /*
2445: * Frame injection is not allowed if beaconing is not allowed
2446: * or if we need radar detection. Beaconing is usually not allowed when
2447: * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
2448: * Passive scan is also used in world regulatory domains where
2449: * your country is not known and as such it should be treated as
2450: * NO TX unless the channel is explicitly allowed in which case
2451: * your current regulatory domain would not have the passive scan
2452: * flag.
2453: *
2454: * Since AP mode uses monitor interfaces to inject/TX management
2455: * frames we can make AP mode the exception to this rule once it
2456: * supports radar detection as its implementation can deal with
2457: * radar detection by itself. We can do that later by adding a
2458: * monitor flag interfaces used for AP support.
2459: */
2460: if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
2461: sdata->vif.type))
2462: goto fail_rcu;
2463:
2464: info->band = chandef->chan->band;
2465:
2466: /* Initialize skb->priority according to frame type and TID class,
2467: * with respect to the sub interface that the frame will actually
2468: * be transmitted on. If the DONT_REORDER flag is set, the original
2469: * skb-priority is preserved to assure frames injected with this
2470: * flag are not reordered relative to each other.
2471: */
2472: ieee80211_select_queue_80211(sdata, skb, hdr);
2473: skb_set_queue_mapping(skb, ieee80211_ac_from_tid(skb->priority));
2474:
2475: /*
2476: * Process the radiotap header. This will now take into account the
2477: * selected chandef above to accurately set injection rates and
2478: * retransmissions.
2479: */
2480: if (!ieee80211_parse_tx_radiotap(skb, dev))
2481: goto fail_rcu;
2482:
2483: /* remove the injection radiotap header */
2484: skb_pull(skb, len_rthdr);
2485:
2486: ieee80211_xmit(sdata, NULL, skb);
2487: rcu_read_unlock();
2488:
2489: return NETDEV_TX_OK;
2490:
2491: fail_rcu:
2492: rcu_read_unlock();
2493: fail:
2494: dev_kfree_skb(skb);
2495: return NETDEV_TX_OK; /* meaning, we dealt with the skb */
2496: }
SourceFile:net/mac80211/tx.c]
|
| 15/2 |
2026/09/07 07:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 10070
output: 51
thoughts: 26
Thoughts: **A Deep Dive into `ieee80211_parse_tx_radiotap`**
Alright, my focus is currently on dissecting the `ieee80211_parse_tx_radiotap` function. I've just encountered its invocation and my immediate inclination is to delve into its inner workings. I need to understand precisely *what* this function does, *how* it accomplishes its task, and *what* implications its operation has within the broader context of IEEE 802.11 packet processing, specifically concerning transmission. My expectation is that it will be instrumental in preparing or validating radiotap headers for outgoing frames, ensuring that all necessary metadata for transmission is correctly parsed and integrated. I’m eager to examine the data structures it manipulates, the specific radiotap fields it expects to find or generate, and the error handling mechanisms in place. This is a critical juncture in the transmission pipeline, and a thorough understanding here is paramount.
|
| 16/2 |
2026/09/07 07:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_parse_tx_radiotap]
Results: map[SourceCode:2106: bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
2107: struct net_device *dev)
2108: {
2109: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2110: struct ieee80211_radiotap_iterator iterator;
2111: struct ieee80211_radiotap_header *rthdr =
2112: (struct ieee80211_radiotap_header *) skb->data;
2113: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2114: int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
2115: NULL);
2116: u16 txflags;
2117: u16 rate = 0;
2118: bool rate_found = false;
2119: u8 rate_retries = 0;
2120: u16 rate_flags = 0;
2121: u8 mcs_known, mcs_flags, mcs_bw;
2122: u16 vht_known;
2123: u8 vht_mcs = 0, vht_nss = 0;
2124: int i;
2125:
2126: if (!ieee80211_validate_radiotap_len(skb))
2127: return false;
2128:
2129: info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
2130: IEEE80211_TX_CTL_DONTFRAG;
2131:
2132: /*
2133: * for every radiotap entry that is present
2134: * (ieee80211_radiotap_iterator_next returns -ENOENT when no more
2135: * entries present, or -EINVAL on error)
2136: */
2137:
2138: while (!ret) {
2139: ret = ieee80211_radiotap_iterator_next(&iterator);
2140:
2141: if (ret)
2142: continue;
2143:
2144: /* see if this argument is something we can use */
2145: switch (iterator.this_arg_index) {
2146: /*
2147: * You must take care when dereferencing iterator.this_arg
2148: * for multibyte types... the pointer is not aligned. Use
2149: * get_unaligned((type *)iterator.this_arg) to dereference
2150: * iterator.this_arg for type "type" safely on all arches.
2151: */
2152: case IEEE80211_RADIOTAP_FLAGS:
2153: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
2154: /*
2155: * this indicates that the skb we have been
2156: * handed has the 32-bit FCS CRC at the end...
2157: * we should react to that by snipping it off
2158: * because it will be recomputed and added
2159: * on transmission
2160: */
2161: if (skb->len < (iterator._max_length + FCS_LEN))
2162: return false;
2163:
2164: skb_trim(skb, skb->len - FCS_LEN);
2165: }
2166: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
2167: info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
2168: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
2169: info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
2170: break;
2171:
2172: case IEEE80211_RADIOTAP_TX_FLAGS:
2173: txflags = get_unaligned_le16(iterator.this_arg);
2174: if (txflags & IEEE80211_RADIOTAP_F_TX_NOACK)
2175: info->flags |= IEEE80211_TX_CTL_NO_ACK;
2176: if (txflags & IEEE80211_RADIOTAP_F_TX_NOSEQNO)
2177: info->control.flags |= IEEE80211_TX_CTRL_NO_SEQNO;
2178: if (txflags & IEEE80211_RADIOTAP_F_TX_ORDER)
2179: info->control.flags |=
2180: IEEE80211_TX_CTRL_DONT_REORDER;
2181: break;
2182:
2183: case IEEE80211_RADIOTAP_RATE:
2184: rate = *iterator.this_arg;
2185: rate_flags = 0;
2186: rate_found = true;
2187: break;
2188:
2189: case IEEE80211_RADIOTAP_ANTENNA:
2190: /* this can appear multiple times, keep a bitmap */
2191: /* control.antennas is only a 2-bit bitmap */
2192: if (*iterator.this_arg < 2)
2193: info->control.antennas |= BIT(*iterator.this_arg);
2194: break;
2195:
2196: case IEEE80211_RADIOTAP_DATA_RETRIES:
2197: rate_retries = *iterator.this_arg;
2198: break;
2199:
2200: case IEEE80211_RADIOTAP_MCS:
2201: mcs_known = iterator.this_arg[0];
2202: mcs_flags = iterator.this_arg[1];
2203: if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
2204: break;
2205:
2206: rate_found = true;
2207: rate = iterator.this_arg[2];
2208: rate_flags = IEEE80211_TX_RC_MCS;
2209:
2210: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
2211: mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
2212: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2213:
2214: mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
2215: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
2216: mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
2217: rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
2218:
2219: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC &&
2220: mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC)
2221: info->flags |= IEEE80211_TX_CTL_LDPC;
2222:
2223: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
2224: u8 stbc = u8_get_bits(mcs_flags,
2225: IEEE80211_RADIOTAP_MCS_STBC_MASK);
2226:
2227: info->flags |=
2228: u32_encode_bits(stbc,
2229: IEEE80211_TX_CTL_STBC);
2230: }
2231: break;
2232:
2233: case IEEE80211_RADIOTAP_VHT:
2234: vht_known = get_unaligned_le16(iterator.this_arg);
2235: rate_found = true;
2236:
2237: rate_flags = IEEE80211_TX_RC_VHT_MCS;
2238: if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
2239: (iterator.this_arg[2] &
2240: IEEE80211_RADIOTAP_VHT_FLAG_SGI))
2241: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2242: if (vht_known &
2243: IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
2244: if (iterator.this_arg[3] == 1)
2245: rate_flags |=
2246: IEEE80211_TX_RC_40_MHZ_WIDTH;
2247: else if (iterator.this_arg[3] == 4)
2248: rate_flags |=
2249: IEEE80211_TX_RC_80_MHZ_WIDTH;
2250: else if (iterator.this_arg[3] == 11)
2251: rate_flags |=
2252: IEEE80211_TX_RC_160_MHZ_WIDTH;
2253: }
2254:
2255: vht_mcs = iterator.this_arg[4] >> 4;
2256: if (vht_mcs > 11)
2257: vht_mcs = 0;
2258: vht_nss = iterator.this_arg[4] & 0xF;
2259: if (!vht_nss || vht_nss > 8)
2260: vht_nss = 1;
2261: break;
2262:
2263: /*
2264: * Please update the file
2265: * Documentation/networking/mac80211-injection.rst
2266: * when parsing new fields here.
2267: */
2268:
2269: default:
2270: break;
2271: }
2272: }
2273:
2274: if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
2275: return false;
2276:
2277: if (rate_found) {
2278: struct ieee80211_supported_band *sband =
2279: local->hw.wiphy->bands[info->band];
2280:
2281: info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
2282:
2283: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
2284: info->control.rates[i].idx = -1;
2285: info->control.rates[i].flags = 0;
2286: info->control.rates[i].count = 0;
2287: }
2288:
2289: if (rate_flags & IEEE80211_TX_RC_MCS) {
2290: /* reset antennas if not enough */
2291: if (IEEE80211_HT_MCS_CHAINS(rate) >
2292: hweight8(info->control.antennas))
2293: info->control.antennas = 0;
2294:
2295: info->control.rates[0].idx = rate;
2296: } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
2297: /* reset antennas if not enough */
2298: if (vht_nss > hweight8(info->control.antennas))
2299: info->control.antennas = 0;
2300:
2301: ieee80211_rate_set_vht(info->control.rates, vht_mcs,
2302: vht_nss);
2303: } else if (sband) {
2304: for (i = 0; i < sband->n_bitrates; i++) {
2305: if (rate * 5 != sband->bitrates[i].bitrate)
2306: continue;
2307:
2308: info->control.rates[0].idx = i;
2309: break;
2310: }
2311: }
2312:
2313: if (info->control.rates[0].idx < 0)
2314: info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
2315:
2316: info->control.rates[0].flags = rate_flags;
2317: info->control.rates[0].count = min_t(u8, rate_retries + 1,
2318: local->hw.max_rate_tries);
2319: }
2320:
2321: return true;
2322: }
SourceFile:net/mac80211/tx.c]
|
| 17/2 |
2026/09/07 07:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 14000
output: 62
thoughts: 1391
Thoughts: **My Thoughts on `ieee80211_parse_tx_radiotap` and Rate Handling**
Okay, I'm digging into the `ieee80211_parse_tx_radiotap` function and a curious sequence of events is unfolding regarding rate injection and retrieval.
Here's my thought process:
First, I see that if `rate_found` is true, the code initializes `info->control.rates[0].idx` to -1. This seems like a deliberate reset.
Then, the logic attempts to find a corresponding rate index within `sband->bitrates` based on the provided `rate` value. If this lookup fails, `info->control.rates[0].idx` remains at -1.
Crucially, I notice this conditional block:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This clearly indicates that if a valid rate index couldn't be found, the `IEEE80211_TX_CTRL_RATE_INJECT` flag is cleared. However, my initial observation is that `info->control.rates[0].idx` *still* remains -1, even after this flag is cleared. This feels like a potential inconsistency or a state that needs further scrutiny.
My attention is then drawn to the `mac80211_hwsim_write_tsf` function. It calls `mac80211_hwsim_get_tx_rate(data->hw, info)`. This is where things get particularly interesting.
Looking at `mac80211_hwsim_get_tx_rate`:
```c
if (info->control.rates[0].flags &
(IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
return NULL;
return ieee80211_get_tx_rate(hw, info);
```
What strikes me is that this function *doesn't* check the `IEEE80211_TX_CTRL_RATE_INJECT` flag at all. It proceeds to call `ieee80211_get_tx_rate` regardless.
Now, let's examine `ieee80211_get_tx_rate`:
```c
if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
return NULL;
```
This function has a clear check: `c->control.rates[0].idx < 0`. If this condition is met (which it is, if the rate wasn't found earlier), it triggers a warning.
This leads me to question: Is `mac80211_hwsim_get_tx_rate` supposed to be the gatekeeper, and *should* it be checking `IEEE80211_TX_CTRL_RATE_INJECT`? Or is the responsibility with `ieee80211_get_tx_rate` to handle this flag more intelligently?
If `IEEE80211_TX_CTRL_RATE_INJECT` is *not* set, my understanding is that the transmit rate should normally be determined by the rate control algorithm. However, the current flow bypasses this by proceeding to `ieee80211_get_tx_rate` even when the index is invalid and injection is disabled.
I also note that if `rate_found` was true but the rate lookup failed, `info->control.rates[0].idx` is -1. This causes `IEEE80211_TX_CTRL_RATE_INJECT` to be cleared. Yet, the frame is still transmitted. This seems to imply that the clearing of `IEEE80211_TX_CTRL_RATE_INJECT` might not be having the intended effect of preventing the rate from being determined or causing issues down the line.
Finally, my understanding is that the transmission process continues via `mac80211_hwsim_tx_frame_no_nl`, which subsequently calls `mac80211_hwsim_write_tsf`. I need to delve into `mac80211_hwsim_tx_frame_no_nl` to fully trace the path and understand the implications of this invalid rate index and the cleared injection flag.
|
| 18/2 |
2026/09/07 07:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_tx_frame_no_nl]
Results: map[SourceCode:1902: static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
1903: struct sk_buff *skb,
1904: struct ieee80211_channel *chan)
1905: {
1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
1907: bool ack = false;
1908: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1909: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1910: struct ieee80211_rx_status rx_status;
1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
1912:
1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
1914:
1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
1916:
1917: memset(&rx_status, 0, sizeof(rx_status));
1918: rx_status.flag |= RX_FLAG_MACTIME_START;
1919: rx_status.freq = chan->center_freq;
1920: rx_status.freq_offset = chan->freq_offset ? 1 : 0;
1921: rx_status.band = chan->band;
1922: if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) {
1923: rx_status.rate_idx =
1924: ieee80211_rate_get_vht_mcs(&info->control.rates[0]);
1925: rx_status.nss =
1926: ieee80211_rate_get_vht_nss(&info->control.rates[0]);
1927: rx_status.encoding = RX_ENC_VHT;
1928: } else {
1929: rx_status.rate_idx = info->control.rates[0].idx;
1930: if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
1931: rx_status.encoding = RX_ENC_HT;
1932: }
1933: if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
1934: rx_status.bw = RATE_INFO_BW_40;
1935: else if (info->control.rates[0].flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
1936: rx_status.bw = RATE_INFO_BW_80;
1937: else if (info->control.rates[0].flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
1938: rx_status.bw = RATE_INFO_BW_160;
1939: else
1940: rx_status.bw = RATE_INFO_BW_20;
1941: if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
1942: rx_status.enc_flags |= RX_ENC_FLAG_SHORT_GI;
1943: /* TODO: simulate optional packet loss */
1944: rx_status.signal = data->rx_rssi;
1945: if (info->control.vif)
1946: rx_status.signal += info->control.vif->bss_conf.txpower;
1947:
1948: if (data->ps != PS_DISABLED)
1949: hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
1950:
1951: /* release the skb's source info */
1952: skb_orphan(skb);
1953: skb_dst_drop(skb);
1954: skb->mark = 0;
1955: skb_ext_reset(skb);
1956: nf_reset_ct(skb);
1957:
1958: if (ieee80211_is_beacon(hdr->frame_control) ||
1959: ieee80211_is_probe_resp(hdr->frame_control))
1960: rx_status.boottime_ns = ktime_get_boottime_ns();
1961:
1962: /* Copy skb to all enabled radios that are on the current frequency */
1963: spin_lock(&hwsim_radio_lock);
1964: list_for_each_entry(data2, &hwsim_radios, list) {
1965: struct sk_buff *nskb;
1966: struct tx_iter_data tx_iter_data = {
1967: .receive = false,
1968: .hw = data2->hw,
1969: .channel = chan,
1970: .rx_status = &rx_status,
1971: };
1972:
1973: if (data == data2)
1974: continue;
1975:
1976: if (!data2->started || (data2->idle && !data2->tmp_chan) ||
1977: !hwsim_ps_rx_ok(data2, skb))
1978: continue;
1979:
1980: if (!(data->group & data2->group))
1981: continue;
1982:
1983: if (data->netgroup != data2->netgroup)
1984: continue;
1985:
1986: /*
1987: * Set mactime early since NAN RX filtering relies on it
1988: * for slot calculation
1989: */
1990: rx_status.mactime = sim_tsf + data2->tsf_offset;
1991:
1992: if (!hwsim_chans_compat(chan, data2->tmp_chan) &&
1993: !hwsim_chans_compat(chan, data2->channel)) {
1994: ieee80211_iterate_active_interfaces_atomic(
1995: data2->hw, IEEE80211_IFACE_ITER_NORMAL,
1996: mac80211_hwsim_tx_iter, &tx_iter_data);
1997: if (!tx_iter_data.receive)
1998: continue;
1999: }
2000:
2001: /*
2002: * reserve some space for our vendor and the normal
2003: * radiotap header, since we're copying anyway
2004: */
2005: if (skb->len < PAGE_SIZE && paged_rx) {
2006: struct page *page = alloc_page(GFP_ATOMIC);
2007:
2008: if (!page)
2009: continue;
2010:
2011: nskb = dev_alloc_skb(128);
2012: if (!nskb) {
2013: __free_page(page);
2014: continue;
2015: }
2016:
2017: memcpy(page_address(page), skb->data, skb->len);
2018: skb_add_rx_frag(nskb, 0, page, 0, skb->len, skb->len);
2019: } else {
2020: nskb = skb_copy(skb, GFP_ATOMIC);
2021: if (!nskb)
2022: continue;
2023: }
2024:
2025: if (mac80211_hwsim_addr_match(data2, hdr->addr1))
2026: ack = true;
2027:
2028: mac80211_hwsim_rx(data2, &rx_status, nskb);
2029: }
2030: spin_unlock(&hwsim_radio_lock);
2031:
2032: return ack;
2033: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 19/2 |
2026/09/07 07:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 17836
output: 45
thoughts: 735
Thoughts: **Understanding the `ieee80211_get_tx_rate` Warning**
Alright, let's trace this out. I've been looking at a bug where a `WARN_ON_ONCE(c->control.rates[0].idx < 0)` is being triggered within `ieee80211_get_tx_rate`. My initial thought process is to follow the flow of `info` and `c` (which I understand to be `struct ieee80211_tx_info`) from the point of transmission initialization.
So, it starts in `ieee80211_monitor_start_xmit`. Here, `info` is zero-initialized. Then, `ieee80211_parse_tx_radiotap` gets involved. If the radiotap header contains a rate field, `rate_found` becomes true. Crucially, at this point, `info->control.rates[0].idx` is set to `-1`.
Now, there's a check: if the parsed rate isn't found within `sband->bitrates` (which can happen if `sband` is NULL or the rate simply doesn't match anything in the available bitrates), `info->control.rates[0].idx` *remains* `-1`. Following this, there's a conditional check: `if (info->control.rates[0].idx < 0)`. If this condition is met, the `IEEE80211_TX_CTRL_RATE_INJECT` flag is cleared. However, `info->control.rates[0].idx` itself is *left* as `-1`.
The packet then proceeds to transmission. Subsequently, `mac80211_hwsim_tx_frame_no_nl` calls `mac80211_hwsim_write_tsf`. `mac80211_hwsim_write_tsf`, in turn, calls `mac80211_hwsim_get_tx_rate(data->hw, info)`. This leads us to `ieee80211_get_tx_rate(hw, info)`. And it's *here* that the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` fires.
My immediate follow-up question is: if `IEEE80211_TX_CTRL_RATE_INJECT` is cleared, shouldn't `mac80211_hwsim_get_tx_rate` or `ieee80211_get_tx_rate` take that into account? Looking at the code for `ieee80211_get_tx_rate`, I see the direct check for `c->control.rates[0].idx < 0`, but no explicit check for `IEEE80211_TX_CTRL_RATE_INJECT`.
This then leads me to ponder: if `IEEE80211_TX_CTRL_RATE_INJECT` is *not* set, how is `c->control.rates[0].idx` supposed to be populated in the first place? Normally, rate control would handle this. But my understanding is that for injected frames, rate control is bypassed. I need to dive into `ieee80211_tx` to fully grasp the implications of the `IEEE80211_TX_CTRL_RATE_INJECT` flag and how it interacts with rate selection mechanisms.
|
| 20/2 |
2026/09/07 07:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx]
Results: map[SourceCode:1949: /*
1950: * Returns false if the frame couldn't be transmitted but was queued instead.
1951: */
1952: static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
1953: struct sta_info *sta, struct sk_buff *skb,
1954: bool txpending)
1955: {
1956: struct ieee80211_local *local = sdata->local;
1957: struct ieee80211_tx_data tx;
1958: ieee80211_tx_result res_prepare;
1959: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1960: bool result = true;
1961:
1962: if (unlikely(skb->len < 10)) {
1963: dev_kfree_skb(skb);
1964: return true;
1965: }
1966:
1967: /* initialises tx */
1968: res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
1969:
1970: if (unlikely(res_prepare == TX_DROP)) {
1971: ieee80211_free_txskb(&local->hw, skb);
1972: tx.sdata->tx_handlers_drop++;
1973: return true;
1974: } else if (unlikely(res_prepare == TX_QUEUED)) {
1975: return true;
1976: }
1977:
1978: /* set up hw_queue value early */
1979: if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) ||
1980: !ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
1981: info->hw_queue =
1982: sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
1983:
1984: if (invoke_tx_handlers_early(&tx))
1985: return true;
1986:
1987: if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
1988: return true;
1989:
1990: if (!invoke_tx_handlers_late(&tx))
1991: result = __ieee80211_tx(local, &tx.skbs, tx.sta, txpending);
1992:
1993: return result;
1994: }
SourceFile:net/mac80211/tx.c]
|
| 21/2 |
2026/09/07 07:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 19409
output: 46
thoughts: 16
Thoughts: **My Thought Process Regarding `__ieee80211_tx`**
Alright, the immediate focus is on `__ieee80211_tx`. I need to delve into its inner workings to understand the transmission process at the IEEE 802.11 level. My primary objective here is to trace the flow of data packets from their origin within the driver to their eventual dispatch onto the wireless medium. I'll be looking for key stages: how the frame is constructed, any necessary management operations like sequence number assignment or retransmission queueing, and crucially, how it interfaces with the hardware abstraction layer for the actual transmission. I'm particularly interested in the error handling mechanisms and any potential performance bottlenecks that might be present within this function, given its central role in wireless data delivery. I'll be scrutinizing parameters, return values, and the underlying logic to form a comprehensive picture of its behavior.
|
| 22/2 |
2026/09/07 07:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:__ieee80211_tx]
Results: map[SourceCode:1759: /*
1760: * Returns false if the frame couldn't be transmitted but was queued instead.
1761: */
1762: static bool __ieee80211_tx(struct ieee80211_local *local,
1763: struct sk_buff_head *skbs, struct sta_info *sta,
1764: bool txpending)
1765: {
1766: struct ieee80211_tx_info *info;
1767: struct ieee80211_sub_if_data *sdata;
1768: struct ieee80211_vif *vif;
1769: struct sk_buff *skb;
1770: bool result;
1771:
1772: if (WARN_ON(skb_queue_empty(skbs)))
1773: return true;
1774:
1775: skb = skb_peek(skbs);
1776: info = IEEE80211_SKB_CB(skb);
1777: sdata = vif_to_sdata(info->control.vif);
1778: if (sta && !sta->uploaded)
1779: sta = NULL;
1780:
1781: switch (sdata->vif.type) {
1782: case NL80211_IFTYPE_MONITOR:
1783: if ((sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) ||
1784: ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) {
1785: vif = &sdata->vif;
1786: break;
1787: }
1788: sdata = rcu_dereference(local->monitor_sdata);
1789: if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) {
1790: vif = &sdata->vif;
1791: info->hw_queue =
1792: vif->hw_queue[skb_get_queue_mapping(skb)];
1793: } else if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) {
1794: ieee80211_purge_tx_queue(&local->hw, skbs);
1795: return true;
1796: } else
1797: vif = NULL;
1798: break;
1799: case NL80211_IFTYPE_AP_VLAN:
1800: sdata = container_of(sdata->bss,
1801: struct ieee80211_sub_if_data, u.ap);
1802: fallthrough;
1803: default:
1804: vif = &sdata->vif;
1805: break;
1806: }
1807:
1808: result = ieee80211_tx_frags(local, vif, sta, skbs, txpending);
1809:
1810: WARN_ON_ONCE(!skb_queue_empty(skbs));
1811:
1812: return result;
1813: }
SourceFile:net/mac80211/tx.c]
|
| 23/2 |
2026/09/07 07:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 20413
output: 48
thoughts: 18
Thoughts: **My Thought Process Regarding `ieee80211_tx_frags`**
Alright, my primary objective here is to get a handle on the internal workings of `ieee80211_tx_frags`. I need to understand what this function is *doing* at its core. Is it a high-level orchestrator, or does it get down into the nitty-gritty details of packet fragmentation and transmission? My immediate instinct is to dive into the source code, of course. I'm looking for the fundamental logic: how does it receive a transmission request? What data structures does it operate on? And crucially, how does it translate that into the actual transmission of one or more 802.11 frames? I’ll be paying close attention to how it handles potential fragmentation – that's in the name, after all – and what mechanisms are in place for dealing with different frame types and their associated requirements. I want to see if there are any obvious bottlenecks or areas for optimization that jump out at me, particularly concerning efficiency and resource utilization. Ultimately, I'm trying to build a clear mental model of its role in the overall 802.11 transmission pipeline, understanding its dependencies and its impact on the rest of the system.
|
| 24/2 |
2026/09/07 07:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_frags]
Results: map[SourceCode:1686: static bool ieee80211_tx_frags(struct ieee80211_local *local,
1687: struct ieee80211_vif *vif,
1688: struct sta_info *sta,
1689: struct sk_buff_head *skbs,
1690: bool txpending)
1691: {
1692: struct ieee80211_tx_control control = {};
1693: struct sk_buff *skb, *tmp;
1694: unsigned long flags;
1695:
1696: skb_queue_walk_safe(skbs, skb, tmp) {
1697: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1698: int q = info->hw_queue;
1699:
1700: #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
1701: if (WARN_ON_ONCE(q >= local->hw.queues)) {
1702: __skb_unlink(skb, skbs);
1703: ieee80211_free_txskb(&local->hw, skb);
1704: continue;
1705: }
1706: #endif
1707:
1708: spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
1709: if (local->queue_stop_reasons[q] ||
1710: (!txpending && !skb_queue_empty(&local->pending[q]))) {
1711: if (unlikely(info->flags &
1712: IEEE80211_TX_INTFL_OFFCHAN_TX_OK)) {
1713: if (local->queue_stop_reasons[q] &
1714: ~BIT(IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL)) {
1715: /*
1716: * Drop off-channel frames if queues
1717: * are stopped for any reason other
1718: * than off-channel operation. Never
1719: * queue them.
1720: */
1721: spin_unlock_irqrestore(
1722: &local->queue_stop_reason_lock,
1723: flags);
1724: ieee80211_purge_tx_queue(&local->hw,
1725: skbs);
1726: return true;
1727: }
1728: } else {
1729:
1730: /*
1731: * Since queue is stopped, queue up frames for
1732: * later transmission from the tx-pending
1733: * tasklet when the queue is woken again.
1734: */
1735: if (txpending)
1736: skb_queue_splice_init(skbs,
1737: &local->pending[q]);
1738: else
1739: skb_queue_splice_tail_init(skbs,
1740: &local->pending[q]);
1741:
1742: spin_unlock_irqrestore(&local->queue_stop_reason_lock,
1743: flags);
1744: return false;
1745: }
1746: }
1747: spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
1748:
1749: info->control.vif = vif;
1750: control.sta = sta ? &sta->sta : NULL;
1751:
1752: __skb_unlink(skb, skbs);
1753: drv_tx(local, &control, skb);
1754: }
1755:
1756: return true;
1757: }
SourceFile:net/mac80211/tx.c]
|
| 25/2 |
2026/09/07 07:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 21598
output: 47
thoughts: 112
Thoughts: **A Deep Dive into my Rate Control Musings**
Right, so I've been tracing this `drv_tx` call, and it leads straight into `mac80211_hwsim_tx`. This immediately flagged something for me: the rate control mechanism appears to be completely bypassed when frames are injected. That's a significant detail, and it sparked a bit of internal debate.
My initial thought was, "Hold on a second, if that `IEEE80211_TX_CTRL_RATE_INJECT` flag isn't set, shouldn't the system be falling back to applying rate control as usual?" It’s the logical expectation, right? You’d assume that the absence of that specific injection flag would trigger the standard rate control pathway.
However, I quickly corrected myself. Rate control isn't actually handled directly in the `mac80211_hwsim_tx` function itself, nor is it solely determined by that `RATE_INJECT` flag in isolation at that point. My recollection and a quick mental check pointed to the fact that the actual rate control logic is invoked much later in the transmission preparation pipeline, specifically within `ieee80211_tx_prepare` or, more broadly, the `ieee80211_tx` function.
Therefore, to truly understand the behavior and confirm my hypothesis about rate control bypass for injected frames, I need to meticulously examine the execution flow within `ieee80211_tx_prepare`. That's where the definitive answer lies.
|
| 26/2 |
2026/09/07 07:09 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_prepare]
Results: map[SourceCode:1202: /*
1203: * initialises @tx
1204: * pass %NULL for the station if unknown, a valid pointer if known
1205: * or an ERR_PTR() if the station is known not to exist
1206: */
1207: static ieee80211_tx_result
1208: ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1209: struct ieee80211_tx_data *tx,
1210: struct sta_info *sta, struct sk_buff *skb)
1211: {
1212: struct ieee80211_local *local = sdata->local;
1213: struct ieee80211_hdr *hdr;
1214: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1215: bool aggr_check = false;
1216: int tid;
1217:
1218: memset(tx, 0, sizeof(*tx));
1219: tx->skb = skb;
1220: tx->local = local;
1221: tx->sdata = sdata;
1222: __skb_queue_head_init(&tx->skbs);
1223:
1224: /*
1225: * If this flag is set to true anywhere, and we get here,
1226: * we are doing the needed processing, so remove the flag
1227: * now.
1228: */
1229: info->control.flags &= ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
1230:
1231: hdr = (struct ieee80211_hdr *) skb->data;
1232:
1233: if (likely(sta)) {
1234: if (!IS_ERR(sta))
1235: tx->sta = sta;
1236: } else {
1237: if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
1238: tx->sta = rcu_dereference(sdata->u.vlan.sta);
1239: if (!tx->sta && sdata->wdev.use_4addr)
1240: return TX_DROP;
1241: } else if (tx->sdata->control_port_protocol == tx->skb->protocol) {
1242: tx->sta = sta_info_get_bss(sdata, hdr->addr1);
1243: }
1244: if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) {
1245: tx->sta = sta_info_get(sdata, hdr->addr1);
1246: aggr_check = true;
1247: }
1248: }
1249:
1250: if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
1251: !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
1252: ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION) &&
1253: !ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) {
1254: struct tid_ampdu_tx *tid_tx;
1255:
1256: tid = ieee80211_get_tid(hdr);
1257: tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1258: if (!tid_tx && aggr_check) {
1259: ieee80211_aggr_check(sdata, tx->sta, skb);
1260: tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1261: }
1262:
1263: if (tid_tx) {
1264: bool queued;
1265:
1266: queued = ieee80211_tx_prep_agg(tx, skb, info,
1267: tid_tx, tid);
1268:
1269: if (unlikely(queued))
1270: return TX_QUEUED;
1271: }
1272: }
1273:
1274: if (is_multicast_ether_addr(hdr->addr1)) {
1275: tx->flags &= ~IEEE80211_TX_UNICAST;
1276: info->flags |= IEEE80211_TX_CTL_NO_ACK;
1277: } else
1278: tx->flags |= IEEE80211_TX_UNICAST;
1279:
1280: if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) {
1281: if (!(tx->flags & IEEE80211_TX_UNICAST) ||
1282: skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
1283: info->flags & IEEE80211_TX_CTL_AMPDU)
1284: info->flags |= IEEE80211_TX_CTL_DONTFRAG;
1285: }
1286:
1287: if (!tx->sta)
1288: info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1289: else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
1290: info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1291: ieee80211_check_fast_xmit(tx->sta);
1292: }
1293:
1294: info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
1295:
1296: return TX_CONTINUE;
1297: }
SourceFile:net/mac80211/tx.c]
|
| 27/2 |
2026/09/07 07:09 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 23511
output: 23
thoughts: 69
Thoughts: **My Thought Process on Rate Control in the IEEE 802.11 Transmission Path**
Alright, so I'm tracing the flow of a transmission, trying to pinpoint exactly where rate control is invoked. My initial thought was that `ieee80211_tx_frags` might be the place, but upon closer inspection, I see that `ieee80211_tx_frags` is merely a conduit, a function that ultimately delegates the actual transmission to `drv_tx`. That means the core logic for sending the data fragment isn't happening there.
This realization immediately sparks a new question: if not `ieee80211_tx_frags`, then *where* in this complex dance of packet preparation and transmission is the rate control decision actually made? It's a critical piece of the puzzle, determining the efficiency and performance of our wireless link.
To find the answer, I need to broaden my search. I'll be looking for key indicators. My next step is to systematically scan the codebase for terms that directly relate to rate control mechanisms. I'm specifically going to be searching for string literals like `rate_control` or structures that encapsulate rate control operations, such as `rc_ops`. This approach should lead me to the specific functions or modules responsible for selecting the optimal transmission rate based on current channel conditions.
|
| 28/2 |
2026/09/07 07:10 |
tool |
grepper |
0m
Error:
Args: map[Expression:rc_ops->get_tx_rate]
Results:
|
| 29/2 |
2026/09/07 07:10 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 23605
output: 19
thoughts: 12
Thoughts: **My Thought Process on `get_tx_rate`**
My initial impulse is to dive straight into the code. I'm thinking, "Okay, what exactly *is* this `get_tx_rate` function doing? What are its inputs, what are its outputs, and more importantly, what's the underlying logic it employs?" I'll probably start by looking for its definition, its usage within the codebase, and then examine its implementation to understand the mechanics. I'll be keenly interested in how it calculates or retrieves the transmission rate, whether it's a hardware-level metric, a software-averaged value, or something else entirely. I'll also be looking for any dependencies or external systems it interacts with to gather this data.
|
| 30/2 |
2026/09/07 07:10 |
tool |
grepper |
0m
Args: map[Expression:get_tx_rate]
Results: map[Output:drivers/net/wireless/admtek/adm8211.c=1672=static void adm8211_tx(struct ieee80211_hw *dev,
--
drivers/net/wireless/admtek/adm8211.c-1680- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
drivers/net/wireless/admtek/adm8211.c:1681: struct ieee80211_rate *txrate = ieee80211_get_tx_rate(dev, info);
drivers/net/wireless/admtek/adm8211.c-1682- u8 rc_flags;
--
drivers/net/wireless/ath/ath5k/base.c=768=ath5k_txbuf_setup(struct ath5k_hw *ah, struct ath5k_buf *bf,
--
drivers/net/wireless/ath/ath5k/base.c-799- if (!ath5k_merge_ratetbl(sta, bf, info)) {
drivers/net/wireless/ath/ath5k/base.c:800: ieee80211_get_tx_rates(info->control.vif,
drivers/net/wireless/ath/ath5k/base.c-801- sta, skb, bf->rates,
--
drivers/net/wireless/ath/ath5k/base.c=1855=ath5k_beacon_setup(struct ath5k_hw *ah, struct ath5k_buf *bf)
--
drivers/net/wireless/ath/ath5k/base.c-1917- (ah->ah_txpower.txp_requested * 2),
drivers/net/wireless/ath/ath5k/base.c:1918: ieee80211_get_tx_rate(ah->hw, info)->hw_value,
drivers/net/wireless/ath/ath5k/base.c-1919- 1, AR5K_TXKEYIX_INVALID,
--
drivers/net/wireless/ath/ath9k/xmit.c=198=static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
--
drivers/net/wireless/ath/ath9k/xmit.c-205- if (!ath_merge_ratetbl(sta, bf, tx_info))
drivers/net/wireless/ath/ath9k/xmit.c:206: ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
drivers/net/wireless/ath/ath9k/xmit.c-207- ARRAY_SIZE(bf->rates));
--
drivers/net/wireless/ath/carl9170/tx.c=872=static void carl9170_tx_get_rates(struct ar9170 *ar,
--
drivers/net/wireless/ath/carl9170/tx.c-883-
drivers/net/wireless/ath/carl9170/tx.c:884: ieee80211_get_tx_rates(vif, sta, skb,
drivers/net/wireless/ath/carl9170/tx.c-885- info->control.rates,
--
drivers/net/wireless/atmel/at76c50x-usb.c=1757=static void at76_mac80211_tx(struct ieee80211_hw *hw,
--
drivers/net/wireless/atmel/at76c50x-usb.c-1805- tx_buffer->wlength = cpu_to_le16(skb->len);
drivers/net/wireless/atmel/at76c50x-usb.c:1806: tx_buffer->tx_rate = ieee80211_get_tx_rate(hw, info)->hw_value;
drivers/net/wireless/atmel/at76c50x-usb.c-1807- memset(tx_buffer->reserved, 0, sizeof(tx_buffer->reserved));
--
drivers/net/wireless/broadcom/b43/main.c=1606=static void b43_write_beacon_template(struct b43_wldev *dev,
--
drivers/net/wireless/broadcom/b43/main.c-1622- info = IEEE80211_SKB_CB(dev->wl->current_beacon);
drivers/net/wireless/broadcom/b43/main.c:1623: rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value;
drivers/net/wireless/broadcom/b43/main.c-1624- /* Clone the beacon, so it cannot go away, while we write it to hw. */
--
drivers/net/wireless/broadcom/b43/xmit.c=235=int b43_generate_txhdr(struct b43_wldev *dev,
--
drivers/net/wireless/broadcom/b43/xmit.c-263-
drivers/net/wireless/broadcom/b43/xmit.c:264: txrate = ieee80211_get_tx_rate(dev->wl->hw, info);
drivers/net/wireless/broadcom/b43/xmit.c-265- rate = txrate ? txrate->hw_value : B43_CCK_RATE_1MB;
--
drivers/net/wireless/broadcom/b43legacy/main.c=938=static void b43legacy_write_beacon_template(struct b43legacy_wldev *dev,
--
drivers/net/wireless/broadcom/b43legacy/main.c-954- 0x200 - sizeof(struct b43legacy_plcp_hdr6));
drivers/net/wireless/broadcom/b43legacy/main.c:955: rate = ieee80211_get_tx_rate(dev->wl->hw, info)->hw_value;
drivers/net/wireless/broadcom/b43legacy/main.c-956-
--
drivers/net/wireless/broadcom/b43legacy/xmit.c=174=static int generate_txhdr_fw3(struct b43legacy_wldev *dev,
--
drivers/net/wireless/broadcom/b43legacy/xmit.c-196-
drivers/net/wireless/broadcom/b43legacy/xmit.c:197: tx_rate = ieee80211_get_tx_rate(dev->wl->hw, info);
drivers/net/wireless/broadcom/b43legacy/xmit.c-198-
--
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c=7202=static void brcms_c_beacon_write(struct brcms_c_info *wlc,
--
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c-7214- len = min_t(size_t, beacon->len, BCN_TMPL_LEN);
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c:7215: wlc->bcn_rspec = ieee80211_get_tx_rate(ieee_hw, tx_info)->hw_value;
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c-7216-
--
drivers/net/wireless/intel/iwlegacy/3945-mac.c=445=il3945_tx_skb(struct il_priv *il,
--
drivers/net/wireless/intel/iwlegacy/3945-mac.c-472-
drivers/net/wireless/intel/iwlegacy/3945-mac.c:473: if ((ieee80211_get_tx_rate(il->hw, info)->hw_value & 0xFF) ==
drivers/net/wireless/intel/iwlegacy/3945-mac.c-474- IL_INVALID_RATE) {
--
drivers/net/wireless/intel/iwlegacy/3945-mac.c=2804=il3945_mac_tx(struct ieee80211_hw *hw,
--
drivers/net/wireless/intel/iwlegacy/3945-mac.c-2812- D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
drivers/net/wireless/intel/iwlegacy/3945-mac.c:2813: ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
drivers/net/wireless/intel/iwlegacy/3945-mac.c-2814-
--
drivers/net/wireless/intel/iwlegacy/3945.c=683=il3945_hw_build_tx_cmd_rate(struct il_priv *il, struct il_device_cmd *cmd,
--
drivers/net/wireless/intel/iwlegacy/3945.c-686-{
drivers/net/wireless/intel/iwlegacy/3945.c:687: u16 hw_value = ieee80211_get_tx_rate(il->hw, info)->hw_value;
drivers/net/wireless/intel/iwlegacy/3945.c-688- u16 rate_idx = min(hw_value & 0xffff, RATE_COUNT_3945 - 1);
--
drivers/net/wireless/intel/iwlegacy/4965-mac.c=5852=il4965_mac_tx(struct ieee80211_hw *hw,
--
drivers/net/wireless/intel/iwlegacy/4965-mac.c-5860- D_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
drivers/net/wireless/intel/iwlegacy/4965-mac.c:5861: ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
drivers/net/wireless/intel/iwlegacy/4965-mac.c-5862-
--
drivers/net/wireless/intel/iwlwifi/mld/tx.c=431=static u32 iwl_mld_get_inject_tx_rate(struct iwl_mld *mld,
--
drivers/net/wireless/intel/iwlwifi/mld/tx.c-485-
drivers/net/wireless/intel/iwlwifi/mld/tx.c:486:static __le32 iwl_mld_get_tx_rate_n_flags(struct iwl_mld *mld,
drivers/net/wireless/intel/iwlwifi/mld/tx.c-487- struct ieee80211_tx_info *info,
--
drivers/net/wireless/intel/iwlwifi/mld/tx.c=540=iwl_mld_fill_tx_cmd(struct iwl_mld *mld, struct sk_buff *skb,
--
drivers/net/wireless/intel/iwlwifi/mld/tx.c-569- flags |= IWL_TX_FLAGS_CMD_RATE;
drivers/net/wireless/intel/iwlwifi/mld/tx.c:570: rate_n_flags = iwl_mld_get_tx_rate_n_flags(mld, info, sta,
drivers/net/wireless/intel/iwlwifi/mld/tx.c-571- hdr->frame_control);
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c=294=static u32 iwl_mvm_get_inject_tx_rate(struct iwl_mvm *mvm,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-345-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:346:static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm,
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-347- struct ieee80211_tx_info *info,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-379-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:380:static __le32 iwl_mvm_get_tx_rate_n_flags(struct iwl_mvm *mvm,
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-381- struct ieee80211_tx_info *info,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-388- else
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:389: rate = iwl_mvm_get_tx_rate(mvm, info, sta, fc) |
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-390- iwl_mvm_get_tx_ant(mvm, info, sta, fc);
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c=398=void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-436- /* Set the rate in the TX cmd */
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:437: tx_cmd_params->rate_n_flags = iwl_mvm_get_tx_rate_n_flags(mvm, info, sta, fc);
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-438-}
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c=553=iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-593- rate_n_flags =
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:594: iwl_mvm_get_tx_rate_n_flags(mvm, info, sta,
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-595- hdr->frame_control);
--
drivers/net/wireless/marvell/libertas_tf/main.c=196=static void lbtf_tx_work(struct work_struct *work)
--
drivers/net/wireless/marvell/libertas_tf/main.c-231- txpd->tx_control |= cpu_to_le32(MRVL_PER_PACKET_RATE |
drivers/net/wireless/marvell/libertas_tf/main.c:232: ieee80211_get_tx_rate(priv->hw, info)->hw_value);
drivers/net/wireless/marvell/libertas_tf/main.c-233-
--
drivers/net/wireless/marvell/mwifiex/main.h=1520=int mwifiex_set_tx_rate_cfg(struct mwifiex_private *priv, int tx_rate_index);
drivers/net/wireless/marvell/mwifiex/main.h-1521-
drivers/net/wireless/marvell/mwifiex/main.h:1522:int mwifiex_get_tx_rate_cfg(struct mwifiex_private *priv, int *tx_rate_index);
drivers/net/wireless/marvell/mwifiex/main.h-1523-
--
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c=335=void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
--
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c-356- wcid = NULL;
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:357: ieee80211_get_tx_rates(info->control.vif, sta, skb,
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c-358- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt76/tx.c=355=mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
--
drivers/net/wireless/mediatek/mt76/tx.c-370- if (wcid && !(wcid->tx_info & MT_WCID_TX_INFO_SET))
drivers/net/wireless/mediatek/mt76/tx.c:371: ieee80211_get_tx_rates(info->control.vif, sta, skb,
drivers/net/wireless/mediatek/mt76/tx.c-372- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt76/tx.c=490=mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
--
drivers/net/wireless/mediatek/mt76/tx.c-517- if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
drivers/net/wireless/mediatek/mt76/tx.c:518: ieee80211_get_tx_rates(txq->vif, txq->sta, skb,
drivers/net/wireless/mediatek/mt76/tx.c-519- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt76/tx.c-542- if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
drivers/net/wireless/mediatek/mt76/tx.c:543: ieee80211_get_tx_rates(txq->vif, txq->sta, skb,
drivers/net/wireless/mediatek/mt76/tx.c-544- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt7601u/tx.c=130=mt7601u_push_txwi(struct mt7601u_dev *dev, struct sk_buff *skb,
--
drivers/net/wireless/mediatek/mt7601u/tx.c-146- if (!wcid->tx_rate_set)
drivers/net/wireless/mediatek/mt7601u/tx.c:147: ieee80211_get_tx_rates(info->control.vif, sta, skb,
drivers/net/wireless/mediatek/mt7601u/tx.c-148- info->control.rates, 1);
--
drivers/net/wireless/nxp/nxpwifi/main.h=1315=int nxpwifi_set_tx_rate_cfg(struct nxpwifi_private *priv, int tx_rate_index);
drivers/net/wireless/nxp/nxpwifi/main.h-1316-
drivers/net/wireless/nxp/nxpwifi/main.h:1317:int nxpwifi_get_tx_rate_cfg(struct nxpwifi_private *priv, int *tx_rate_index);
drivers/net/wireless/nxp/nxpwifi/main.h-1318-
--
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c=384=static void rt2x00queue_create_tx_descriptor(struct rt2x00_dev *rt2x00dev,
--
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c-462- else {
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c:463: rate = ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c-464- hwrate = rt2x00_get_rate(rate->hw_value);
--
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c=454=static void rtl8180_tx(struct ieee80211_hw *dev,
--
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-490- RTL818X_TX_DESC_FLAG_LS |
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c:491: (ieee80211_get_tx_rate(dev, info)->hw_value << 24) |
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-492- skb->len;
--
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-519- plcp_len = DIV_ROUND_UP(16 * (skb->len + 4),
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c:520: (ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-521- remainder = (16 * (skb->len + 4)) %
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c:522: ((ieee80211_get_tx_rate(dev, info)->bitrate * 2) / 10);
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-523- if (remainder <= 6)
--
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-533- NL80211_BAND_2GHZ, skb->len,
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c:534: ieee80211_get_tx_rate(dev, info));
drivers/net/wireless/realtek/rtl818x/rtl8180/dev.c-535-
--
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c=227=static void rtl8187_tx(struct ieee80211_hw *dev,
--
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-249-
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c:250: flags |= ieee80211_get_tx_rate(dev, info)->hw_value << 24;
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-251- if (ieee80211_has_morefrags(tx_hdr->frame_control))
--
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-292- struct ieee80211_rate *txrate =
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c:293: ieee80211_get_tx_rate(dev, info);
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c-294- memset(hdr, 0, sizeof(*hdr));
--
drivers/net/wireless/realtek/rtlwifi/base.c=1192=static u8 _rtl_get_tx_hw_rate(struct ieee80211_hw *hw,
--
drivers/net/wireless/realtek/rtlwifi/base.c-1213- /* legacy */
drivers/net/wireless/realtek/rtlwifi/base.c:1214: txrate = ieee80211_get_tx_rate(hw, info);
drivers/net/wireless/realtek/rtlwifi/base.c-1215-
--
drivers/net/wireless/st/cw1200/txrx.c=23=static const struct ieee80211_rate *
drivers/net/wireless/st/cw1200/txrx.c:24:cw1200_get_tx_rate(const struct cw1200_common *priv,
drivers/net/wireless/st/cw1200/txrx.c-25- const struct ieee80211_tx_rate *rate);
--
drivers/net/wireless/st/cw1200/txrx.c=65=static void tx_policy_build(const struct cw1200_common *priv,
--
drivers/net/wireless/st/cw1200/txrx.c-169-
drivers/net/wireless/st/cw1200/txrx.c:170: policy->defined = cw1200_get_tx_rate(priv, &rates[0])->hw_value + 1;
drivers/net/wireless/st/cw1200/txrx.c-171-
--
drivers/net/wireless/st/cw1200/txrx.c-174-
drivers/net/wireless/st/cw1200/txrx.c:175: rateid = cw1200_get_tx_rate(priv, &rates[i])->hw_value;
drivers/net/wireless/st/cw1200/txrx.c-176- off = rateid >> 3; /* eq. rateid / 8 */
--
drivers/net/wireless/st/cw1200/txrx.c=424=static const struct ieee80211_rate *
drivers/net/wireless/st/cw1200/txrx.c:425:cw1200_get_tx_rate(const struct cw1200_common *priv,
drivers/net/wireless/st/cw1200/txrx.c-426- const struct ieee80211_tx_rate *rate)
--
drivers/net/wireless/st/cw1200/txrx.c=638=cw1200_tx_h_rate_policy(struct cw1200_common *priv,
--
drivers/net/wireless/st/cw1200/txrx.c-651-
drivers/net/wireless/st/cw1200/txrx.c:652: t->rate = cw1200_get_tx_rate(priv,
drivers/net/wireless/st/cw1200/txrx.c-653- &t->tx_info->control.rates[0]);
--
drivers/net/wireless/ti/wl1251/tx.c=134=static int wl1251_tx_fill_hdr(struct wl1251 *wl, struct sk_buff *skb,
--
drivers/net/wireless/ti/wl1251/tx.c-152- tx_hdr->length = cpu_to_le16(skb->len - sizeof(*tx_hdr));
drivers/net/wireless/ti/wl1251/tx.c:153: rate = ieee80211_get_tx_rate(wl->hw, control);
drivers/net/wireless/ti/wl1251/tx.c-154- tx_hdr->rate = cpu_to_le16(rate->hw_value);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1327=static struct ieee80211_rate *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1328:mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1329- struct ieee80211_tx_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1334-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335: return ieee80211_get_tx_rate(hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1336-}
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1338=static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1346- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1347: struct ieee80211_rate *txrate = mac80211_hwsim_get_tx_rate(hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1348-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1605=static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1616-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1618- if (txrate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2104=static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2243- if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2244: ieee80211_get_tx_rates(vif, control->sta, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2245- txi->control.rates,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2409=void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2417- struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2418: ieee80211_get_tx_rates(txi->control.vif, NULL, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2419- txi->control.rates,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2432=static void __mac80211_hwsim_beacon_tx(struct ieee80211_bss_conf *link_conf,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2448- if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2449: ieee80211_get_tx_rates(vif, NULL, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2450- info->control.rates,
--
drivers/net/wireless/zydas/zd1211rw/zd_mac.c=852=static int fill_ctrlset(struct zd_mac *mac,
--
drivers/net/wireless/zydas/zd1211rw/zd_mac.c-872-
drivers/net/wireless/zydas/zd1211rw/zd_mac.c:873: txrate = ieee80211_get_tx_rate(mac->hw, info);
drivers/net/wireless/zydas/zd1211rw/zd_mac.c-874-
--
include/net/mac80211.h=3409=static inline struct ieee80211_rate *
include/net/mac80211.h:3410:ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
include/net/mac80211.h-3411- const struct ieee80211_tx_info *c)
--
include/net/mac80211.h=5597=void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
--
include/net/mac80211.h-5600-/**
include/net/mac80211.h:5601: * ieee80211_get_tx_rates - get the selected transmit rates for a packet
include/net/mac80211.h-5602- *
--
include/net/mac80211.h-5612- */
include/net/mac80211.h:5613:void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
include/net/mac80211.h-5614- struct ieee80211_sta *sta,
--
net/mac80211/rate.c=843=static void rate_control_apply_mask(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/rate.c-881-
net/mac80211/rate.c:882:void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
net/mac80211/rate.c-883- struct ieee80211_sta *sta,
--
net/mac80211/rate.c-916-}
net/mac80211/rate.c:917:EXPORT_SYMBOL(ieee80211_get_tx_rates);
net/mac80211/rate.c-918-
net/mac80211/rate.c=919=void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/rate.c-956-
net/mac80211/rate.c:957: ieee80211_get_tx_rates(&sdata->vif, ista, txrc->skb,
net/mac80211/rate.c-958- info->control.rates,
]
|
| 31/2 |
2026/09/07 07:10 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 33133
output: 56
thoughts: 52
Thoughts: **My Thought Process on `ieee80211_get_tx_rates` and `mac80211_hwsim_tx`**
Okay, so my initial observation, and the trigger for this whole line of inquiry, is that I've spotted the function `ieee80211_get_tx_rates` being invoked within `mac80211_hwsim_tx`. This immediately signals to me that there's a critical interaction happening here, and to truly understand the behavior or the system I'm examining, I absolutely *must* dive into the details of `mac80211_hwsim_tx`. It's not enough to just see the call; I need to understand the *context* in which `ieee80211_get_tx_rates` is being used. What is `mac80211_hwsim_tx` doing that necessitates determining the transmit rates? Is it selecting them, validating them, logging them? The name `hwsim` suggests a hardware simulation environment, which is key – it implies that this function is likely orchestrating the simulated transmission process, and therefore, rate selection is a fundamental part of that simulation.
My next step, therefore, is to thoroughly examine `mac80211_hwsim_tx`. I'm looking to understand its overall purpose within the `mac80211` subsystem, specifically how it handles outgoing frames. I need to trace the flow of execution, and pay close attention to any data structures or parameters that are passed to or returned from `ieee80211_get_tx_rates`. What information is this function providing to `mac80211_hwsim_tx`? Is it a list of supported rates, the currently negotiated rate for a specific station, or something else entirely? I'm also curious about the simulation aspect: how does `mac80211_hwsim_tx` leverage the information from `ieee80211_get_tx_rates` to mimic real-world hardware behavior? Does it simulate rate adaptation, interference, or packet loss based on the determined rates? Understanding `mac80211_hwsim_tx` is paramount because it's the immediate caller and, as such, dictates the immediate use and implications of `ieee80211_get_tx_rates`'s functionality.
|
| 32/2 |
2026/09/07 07:10 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_tx]
Results: map[SourceCode:2104: static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
2105: struct ieee80211_tx_control *control,
2106: struct sk_buff *skb)
2107: {
2108: struct mac80211_hwsim_data *data = hw->priv;
2109: struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
2110: struct ieee80211_hdr *hdr = (void *)skb->data;
2111: struct ieee80211_chanctx_conf *chanctx_conf;
2112: struct ieee80211_channel *channel;
2113: struct ieee80211_vif *vif = txi->control.vif;
2114: bool ack, unicast_data;
2115: enum nl80211_chan_width confbw = NL80211_CHAN_WIDTH_20_NOHT;
2116: u32 _portid, i;
2117: int tx_link_id = -1;
2118:
2119: if (WARN_ON(skb->len < 10)) {
2120: /* Should not happen; just a sanity check for addr1 use */
2121: ieee80211_free_txskb(hw, skb);
2122: return;
2123: }
2124:
2125: unicast_data = is_unicast_ether_addr(hdr->addr1) &&
2126: ieee80211_is_data(hdr->frame_control);
2127:
2128: if (unicast_data && ieee80211_encrypt_tx_skb(skb) < 0) {
2129: ieee80211_free_txskb(hw, skb);
2130: return;
2131: }
2132: /* re-assign hdr since skb data may have shifted after encryption */
2133: hdr = (void *)skb->data;
2134:
2135: if (vif && !data->tmp_chan &&
2136: (vif->type == NL80211_IFTYPE_NAN ||
2137: vif->type == NL80211_IFTYPE_NAN_DATA)) {
2138: struct cfg80211_chan_def chandef;
2139:
2140: mac80211_hwsim_nan_get_tx_chandef(hw, &chandef);
2141: if (WARN_ON(!chandef.chan)) {
2142: /* No valid channel in current slot, drop frame */
2143: ieee80211_free_txskb(hw, skb);
2144: return;
2145: }
2146: channel = chandef.chan;
2147: confbw = chandef.width;
2148: } else if (!data->use_chanctx) {
2149: channel = data->channel;
2150: confbw = data->bw;
2151: } else if (txi->hw_queue == 4) {
2152: channel = data->tmp_chan;
2153: } else {
2154: u8 link = u32_get_bits(IEEE80211_SKB_CB(skb)->control.flags,
2155: IEEE80211_TX_CTRL_MLO_LINK);
2156: struct ieee80211_link_sta *link_sta = NULL;
2157: struct ieee80211_sta *sta = control->sta;
2158: struct ieee80211_bss_conf *bss_conf;
2159:
2160: /* This can happen in case of monitor injection */
2161: if (!vif) {
2162: ieee80211_free_txskb(hw, skb);
2163: return;
2164: }
2165:
2166: if (link != IEEE80211_LINK_UNSPECIFIED) {
2167: bss_conf = rcu_dereference(vif->link_conf[link]);
2168: if (sta)
2169: link_sta = rcu_dereference(sta->link[link]);
2170: } else {
2171: bss_conf = mac80211_hwsim_select_tx_link(data, vif, sta,
2172: hdr, &link_sta);
2173: }
2174:
2175: if (bss_conf)
2176: tx_link_id = bss_conf->link_id;
2177:
2178: if (unlikely(!bss_conf)) {
2179: /* if it's an MLO STA, it might have deactivated all
2180: * links temporarily - but we don't handle real PS in
2181: * this code yet, so just drop the frame in that case
2182: */
2183: WARN(link != IEEE80211_LINK_UNSPECIFIED || !sta || !sta->mlo,
2184: "link:%d, sta:%pM, sta->mlo:%d\n",
2185: link, sta ? sta->addr : NULL, sta ? sta->mlo : -1);
2186: ieee80211_free_txskb(hw, skb);
2187: return;
2188: }
2189:
2190: /* Do address translations only between shared links. It is
2191: * possible that while an non-AP MLD station and an AP MLD
2192: * station have shared links, the frame is intended to be sent
2193: * on a link which is not shared (for example when sending a
2194: * probe response).
2195: */
2196: if (sta && sta->mlo && link_sta) {
2197: /* address translation to link addresses on TX */
2198: ether_addr_copy(hdr->addr1, link_sta->addr);
2199: ether_addr_copy(hdr->addr2, bss_conf->addr);
2200: /* translate A3 only if it's the BSSID */
2201: if (!ieee80211_has_tods(hdr->frame_control) &&
2202: !ieee80211_has_fromds(hdr->frame_control)) {
2203: if (ether_addr_equal(hdr->addr3, sta->addr))
2204: ether_addr_copy(hdr->addr3, link_sta->addr);
2205: else if (ether_addr_equal(hdr->addr3, vif->addr))
2206: ether_addr_copy(hdr->addr3, bss_conf->addr);
2207: }
2208: /* no need to look at A4, if present it's SA */
2209: }
2210:
2211: chanctx_conf = rcu_dereference(bss_conf->chanctx_conf);
2212: if (chanctx_conf) {
2213: channel = chanctx_conf->def.chan;
2214: confbw = chanctx_conf->def.width;
2215: } else {
2216: channel = NULL;
2217: }
2218: }
2219:
2220: if (!unicast_data && ieee80211_encrypt_tx_skb(skb) < 0) {
2221: ieee80211_free_txskb(hw, skb);
2222: return;
2223: }
2224: /* re-assign hdr since skb data may have shifted after encryption */
2225: hdr = (void *)skb->data;
2226:
2227: if (WARN(!channel, "TX w/o channel - queue = %d\n", txi->hw_queue)) {
2228: ieee80211_free_txskb(hw, skb);
2229: return;
2230: }
2231:
2232: if (data->idle && !data->tmp_chan) {
2233: wiphy_dbg(hw->wiphy, "Trying to TX when idle - reject\n");
2234: ieee80211_free_txskb(hw, skb);
2235: return;
2236: }
2237:
2238: if (vif)
2239: hwsim_check_magic(vif);
2240: if (control->sta)
2241: hwsim_check_sta_magic(control->sta);
2242:
2243: if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
2244: ieee80211_get_tx_rates(vif, control->sta, skb,
2245: txi->control.rates,
2246: ARRAY_SIZE(txi->control.rates));
2247:
2248: for (i = 0; i < ARRAY_SIZE(txi->control.rates); i++) {
2249: u16 rflags = txi->control.rates[i].flags;
2250: /* initialize to data->bw for 5/10 MHz handling */
2251: enum nl80211_chan_width bw = data->bw;
2252:
2253: if (txi->control.rates[i].idx == -1)
2254: break;
2255:
2256: if (rflags & IEEE80211_TX_RC_40_MHZ_WIDTH)
2257: bw = NL80211_CHAN_WIDTH_40;
2258: else if (rflags & IEEE80211_TX_RC_80_MHZ_WIDTH)
2259: bw = NL80211_CHAN_WIDTH_80;
2260: else if (rflags & IEEE80211_TX_RC_160_MHZ_WIDTH)
2261: bw = NL80211_CHAN_WIDTH_160;
2262:
2263: if (WARN_ON(hwsim_get_chanwidth(bw) > hwsim_get_chanwidth(confbw)))
2264: return;
2265: }
2266:
2267: /* wmediumd mode check */
2268: _portid = READ_ONCE(data->wmediumd);
2269:
2270: if (_portid || hwsim_virtio_enabled)
2271: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, channel);
2272:
2273: /* NO wmediumd detected, perfect medium simulation */
2274: data->tx_pkts++;
2275: data->tx_bytes += skb->len;
2276: ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel);
2277:
2278: if (ack && skb->len >= 16)
2279: mac80211_hwsim_monitor_ack(channel, hdr->addr2);
2280:
2281: ieee80211_tx_info_clear_status(txi);
2282:
2283: /* frame was transmitted at most favorable rate at first attempt */
2284: txi->control.rates[0].count = 1;
2285: txi->control.rates[1].idx = -1;
2286:
2287: if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) && ack)
2288: txi->flags |= IEEE80211_TX_STAT_ACK;
2289:
2290: if (tx_link_id >= 0) {
2291: txi->status.link_valid = 1;
2292: txi->status.link_id = tx_link_id;
2293: }
2294:
2295: ieee80211_tx_status_irqsafe(hw, skb);
2296: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 33/2 |
2026/09/07 07:10 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 36788
output: 58
thoughts: 101
Thoughts: **My Thought Process Regarding `mac80211_hwsim_tx` and Rate Control Tables**
Okay, I'm digging into the `mac80211_hwsim_tx` function, and I've just noticed something interesting. It appears that `mac80211_hwsim_tx` makes a call to `ieee80211_get_tx_rates`. Now, this call is contingent on a specific condition: `ieee80211_hw_check(hw, SUPPORTS_RC_TABLE)` must evaluate to true.
This immediately sparks a question in my mind. For `ieee80211_get_tx_rates` to be invoked under this condition, it implies that the `mac80211_hwsim` module itself *must* be setting the `SUPPORTS_RC_TABLE` capability flag on the hardware object (`hw`).
To confirm this hypothesis, my next step is to meticulously examine the `mac80211_hwsim_new_radio` function. This is where the hardware emulation is initialized, and it's the logical place to find the setting of such hardware capabilities. I need to see if and how `SUPPORTS_RC_TABLE` is being configured during the hardware simulation setup.
|
| 34/2 |
2026/09/07 07:10 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_new_radio]
Results: map[SourceCode:5674: static int mac80211_hwsim_new_radio(struct genl_info *info,
5675: struct hwsim_new_radio_params *param)
5676: {
5677: int err;
5678: u8 addr[ETH_ALEN];
5679: struct mac80211_hwsim_data *data;
5680: struct ieee80211_hw *hw;
5681: enum nl80211_band band;
5682: const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
5683: struct net *net;
5684: int idx, i;
5685: int n_limits = 0;
5686: int n_bands = 0;
5687:
5688: if (WARN_ON(param->channels > 1 && !param->use_chanctx))
5689: return -EINVAL;
5690:
5691: spin_lock_bh(&hwsim_radio_lock);
5692: idx = hwsim_radio_idx++;
5693: spin_unlock_bh(&hwsim_radio_lock);
5694:
5695: if (param->mlo)
5696: ops = &mac80211_hwsim_mlo_ops;
5697: else if (param->use_chanctx)
5698: ops = &mac80211_hwsim_mchan_ops;
5699: hw = ieee80211_alloc_hw_nm(sizeof(*data), ops, param->hwname);
5700: if (!hw) {
5701: pr_debug("mac80211_hwsim: ieee80211_alloc_hw failed\n");
5702: err = -ENOMEM;
5703: goto failed;
5704: }
5705:
5706: /* ieee80211_alloc_hw_nm may have used a default name */
5707: param->hwname = wiphy_name(hw->wiphy);
5708:
5709: if (info)
5710: net = genl_info_net(info);
5711: else
5712: net = &init_net;
5713: wiphy_net_set(hw->wiphy, net);
5714:
5715: data = hw->priv;
5716: data->hw = hw;
5717:
5718: data->dev = device_create(&hwsim_class, NULL, 0, hw, "hwsim%d", idx);
5719: if (IS_ERR(data->dev)) {
5720: printk(KERN_DEBUG
5721: "mac80211_hwsim: device_create failed (%ld)\n",
5722: PTR_ERR(data->dev));
5723: err = -ENOMEM;
5724: goto failed_drvdata;
5725: }
5726: data->dev->driver = &mac80211_hwsim_driver.driver;
5727: err = device_bind_driver(data->dev);
5728: if (err != 0) {
5729: pr_debug("mac80211_hwsim: device_bind_driver failed (%d)\n",
5730: err);
5731: goto failed_bind;
5732: }
5733:
5734: skb_queue_head_init(&data->pending);
5735:
5736: SET_IEEE80211_DEV(hw, data->dev);
5737: if (!param->perm_addr) {
5738: eth_zero_addr(addr);
5739: addr[0] = 0x02;
5740: addr[3] = idx >> 8;
5741: addr[4] = idx;
5742: memcpy(data->addresses[0].addr, addr, ETH_ALEN);
5743: /* Why need here second address ? */
5744: memcpy(data->addresses[1].addr, addr, ETH_ALEN);
5745: data->addresses[1].addr[0] |= 0x40;
5746: memcpy(data->addresses[2].addr, addr, ETH_ALEN);
5747: data->addresses[2].addr[0] |= 0x50;
5748:
5749: hw->wiphy->n_addresses = 3;
5750: hw->wiphy->addresses = data->addresses;
5751: /* possible address clash is checked at hash table insertion */
5752: } else {
5753: memcpy(data->addresses[0].addr, param->perm_addr, ETH_ALEN);
5754: /* compatibility with automatically generated mac addr */
5755: memcpy(data->addresses[1].addr, param->perm_addr, ETH_ALEN);
5756: memcpy(data->addresses[2].addr, param->perm_addr, ETH_ALEN);
5757: hw->wiphy->n_addresses = 3;
5758: hw->wiphy->addresses = data->addresses;
5759: }
5760:
5761: data->channels = param->channels;
5762: data->use_chanctx = param->use_chanctx;
5763: data->idx = idx;
5764: data->destroy_on_close = param->destroy_on_close;
5765: if (info)
5766: data->portid = info->snd_portid;
5767:
5768: /* setup interface limits, only on interface types we support */
5769: if (param->iftypes & BIT(NL80211_IFTYPE_ADHOC)) {
5770: data->if_limits[n_limits].max = 1;
5771: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_ADHOC);
5772: n_limits++;
5773: }
5774:
5775: if (param->iftypes & HWSIM_DEFAULT_IF_LIMIT) {
5776: data->if_limits[n_limits].max = 2048;
5777: /*
5778: * For this case, we may only support a subset of
5779: * HWSIM_DEFAULT_IF_LIMIT, therefore we only want to add the
5780: * bits that both param->iftype & HWSIM_DEFAULT_IF_LIMIT have.
5781: */
5782: data->if_limits[n_limits].types =
5783: HWSIM_DEFAULT_IF_LIMIT & param->iftypes;
5784: n_limits++;
5785: }
5786:
5787: if (param->iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
5788: data->if_limits[n_limits].max = 1;
5789: data->if_limits[n_limits].types =
5790: BIT(NL80211_IFTYPE_P2P_DEVICE);
5791: n_limits++;
5792: }
5793:
5794: if (param->iftypes & BIT(NL80211_IFTYPE_NAN)) {
5795: data->if_limits[n_limits].max = 1;
5796: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN);
5797: n_limits++;
5798:
5799: hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ) |
5800: BIT(NL80211_BAND_5GHZ);
5801:
5802: hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
5803: WIPHY_NAN_FLAGS_USERSPACE_DE;
5804: hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
5805: NAN_OP_MODE_80P80MHZ |
5806: NAN_OP_MODE_160MHZ;
5807:
5808: hw->wiphy->nan_capa.n_antennas = 0x22;
5809: hw->wiphy->nan_capa.max_channel_switch_time = 0;
5810:
5811: wiphy_ext_feature_set(hw->wiphy,
5812: NL80211_EXT_FEATURE_SECURE_NAN);
5813:
5814: hrtimer_setup(&data->nan.slot_timer,
5815: mac80211_hwsim_nan_slot_timer,
5816: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5817: hrtimer_setup(&data->nan.resume_txqs_timer,
5818: mac80211_hwsim_nan_resume_txqs_timer,
5819: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5820: hrtimer_setup(&data->nan.discovery_beacon_timer,
5821: mac80211_hwsim_nan_discovery_beacon_timer,
5822: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5823:
5824: spin_lock_init(&data->nan.state_lock);
5825: }
5826:
5827: if (param->iftypes & BIT(NL80211_IFTYPE_NAN_DATA)) {
5828: data->if_limits[n_limits].max = 2;
5829: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN_DATA);
5830: n_limits++;
5831:
5832: hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap;
5833: hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap;
5834: hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap;
5835:
5836: /*
5837: * NAN switches between bands/channels per its schedule,
5838: * so mac80211 rate control can't work here.
5839: */
5840: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5841: }
5842:
5843: data->if_combination.radar_detect_widths =
5844: BIT(NL80211_CHAN_WIDTH_5) |
5845: BIT(NL80211_CHAN_WIDTH_10) |
5846: BIT(NL80211_CHAN_WIDTH_20_NOHT) |
5847: BIT(NL80211_CHAN_WIDTH_20) |
5848: BIT(NL80211_CHAN_WIDTH_40) |
5849: BIT(NL80211_CHAN_WIDTH_80) |
5850: BIT(NL80211_CHAN_WIDTH_160);
5851:
5852: if (data->use_chanctx) {
5853: hw->wiphy->max_scan_ssids = 255;
5854: hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
5855: hw->wiphy->max_remain_on_channel_duration = 1000;
5856: data->if_combination.num_different_channels = data->channels;
5857: } else {
5858: data->if_combination.num_different_channels = 1;
5859: }
5860:
5861: if (!n_limits) {
5862: err = -EINVAL;
5863: goto failed_hw;
5864: }
5865:
5866: data->if_combination.max_interfaces = 0;
5867: for (i = 0; i < n_limits; i++)
5868: data->if_combination.max_interfaces +=
5869: data->if_limits[i].max;
5870:
5871: data->if_combination.n_limits = n_limits;
5872: data->if_combination.limits = data->if_limits;
5873:
5874: /*
5875: * If we actually were asked to support combinations,
5876: * advertise them - if there's only a single thing like
5877: * only IBSS then don't advertise it as combinations.
5878: */
5879: if (data->if_combination.max_interfaces > 1) {
5880: hw->wiphy->iface_combinations = &data->if_combination;
5881: hw->wiphy->n_iface_combinations = 1;
5882: }
5883:
5884: if (param->ciphers) {
5885: memcpy(data->ciphers, param->ciphers,
5886: param->n_ciphers * sizeof(u32));
5887: hw->wiphy->cipher_suites = data->ciphers;
5888: hw->wiphy->n_cipher_suites = param->n_ciphers;
5889: }
5890:
5891: hw->wiphy->mbssid_max_interfaces = 8;
5892: hw->wiphy->ema_max_profile_periodicity = 3;
5893:
5894: spin_lock_init(&data->tsf_offset_lock);
5895:
5896: data->rx_rssi = DEFAULT_RX_RSSI;
5897:
5898: INIT_DELAYED_WORK(&data->roc_start, hw_roc_start);
5899: INIT_DELAYED_WORK(&data->roc_done, hw_roc_done);
5900: INIT_DELAYED_WORK(&data->hw_scan, hw_scan_work);
5901:
5902: hw->queues = 5;
5903: hw->offchannel_tx_hw_queue = 4;
5904:
5905: ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
5906: ieee80211_hw_set(hw, CHANCTX_STA_CSA);
5907: ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
5908: ieee80211_hw_set(hw, QUEUE_CONTROL);
5909: ieee80211_hw_set(hw, WANT_MONITOR_VIF);
5910: ieee80211_hw_set(hw, AMPDU_AGGREGATION);
5911: ieee80211_hw_set(hw, MFP_CAPABLE);
5912: ieee80211_hw_set(hw, SIGNAL_DBM);
5913: ieee80211_hw_set(hw, SUPPORTS_PS);
5914: ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
5915: ieee80211_hw_set(hw, TDLS_WIDER_BW);
5916: ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
5917: ieee80211_hw_set(hw, STRICT);
5918: ieee80211_hw_set(hw, BUFF_MMPDU_TXQ);
5919: ieee80211_hw_set(hw, STA_MMPDU_TXQ);
5920:
5921: if (param->mlo) {
5922: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
5923: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5924: ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
5925: ieee80211_hw_set(hw, CONNECTION_MONITOR);
5926: ieee80211_hw_set(hw, AP_LINK_PS);
5927:
5928: hw->wiphy->iftype_ext_capab = mac80211_hwsim_iftypes_ext_capa;
5929: hw->wiphy->num_iftype_ext_capab =
5930: ARRAY_SIZE(mac80211_hwsim_iftypes_ext_capa);
5931: } else {
5932: ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
5933: ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
5934: if (rctbl)
5935: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
5936: }
5937:
5938: hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
5939: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
5940: WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
5941: WIPHY_FLAG_AP_UAPSD |
5942: WIPHY_FLAG_HAS_CHANNEL_SWITCH;
5943: hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
5944: hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
5945: NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
5946: NL80211_FEATURE_STATIC_SMPS |
5947: NL80211_FEATURE_DYNAMIC_SMPS |
5948: NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
5949: NL80211_FEATURE_AP_SCAN;
5950: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
5951: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
5952: wiphy_ext_feature_set(hw->wiphy,
5953: NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
5954: wiphy_ext_feature_set(hw->wiphy,
5955: NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
5956: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
5957:
5958: wiphy_ext_feature_set(hw->wiphy,
5959: NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT);
5960: wiphy_ext_feature_set(hw->wiphy,
5961: NL80211_EXT_FEATURE_BSS_COLOR);
5962: wiphy_ext_feature_set(hw->wiphy,
5963: NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT);
5964: wiphy_ext_feature_set(hw->wiphy,
5965: NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
5966: wiphy_ext_feature_set(hw->wiphy,
5967: NL80211_EXT_FEATURE_EXT_KEY_ID);
5968: wiphy_ext_feature_set(hw->wiphy,
5969: NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION);
5970:
5971: hw->wiphy->interface_modes = param->iftypes;
5972:
5973: /* ask mac80211 to reserve space for magic */
5974: hw->vif_data_size = sizeof(struct hwsim_vif_priv);
5975: hw->sta_data_size = sizeof(struct hwsim_sta_priv);
5976: hw->chanctx_data_size = sizeof(struct hwsim_chanctx_priv);
5977: hw->txq_data_size = 0;
5978:
5979: memcpy(data->channels_2ghz, hwsim_channels_2ghz,
5980: sizeof(hwsim_channels_2ghz));
5981: memcpy(data->channels_5ghz, hwsim_channels_5ghz,
5982: sizeof(hwsim_channels_5ghz));
5983: memcpy(data->channels_6ghz, hwsim_channels_6ghz,
5984: sizeof(hwsim_channels_6ghz));
5985: memcpy(data->channels_s1g, hwsim_channels_s1g,
5986: sizeof(hwsim_channels_s1g));
5987: memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates));
5988:
5989: for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
5990: struct ieee80211_supported_band *sband = &data->bands[band];
5991: struct wiphy_radio_freq_range *radio_range;
5992: const struct ieee80211_channel *c;
5993: struct wiphy_radio *radio;
5994:
5995: sband->band = band;
5996:
5997: switch (band) {
5998: case NL80211_BAND_2GHZ:
5999: sband->channels = data->channels_2ghz;
6000: sband->n_channels = ARRAY_SIZE(hwsim_channels_2ghz);
6001: sband->bitrates = data->rates;
6002: sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
6003: break;
6004: case NL80211_BAND_5GHZ:
6005: sband->channels = data->channels_5ghz;
6006: sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
6007: sband->bitrates = data->rates + 4;
6008: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6009:
6010: sband->vht_cap.vht_supported = true;
6011: sband->vht_cap.cap =
6012: IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
6013: IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
6014: IEEE80211_VHT_CAP_RXLDPC |
6015: IEEE80211_VHT_CAP_SHORT_GI_80 |
6016: IEEE80211_VHT_CAP_SHORT_GI_160 |
6017: IEEE80211_VHT_CAP_TXSTBC |
6018: IEEE80211_VHT_CAP_RXSTBC_4 |
6019: IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
6020: sband->vht_cap.vht_mcs.rx_mcs_map =
6021: cpu_to_le16(HWSIM_VHT_MCS_MAP);
6022: sband->vht_cap.vht_mcs.tx_mcs_map =
6023: sband->vht_cap.vht_mcs.rx_mcs_map;
6024: break;
6025: case NL80211_BAND_6GHZ:
6026: sband->channels = data->channels_6ghz;
6027: sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
6028: sband->bitrates = data->rates + 4;
6029: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6030: break;
6031: case NL80211_BAND_S1GHZ:
6032: memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
6033: sizeof(sband->s1g_cap));
6034: sband->channels = data->channels_s1g;
6035: sband->n_channels = ARRAY_SIZE(hwsim_channels_s1g);
6036: break;
6037: default:
6038: continue;
6039: }
6040:
6041: if (band != NL80211_BAND_6GHZ){
6042: sband->ht_cap.ht_supported = true;
6043: sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
6044: IEEE80211_HT_CAP_GRN_FLD |
6045: IEEE80211_HT_CAP_SGI_20 |
6046: IEEE80211_HT_CAP_SGI_40 |
6047: IEEE80211_HT_CAP_DSSSCCK40 |
6048: IEEE80211_HT_CAP_TX_STBC |
6049: IEEE80211_HT_CAP_RX_STBC;
6050: sband->ht_cap.ampdu_factor = 0x3;
6051: sband->ht_cap.ampdu_density = 0x6;
6052: memset(&sband->ht_cap.mcs, 0,
6053: sizeof(sband->ht_cap.mcs));
6054: sband->ht_cap.mcs.rx_mask[0] = 0xff;
6055: sband->ht_cap.mcs.rx_mask[1] = 0xff;
6056: sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
6057: }
6058:
6059: mac80211_hwsim_sband_capab(sband);
6060:
6061: hw->wiphy->bands[band] = sband;
6062:
6063: if (!param->multi_radio)
6064: continue;
6065:
6066: c = sband->channels;
6067: radio_range = &data->radio_range[n_bands];
6068: radio_range->start_freq = ieee80211_channel_to_khz(c) - 10000;
6069:
6070: c += sband->n_channels - 1;
6071: radio_range->end_freq = ieee80211_channel_to_khz(c) + 10000;
6072:
6073: radio = &data->radio[n_bands++];
6074: radio->freq_range = radio_range;
6075: radio->n_freq_range = 1;
6076: radio->iface_combinations = &data->if_combination_radio;
6077: radio->n_iface_combinations = 1;
6078: }
6079:
6080: if (param->multi_radio) {
6081: hw->wiphy->radio = data->radio;
6082: hw->wiphy->n_radio = n_bands;
6083:
6084: memcpy(&data->if_combination_radio, &data->if_combination,
6085: sizeof(data->if_combination));
6086: data->if_combination.num_different_channels *= n_bands;
6087: }
6088:
6089: if (data->use_chanctx)
6090: data->if_combination.radar_detect_widths = 0;
6091:
6092: /* By default all radios belong to the first group */
6093: data->group = 1;
6094: mutex_init(&data->mutex);
6095:
6096: data->netgroup = hwsim_net_get_netgroup(net);
6097: data->wmediumd = hwsim_net_get_wmediumd(net);
6098:
6099: /* Enable frame retransmissions for lossy channels */
6100: hw->max_rates = 4;
6101: hw->max_rate_tries = 11;
6102:
6103: hw->wiphy->vendor_commands = mac80211_hwsim_vendor_commands;
6104: hw->wiphy->n_vendor_commands =
6105: ARRAY_SIZE(mac80211_hwsim_vendor_commands);
6106: hw->wiphy->vendor_events = mac80211_hwsim_vendor_events;
6107: hw->wiphy->n_vendor_events = ARRAY_SIZE(mac80211_hwsim_vendor_events);
6108:
6109: if (param->reg_strict)
6110: hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
6111: if (param->regd) {
6112: data->regd = param->regd;
6113: hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
6114: wiphy_apply_custom_regulatory(hw->wiphy, param->regd);
6115: /* give the regulatory workqueue a chance to run */
6116: schedule_timeout_interruptible(1);
6117: }
6118:
6119: wiphy_ext_feature_set(hw->wiphy,
6120: NL80211_EXT_FEATURE_DFS_CONCURRENT);
6121: if (param->background_radar)
6122: wiphy_ext_feature_set(hw->wiphy,
6123: NL80211_EXT_FEATURE_RADAR_BACKGROUND);
6124:
6125: if (param->no_vif)
6126: ieee80211_hw_set(hw, NO_AUTO_VIF);
6127:
6128: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
6129: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PUNCT);
6130: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PROBE_AP);
6131:
6132: for (i = 0; i < ARRAY_SIZE(data->link_data); i++) {
6133: hrtimer_setup(&data->link_data[i].beacon_timer, mac80211_hwsim_beacon,
6134: CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
6135: data->link_data[i].link_id = i;
6136: }
6137:
6138: err = ieee80211_register_hw(hw);
6139: if (err < 0) {
6140: pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
6141: err);
6142: goto failed_hw;
6143: }
6144:
6145: wiphy_dbg(hw->wiphy, "hwaddr %pM registered\n", hw->wiphy->perm_addr);
6146:
6147: if (param->reg_alpha2) {
6148: data->alpha2[0] = param->reg_alpha2[0];
6149: data->alpha2[1] = param->reg_alpha2[1];
6150: regulatory_hint(hw->wiphy, param->reg_alpha2);
6151: }
6152:
6153: data->debugfs = debugfs_create_dir("hwsim", hw->wiphy->debugfsdir);
6154: debugfs_create_file("ps", 0666, data->debugfs, data, &hwsim_fops_ps);
6155: debugfs_create_file("group", 0666, data->debugfs, data,
6156: &hwsim_fops_group);
6157: debugfs_create_file("rx_rssi", 0666, data->debugfs, data,
6158: &hwsim_fops_rx_rssi);
6159: if (!data->use_chanctx)
6160: debugfs_create_file("dfs_simulate_radar", 0222,
6161: data->debugfs,
6162: data, &hwsim_simulate_radar);
6163: if (param->background_radar)
6164: debugfs_create_file("dfs_background_cac", 0200,
6165: data->debugfs,
6166: data, &hwsim_background_cac_ops);
6167: debugfs_create_file("simulate_incumbent_signal_interference", 0200,
6168: data->debugfs,
6169: data, &hwsim_simulate_incumbent_signal_fops);
6170:
6171: if (param->pmsr_capa) {
6172: data->pmsr_capa = *param->pmsr_capa;
6173: hw->wiphy->pmsr_capa = &data->pmsr_capa;
6174: }
6175:
6176: spin_lock_bh(&hwsim_radio_lock);
6177: err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
6178: hwsim_rht_params);
6179: if (err < 0) {
6180: if (info) {
6181: GENL_SET_ERR_MSG(info, "perm addr already present");
6182: NL_SET_BAD_ATTR(info->extack,
6183: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6184: }
6185: spin_unlock_bh(&hwsim_radio_lock);
6186: goto failed_final_insert;
6187: }
6188:
6189: list_add_tail(&data->list, &hwsim_radios);
6190: hwsim_radios_generation++;
6191: spin_unlock_bh(&hwsim_radio_lock);
6192:
6193: hwsim_mcast_new_radio(idx, info, param);
6194:
6195: return idx;
6196:
6197: failed_final_insert:
6198: debugfs_remove_recursive(data->debugfs);
6199: ieee80211_unregister_hw(data->hw);
6200: failed_hw:
6201: device_release_driver(data->dev);
6202: failed_bind:
6203: device_unregister(data->dev);
6204: failed_drvdata:
6205: ieee80211_free_hw(hw);
6206: failed:
6207: return err;
6208: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 35/2 |
2026/09/07 07:10 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 47182
output: 48
thoughts: 54
Thoughts: **My Thought Process Regarding `mac80211_hwsim_new_radio` and `SUPPORTS_RC_TABLE`**
My initial observation was that the `mac80211_hwsim_new_radio` function appears to set the `SUPPORTS_RC_TABLE` flag, but only under a specific condition: when the `rctbl` parameter is true. This immediately piqued my curiosity. My next thought was to verify the nature of this `rctbl` parameter. Is it a local variable, a function argument, or something else entirely? Given the context of module functions in the Linux kernel, my immediate suspicion was that `rctbl` is likely a module parameter. This would mean its value is configurable at module load time, allowing users to control whether the hardware simulation supports rate control tables. To confirm this, I would proceed to check the module's source code or documentation to explicitly verify the declaration and usage of `rctbl`.
|
| 36/2 |
2026/09/07 07:10 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:rctbl]
Results: map[SourceCode: 63: static bool rctbl = false;
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 37/2 |
2026/09/07 07:10 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 47322
output: 49
thoughts: 1140
Thoughts: **The Curious Case of the Uninitialized TX Rate Index**
I've been digging into the `mac80211_hwsim` driver, specifically looking at how it handles transmit rates when the `rctbl` (rate control table) is disabled by default. It seems there's a bit of a logic loop I've stumbled upon, and it all hinges on the `txi->control.rates[0].idx` value.
Here's how my thought process unfolded:
Initially, I observed that `rctbl` defaults to `false`. This has a cascading effect: if `rctbl` is `false`, then the `SUPPORTS_RC_TABLE` flag isn't set. Crucially, this means that within `mac80211_hwsim_tx`, the `ieee80211_get_tx_rates` function is **not** called.
Now, this is where it gets interesting. If `ieee80211_get_tx_rates` is skipped, then `txi->control.rates[0].idx` remains at its initial value, which is `-1`. This is a problem, as I later discovered when I looked at the loop in `mac80211_hwsim_tx`:
```c
for (i = 0; i < ARRAY_SIZE(txi->control.rates); i++) {
u16 rflags = txi->control.rates[i].flags;
/* initialize to data->bw for 5/10 MHz handling */
enum nl80211_chan_width bw = data->bw;
if (txi->control.rates[i].idx == -1)
break; // <-- It breaks here!
```
Because `txi->control.rates[0].idx` is `-1`, this loop immediately breaks out on the first iteration. Subsequently, the function proceeds to call `mac80211_hwsim_tx_frame_no_nl(hw, skb, channel)`.
This path then leads to `mac80211_hwsim_write_tsf(data, skb, sim_tsf)`, which in turn calls `mac80211_hwsim_get_tx_rate(data->hw, info)`. And this, finally, calls `ieee80211_get_tx_rate(hw, info)`. It's at this point, within `ieee80211_get_tx_rate`, that the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` condition is met, triggering the warning I was observing.
But why does `mac80211_hwsim_write_tsf` even attempt to get the TX rate if `idx` is `-1`? My understanding is that it needs this information to accurately calculate the frame's transmission time, which is essential for updating the TSF in beacons and probe responses. It tries to fetch the bitrate:
```c
txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
if (txrate)
bitrate = txrate->bitrate;
```
And `mac80211_hwsim_get_tx_rate` is precisely where the warning occurs when `idx` is negative.
So, the core of the puzzle is: how did `idx` end up as `-1` in the first place? I traced this back to `ieee80211_parse_tx_radiotap`. If a `rate_found` flag is set to true within this function, it initially sets `info->control.rates[0].idx` to `-1`. Then, it attempts to find the actual rate within `sband->bitrates`. If this rate *isn't* found, `idx` consequently remains at `-1`. The function then clears `IEEE80211_TX_CTRL_RATE_INJECT`.
Here’s the critical point: even though `IEEE80211_TX_CTRL_RATE_INJECT` is cleared, `idx` is still `-1`. Normally, if `IEEE80211_TX_CTRL_RATE_INJECT` is cleared, rate control should step in and populate `idx`. However, as we established, `mac80211_hwsim` doesn't use rate control by default (`rctbl = false`), and therefore `SUPPORTS_RC_TABLE` isn't set.
This brings me back to the beginning: if `SUPPORTS_RC_TABLE` is not set, `ieee80211_get_tx_rates` is never called. This means `idx`, which was left at `-1` after the unsuccessful rate lookup in `ieee80211_parse_tx_radiotap`, **stays** at `-1`. And this is why `mac80211_hwsim_write_tsf` ends up calling `mac80211_hwsim_get_tx_rate` with an invalid index, leading to the warning.
It's interesting to consider what happens if `SUPPORTS_RC_TABLE` *is* set. In that scenario, `ieee80211_get_tx_rates` would be invoked, and the behavior would likely be different, presumably populating `idx` correctly. I intend to investigate that path next.
|
| 38/2 |
2026/09/07 07:10 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/rate.c Name:ieee80211_get_tx_rates]
Results: map[SourceCode: 882: void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
883: struct ieee80211_sta *sta,
884: struct sk_buff *skb,
885: struct ieee80211_tx_rate *dest,
886: int max_rates)
887: {
888: struct ieee80211_sub_if_data *sdata;
889: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
890: struct ieee80211_supported_band *sband;
891: u32 mask = ~0;
892:
893: rate_control_fill_sta_table(sta, info, dest, max_rates);
894:
895: if (!vif)
896: return;
897:
898: sdata = vif_to_sdata(vif);
899: if (info->band >= NUM_NL80211_BANDS)
900: return;
901:
902: sband = sdata->local->hw.wiphy->bands[info->band];
903:
904: if (ieee80211_is_tx_data(skb))
905: rate_control_apply_mask(sdata, sta, sband, dest, max_rates);
906:
907: if (!(info->control.flags & IEEE80211_TX_CTRL_DONT_USE_RATE_MASK))
908: mask = sdata->rc_rateidx_mask[info->band];
909:
910: if (dest[0].idx < 0)
911: __rate_control_send_low(&sdata->local->hw, sband, sta, info,
912: mask);
913:
914: if (sta)
915: rate_fixup_ratelist(vif, sband, info, dest, max_rates);
916: }
SourceFile:net/mac80211/rate.c]
|
| 39/2 |
2026/09/07 07:10 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 49145
output: 44
thoughts: 38
Thoughts: **My Thought Process on Rate Control Logic**
Alright, so my initial check focused on a specific condition: if the `idx` value within the `dest[0]` element is less than zero. My immediate thought was, "Okay, what happens when that condition is met?" The code clearly dictates that in such a scenario, it triggers a function called `__rate_control_send_low`.
Naturally, my next step was to dive into the implementation of `__rate_control_send_low` itself. I needed to understand precisely what actions are taken when this "low rate" sending mechanism is invoked. This is where the core of the rate control logic for these specific circumstances lies, and I'm keen to dissect its behavior to ensure it aligns with the overall system's requirements.
|
| 40/2 |
2026/09/07 07:11 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/rate.c Name:__rate_control_send_low]
Results: map[SourceCode: 366: static void __rate_control_send_low(struct ieee80211_hw *hw,
367: struct ieee80211_supported_band *sband,
368: struct ieee80211_sta *sta,
369: struct ieee80211_tx_info *info,
370: u32 rate_mask)
371: {
372: u32 rate_flags = 0;
373: int i;
374:
375: if (sband->band == NL80211_BAND_S1GHZ) {
376: info->control.rates[0].flags |= IEEE80211_TX_RC_S1G_MCS;
377: info->control.rates[0].idx = 0;
378: return;
379: }
380:
381: if ((sband->band == NL80211_BAND_2GHZ) &&
382: (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE))
383: rate_flags |= IEEE80211_RATE_ERP_G;
384:
385: info->control.rates[0].idx = 0;
386: for (i = 0; i < sband->n_bitrates; i++) {
387: if (!(rate_mask & BIT(i)))
388: continue;
389:
390: if ((rate_flags & sband->bitrates[i].flags) != rate_flags)
391: continue;
392:
393: if (!rate_supported(sta, sband->band, i))
394: continue;
395:
396: info->control.rates[0].idx = i;
397: break;
398: }
399: WARN_ONCE(i == sband->n_bitrates,
400: "no supported rates for sta %pM (0x%x, band %d) in rate_mask 0x%x with flags 0x%x\n",
401: sta ? sta->addr : NULL,
402: sta ? sta->deflink.supp_rates[sband->band] : -1,
403: sband->band,
404: rate_mask, rate_flags);
405:
406: info->control.rates[0].count =
407: (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
408: 1 : hw->max_rate_tries;
409:
410: info->control.skip_table = 1;
411: }
SourceFile:net/mac80211/rate.c]
|
| 41/2 |
2026/09/07 07:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 50036
output: 21
thoughts: 993
Thoughts: **My Thought Process Unraveling the Rate Control Bug in mac80211_hwsim**
Okay, let's trace this through. My initial observation is that if `SUPPORTS_RC_TABLE` is enabled, `ieee80211_get_tx_rates` seems to reliably set a valid index, at least to 0. This looks like a good path. However, in `mac80211_hwsim`, `SUPPORTS_RC_TABLE` is *false* by default. This immediately raises a flag.
Now, I'm thinking, if `SUPPORTS_RC_TABLE` is false, then `mac80211_hwsim_tx` won't even *call* `ieee80211_get_tx_rates`. So, how is the rate determined? I recall seeing `HAS_RATE_CONTROL` as another factor. But wait, `HAS_RATE_CONTROL` is only really relevant for MLO or NAN_DATA scenarios. If neither of those flags are set, then `mac80211_hwsim` effectively *doesn't have rate control* in the traditional sense. This is a critical point for me.
So, if `mac80211_hwsim` lacks rate control, how *does* it get the transmission rate? I need to re-examine `mac80211_hwsim_tx`. Looking at the code snippet:
```c
if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
ieee80211_get_tx_rates(vif, control->sta, skb,
txi->control.rates,
ARRAY_SIZE(txi->control.rates));
```
This confirms my earlier thought: if `SUPPORTS_RC_TABLE` is false, this block is skipped. `txi->control.rates` is left untouched from whatever state it was in. And here's where it gets interesting: if `txi->control.rates[0].idx` is `-1`, the loop breaks, and the frame proceeds to transmission. This is a potential pathway for the problem.
Following this path, `mac80211_hwsim_write_tsf` then calls `mac80211_hwsim_get_tx_rate`. If `idx` is still `-1` at this point, that's precisely what triggers the warning I'm seeing.
So, I'm starting to piece together the root cause: `ieee80211_parse_tx_radiotap` is setting `idx` to `-1` and clearing `IEEE80211_TX_CTRL_RATE_INJECT`. The crucial part is that it *leaves* `idx` as `-1`. Because `mac80211_hwsim` doesn't have rate control enabled (due to `SUPPORTS_RC_TABLE` being false and `HAS_RATE_CONTROL` not being set for normal frames), this `-1` value for `idx` persists. This, in turn, leads to `mac80211_hwsim_write_tsf` encountering the invalid index and issuing the warning.
This leads me to a further question: if `IEEE80211_TX_CTRL_RATE_INJECT` is cleared, shouldn't either `mac80211_hwsim_tx` or the generic `ieee80211_tx` logic be responsible for populating `idx`? My understanding is that if `HAS_RATE_CONTROL` is *not* set, `mac80211` itself doesn't perform rate control. But then, who *does* populate `idx`?
I'm going back to check `ieee80211_tx_frags`. It simply calls `drv_tx`. If `HAS_RATE_CONTROL` isn't set, the responsibility for setting `idx` must lie somewhere else. Let me look at `ieee80211_tx_prepare`. No, that function doesn't seem to be populating `idx` either.
This is starting to feel like a situation where if `HAS_RATE_CONTROL` isn't set, `mac80211` might *expect* the driver to populate `idx`. But in the case of a virtual driver like `mac80211_hwsim` that also doesn't support `SUPPORTS_RC_TABLE` for normal frames, it seems like there's a gap. `mac80211` isn't populating `idx` because it believes rate control isn't active, and `mac80211_hwsim` isn't setting `SUPPORTS_RC_TABLE` or `HAS_RATE_CONTROL` for these frames, so it doesn't have a built-in mechanism to determine the rate.
So, if `mac80211` doesn't populate `idx` in this scenario, how does `mac80211_hwsim` ever get a valid rate for these "normal" frames? I need to investigate where `idx` is actually populated for frames that don't involve rate control or rate injection. I'll trace `ieee80211_tx_prepare` more closely, perhaps looking at `ieee80211_tx_prep_agg` or other related functions to see where that missing `idx` value is supposed to come from.
|
| 42/2 |
2026/09/07 07:11 |
tool |
grepper |
0m
Args: map[Expression:rates\[0\]\.idx =]
Results: map[Output:drivers/net/wireless/ath/ath10k/htt_rx.c=3787=ath10k_update_per_peer_tx_stats(struct ath10k *ar,
--
drivers/net/wireless/ath/ath10k/htt_rx.c-3849- if (conf && conf->def.chan->band == NL80211_BAND_5GHZ)
drivers/net/wireless/ath/ath10k/htt_rx.c:3850: arsta->tx_info.status.rates[0].idx = rate_idx - 4;
drivers/net/wireless/ath/ath10k/htt_rx.c-3851- break;
drivers/net/wireless/ath/ath10k/htt_rx.c-3852- case WMI_RATE_PREAMBLE_CCK:
drivers/net/wireless/ath/ath10k/htt_rx.c:3853: arsta->tx_info.status.rates[0].idx = rate_idx;
drivers/net/wireless/ath/ath10k/htt_rx.c-3854- if (sgi)
--
drivers/net/wireless/ath/ath10k/htt_rx.c-3859- case WMI_RATE_PREAMBLE_HT:
drivers/net/wireless/ath/ath10k/htt_rx.c:3860: arsta->tx_info.status.rates[0].idx =
drivers/net/wireless/ath/ath10k/htt_rx.c-3861- txrate.mcs + ((txrate.nss - 1) * 8);
--
drivers/net/wireless/ath/ath10k/txrx.c=43=int ath10k_txrx_tx_unref(struct ath10k_htt *htt,
--
drivers/net/wireless/ath/ath10k/txrx.c-100- memset(&info->status, 0, sizeof(info->status));
drivers/net/wireless/ath/ath10k/txrx.c:101: info->status.rates[0].idx = -1;
drivers/net/wireless/ath/ath10k/txrx.c-102-
--
drivers/net/wireless/ath/ath11k/dp_tx.c=551=static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
--
drivers/net/wireless/ath/ath11k/dp_tx.c-586- /* skip tx rate update from ieee80211_status*/
drivers/net/wireless/ath/ath11k/dp_tx.c:587: info->status.rates[0].idx = -1;
drivers/net/wireless/ath/ath11k/dp_tx.c-588-
--
drivers/net/wireless/ath/ath11k/wmi.c=6014=static int wmi_process_mgmt_tx_comp(struct ath11k *ar,
--
drivers/net/wireless/ath/ath11k/wmi.c-6039- memset(&info->status, 0, sizeof(info->status));
drivers/net/wireless/ath/ath11k/wmi.c:6040: info->status.rates[0].idx = -1;
drivers/net/wireless/ath/ath11k/wmi.c-6041-
--
drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c=737=static void ath12k_wifi7_dp_tx_complete_msdu(struct ath12k_pdev_dp *dp_pdev,
--
drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c-797- /* skip tx rate update from ieee80211_status*/
drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c:798: info->status.rates[0].idx = -1;
drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c-799-
--
drivers/net/wireless/ath/ath12k/wmi.c=6436=static int wmi_process_mgmt_tx_comp(struct ath12k *ar, u32 desc_id,
--
drivers/net/wireless/ath/ath12k/wmi.c-6463- /* skip tx rate update from ieee80211_status*/
drivers/net/wireless/ath/ath12k/wmi.c:6464: info->status.rates[0].idx = -1;
drivers/net/wireless/ath/ath12k/wmi.c-6465-
--
drivers/net/wireless/ath/ath9k/link.c=201=static bool ath_paprd_send_frame(struct ath_softc *sc, struct sk_buff *skb, int chain)
--
drivers/net/wireless/ath/ath9k/link.c-215- tx_info->flags |= IEEE80211_TX_CTL_NO_ACK;
drivers/net/wireless/ath/ath9k/link.c:216: tx_info->control.rates[0].idx = 0;
drivers/net/wireless/ath/ath9k/link.c-217- tx_info->control.rates[0].count = 1;
--
drivers/net/wireless/intel/iwlegacy/3945-rs.c=600=il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
--
drivers/net/wireless/intel/iwlegacy/3945-rs.c-786- rs_sta->last_txrate_idx = idx;
drivers/net/wireless/intel/iwlegacy/3945-rs.c:787: info->control.rates[0].idx = idx - IL_FIRST_OFDM_RATE;
drivers/net/wireless/intel/iwlegacy/3945-rs.c-788- } else {
drivers/net/wireless/intel/iwlegacy/3945-rs.c-789- rs_sta->last_txrate_idx = idx;
drivers/net/wireless/intel/iwlegacy/3945-rs.c:790: info->control.rates[0].idx = rs_sta->last_txrate_idx;
drivers/net/wireless/intel/iwlegacy/3945-rs.c-791- }
--
drivers/net/wireless/intel/iwlegacy/3945.c=298=il3945_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb)
--
drivers/net/wireless/intel/iwlegacy/3945.c-341-
drivers/net/wireless/intel/iwlegacy/3945.c:342: info->status.rates[0].idx = rate_idx;
drivers/net/wireless/intel/iwlegacy/3945.c-343- info->status.rates[0].count = fail + 1; /* add final attempt */
--
drivers/net/wireless/intel/iwlegacy/4965-rs.c=2176=il4965_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
--
drivers/net/wireless/intel/iwlegacy/4965-rs.c-2241- }
drivers/net/wireless/intel/iwlegacy/4965-rs.c:2242: info->control.rates[0].idx = rate_idx;
drivers/net/wireless/intel/iwlegacy/4965-rs.c-2243- info->control.rates[0].count = 1;
--
drivers/net/wireless/intel/iwlwifi/dvm/rs.c=2660=static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
--
drivers/net/wireless/intel/iwlwifi/dvm/rs.c-2719- }
drivers/net/wireless/intel/iwlwifi/dvm/rs.c:2720: info->control.rates[0].idx = rate_idx;
drivers/net/wireless/intel/iwlwifi/dvm/rs.c-2721- info->control.rates[0].count = 1;
--
drivers/net/wireless/marvell/mwl8k.c=1681=mwl8k_txq_reclaim(struct ieee80211_hw *hw, int index, int limit, int force)
--
drivers/net/wireless/marvell/mwl8k.c-1762- */
drivers/net/wireless/marvell/mwl8k.c:1763: info->status.rates[0].idx = -1;
drivers/net/wireless/marvell/mwl8k.c-1764- info->status.rates[0].count = 1;
--
drivers/net/wireless/mediatek/mt76/mt7603/mac.c=1248=mt7603_mac_add_txs_skb(struct mt7603_dev *dev, struct mt7603_sta *sta, int pid,
--
drivers/net/wireless/mediatek/mt76/mt7603/mac.c-1266- info->status.rates[0].count = 0;
drivers/net/wireless/mediatek/mt76/mt7603/mac.c:1267: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt76/mt7603/mac.c-1268- }
--
drivers/net/wireless/mediatek/mt76/mt7615/mac.c=1437=static bool mt7615_mac_add_txs_skb(struct mt7615_dev *dev,
--
drivers/net/wireless/mediatek/mt76/mt7615/mac.c-1456- info->status.rates[0].count = 0;
drivers/net/wireless/mediatek/mt76/mt7615/mac.c:1457: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt76/mt7615/mac.c-1458- }
--
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c=749=bool mt76_connac2_mac_add_txs_skb(struct mt76_dev *dev, struct mt76_wcid *wcid,
--
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-768- !!(info->flags & IEEE80211_TX_STAT_ACK);
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:769: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c-770-
--
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c=440=mt76x02_tx_rate_fallback(struct ieee80211_tx_rate *rates, int idx, int phy)
--
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c-463- /* MCS 8 falls back to MCS 0 */
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:464: if (rates[0].idx == 8) {
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c-465- rates[1].idx = 0;
--
drivers/net/wireless/mediatek/mt76/mt7925/mac.c=924=mt7925_mac_add_txs_skb(struct mt792x_dev *dev, struct mt76_wcid *wcid,
--
drivers/net/wireless/mediatek/mt76/mt7925/mac.c-951-
drivers/net/wireless/mediatek/mt76/mt7925/mac.c:952: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt76/mt7925/mac.c-953-
--
drivers/net/wireless/mediatek/mt76/mt7925/mac.c=1061=mt7928_mac_add_txs_skb_msg(struct mt792x_dev *dev, struct mt76_wcid *wcid,
--
drivers/net/wireless/mediatek/mt76/mt7925/mac.c-1087-
drivers/net/wireless/mediatek/mt76/mt7925/mac.c:1088: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt76/mt7925/mac.c-1089-
--
drivers/net/wireless/mediatek/mt76/mt7996/mac.c=1472=mt7996_mac_add_txs_skb(struct mt7996_dev *dev, struct mt76_wcid *wcid,
--
drivers/net/wireless/mediatek/mt76/mt7996/mac.c-1501-
drivers/net/wireless/mediatek/mt76/mt7996/mac.c:1502: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt76/mt7996/mac.c-1503- }
--
drivers/net/wireless/mediatek/mt76/tx.c=89=__mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, u8 flags,
--
drivers/net/wireless/mediatek/mt76/tx.c-105- info->status.rates[0].count = 0;
drivers/net/wireless/mediatek/mt76/tx.c:106: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt76/tx.c-107- info->flags |= IEEE80211_TX_STAT_ACK;
--
drivers/net/wireless/mediatek/mt7601u/tx.c=102=void mt7601u_tx_status(struct mt7601u_dev *dev, struct sk_buff *skb)
--
drivers/net/wireless/mediatek/mt7601u/tx.c-108- ieee80211_tx_info_clear_status(info);
drivers/net/wireless/mediatek/mt7601u/tx.c:109: info->status.rates[0].idx = -1;
drivers/net/wireless/mediatek/mt7601u/tx.c-110- info->flags |= IEEE80211_TX_STAT_ACK;
--
drivers/net/wireless/morsemicro/mm81x/rc.c=191=static void mm81x_rc_sta_fill_basic_rates(struct mm81x_skb_tx_info *tx_info,
--
drivers/net/wireless/morsemicro/mm81x/rc.c-210-
drivers/net/wireless/morsemicro/mm81x/rc.c:211: info->control.rates[0].idx = 0;
drivers/net/wireless/morsemicro/mm81x/rc.c-212- info->control.rates[0].count = tx_info->rates[0].count;
--
drivers/net/wireless/realtek/rtl8xxxu/core.c=5149=static void rtl8xxxu_tx_complete(struct urb *urb)
--
drivers/net/wireless/realtek/rtl8xxxu/core.c-5164- ieee80211_tx_info_clear_status(tx_info);
drivers/net/wireless/realtek/rtl8xxxu/core.c:5165: tx_info->status.rates[0].idx = -1;
drivers/net/wireless/realtek/rtl8xxxu/core.c-5166- tx_info->status.rates[0].count = 0;
--
drivers/net/wireless/realtek/rtlwifi/base.c=1228=void rtl_get_tcb_desc(struct ieee80211_hw *hw,
--
drivers/net/wireless/realtek/rtlwifi/base.c-1264- */
drivers/net/wireless/realtek/rtlwifi/base.c:1265: if (info->control.rates[0].idx == 0 ||
drivers/net/wireless/realtek/rtlwifi/base.c-1266- ieee80211_is_nullfunc(fc)) {
--
drivers/net/wireless/realtek/rtlwifi/base.c=2434=int rtl_send_smps_action(struct ieee80211_hw *hw,
--
drivers/net/wireless/realtek/rtlwifi/base.c-2472-
drivers/net/wireless/realtek/rtlwifi/base.c:2473: info->control.rates[0].idx = 0;
drivers/net/wireless/realtek/rtlwifi/base.c-2474- info->band = hw->conf.chandef.chan->band;
--
drivers/net/wireless/ti/wlcore/ps.c=77=static void wl1271_ps_filter_frames(struct wl1271 *wl, u8 hlid)
--
drivers/net/wireless/ti/wlcore/ps.c-96- info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
drivers/net/wireless/ti/wlcore/ps.c:97: info->status.rates[0].idx = -1;
drivers/net/wireless/ti/wlcore/ps.c-98- ieee80211_tx_status_ni(wl->hw, skb);
--
drivers/net/wireless/ti/wlcore/tx.c=897=static void wl1271_tx_complete_packet(struct wl1271 *wl,
--
drivers/net/wireless/ti/wlcore/tx.c-939-
drivers/net/wireless/ti/wlcore/tx.c:940: info->status.rates[0].idx = rate;
drivers/net/wireless/ti/wlcore/tx.c-941- info->status.rates[0].count = retries;
--
drivers/net/wireless/ti/wlcore/tx.c=1018=void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid)
--
drivers/net/wireless/ti/wlcore/tx.c-1033- info = IEEE80211_SKB_CB(skb);
drivers/net/wireless/ti/wlcore/tx.c:1034: info->status.rates[0].idx = -1;
drivers/net/wireless/ti/wlcore/tx.c-1035- info->status.rates[0].count = 0;
--
drivers/net/wireless/ti/wlcore/tx.c=1076=void wl12xx_tx_reset(struct wl1271 *wl)
--
drivers/net/wireless/ti/wlcore/tx.c-1122-
drivers/net/wireless/ti/wlcore/tx.c:1123: info->status.rates[0].idx = -1;
drivers/net/wireless/ti/wlcore/tx.c-1124- info->status.rates[0].count = 0;
--
drivers/net/wireless/zydas/zd1211rw/zd_mac.c=430=static void zd_mac_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
--
drivers/net/wireless/zydas/zd1211rw/zd_mac.c-458-
drivers/net/wireless/zydas/zd1211rw/zd_mac.c:459: info->status.rates[0].idx = retries->rate[0];
drivers/net/wireless/zydas/zd1211rw/zd_mac.c-460- info->status.rates[0].count = 1; // (retry > 1 ? 2 : 1);
--
net/mac80211/rate.c=366=static void __rate_control_send_low(struct ieee80211_hw *hw,
--
net/mac80211/rate.c-376- info->control.rates[0].flags |= IEEE80211_TX_RC_S1G_MCS;
net/mac80211/rate.c:377: info->control.rates[0].idx = 0;
net/mac80211/rate.c-378- return;
--
net/mac80211/rate.c-384-
net/mac80211/rate.c:385: info->control.rates[0].idx = 0;
net/mac80211/rate.c-386- for (i = 0; i < sband->n_bitrates; i++) {
--
net/mac80211/rate.c-395-
net/mac80211/rate.c:396: info->control.rates[0].idx = i;
net/mac80211/rate.c-397- break;
--
net/mac80211/rate.c=414=static bool rate_control_send_low(struct ieee80211_sta *pubsta,
--
net/mac80211/rate.c-432- if (mcast_rate > 0) {
net/mac80211/rate.c:433: info->control.rates[0].idx = mcast_rate - 1;
net/mac80211/rate.c-434- return true;
--
net/mac80211/tx.c=2106=bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
--
net/mac80211/tx.c-2294-
net/mac80211/tx.c:2295: info->control.rates[0].idx = rate;
net/mac80211/tx.c-2296- } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
--
net/mac80211/tx.c-2307-
net/mac80211/tx.c:2308: info->control.rates[0].idx = i;
net/mac80211/tx.c-2309- break;
]
|
| 43/2 |
2026/09/07 07:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 57106
output: 27
thoughts: 585
Thoughts: **My Thought Process Unraveling the Rate Control Flow in mac80211_hwsim**
Okay, let's break down this chain of thought about the rate control mechanism, specifically within the `mac80211_hwsim` context. I'm trying to understand how transmission rates are determined, especially when the rate control table (`rctbl`) might be involved or, more importantly, *not* involved.
My initial thought was about `rate_control_send_low` setting `idx = 0`. This seemed like a straightforward initialization or default behavior. However, I immediately questioned its context. Was it directly called from `rate_control_fill_sta_table`? A quick mental check or look at the code would tell me that's unlikely. The actual call I recalled or found was `__rate_control_send_low` originating from `ieee80211_get_tx_rates`. This is a crucial distinction because `ieee80211_get_tx_rates` is where the actual rate selection logic for a given transmission attempt would reside.
Then, I hit a potential branching point: the `HAS_RATE_CONTROL` flag. If this flag is not set, then `mac80211` itself bypasses the rate control logic entirely. This implies that any rate selection would need to be handled by the driver or a fallback mechanism.
This led me to consider the `mac80211_hwsim` specific implementation. I remembered that `mac80211_hwsim` sets the `SUPPORTS_RC_TABLE` capability based on the `rctbl` parameter. This is a key piece of information. If `rctbl` is false, then `SUPPORTS_RC_TABLE` will also be false.
Now, this creates a significant implication: if `SUPPORTS_RC_TABLE` is false, the `mac80211_hwsim_tx` function *will not* call `ieee80211_get_tx_rates`. This is where my confusion started to mount. If `ieee80211_get_tx_rates` isn't called, and `SUPPORTS_RC_TABLE` is false, how does `mac80211_hwsim` manage to determine the transmission rate for "normal" frames? This seemed like a gap in my understanding.
To resolve this, I revisited the `mac80211_hwsim_tx` function. Looking at the snippet provided, I see the conditional:
```c
if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
ieee80211_get_tx_rates(vif, control->sta, skb,
txi->control.rates,
ARRAY_SIZE(txi->control.rates));
```
This clearly shows that if `SUPPORTS_RC_TABLE` is false, the `ieee80211_get_tx_rates` call is skipped. This confirms my suspicion. Therefore, if `SUPPORTS_RC_TABLE` is false, the `txi->control.rates` array is *not* populated by `mac80211_hwsim_tx` in that specific codepath.
This immediately brings up the next logical question: If `mac80211_hwsim_tx` doesn't populate `txi->control.rates` when `SUPPORTS_RC_TABLE` is false, then who does? The assumption is that for "normal" frames (those not going through a specific rate control table lookup if `SUPPORTS_RC_TABLE` were true), the rate information must be provided somehow. My next step in this thought process would be to investigate where `txi->control.rates` gets populated *before* `drv_tx` is called. I'd trace back from `mac80211_hwsim_tx` through functions like `ieee80211_tx_frags` to `ieee80211_tx`, searching for the mechanism that fills this crucial rate information when the hardware rate control table support is absent.
|
| 44/2 |
2026/09/07 07:11 |
tool |
grepper |
0m
Args: map[Expression:ieee80211_get_tx_rates]
Results: map[Output:drivers/net/wireless/ath/ath5k/base.c=768=ath5k_txbuf_setup(struct ath5k_hw *ah, struct ath5k_buf *bf,
--
drivers/net/wireless/ath/ath5k/base.c-799- if (!ath5k_merge_ratetbl(sta, bf, info)) {
drivers/net/wireless/ath/ath5k/base.c:800: ieee80211_get_tx_rates(info->control.vif,
drivers/net/wireless/ath/ath5k/base.c-801- sta, skb, bf->rates,
--
drivers/net/wireless/ath/ath9k/xmit.c=198=static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
--
drivers/net/wireless/ath/ath9k/xmit.c-205- if (!ath_merge_ratetbl(sta, bf, tx_info))
drivers/net/wireless/ath/ath9k/xmit.c:206: ieee80211_get_tx_rates(vif, sta, bf->bf_mpdu, bf->rates,
drivers/net/wireless/ath/ath9k/xmit.c-207- ARRAY_SIZE(bf->rates));
--
drivers/net/wireless/ath/carl9170/tx.c=872=static void carl9170_tx_get_rates(struct ar9170 *ar,
--
drivers/net/wireless/ath/carl9170/tx.c-883-
drivers/net/wireless/ath/carl9170/tx.c:884: ieee80211_get_tx_rates(vif, sta, skb,
drivers/net/wireless/ath/carl9170/tx.c-885- info->control.rates,
--
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c=335=void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi,
--
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c-356- wcid = NULL;
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c:357: ieee80211_get_tx_rates(info->control.vif, sta, skb,
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c-358- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt76/tx.c=355=mt76_tx(struct mt76_phy *phy, struct ieee80211_sta *sta,
--
drivers/net/wireless/mediatek/mt76/tx.c-370- if (wcid && !(wcid->tx_info & MT_WCID_TX_INFO_SET))
drivers/net/wireless/mediatek/mt76/tx.c:371: ieee80211_get_tx_rates(info->control.vif, sta, skb,
drivers/net/wireless/mediatek/mt76/tx.c-372- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt76/tx.c=490=mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q,
--
drivers/net/wireless/mediatek/mt76/tx.c-517- if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
drivers/net/wireless/mediatek/mt76/tx.c:518: ieee80211_get_tx_rates(txq->vif, txq->sta, skb,
drivers/net/wireless/mediatek/mt76/tx.c-519- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt76/tx.c-542- if (!(wcid->tx_info & MT_WCID_TX_INFO_SET))
drivers/net/wireless/mediatek/mt76/tx.c:543: ieee80211_get_tx_rates(txq->vif, txq->sta, skb,
drivers/net/wireless/mediatek/mt76/tx.c-544- info->control.rates, 1);
--
drivers/net/wireless/mediatek/mt7601u/tx.c=130=mt7601u_push_txwi(struct mt7601u_dev *dev, struct sk_buff *skb,
--
drivers/net/wireless/mediatek/mt7601u/tx.c-146- if (!wcid->tx_rate_set)
drivers/net/wireless/mediatek/mt7601u/tx.c:147: ieee80211_get_tx_rates(info->control.vif, sta, skb,
drivers/net/wireless/mediatek/mt7601u/tx.c-148- info->control.rates, 1);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2104=static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2243- if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2244: ieee80211_get_tx_rates(vif, control->sta, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2245- txi->control.rates,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2409=void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2417- struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2418: ieee80211_get_tx_rates(txi->control.vif, NULL, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2419- txi->control.rates,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2432=static void __mac80211_hwsim_beacon_tx(struct ieee80211_bss_conf *link_conf,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2448- if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2449: ieee80211_get_tx_rates(vif, NULL, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2450- info->control.rates,
--
include/net/mac80211.h=5597=void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
--
include/net/mac80211.h-5600-/**
include/net/mac80211.h:5601: * ieee80211_get_tx_rates - get the selected transmit rates for a packet
include/net/mac80211.h-5602- *
--
include/net/mac80211.h-5612- */
include/net/mac80211.h:5613:void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
include/net/mac80211.h-5614- struct ieee80211_sta *sta,
--
net/mac80211/rate.c=843=static void rate_control_apply_mask(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/rate.c-881-
net/mac80211/rate.c:882:void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
net/mac80211/rate.c-883- struct ieee80211_sta *sta,
--
net/mac80211/rate.c-916-}
net/mac80211/rate.c:917:EXPORT_SYMBOL(ieee80211_get_tx_rates);
net/mac80211/rate.c-918-
net/mac80211/rate.c=919=void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/rate.c-956-
net/mac80211/rate.c:957: ieee80211_get_tx_rates(&sdata->vif, ista, txrc->skb,
net/mac80211/rate.c-958- info->control.rates,
]
|
| 45/2 |
2026/09/07 07:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 60331
output: 43
thoughts: 41
Thoughts: **My Thought Process Regarding Rate Control and TX Rate Retrieval**
Okay, so my initial thought, when looking at this particular section of code, is to trace the execution flow, specifically focusing on how the system determines the transmission (TX) rates. I see that the `rate_control_get_rate` function is being called. My immediate next step, then, is to dive into *that* function to understand its internal workings. I'm not just accepting that it's called; I want to know *what it does*. Specifically, I'm interested in the mechanism it uses to obtain the actual TX rates. My quick observation, as I'm examining `rate_control_get_rate`, reveals that it, in turn, invokes `ieee80211_get_tx_rates`. This is a key piece of information. It tells me that the responsibility for fetching the TX rates isn't directly within `rate_control_get_rate` itself, but rather delegated to this `ieee80211_get_tx_rates` function. So, my focus now shifts. While I initiated this exploration by looking at `rate_control_get_rate`, the crucial next step, the one that will reveal the actual rate selection logic, is to scrutinize the implementation of `ieee80211_get_tx_rates`. That's where the real secrets of rate control are likely to be found.
|
| 46/2 |
2026/09/07 07:11 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/rate.c Name:rate_control_get_rate]
Results: map[SourceCode: 919: void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
920: struct sta_info *sta,
921: struct ieee80211_tx_rate_control *txrc)
922: {
923: struct rate_control_ref *ref = sdata->local->rate_ctrl;
924: void *priv_sta = NULL;
925: struct ieee80211_sta *ista = NULL;
926: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
927: int i;
928:
929: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
930: info->control.rates[i].idx = -1;
931: info->control.rates[i].flags = 0;
932: info->control.rates[i].count = 0;
933: }
934:
935: if (rate_control_send_low(sta ? &sta->sta : NULL, txrc))
936: return;
937:
938: if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
939: return;
940:
941: if (sta && test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) {
942: ista = &sta->sta;
943: priv_sta = sta->rate_ctrl_priv;
944: }
945:
946: if (ista) {
947: spin_lock_bh(&sta->rate_ctrl_lock);
948: ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
949: spin_unlock_bh(&sta->rate_ctrl_lock);
950: } else {
951: rate_control_send_low(NULL, txrc);
952: }
953:
954: if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))
955: return;
956:
957: ieee80211_get_tx_rates(&sdata->vif, ista, txrc->skb,
958: info->control.rates,
959: ARRAY_SIZE(info->control.rates));
960: }
SourceFile:net/mac80211/rate.c]
|
| 47/2 |
2026/09/07 07:11 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 61166
output: 46
thoughts: 321
Thoughts: **My Journey Through `rate_control_get_rate` and Injected Frames**
My investigation into how rate control interacts with injected frames has led me down an interesting path. Initially, I observed that `rate_control_get_rate` is indeed invoked by `mac80211`. My immediate thought was that this function would be responsible for selecting the appropriate transmission rate. However, I noticed a peculiar behavior: `rate_control_get_rate` seems to initialize `idx` to `-1` for all rates before proceeding. Following that, it calls `rate_control_send_low`. My understanding is that if either `HAS_RATE_CONTROL` or `SUPPORTS_RC_TABLE` is defined, the function simply returns. This implies that the actual rate selection logic might be bypassed in certain configurations. If neither of those flags is set, it then calls `ieee80211_get_tx_rates`.
This sequence made me question how `idx` gets populated. My expectation was that `rate_control_get_rate`, by its very name, should be setting `idx` to a meaningful value. However, a critical realization struck me: for injected frames, `rate_control_get_rate` is *not* called at all. This is because `ieee80211_monitor_start_xmit`, which handles injected frames, sidesteps the usual `ieee80211_tx_prepare` and `ieee80211_tx` functions. Instead, it directly invokes `ieee80211_xmit`. I double-checked the `ieee80211_monitor_start_xmit` code, and indeed, it performs the necessary cleanup of the radiotap header and then immediately calls `ieee80211_xmit`. This direct call to `ieee80211_xmit` is the key; it bypasses the rate control negotiation that would typically occur earlier in the transmission pipeline. My next step, naturally, is to delve into the specifics of `ieee80211_xmit` to understand its behavior in this context.
|
| 48/2 |
2026/09/07 07:12 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_xmit]
Results: map[SourceCode:2041: void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
2042: struct sta_info *sta, struct sk_buff *skb)
2043: {
2044: struct ieee80211_local *local = sdata->local;
2045: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2046: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
2047: int headroom;
2048: enum ieee80211_encrypt encrypt;
2049:
2050: if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)
2051: encrypt = ENCRYPT_NO;
2052: else if (ieee80211_is_mgmt(hdr->frame_control))
2053: encrypt = ENCRYPT_MGMT;
2054: else
2055: encrypt = ENCRYPT_DATA;
2056:
2057: headroom = local->tx_headroom;
2058: if (encrypt != ENCRYPT_NO)
2059: headroom += IEEE80211_ENCRYPT_HEADROOM;
2060: headroom -= skb_headroom(skb);
2061: headroom = max_t(int, 0, headroom);
2062:
2063: if (ieee80211_skb_resize(sdata, skb, headroom, encrypt)) {
2064: ieee80211_free_txskb(&local->hw, skb);
2065: return;
2066: }
2067:
2068: /* reload after potential resize */
2069: hdr = (struct ieee80211_hdr *) skb->data;
2070: info->control.vif = &sdata->vif;
2071:
2072: if (ieee80211_vif_is_mesh(&sdata->vif)) {
2073: if (ieee80211_is_data(hdr->frame_control) &&
2074: is_unicast_ether_addr(hdr->addr1)) {
2075: if (mesh_nexthop_resolve(sdata, skb))
2076: return; /* skb queued: don't free */
2077: } else {
2078: ieee80211_mps_set_frame_flags(sdata, NULL, hdr);
2079: }
2080: }
2081:
2082: ieee80211_set_qos_hdr(sdata, skb);
2083: ieee80211_tx(sdata, sta, skb, false);
2084: }
SourceFile:net/mac80211/tx.c]
|
| 49/2 |
2026/09/07 07:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 62370
output: 25
thoughts: 94
Thoughts: **My Journey Through the IEEE 802.11 Transmission Process: A Hunt for the Rate Control Logic**
Alright, so I'm tracing the execution flow for transmitting an IEEE 802.11 packet, and I've hit a point where I need to understand how the transmission rate is determined. My initial path led me to `ieee80211_xmit`. From there, the control flow clearly moves to `ieee80211_tx`, which is where the heavy lifting of preparing the packet for transmission begins. And sure enough, `ieee80211_tx` then invokes `ieee80211_tx_prepare`.
Now, my expectation, given the context of packet transmission, is that the `rate_control_get_rate` function – the logical place to ascertain the appropriate modulation and coding scheme – would be called within this preparation phase. However, as I scrutinize the code, I'm noticing something rather peculiar: `ieee80211_tx_prepare` *does not* directly call `rate_control_get_rate`. This is a significant deviation from what I would have anticipated.
This immediately throws me into a bit of a quandary. If `ieee80211_tx_prepare` isn't the gatekeeper for rate control, then where *is* this crucial piece of functionality being invoked? My next step is to meticulously backtrack and explore the call stack further, or perhaps investigate sibling functions or even upstream callers, to pinpoint the exact location where the dynamic rate selection logic is actually executed within the IEEE 802.11 transmission pipeline. The hunt is on!
|
| 50/2 |
2026/09/07 07:12 |
tool |
codesearch-find-references |
0m
Args: map[Name:rate_control_get_rate]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ieee80211_beacon_get_finish SourceFile:net/mac80211/tx.c SourceLine:5556] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ieee80211_tx_h_rate_ctrl SourceFile:net/mac80211/tx.c SourceLine:764]] TruncatedOutput:false]
|
| 51/2 |
2026/09/07 07:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 62588
output: 51
thoughts: 53
Thoughts: **My Thought Process Regarding `rate_control_get_rate` and its Context**
Ah, so the very first thing that catches my eye is the invocation of `rate_control_get_rate` within the `ieee80211_tx_h_rate_ctrl` function. This immediately tells me that we're deep in the transmit path, specifically within the hardware abstraction layer (HAL) or a similarly low-level component responsible for managing transmission parameters. The presence of `rate_ctrl` in the function name itself is a strong indicator that we're dealing with the core logic that determines the optimal transmission rate for a given packet.
My immediate next step, as any seasoned engineer would do, is to dive into the implementation of `ieee80211_tx_h_rate_ctrl`. I need to understand precisely *when* and *why* `rate_control_get_rate` is being called within its execution flow. Is it called unconditionally for every transmission attempt? Is it part of a loop that iterates through potential rates? Does it depend on certain conditions being met, like the state of the link, the buffer status, or the capabilities of the receiver? Understanding its placement within `ieee80211_tx_h_rate_ctrl` is crucial for grasping the overall rate control strategy. Is this a static choice, or is it dynamic and adaptive? Does `ieee80211_tx_h_rate_ctrl` itself perform any pre-processing before querying the rate control module, or does it simply delegate the decision-making entirely? My focus is on mapping the execution path and identifying the triggers for this specific rate determination function.
|
| 52/2 |
2026/09/07 07:12 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_h_rate_ctrl]
Results: map[SourceCode: 674: static ieee80211_tx_result debug_noinline
675: ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
676: {
677: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
678: struct ieee80211_hdr *hdr = (void *)tx->skb->data;
679: struct ieee80211_supported_band *sband;
680: u32 len;
681: struct ieee80211_tx_rate_control txrc;
682: struct ieee80211_sta_rates *ratetbl = NULL;
683: bool encap = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
684: bool assoc = false;
685:
686: memset(&txrc, 0, sizeof(txrc));
687:
688: if (info->band < NUM_NL80211_BANDS)
689: sband = tx->local->hw.wiphy->bands[info->band];
690: else
691: return TX_CONTINUE;
692:
693: len = min_t(u32, tx->skb->len + FCS_LEN,
694: tx->local->hw.wiphy->frag_threshold);
695:
696: /* set up the tx rate control struct we give the RC algo */
697: txrc.hw = &tx->local->hw;
698: txrc.sband = sband;
699: txrc.bss_conf = &tx->sdata->vif.bss_conf;
700: txrc.skb = tx->skb;
701: txrc.reported_rate.idx = -1;
702:
703: if (unlikely(info->control.flags & IEEE80211_TX_CTRL_DONT_USE_RATE_MASK)) {
704: txrc.rate_idx_mask = ~0;
705: } else {
706: txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band];
707:
708: if (tx->sdata->rc_has_mcs_mask[info->band])
709: txrc.rate_idx_mcs_mask =
710: tx->sdata->rc_rateidx_mcs_mask[info->band];
711: }
712:
713: txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
714: tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
715: tx->sdata->vif.type == NL80211_IFTYPE_ADHOC ||
716: tx->sdata->vif.type == NL80211_IFTYPE_OCB);
717:
718: /* set up RTS protection if desired */
719: if (len > tx->local->hw.wiphy->rts_threshold) {
720: txrc.rts = true;
721: }
722:
723: info->control.use_rts = txrc.rts;
724: info->control.use_cts_prot = tx->sdata->vif.bss_conf.use_cts_prot;
725:
726: /*
727: * Use short preamble if the BSS can handle it, but not for
728: * management frames unless we know the receiver can handle
729: * that -- the management frame might be to a station that
730: * just wants a probe response.
731: */
732: if (tx->sdata->vif.bss_conf.use_short_preamble &&
733: (ieee80211_is_tx_data(tx->skb) ||
734: (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE))))
735: txrc.short_preamble = true;
736:
737: info->control.short_preamble = txrc.short_preamble;
738:
739: /* don't ask rate control when rate already injected via radiotap */
740: if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
741: return TX_CONTINUE;
742:
743: if (tx->sta)
744: assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
745:
746: /*
747: * Lets not bother rate control if we're associated and cannot
748: * talk to the sta. This should not happen.
749: */
750: if (WARN(test_bit(SCAN_SW_SCANNING, &tx->local->scanning) && assoc &&
751: !rate_usable_index_exists(sband, &tx->sta->sta),
752: "%s: Dropped data frame as no usable bitrate found while "
753: "scanning and associated. Target station: "
754: "%pM on %d GHz band\n",
755: tx->sdata->name,
756: encap ? ((struct ethhdr *)hdr)->h_dest : hdr->addr1,
757: info->band ? 5 : 2))
758: return TX_DROP;
759:
760: /*
761: * If we're associated with the sta at this point we know we can at
762: * least send the frame at the lowest bit rate.
763: */
764: rate_control_get_rate(tx->sdata, tx->sta, &txrc);
765:
766: if (tx->sta && !info->control.skip_table)
767: ratetbl = rcu_dereference(tx->sta->sta.rates);
768:
769: if (unlikely(info->control.rates[0].idx < 0)) {
770: if (ratetbl) {
771: struct ieee80211_tx_rate rate = {
772: .idx = ratetbl->rate[0].idx,
773: .flags = ratetbl->rate[0].flags,
774: .count = ratetbl->rate[0].count
775: };
776:
777: if (ratetbl->rate[0].idx < 0)
778: return TX_DROP;
779:
780: tx->rate = rate;
781: } else {
782: return TX_DROP;
783: }
784: } else {
785: tx->rate = info->control.rates[0];
786: }
787:
788: if (txrc.reported_rate.idx < 0) {
789: txrc.reported_rate = tx->rate;
790: if (tx->sta && ieee80211_is_tx_data(tx->skb))
791: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
792: } else if (tx->sta)
793: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
794:
795: if (ratetbl)
796: return TX_CONTINUE;
797:
798: if (unlikely(!info->control.rates[0].count))
799: info->control.rates[0].count = 1;
800:
801: if (WARN_ON_ONCE((info->control.rates[0].count > 1) &&
802: (info->flags & IEEE80211_TX_CTL_NO_ACK)))
803: info->control.rates[0].count = 1;
804:
805: return TX_CONTINUE;
806: }
SourceFile:net/mac80211/tx.c]
|
| 53/2 |
2026/09/07 07:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 65079
output: 33
thoughts: 68
Thoughts: **My Thought Process Regarding IEEE 802.11 Transmission Rate Control**
I've been diving into the intricacies of the IEEE 802.11 transmission process, specifically focusing on how the system determines the optimal transmission rate. My initial thought was that the `ieee80211_tx_h_rate_ctrl` function directly initiates the rate control mechanism by calling `rate_control_get_rate`. This seemed like a straightforward, linear flow of control within the transmission pipeline.
However, my expertise in this domain prompts me to rigorously verify such assumptions. A quick check of the call stack or relevant code paths revealed a potential point of confusion. I needed to confirm whether `ieee80211_tx_h_rate_ctrl` is indeed the *direct* caller of `rate_control_get_rate`, or if it's invoked *from* another function. My hypothesis, which I'm now in the process of validating, is that `ieee80211_tx_h_rate_ctrl` might be called by `invoke_tx_handlers_early`. This distinction is critical; it means that the rate control logic might be integrated earlier in the overall transmission handler invocation sequence than I initially assumed. This level of detail is crucial for understanding the precise timing and context in which rate decisions are made, which can have significant implications for performance and stability. I'm currently scrutinizing the code to definitively establish this call relationship.
|
| 54/2 |
2026/09/07 07:12 |
tool |
codesearch-find-references |
0m
Args: map[Name:ieee80211_tx_h_rate_ctrl]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ieee80211_tx_dequeue SourceFile:net/mac80211/tx.c SourceLine:3983] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ieee80211_xmit_fast_finish SourceFile:net/mac80211/tx.c SourceLine:3632] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:invoke_tx_handlers_late SourceFile:net/mac80211/tx.c SourceLine:1866]] TruncatedOutput:false]
|
| 55/2 |
2026/09/07 07:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 65316
output: 43
thoughts: 718
Thoughts: **My Journey Through the IEEE 802.11 Transmission Control Flow**
As I delve into the intricacies of the IEEE 802.11 driver, I'm piecing together the transmission control flow, and a few key observations are shaping my understanding of a potential bug.
Initially, I traced the path from `invoke_tx_handlers_late`, which I noted directly calls `ieee80211_tx_h_rate_ctrl`. My next step was to follow the call chain leading to `invoke_tx_handlers_late`. I found that `ieee80211_tx` is indeed the function responsible for invoking `invoke_tx_handlers_late`. This establishes a clear sequence: `ieee80211_tx` -> `invoke_tx_handlers_late` -> `ieee80211_tx_h_rate_ctrl`.
However, I then examined the `ieee80211_monitor_start_xmit` function, and here's where things took a slight turn. I realized that `ieee80211_monitor_start_xmit` *doesn't* directly call `ieee80211_tx`. Instead, it calls `ieee80211_xmit`. This was an important distinction.
My next thought was to investigate `ieee80211_xmit` more closely. I double-checked its implementation and confirmed that, yes, `ieee80211_xmit` *does* call `ieee80211_tx`. This connects the monitor path back to the main transmission path: `ieee80211_monitor_start_xmit` -> `ieee80211_xmit` -> `ieee80211_tx`.
Now, with the established flow `ieee80211_tx` -> `invoke_tx_handlers_late` -> `ieee80211_tx_h_rate_ctrl`, I focused on what `ieee80211_tx_h_rate_ctrl` actually does. I saw a critical conditional check:
```c
/* don't ask rate control when rate already injected via radiotap */
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
This tells me that if the `IEEE80211_TX_CTRL_RATE_INJECT` flag is set in the `info->control.flags`, the function immediately returns `TX_CONTINUE`, effectively skipping the rate control mechanism.
This is where my attention was drawn to the bug I'm investigating. I recalled that in our specific bug scenario, the `IEEE80211_TX_CTRL_RATE_INJECT` flag was actually *cleared* by `ieee80211_parse_tx_radiotap`. The logic there is:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This means that if the rate index is negative, the `IEEE80211_TX_CTRL_RATE_INJECT` flag is explicitly unset. Consequently, the condition in `ieee80211_tx_h_rate_ctrl` (`info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT`) evaluates to false.
Because the `IEEE80211_TX_CTRL_RATE_INJECT` flag is *not* set, `ieee80211_tx_h_rate_ctrl` proceeds to call `rate_control_get_rate(tx->sdata, tx->sta, &txrc)`. Now I need to understand what `rate_control_get_rate` does. I observed its initial loop:
```c
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
info->control.rates[i].idx = -1;
info->control.rates[i].flags = 0;
info->control.rates[i].count = 0;
}
```
This loop seems to be clearing out any existing rate information. Following that, it checks:
```c
if (rate_control_send_low(sta ? &sta->sta : NULL, txrc))
return;
```
This `if` statement implies that if `rate_control_send_low` returns `true`, the function will return, meaning the rate control has been successfully handled. This leads me to my next crucial investigation: the behavior of `rate_control_send_low`.
|
| 56/2 |
2026/09/07 07:12 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/rate.c Name:rate_control_send_low]
Results: map[SourceCode: 414: static bool rate_control_send_low(struct ieee80211_sta *pubsta,
415: struct ieee80211_tx_rate_control *txrc)
416: {
417: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
418: struct ieee80211_supported_band *sband = txrc->sband;
419: struct sta_info *sta;
420: int mcast_rate;
421: bool use_basicrate = false;
422:
423: if (!sband)
424: return false;
425:
426: if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
427: __rate_control_send_low(txrc->hw, sband, pubsta, info,
428: txrc->rate_idx_mask);
429:
430: if (!pubsta && txrc->bss) {
431: mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
432: if (mcast_rate > 0) {
433: info->control.rates[0].idx = mcast_rate - 1;
434: return true;
435: }
436: use_basicrate = true;
437: } else if (pubsta) {
438: sta = container_of(pubsta, struct sta_info, sta);
439: if (ieee80211_vif_is_mesh(&sta->sdata->vif))
440: use_basicrate = true;
441: }
442:
443: if (use_basicrate)
444: rc_send_low_basicrate(&info->control.rates[0],
445: txrc->bss_conf->basic_rates,
446: sband);
447:
448: return true;
449: }
450: return false;
451: }
SourceFile:net/mac80211/rate.c]
|
| 57/2 |
2026/09/07 07:12 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 66720
output: 48
thoughts: 867
Thoughts: **Unraveling a Tricky `idx` Behavior in IEEE 802.11 Transmission**
My initial observation was that `rate_control_send_low` returns `true` if `!pubsta`. I then noticed that in `ieee80211_monitor_start_xmit`, `ieee80211_xmit` is called with `sta = NULL`. This means `pubsta` is indeed `NULL`. Consequently, `rate_control_send_low` calls `__rate_control_send_low`, which, as expected, sets `info->control.rates[0].idx = 0` and then returns `true`.
This `true` return value from `rate_control_send_low` immediately causes `rate_control_get_rate` to return, and importantly, the `idx` remains at `0`.
Now, let's look at `ieee80211_tx_h_rate_ctrl`. It has a conditional check: `if (unlikely(info->control.rates[0].idx < 0))`. Since `idx` is `0` and not less than `0`, the `else` block is executed: `tx.rate = info->control.rates[0];`. And again, `idx` is `0`. This confirms that `idx` is *not* `-1`.
This leads me to a point of confusion: if `idx` is `0`, why is the `mac80211_hwsim_write_tsf` function triggering a warning about `idx < 0`? This discrepancy is what I'm currently digging into.
Let me re-examine `ieee80211_monitor_start_xmit` more closely. The comments indicate it processes the radiotap header to set injection rates and retransmissions, which is crucial for monitoring. After parsing, it removes the radiotap header with `skb_pull(skb, len_rthdr);` and then calls `ieee80211_xmit(sdata, NULL, skb);`.
Here's another crucial realization: `ieee80211_xmit` internally calls `ieee80211_tx`. And `ieee80211_tx`, in turn, calls `ieee80211_tx_prepare`. Within `ieee80211_tx_prepare`, there's a check:
```c
if (unlikely(res_prepare == TX_DROP)) {
ieee80211_free_txskb(&local->hw, skb);
tx.sdata->tx_handlers_drop++;
return true;
} else if (unlikely(res_prepare == TX_QUEUED)) {
return true;
}
```
If `res_prepare` is `TX_QUEUED`, `ieee80211_tx_prepare` returns `true`. Following this, `ieee80211_tx_prepare` invokes `invoke_tx_handlers_early`.
Then, `ieee80211_tx` calls `ieee80211_queue_skb`. The critical part here is:
```c
if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
return true;
```
If `ieee80211_queue_skb` successfully queues the `skb` (returning `true`), then `ieee80211_tx` also returns `true`. This means that `invoke_tx_handlers_late` is *not* called when the `skb` is queued.
My current focus is on understanding the exact behavior of `ieee80211_queue_skb` and how it interacts with the subsequent steps, particularly in light of the unexpected `idx < 0` warning I'm observing elsewhere. I need to trace the flow more precisely to reconcile these observations.
|
| 58/2 |
2026/09/07 07:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_queue_skb]
Results: map[SourceCode:1658: static bool ieee80211_queue_skb(struct ieee80211_local *local,
1659: struct ieee80211_sub_if_data *sdata,
1660: struct sta_info *sta,
1661: struct sk_buff *skb)
1662: {
1663: struct ieee80211_vif *vif;
1664: struct txq_info *txqi;
1665:
1666: if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
1667: return false;
1668:
1669: if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
1670: sdata = container_of(sdata->bss,
1671: struct ieee80211_sub_if_data, u.ap);
1672:
1673: vif = &sdata->vif;
1674: txqi = ieee80211_get_txq(local, vif, sta, skb);
1675:
1676: if (!txqi)
1677: return false;
1678:
1679: ieee80211_txq_enqueue(local, txqi, skb);
1680:
1681: schedule_and_wake_txq(local, txqi);
1682:
1683: return true;
1684: }
SourceFile:net/mac80211/tx.c]
|
| 59/2 |
2026/09/07 07:13 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 68090
output: 47
thoughts: 939
Thoughts: **The Curious Case of the Missing Rate Index in Monitor Mode Transmissions**
My journey began by noticing an interesting behavior: `ieee80211_queue_skb` returns `false` specifically when the interface type is `NL80211_IFTYPE_MONITOR`. This immediately told me that for monitor interfaces, the packet transmission path would deviate. Following this, `ieee80211_tx` proceeds to call `invoke_tx_handlers_late`, which in turn invokes `ieee80211_tx_h_rate_ctrl`. My expectation was that `ieee80211_tx_h_rate_ctrl` would populate the `idx` field, which is crucial for selecting the correct transmission rate.
However, my debugging revealed a perplexing situation: `idx` was reported as `-1` within `mac80211_hwsim_tx_frame_no_nl`. This contradicted my understanding of `ieee80211_tx_h_rate_ctrl`'s purpose. This led me back to carefully re-examine the logic within `ieee80211_tx_h_rate_ctrl`.
I discovered a critical condition: `if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)`. If this flag is set, `ieee80211_tx_h_rate_ctrl` immediately returns `TX_CONTINUE` and *does not* attempt to populate `idx`. This was a significant clue.
Now, I needed to understand how `IEEE80211_TX_CTRL_RATE_INJECT` gets set. My investigation led me to `ieee80211_parse_tx_radiotap`. Here, I found that if a rate is successfully parsed from the radiotap header (`rate_found` is true), this flag is set. More importantly, the logic within `ieee80211_parse_tx_radiotap` dictates the fate of `idx` and the `IEEE80211_TX_CTRL_RATE_INJECT` flag:
* If the parsed rate is **valid**, `idx` is set to that valid index, and `IEEE80211_TX_CTRL_RATE_INJECT` *remains set*.
* If the parsed rate is **INVALID**, `idx` is set to `-1`, and crucially, `IEEE80211_TX_CTRL_RATE_INJECT` is *cleared*.
This then explained why, if `IEEE80211_TX_CTRL_RATE_INJECT` is cleared (due to an invalid rate), `ieee80211_tx_h_rate_ctrl` *does* proceed to call `rate_control_get_rate`, which should then set `idx` to `0`. So, if the flag is cleared, `idx` should logically be `0`, not `-1`.
My thought process then shifted to considering edge cases, particularly the scenario where `rate_flags & IEEE80211_TX_RC_MCS` is true. In this case, `ieee80211_tx_h_rate_ctrl` directly sets `info->control.rates[0].idx = rate`. My concern was that `rate` here is a `u16` from radiotap. If `rate` were, for example, `128`, then `idx` would be `128`. However, I then recalled that `idx` is an `s8`. This brought me to a crucial realization: the type of `idx` is `s8` within `struct ieee80211_tx_rate`.
This final observation, about the `s8` type for `idx`, is the piece that I need to fully reconcile. If `IEEE80211_TX_CTRL_RATE_INJECT` is *not* set and `ieee80211_tx_h_rate_ctrl` *does* call `rate_control_get_rate`, `idx` should be `0`. If `IEEE80211_TX_CTRL_RATE_INJECT` *is* set, then `idx` is populated by `ieee80211_parse_tx_radiotap`. If the rate was valid, `idx` would be a non-negative `s8`. If the rate was invalid, `idx` would be `-1`, and the flag cleared. The only remaining mystery is how `idx` can end up as `-1` in `mac80211_hwsim_tx_frame_no_nl` if `IEEE80211_TX_CTRL_RATE_INJECT` is cleared and `rate_control_get_rate` *should* set it to `0`, or if the flag is set and the rate was valid. The `s8` type for `idx` is critical here; perhaps an overflow or specific interpretation of a `u16` radiotap rate when cast to `s8` is occurring, leading to the `-1` result under certain specific, unhandled rate conditions within the monitor context.
|
| 60/2 |
2026/09/07 07:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/net/mac80211.h Name:ieee80211_tx_rate]
Results: map[SourceCode:1245: /**
1246: * struct ieee80211_tx_rate - rate selection/status
1247: *
1248: * @idx: rate index to attempt to send with
1249: * @flags: rate control flags (&enum mac80211_rate_control_flags)
1250: * @count: number of tries in this rate before going to the next rate
1251: *
1252: * A value of -1 for @idx indicates an invalid rate and, if used
1253: * in an array of retry rates, that no more rates should be tried.
1254: *
1255: * When used for transmit status reporting, the driver should
1256: * always report the rate along with the flags it used.
1257: *
1258: * &struct ieee80211_tx_info contains an array of these structs
1259: * in the control information, and it will be filled by the rate
1260: * control algorithm according to what should be sent. For example,
1261: * if this array contains, in the format { <idx>, <count> } the
1262: * information::
1263: *
1264: * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
1265: *
1266: * then this means that the frame should be transmitted
1267: * up to twice at rate 3, up to twice at rate 2, and up to four
1268: * times at rate 1 if it doesn't get acknowledged. Say it gets
1269: * acknowledged by the peer after the fifth attempt, the status
1270: * information should then contain::
1271: *
1272: * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
1273: *
1274: * since it was transmitted twice at rate 3, twice at rate 2
1275: * and once at rate 1 after which we received an acknowledgement.
1276: */
1277: struct ieee80211_tx_rate {
1278: s8 idx;
1279: u16 count:5,
1280: flags:11;
1281: } __packed;
SourceFile:include/net/mac80211.h]
|
| 61/2 |
2026/09/07 07:13 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 69749
output: 50
thoughts: 309
Thoughts: **A Deep Dive into Rate Control Logic and Potential Discrepancies**
My current line of inquiry is focused on a specific aspect of rate control logic, and I've stumbled upon what appears to be a critical discrepancy or a misunderstanding on my part that I need to meticulously unravel. It began with my observation that the `idx` variable is of type `s8`. This is a foundational piece of information, as it immediately brings signed integer arithmetic into play.
The crux of my confusion arose when I considered the scenario where `rate` is equal to 128. My initial thought process, based on typical signed integer behavior, led me to believe that in this case, `idx` would become `-128`. I re-verified this thought, confirming: "Wait, if `rate` is 128, `idx` is `-128`." This is a straightforward interpretation of signed 8-bit representation where 128 might wrap around to its negative equivalent.
Following this, I evaluated the conditional statement `info->control.rates[0].idx < 0`. If `idx` is indeed `-128`, then this condition evaluates to TRUE. And this is where the chain of events becomes particularly interesting. My analysis indicates that if this condition is TRUE, the `IEEE80211_TX_CTRL_RATE_INJECT` flag is cleared. This clearing action then triggers a subsequent call to `rate_control_get_rate`.
The critical outcome of this `rate_control_get_rate` call, as I understand it, is that it sets `idx` to 0. This is the point of divergence. If `idx` started at `-128` and subsequently becomes 0, then my initial conclusion that `idx` *should* be `-128` or `-1` is, in fact, incorrect. The correct expectation, based on this sequence of operations, is that `idx` should ultimately resolve to 0. I've articulated this revised understanding by noting: "So `idx` should be 0, not `-128` or `-1`."
However, my thought process didn't stop there. I recognized that this path might not be the only one, and the presence of VHT (Very High Throughput) modes introduces further complexity. I posed the question: "Wait, what if `rate_flags & IEEE80211_TX_RC_VHT_MCS` is true?" This prompts me to examine the code block associated with VHT MCS.
The provided snippet shows a conditional branch for `IEEE80211_TX_RC_VHT_MCS`:
```c
} else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
/* reset antennas if not enough */
if (vht_nss > hweight8(info->control.antennas))
info->control.antennas = 0;
ieee80211_rate_set_vht(info->control.rates, vht_mcs,
vht_nss);
```
This naturally leads me to investigate the `ieee80211_rate_set_vht` function itself. My next logical step is to scrutinize its internal workings to understand how it influences `idx` (or related rate control parameters) when VHT MCS is involved, as this could present an alternative or concurrent mechanism for setting the rate index. "Let's check `ieee80211_rate_set_vht`." This is the point where my current exploration stands, poised to delve into the specifics of VHT rate setting.
|
| 62/2 |
2026/09/07 07:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/net/mac80211.h Name:ieee80211_rate_set_vht]
Results: map[SourceCode:1290: static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
1291: u8 mcs, u8 nss)
1292: {
1293: WARN_ON(mcs & ~0xF);
1294: WARN_ON((nss - 1) & ~0x7);
1295: rate->idx = ((nss - 1) << 4) | mcs;
1296: }
SourceFile:include/net/mac80211.h]
|
| 63/2 |
2026/09/07 07:13 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 70263
output: 43
thoughts: 1134
Thoughts: **My Thought Process Regarding Rate Control and Index Handling in `mac80211_hwsim`**
Okay, let's walk through my reasoning on this. I'm trying to understand how the `idx` value for transmission rates is determined and whether it can ever be negative when it's expected to be non-negative, specifically in the context of `mac80211_hwsim`.
My initial exploration started with a specific calculation: if `nss` is 8, then `nss - 1` is 7. When this is left-shifted by 4 (`7 << 4`), I get 112. I also know that `mcs` can be up to 11. Performing a bitwise OR operation (`112 | 11`) results in 123. I then confirmed that this value, 123, fits within an `s8` data type, which has a maximum value of 127. This seemed straightforward initially.
However, I immediately started questioning this. What if `nss` was 9? This brought to mind a specific check within `ieee80211_parse_tx_radiotap`: `vht_nss` is capped at 8. The code snippet `vht_nss = iterator.this_arg[4] & 0xF; if (!vht_nss || vht_nss > 8) vht_nss = 1;` clearly indicates that `vht_nss` will never exceed 8. This reinforces that my previous calculation with `nss=8` was already at the upper bound of what's effectively used, and the resulting `idx` (which I calculated as 123) is always non-negative because `vht_nss` is always at least 1.
Then, I shifted my focus to the case where `rate_flags` is 0, indicating a legacy rate. I looked at the loop:
```c
} else if (sband) {
for (i = 0; i < sband->n_bitrates; i++) {
if (rate * 5 != sband->bitrates[i].bitrate)
continue;
info->control.rates[0].idx = i;
break;
}
}
```
My immediate concern here was: what happens if the `rate` is *not found* within `sband->bitrates`? In that scenario, the loop would complete without `info->control.rates[0].idx` being assigned a value within the loop. This means `idx` would remain at its initial value, which, critically, could be `-1`. If `idx` is `-1`, then the condition `info->control.rates[0].idx < 0` becomes TRUE. This leads to `IEEE80211_TX_CTRL_RATE_INJECT` being cleared. Consequently, `rate_control_get_rate` is called, and this function sets `idx` to 0. So, even if it starts as `-1`, it's corrected to 0. This seems like a robustness mechanism.
This led me to a more direct question: why would `idx` ever be less than 0 *within* `mac80211_hwsim_write_tsf`? I re-examined `mac80211_hwsim_write_tsf` and traced the call to `mac80211_hwsim_get_tx_rate`.
```c
txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
```
And `mac80211_hwsim_get_tx_rate` contains this logic:
```c
if (info->control.rates[0].flags &
(IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
return NULL;
return ieee80211_get_tx_rate(hw, info);
```
Crucially, the `ieee80211_get_tx_rate` function itself has a check: `WARN_ON_ONCE(c->control.rates[0].idx < 0)`. This `WARN_ON_ONCE` is a strong indicator that `idx < 0` is considered an error state and should ideally not occur.
My next line of inquiry was to ensure `rate_control_get_rate` is *always* called when it should be. I looked at `ieee80211_tx_h_rate_ctrl` (the rate control handler). It has this important conditional:
```c
/* don't ask rate control when rate already injected via radiotap */
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
This means if `IEEE80211_TX_CTRL_RATE_INJECT` is set, the rate control logic is bypassed, and we don't call `rate_control_get_rate`. This leads to a new concern: could `IEEE80211_TX_CTRL_RATE_INJECT` be set *while* `idx` is still negative?
I revisited `ieee80211_parse_tx_radiotap` again to see how `IEEE80211_TX_CTRL_RATE_INJECT` is managed. I found this:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This line is critical. It *clears* the `IEEE80211_TX_CTRL_RATE_INJECT` flag if `idx` is found to be less than 0. This directly addresses my concern. Therefore, if `IEEE80211_TX_CTRL_RATE_INJECT` is set, it *must* mean that `idx` is greater than or equal to 0.
Finally, I considered the scenario where `rate_found` (presumably from the legacy rate lookup) is false. In this case, `IEEE80211_TX_CTRL_RATE_INJECT` would *not* be set. This would then cause `ieee80211_tx_h_rate_ctrl` to proceed and call `rate_control_get_rate`. As we've seen, `rate_control_get_rate` explicitly sets `idx = 0` in such fallback scenarios. Thus, `idx` should end up as 0.
My last remaining question was about the execution flow: is `ieee80211_tx_h_rate_ctrl` *always* invoked when it needs to be? My current understanding is that it's called from `invoke_tx_handlers_late`. I would need to examine the `invoke_tx_handlers_late` function to confirm the full call chain and ensure there are no other paths that might bypass the rate control logic in unexpected ways. This is where my current thought process is paused, pending further investigation into that specific function.
|
| 64/2 |
2026/09/07 07:14 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:invoke_tx_handlers_late]
Results: map[SourceCode:1856: /*
1857: * Late handlers can be called while the sta lock is held. Handlers that can
1858: * cause packets to be generated will cause deadlock!
1859: */
1860: static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx)
1861: {
1862: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
1863: ieee80211_tx_result res = TX_CONTINUE;
1864:
1865: if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1866: CALL_TXH(ieee80211_tx_h_rate_ctrl);
1867:
1868: if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) {
1869: __skb_queue_tail(&tx->skbs, tx->skb);
1870: tx->skb = NULL;
1871: goto txh_done;
1872: }
1873:
1874: CALL_TXH(ieee80211_tx_h_michael_mic_add);
1875: CALL_TXH(ieee80211_tx_h_sequence);
1876: CALL_TXH(ieee80211_tx_h_fragment);
1877: /* handlers after fragment must be aware of tx info fragmentation! */
1878: CALL_TXH(ieee80211_tx_h_stats);
1879: CALL_TXH(ieee80211_tx_h_encrypt);
1880: if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1881: CALL_TXH(ieee80211_tx_h_calculate_duration);
1882: #undef CALL_TXH
1883:
1884: txh_done:
1885: if (unlikely(res == TX_DROP)) {
1886: tx->sdata->tx_handlers_drop++;
1887: if (tx->skb)
1888: ieee80211_free_txskb(&tx->local->hw, tx->skb);
1889: else
1890: ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs);
1891: return -1;
1892: } else if (unlikely(res == TX_QUEUED)) {
1893: I802_DEBUG_INC(tx->local->tx_handlers_queued);
1894: return -1;
1895: }
1896:
1897: return 0;
1898: }
SourceFile:net/mac80211/tx.c]
|
| 65/2 |
2026/09/07 07:14 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 72267
output: 50
thoughts: 350
Thoughts: **My Thought Process Regarding `ieee80211_tx` Flow**
Okay, I'm digging into the `ieee80211_tx` path, and I just had a realization about the `invoke_tx_handlers_late` function. My initial thought was that it *only* calls `ieee80211_tx_h_rate_ctrl` if `HAS_RATE_CONTROL` is *not* set on the hardware. That's because the condition is `!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)`.
Then I remembered that `mac80211_hwsim`, which is what I'm dealing with, *doesn't* set `HAS_RATE_CONTROL` by default, unless MLO or NAN_DATA is involved. This means my initial assumption leads me to believe that `ieee80211_tx_h_rate_ctrl` *is* actually called in my scenario.
However, my focus then shifted to whether `invoke_tx_handlers_late` is *always* called. Re-examining the `ieee80211_tx` function, I see this:
```c
if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
return true;
if (!invoke_tx_handlers_late(&tx))
result = __ieee80211_tx(local, &tx.skbs, tx.sta, txpending);
```
This structure is crucial. If `ieee80211_queue_skb` returns `true`, it means the SKB was successfully queued. And if that happens, the `invoke_tx_handlers_late` function is *not* invoked at all.
So, my next immediate question is: if the SKB gets queued by `ieee80211_queue_skb`, when will it actually be dequeued and processed? I need to trace that path. My current suspicion is that it's handled by a deferred mechanism, like `ieee80211_tx_pending_tasklet` or something similar. I'm going to dive into that function next to understand the full lifecycle.
|
| 66/2 |
2026/09/07 07:14 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_pending_tasklet]
Results: map[SourceCode: SourceFile:]
|
| 67/2 |
2026/09/07 07:14 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 72672
output: 47
thoughts: 17
Thoughts: **My Thought Process Regarding `ieee80211_tx_dequeue`**
Alright, my immediate instinct here is to dive into `ieee80211_tx_dequeue`. I need to understand precisely how this function operates. My primary concern is to get a grip on its role in the overall transmission pipeline. I'm particularly interested in its mechanism for extracting data packets from the queue. What criteria does it use for selection? Is it a simple FIFO, or are there more sophisticated prioritization schemes at play? I also need to ascertain the state management involved – what happens to a packet after it's dequeued? Is it marked as transmitted, or are there further processing steps it must undergo? Understanding the interdependencies between `ieee80211_tx_dequeue` and other components, such as the data source and the actual transmission hardware, is crucial. I'll be looking for any potential bottlenecks or race conditions that might arise from its operation. Essentially, I'm aiming for a comprehensive grasp of the data flow and lifecycle of a packet as managed by this specific function.
|
| 68/2 |
2026/09/07 07:14 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_dequeue]
Results: map[SourceCode:3880: struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
3881: struct ieee80211_txq *txq)
3882: {
3883: struct ieee80211_local *local = hw_to_local(hw);
3884: struct txq_info *txqi = container_of(txq, struct txq_info, txq);
3885: struct ieee80211_hdr *hdr;
3886: struct sk_buff *skb = NULL;
3887: struct fq *fq = &local->fq;
3888: struct fq_tin *tin = &txqi->tin;
3889: struct ieee80211_tx_info *info;
3890: struct ieee80211_tx_data tx;
3891: ieee80211_tx_result r;
3892: struct ieee80211_vif *vif = txq->vif;
3893: int q = vif->hw_queue[txq->ac];
3894: unsigned long flags;
3895: bool q_stopped;
3896:
3897: WARN_ON_ONCE(softirq_count() == 0);
3898:
3899: if (!ieee80211_txq_airtime_check(hw, txq))
3900: return NULL;
3901:
3902: begin:
3903: spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
3904: q_stopped = local->queue_stop_reasons[q];
3905: spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
3906:
3907: if (unlikely(q_stopped)) {
3908: /* mark for waking later */
3909: set_bit(IEEE80211_TXQ_DIRTY, &txqi->flags);
3910: return NULL;
3911: }
3912:
3913: spin_lock_bh(&fq->lock);
3914:
3915: /* Make sure fragments stay together. */
3916: skb = __skb_dequeue(&txqi->frags);
3917: if (unlikely(skb)) {
3918: if (!(IEEE80211_SKB_CB(skb)->control.flags &
3919: IEEE80211_TX_INTCFL_NEED_TXPROCESSING))
3920: goto out;
3921: IEEE80211_SKB_CB(skb)->control.flags &=
3922: ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
3923: } else {
3924: if (unlikely(test_bit(IEEE80211_TXQ_STOP, &txqi->flags)))
3925: goto out;
3926:
3927: skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);
3928: }
3929:
3930: if (!skb)
3931: goto out;
3932:
3933: spin_unlock_bh(&fq->lock);
3934:
3935: hdr = (struct ieee80211_hdr *)skb->data;
3936: info = IEEE80211_SKB_CB(skb);
3937:
3938: memset(&tx, 0, sizeof(tx));
3939: __skb_queue_head_init(&tx.skbs);
3940: tx.local = local;
3941: tx.skb = skb;
3942: tx.sdata = vif_to_sdata(info->control.vif);
3943:
3944: if (txq->sta) {
3945: tx.sta = container_of(txq->sta, struct sta_info, sta);
3946: /*
3947: * Drop unicast frames to unauthorised stations unless they are
3948: * injected frames or EAPOL frames from the local station.
3949: */
3950: if (unlikely(!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
3951: ieee80211_is_data_present(hdr->frame_control) &&
3952: !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
3953: tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
3954: !is_multicast_ether_addr(hdr->addr1) &&
3955: !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
3956: (!(info->control.flags &
3957: IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
3958: !ieee80211_is_our_addr(tx.sdata, hdr->addr2,
3959: NULL)))) {
3960: I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
3961: ieee80211_free_txskb(&local->hw, skb);
3962: goto begin;
3963: }
3964: }
3965:
3966: /*
3967: * The key can be removed while the packet was queued, so need to call
3968: * this here to get the current key.
3969: */
3970: info->control.hw_key = NULL;
3971: r = ieee80211_tx_h_select_key(&tx);
3972: if (r != TX_CONTINUE) {
3973: ieee80211_free_txskb(&local->hw, skb);
3974: goto begin;
3975: }
3976:
3977: if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
3978: info->flags |= (IEEE80211_TX_CTL_AMPDU |
3979: IEEE80211_TX_CTL_DONTFRAG);
3980:
3981: if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
3982: if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
3983: r = ieee80211_tx_h_rate_ctrl(&tx);
3984: if (r != TX_CONTINUE) {
3985: ieee80211_free_txskb(&local->hw, skb);
3986: goto begin;
3987: }
3988: }
3989: goto encap_out;
3990: }
3991:
3992: if (info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) {
3993: struct sta_info *sta = container_of(txq->sta, struct sta_info,
3994: sta);
3995: u8 pn_offs = 0;
3996:
3997: if (tx.key &&
3998: (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV))
3999: pn_offs = ieee80211_hdrlen(hdr->frame_control);
4000:
4001: r = ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs,
4002: tx.key, &tx);
4003: if (r != TX_CONTINUE) {
4004: ieee80211_free_txskb(&local->hw, skb);
4005: goto begin;
4006: }
4007: } else {
4008: if (invoke_tx_handlers_late(&tx))
4009: goto begin;
4010:
4011: skb = __skb_dequeue(&tx.skbs);
4012: info = IEEE80211_SKB_CB(skb);
4013:
4014: if (!skb_queue_empty(&tx.skbs)) {
4015: spin_lock_bh(&fq->lock);
4016: skb_queue_splice_tail(&tx.skbs, &txqi->frags);
4017: spin_unlock_bh(&fq->lock);
4018: }
4019: }
4020:
4021: if (skb_has_frag_list(skb) &&
4022: !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) {
4023: if (skb_linearize(skb)) {
4024: ieee80211_free_txskb(&local->hw, skb);
4025: goto begin;
4026: }
4027: }
4028:
4029: switch (tx.sdata->vif.type) {
4030: case NL80211_IFTYPE_MONITOR:
4031: if ((tx.sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) ||
4032: ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) {
4033: vif = &tx.sdata->vif;
4034: break;
4035: }
4036: tx.sdata = rcu_dereference(local->monitor_sdata);
4037: if (tx.sdata &&
4038: ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) {
4039: vif = &tx.sdata->vif;
4040: info->hw_queue =
4041: vif->hw_queue[skb_get_queue_mapping(skb)];
4042: } else if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) {
4043: ieee80211_free_txskb(&local->hw, skb);
4044: goto begin;
4045: } else {
4046: info->control.vif = NULL;
4047: return skb;
4048: }
4049: break;
4050: case NL80211_IFTYPE_AP_VLAN:
4051: tx.sdata = container_of(tx.sdata->bss,
4052: struct ieee80211_sub_if_data, u.ap);
4053: fallthrough;
4054: default:
4055: vif = &tx.sdata->vif;
4056: break;
4057: }
4058:
4059: encap_out:
4060: info->control.vif = vif;
4061:
4062: if (wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) {
4063: bool ampdu = txq->sta && txq->ac != IEEE80211_AC_VO;
4064: u32 airtime;
4065:
4066: airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta,
4067: skb->len, ampdu);
4068: if (!airtime)
4069: return skb;
4070:
4071: airtime = ieee80211_info_set_tx_time_est(info, airtime);
4072: info->tx_time_mc = !tx.sta;
4073: ieee80211_sta_update_pending_airtime(local, tx.sta, txq->ac,
4074: airtime, false,
4075: info->tx_time_mc);
4076: }
4077:
4078: return skb;
4079:
4080: out:
4081: spin_unlock_bh(&fq->lock);
4082:
4083: return skb;
4084: }
SourceFile:net/mac80211/tx.c]
|
| 69/2 |
2026/09/07 07:14 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 76322
output: 53
thoughts: 5252
Thoughts: **The Curious Case of the Misbehaving TX Rate Index**
My current line of thought is a deep dive into why I'm seeing a warning: `WARN_ON_ONCE(c->control.rates[0].idx < 0)` within `ieee80211_get_tx_rate` when I expect the index to be non-negative. It seems like a simple path, but the execution flow is proving quite intricate.
Initially, I established that `ieee80211_tx_dequeue` does indeed call `invoke_tx_handlers_late`, confirming that `invoke_tx_handlers_late` *is* executed for queued packets. However, for monitor interfaces, `ieee80211_queue_skb` returns `false`. This is a crucial point because if `ieee80211_queue_skb` returns `false`, `ieee80211_tx` directly calls `invoke_tx_handlers_late`. So, even in this scenario, `invoke_tx_handlers_late` is invoked.
My understanding then flowed through the call chain: `invoke_tx_handlers_late` calls `ieee80211_tx_h_rate_ctrl`, which in turn calls `rate_control_get_rate`. `rate_control_get_rate`, in a standard path, sets the index to 0. This led me to question how, then, this index could ever be less than 0 when `mac80211_hwsim_write_tsf` eventually checks it.
I meticulously traced the execution flow:
1. The process begins with `ieee80211_monitor_start_xmit`.
2. `ieee80211_parse_tx_radiotap` is called. This is where things get interesting. It can set `idx = -1` and clear `IEEE80211_TX_CTRL_RATE_INJECT`.
3. `ieee80211_xmit` leads to `ieee80211_tx`.
4. `ieee80211_tx` calls `ieee80211_tx_prepare`, which returns `TX_CONTINUE`.
5. As expected for monitor interfaces, `ieee80211_queue_skb` returns `false`.
6. Consequently, `invoke_tx_handlers_late` is called.
7. `invoke_tx_handlers_late` calls `ieee80211_tx_h_rate_ctrl`.
8. `ieee80211_tx_h_rate_ctrl` checks `info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT`. If this flag is NOT set, it proceeds to call `rate_control_get_rate`.
9. `rate_control_get_rate` internally calls `rate_control_send_low` and then `__rate_control_send_low`.
10. `__rate_control_send_low` appears to set `info->control.rates[0].idx = 0`.
11. `rate_control_send_low` returns `true`, and `rate_control_get_rate` returns.
12. `ieee80211_tx_h_rate_ctrl` then checks `info->control.rates[0].idx < 0`. Since it's 0, this condition is false.
13. The transmission rate (`tx->rate`) is set from `info->control.rates[0]`.
14. `ieee80211_tx_h_rate_ctrl` returns `TX_CONTINUE`.
15. `invoke_tx_handlers_late` returns 0.
16. `__ieee80211_tx` is called, eventually leading to `drv_tx`.
17. `drv_tx` calls `mac80211_hwsim_tx`.
18. `mac80211_hwsim_tx` calls `mac80211_hwsim_tx_frame_no_nl`.
19. `mac80211_hwsim_tx_frame_no_nl` calls `mac80211_hwsim_write_tsf`.
20. `mac80211_hwsim_write_tsf` calls `mac80211_hwsim_get_tx_rate`.
21. `mac80211_hwsim_get_tx_rate` calls `ieee80211_get_tx_rate`.
22. It's at this point that `WARN_ON_ONCE(c->control.rates[0].idx < 0)` is encountered.
My confusion stemmed from the fact that, in the path I was tracing, `idx` seemed to be correctly set to 0 by `rate_control_get_rate`. So, why the warning? I started looking for other scenarios where `idx` could become negative again or where the warning condition was met under different circumstances.
I re-examined `ieee80211_parse_tx_radiotap`. It sets `info->control.rates[0].idx = rate;` if `rate_flags & IEEE80211_TX_RC_MCS`. If `rate` is 128, this indeed makes `idx = -128` (due to `s8` type). Crucially, `ieee80211_parse_tx_radiotap` then checks `if (info->control.rates[0].idx < 0)` and clears `IEEE80211_TX_CTRL_RATE_INJECT` if true. This means that if `idx` is set to a negative value here, the `IEEE80211_TX_CTRL_RATE_INJECT` flag is *cleared*.
Then, I considered the VHT MCS case. If `IEEE80211_TX_RC_VHT_MCS` is set, `ieee80211_rate_set_vht` is called. This function calculates `idx = ((nss - 1) << 4) | mcs`. However, `vht_nss` is capped at 8, so `nss - 1` is at most 7. `7 << 4` is 112. Even with the maximum `mcs` of 11, the resulting `idx` (123) is positive. Therefore, this path does not lead to a negative `idx`, and `IEEE80211_TX_CTRL_RATE_INJECT` is not cleared. In this scenario, `ieee80211_tx_h_rate_ctrl` would see `IEEE80211_TX_CTRL_RATE_INJECT` set and *skip* calling `rate_control_get_rate`. This means `idx` would retain the value set by `ieee80211_rate_set_vht`, which is positive. So this path is also safe.
The puzzle persisted. I then focused on the possibility that `ieee80211_tx_h_rate_ctrl` might *not* be called. This happens if `ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)` is true. This is where the `mac80211_hwsim` configuration becomes critical. If `HAS_RATE_CONTROL` is enabled (which can happen if `param->mlo` is true during radio creation), `ieee80211_tx_h_rate_ctrl` is *skipped* entirely by `invoke_tx_handlers_late`.
This leads to the critical realization: if `HAS_RATE_CONTROL` is set, and `ieee80211_parse_tx_radiotap` sets `idx` to a negative value (e.g., `-128` for MCS 128, or `-1` if a legacy rate isn't found), and then clears `IEEE80211_TX_CTRL_RATE_INJECT`, `ieee80211_tx_h_rate_ctrl` is skipped. The `idx` remains negative. Subsequently, `mac80211_hwsim_tx` is called. If `SUPPORTS_RC_TABLE` is not set (which is typical for `hwsim` without specific configuration), `ieee80211_get_tx_rates` is *not* called to re-populate the rates. The `idx` remains negative. The loop in `mac80211_hwsim_tx` checking for `txi->control.rates[i].idx == -1` might break early, or not break if it's not -1, but the negative `idx` is preserved. Finally, `mac80211_hwsim_tx_frame_no_nl` -> `mac80211_hwsim_write_tsf` -> `mac80211_hwsim_get_tx_rate` -> `ieee80211_get_tx_rate` is called, and the warning `WARN_ON_ONCE(c->control.rates[0].idx < 0)` is triggered because `idx` is still negative.
The key seems to be the combination of `HAS_RATE_CONTROL` being enabled (via `param->mlo`), and `ieee80211_parse_tx_radiotap` setting a negative `idx` where the rate control logic (which would normally correct it to 0) is bypassed. The syzkaller reproducer, I suspect, is setting up `mac80211_hwsim` with `HWSIM_ATTR_MLO` true, thus enabling `HAS_RATE_CONTROL` and triggering this precise problematic path.
|
| 70/2 |
2026/09/07 07:15 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:HWSIM_ATTR_MLO]
Results: map[SourceCode: SourceFile:]
|
| 71/2 |
2026/09/07 07:15 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 81632
output: 53
thoughts: 14
Thoughts: **My Thought Process**
Right, so the first thing that comes to my mind is to verify the details related to `hwsim_new_radio_params`. I need to make sure this specific piece of information is accurate and up-to-date. It's crucial to get the fundamentals right before delving into anything more complex.
|
| 72/2 |
2026/09/07 07:15 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:hwsim_new_radio_params]
Results: map[SourceCode:4378: struct hwsim_new_radio_params {
4379: unsigned int channels;
4380: const char *reg_alpha2;
4381: const struct ieee80211_regdomain *regd;
4382: bool reg_strict;
4383: bool p2p_device;
4384: bool use_chanctx;
4385: bool multi_radio;
4386: bool destroy_on_close;
4387: const char *hwname;
4388: bool no_vif;
4389: const u8 *perm_addr;
4390: u32 iftypes;
4391: u32 *ciphers;
4392: u8 n_ciphers;
4393: bool mlo;
4394: const struct cfg80211_pmsr_capabilities *pmsr_capa;
4395: bool nan_device;
4396: bool background_radar;
4397: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 73/2 |
2026/09/07 07:15 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 82010
output: 53
thoughts: 21
Thoughts: **My Thought Process on `mlo` Parameter Parsing**
Ah, yes, I've just confirmed that `mlo` is indeed a parameter we're dealing with here. My immediate next step is to delve into how this specific parameter is being parsed within the system. Understanding the parsing mechanism is crucial for me to fully grasp its behavior and potential implications. I need to investigate the code or logic responsible for taking the raw input for `mlo` and transforming it into a usable value. This will involve examining the data types, validation rules, and any potential transformations or interpretations that are applied. Without a clear understanding of this parsing process, any further analysis or manipulation of the `mlo` parameter would be built on shaky ground.
|
| 74/2 |
2026/09/07 07:15 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:hwsim_new_radio_nl]
Results: map[SourceCode:6805: static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
6806: {
6807: struct hwsim_new_radio_params param = { 0 };
6808: const char *hwname = NULL;
6809: int ret;
6810:
6811: param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
6812: param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
6813: param.nan_device = info->attrs[HWSIM_ATTR_SUPPORT_NAN_DEVICE];
6814: param.channels = channels;
6815: param.destroy_on_close =
6816: info->attrs[HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE];
6817:
6818: if (info->attrs[HWSIM_ATTR_CHANNELS])
6819: param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]);
6820:
6821: if (param.channels < 1) {
6822: GENL_SET_ERR_MSG(info, "must have at least one channel");
6823: return -EINVAL;
6824: }
6825:
6826: if (info->attrs[HWSIM_ATTR_NO_VIF])
6827: param.no_vif = true;
6828:
6829: if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
6830: param.use_chanctx = true;
6831: else
6832: param.use_chanctx = (param.channels > 1);
6833:
6834: if (info->attrs[HWSIM_ATTR_MULTI_RADIO])
6835: param.multi_radio = true;
6836:
6837: if (info->attrs[HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR])
6838: param.background_radar = true;
6839:
6840: if (info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2])
6841: param.reg_alpha2 =
6842: nla_data(info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]);
6843:
6844: if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
6845: u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
6846:
6847: if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
6848: return -EINVAL;
6849:
6850: idx = array_index_nospec(idx,
6851: ARRAY_SIZE(hwsim_world_regdom_custom));
6852: param.regd = hwsim_world_regdom_custom[idx];
6853: }
6854:
6855: if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
6856: if (!is_valid_ether_addr(
6857: nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
6858: GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
6859: NL_SET_BAD_ATTR(info->extack,
6860: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6861: return -EINVAL;
6862: }
6863:
6864: param.perm_addr = nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]);
6865: }
6866:
6867: if (info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]) {
6868: param.iftypes =
6869: nla_get_u32(info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]);
6870:
6871: if (param.iftypes & ~HWSIM_IFTYPE_SUPPORT_MASK) {
6872: NL_SET_ERR_MSG_ATTR(info->extack,
6873: info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT],
6874: "cannot support more iftypes than kernel");
6875: return -EINVAL;
6876: }
6877: } else {
6878: param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
6879: }
6880:
6881: /* ensure both flag and iftype support is honored */
6882: if (param.p2p_device ||
6883: param.iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
6884: param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
6885: param.p2p_device = true;
6886: }
6887:
6888: if (param.nan_device) {
6889: if (param.multi_radio) {
6890: NL_SET_ERR_MSG(info->extack,
6891: "NAN is not supported on multi-radio wiphys");
6892: return -EINVAL;
6893: }
6894: param.iftypes |= BIT(NL80211_IFTYPE_NAN) |
6895: BIT(NL80211_IFTYPE_NAN_DATA);
6896: }
6897:
6898: if (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]) {
6899: u32 len = nla_len(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6900:
6901: param.ciphers =
6902: nla_data(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6903:
6904: if (len % sizeof(u32)) {
6905: NL_SET_ERR_MSG_ATTR(info->extack,
6906: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6907: "bad cipher list length");
6908: return -EINVAL;
6909: }
6910:
6911: param.n_ciphers = len / sizeof(u32);
6912:
6913: if (param.n_ciphers > ARRAY_SIZE(hwsim_ciphers)) {
6914: NL_SET_ERR_MSG_ATTR(info->extack,
6915: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6916: "too many ciphers specified");
6917: return -EINVAL;
6918: }
6919:
6920: if (!hwsim_known_ciphers(param.ciphers, param.n_ciphers)) {
6921: NL_SET_ERR_MSG_ATTR(info->extack,
6922: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6923: "unsupported ciphers specified");
6924: return -EINVAL;
6925: }
6926: }
6927:
6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
6929:
6930: if (param.mlo || param.multi_radio)
6931: param.use_chanctx = true;
6932:
6933: if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
6934: hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6935: nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6936: GFP_KERNEL);
6937: if (!hwname)
6938: return -ENOMEM;
6939: param.hwname = hwname;
6940: }
6941:
6942: if (info->attrs[HWSIM_ATTR_PMSR_SUPPORT]) {
6943: struct cfg80211_pmsr_capabilities *pmsr_capa;
6944:
6945: pmsr_capa = kzalloc_obj(*pmsr_capa);
6946: if (!pmsr_capa) {
6947: ret = -ENOMEM;
6948: goto out_free;
6949: }
6950: param.pmsr_capa = pmsr_capa;
6951:
6952: ret = parse_pmsr_capa(info->attrs[HWSIM_ATTR_PMSR_SUPPORT], pmsr_capa, info);
6953: if (ret)
6954: goto out_free;
6955: }
6956:
6957: ret = mac80211_hwsim_new_radio(info, ¶m);
6958:
6959: out_free:
6960: kfree(hwname);
6961: kfree(param.pmsr_capa);
6962: return ret;
6963: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 75/2 |
2026/09/07 07:15 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 84772
output: 60
thoughts: 4305
Thoughts: **The Root of the Rate Control Warning in mac80211_hwsim**
I've been digging into a rather persistent warning: `WARN_ON_ONCE(c->control.rates[0].idx < 0)`. My analysis indicates this stems from a specific interaction between how `mac80211_hwsim` handles MLO (Multi-Link Operation) or NAN (Neighbor Awareness Networking) devices, injected frames with invalid radiotap rate information, and the absence of a proper rate control implementation for such scenarios within the simulation driver.
Here's how I see the thought process leading to this bug:
The trigger seems to be the presence of `HWSIM_ATTR_MLO_SUPPORT` (or, as I discovered, `HWSIM_ATTR_SUPPORT_NAN_DEVICE`) when creating a `mac80211_hwsim` radio. This flag, when parsed, correctly sets `param.mlo` (or `param.nan_device`). Consequently, during the radio's initialization via `mac80211_hwsim_new_radio`, the `HAS_RATE_CONTROL` flag is set. This is a crucial step, as it signals to the `mac80211` core that the driver is responsible for rate control.
Now, when a frame is injected, particularly through a monitor interface, and it carries a radiotap header with a rate field that doesn't align with any valid bitrates in the `sband->bitrates` table, `ieee80211_parse_tx_radiotap` diligently sets `idx` to `-1`. Simultaneously, it clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
The problem then starts to cascade. Because `HAS_RATE_CONTROL` is set, the standard `ieee80211_tx_h_rate_ctrl` function is skipped. This is where I'd normally expect rate control logic to potentially re-evaluate or reset the `idx` if it was invalid. However, since it's skipped, `idx` remains at its problematic `-1` value.
Subsequently, `mac80211_hwsim_tx` is invoked. Here's another critical junction: if `SUPPORTS_RC_TABLE` is *false* (which is the case for `mac80211_hwsim` in this context), the `ieee80211_get_tx_rates` function is not called. This function would normally be responsible for determining the actual transmission rates. Without it, `idx` still holds its invalid `-1`.
The execution continues to `mac80211_hwsim_tx_frame_no_nl`, which then calls `mac80211_hwsim_write_tsf`. This, in turn, calls `mac80211_hwsim_get_tx_rate`, which finally calls `ieee80211_get_tx_rate`. It's within `ieee80211_get_tx_rate` that the warning is triggered: `WARN_ON_ONCE(c->control.rates[0].idx < 0)`.
My deeper investigation revealed a potential path that might *not* lead to this warning, and that's if `HWSIM_ATTR_MLO_SUPPORT` is *not* set, but `HWSIM_ATTR_SUPPORT_NAN_DEVICE` *is*. I found that `mac80211_hwsim_new_radio` also sets `HAS_RATE_CONTROL` if `param.nan_device` is true. So, in either of these MLO/NAN-related scenarios, `HAS_RATE_CONTROL` is set, but `SUPPORTS_RC_TABLE` remains unset. This leads to the same core issue: the driver isn't implementing rate control for injected frames, yet `mac80211` expects it to.
I initially thought that for normal frames, `idx` defaulting to 0 (due to `memset(info, 0, sizeof(*info))` in `mac80211_start_xmit`) would make things work. And indeed, that seems to be the case for non-injected frames. The problem is specifically with injected frames where `ieee80211_parse_tx_radiotap` explicitly sets `idx = -1`. Since `ieee80211_tx_h_rate_ctrl` is skipped due to `HAS_RATE_CONTROL`, this `-1` value persists, ultimately causing the `WARN_ON_ONCE`.
My current understanding is that the bug arises because:
1. A `mac80211_hwsim` radio is created with `HWSIM_ATTR_MLO_SUPPORT` or `HWSIM_ATTR_SUPPORT_NAN_DEVICE` enabled.
2. A monitor interface is created on this radio and brought up.
3. A packet is sent via `AF_PACKET` to this monitor interface.
4. The packet's radiotap header includes a rate field with an invalid value.
5. `ieee80211_parse_tx_radiotap` sets `idx` to `-1` and clears `IEEE80211_TX_CTRL_RATE_INJECT`.
6. `ieee80211_tx_h_rate_ctrl` is skipped because `HAS_RATE_CONTROL` is set.
7. `mac80211_hwsim_tx` does not call `ieee80211_get_tx_rates` because `SUPPORTS_RC_TABLE` is false.
8. The invalid `idx` of `-1` propagates through `mac80211_hwsim_tx_frame_no_nl`, `mac80211_hwsim_write_tsf`, `mac80211_hwsim_get_tx_rate`, and finally to `ieee80211_get_tx_rate`, triggering the warning.
The key seems to be that `mac80211_hwsim` doesn't actually implement the rate control it signals it supports via `HAS_RATE_CONTROL` for injected frames when `SUPPORTS_RC_TABLE` is not set, and an invalid rate is provided.
|
| 76/2 |
2026/09/07 07:16 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_select_tx_link]
Results: map[SourceCode:2035: static struct ieee80211_bss_conf *
2036: mac80211_hwsim_select_tx_link(struct mac80211_hwsim_data *data,
2037: struct ieee80211_vif *vif,
2038: struct ieee80211_sta *sta,
2039: struct ieee80211_hdr *hdr,
2040: struct ieee80211_link_sta **link_sta)
2041: {
2042: struct hwsim_sta_priv *sp = (void *)sta->drv_priv;
2043: int i;
2044:
2045: if (!ieee80211_vif_is_mld(vif))
2046: return &vif->bss_conf;
2047:
2048: WARN_ON(is_multicast_ether_addr(hdr->addr1));
2049:
2050: if (WARN_ON_ONCE(!sta || !sta->valid_links))
2051: return &vif->bss_conf;
2052:
2053: for (i = 0; i < ARRAY_SIZE(vif->link_conf); i++) {
2054: struct ieee80211_bss_conf *bss_conf;
2055: unsigned int link_id;
2056:
2057: /* round-robin the available link IDs */
2058: link_id = (sp->last_link + i + 1) % ARRAY_SIZE(vif->link_conf);
2059:
2060: if (!(vif->active_links & BIT(link_id)))
2061: continue;
2062:
2063: if (!(sp->active_links_rx & BIT(link_id)))
2064: continue;
2065:
2066: *link_sta = rcu_dereference(sta->link[link_id]);
2067: if (!*link_sta)
2068: continue;
2069:
2070: bss_conf = rcu_dereference(vif->link_conf[link_id]);
2071: if (WARN_ON_ONCE(!bss_conf))
2072: continue;
2073:
2074: /* can happen while switching links */
2075: if (!rcu_access_pointer(bss_conf->chanctx_conf))
2076: continue;
2077:
2078: sp->last_link = link_id;
2079: return bss_conf;
2080: }
2081:
2082: return NULL;
2083: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 77/2 |
2026/09/07 07:16 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 89939
output: 25
thoughts: 2506
Thoughts: **My Thought Process on Reproducing a mac80211_hwsim TX Bug**
Alright, let's break down how I arrived at the strategy for reproducing this specific bug within the `mac80211_hwsim` module. It's all about tracing the execution path and identifying the precise conditions that lead to the problematic scenario.
My initial focus was on the `mac80211_hwsim_tx` function. I noticed a critical conditional: if `!ieee80211_vif_is_mld(vif)`, it directly returns `&vif->bss_conf`. This immediately raised a flag for monitor interfaces, as `ieee80211_vif_is_mld` would be false for them. Consequently, the function would proceed with `&vif->bss_conf`. The key insight here is that `bss_conf` itself wouldn't be NULL in this case.
The next step in the execution flow was `chanctx_conf = rcu_dereference(bss_conf->chanctx_conf);`. If `chanctx_conf` turned out to be NULL, then `channel` would also be NULL. And here's where the potential for data loss becomes apparent: the `mac80211_hwsim_tx` function has a check:
```c
if (WARN(!channel, "TX w/o channel - queue = %d\n", txi->hw_queue)) {
ieee80211_free_txskb(hw, skb);
return;
}
```
If `channel` is NULL, this warning triggers, and crucially, the frame is dropped. My primary concern then became: "Does a monitor interface *always* have a `chanctx_conf` set?"
I then examined `ieee80211_monitor_start_xmit`. This function attempts to find a `chanctx_conf` in a few ways, including checking `sdata->vif.bss_conf.chanctx_conf` and even iterating through `local->chanctx_list`. It *does* find and use a `chanctx_conf` for radiotap parsing. However, and this is the critical point, it *does not* set `vif->bss_conf.chanctx_conf`.
This means that back in `mac80211_hwsim_tx`, `bss_conf->chanctx_conf` *could* indeed be NULL for a monitor interface. And if it's NULL, as we've seen, `channel` becomes NULL, leading to the frame being dropped without even triggering the warning due to the `WARN` condition itself.
My next question was: "When *is* `monitor_sdata->vif.bss_conf.chanctx_conf` set?" It's set when a monitor interface is explicitly assigned a channel context. If it *is* set, `chanctx_conf` would not be NULL. This implies that to avoid the drop, I would need to assign a channel to the monitor interface, for example, by using `iw dev wlan0 set channel 1`.
This led me to think about alternative ways to achieve the desired state, specifically if there's a way to avoid `use_chanctx` altogether while still ensuring the necessary hardware features are enabled. This is where `HWSIM_ATTR_SUPPORT_NAN_DEVICE` came into play.
If `param.nan_device` is true, then `param.use_chanctx` is generally false (unless `param.channels > 1`). When `param.use_chanctx` is false, `mac80211_hwsim_tx` directly uses `data->channel`, which *is* set, so `channel` is *not* NULL. Furthermore, when `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is used, `HAS_RATE_CONTROL` is set.
The implication of `HAS_RATE_CONTROL` being set is that `ieee80211_tx_h_rate_ctrl` *will* be called. This function, in turn, calls `rate_control_get_rate`. And this is where the bug manifests: `rate_control_get_rate` would attempt to get a rate, and if the radiotap header has an invalid rate field (like `0x01`), it would lead to the `idx` being set to -1.
The original warning in `mac80211_hwsim_tx` about `TX w/o channel` is *not* triggered in this scenario because `channel` is not NULL. Instead, the problem shifts to `mac80211_hwsim_get_tx_rate` when `idx` is -1, which *then* triggers a different warning: `WARN(idx < 0, ...)` that I'm observing.
So, the path forward became clear:
1. **Create a `mac80211_hwsim` radio with `HWSIM_ATTR_SUPPORT_NAN_DEVICE` enabled.** This is crucial for setting `HAS_RATE_CONTROL` without forcing `use_chanctx` to true.
2. **Create a monitor interface on this new wiphy.**
3. **Bring the monitor interface up.**
4. **Open an `AF_PACKET` socket and bind it to the monitor interface.** This is the standard way to capture raw packets.
5. **Send a packet containing a radiotap header with an invalid rate field.** The specific radiotap header I'm targeting is a simple one, 10 bytes long: `0x00, 0x00, 0x0a, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00`. The `0x01` in the rate field is the specific invalid value designed to cause `rate_control_get_rate` to return -1. This is followed by a standard 802.11 data frame header.
The key verification was checking if `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is actually supported for creating the hwsim radio. It is parsed in `hwsim_new_radio_nl`, so that's a valid path.
My final consideration was around kernel versions and the availability of `HWSIM_ATTR_SUPPORT_NAN_DEVICE`. Since the bug was reported on a recent kernel (syzkaller #0 PREEMPT(full)), I could be confident that this attribute would be present. If it weren't, I'd have to fall back to the `use_chanctx = true` scenario and ensure a channel context was assigned to the monitor interface. However, the NAN device approach is significantly cleaner.
Finally, I thought about the practical implementation of creating the hwsim radio. While libnl is convenient, syzkaller often uses raw netlink. Thus, the reproducer would need to construct the netlink messages manually to send the `HWSIM_CMD_NEW_RADIO` command with the appropriate attributes. This involves finding the generic netlink family ID for "mac80211_hwsim" and then crafting the message with the `HWSIM_ATTR_SUPPORT_NAN_DEVICE` attribute set.
|
| 78/2 |
2026/09/07 07:16 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_ATTR_SUPPORT_NAN_DEVICE]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim.h=91=enum hwsim_commands {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-162- * each radio instead of for the wiphy.
drivers/net/wireless/virtual/mac80211_hwsim.h:163: * @HWSIM_ATTR_SUPPORT_NAN_DEVICE: support NAN Device virtual interface (flag)
drivers/net/wireless/virtual/mac80211_hwsim.h-164- * @HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR: background radar/CAC support (flag)
--
drivers/net/wireless/virtual/mac80211_hwsim.h=167=enum hwsim_attrs {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-197- HWSIM_ATTR_MULTI_RADIO,
drivers/net/wireless/virtual/mac80211_hwsim.h:198: HWSIM_ATTR_SUPPORT_NAN_DEVICE,
drivers/net/wireless/virtual/mac80211_hwsim.h-199- HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=865=static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-895- [HWSIM_ATTR_MULTI_RADIO] = { .type = NLA_FLAG },
drivers/net/wireless/virtual/mac80211_hwsim_main.c:896: [HWSIM_ATTR_SUPPORT_NAN_DEVICE] = { .type = NLA_FLAG },
drivers/net/wireless/virtual/mac80211_hwsim_main.c-897- [HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR] = { .type = NLA_FLAG },
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4410=static int append_radio_msg(struct sk_buff *skb, int id,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4477- if (param->nan_device) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4478: ret = nla_put_flag(skb, HWSIM_ATTR_SUPPORT_NAN_DEVICE);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4479- if (ret < 0)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6805=static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6812- param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6813: param.nan_device = info->attrs[HWSIM_ATTR_SUPPORT_NAN_DEVICE];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6814- param.channels = channels;
]
|
| 79/2 |
2026/09/07 07:16 |
llm |
initial-researcher |
0m
Model:
Tokens:
input: 93369
output: 47
thoughts: 21
Thoughts: **My Thought Process for Determining `HWSIM_ATTR_SUPPORT_NAN_DEVICE`'s Value**
As an expert in my field, my immediate thought upon encountering `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is to ascertain its precise numerical value. This isn't just a matter of curiosity; it's about understanding the underlying data structures and the specific bitmask or enumeration constant it represents within the `HWSIM` framework.
My internal process would involve several key steps, driven by the need for absolute accuracy and a deep understanding of the system's architecture.
First, I'd access the relevant source code. My immediate inclination is to look for the definition of this constant. This almost always resides in header files, likely within the `HWSIM` (Hardware Simulation) library's include directories. I'd be searching for a file that defines various attributes, enumerations, or macros related to hardware simulation capabilities. Common file names might include `hwsim.h`, `hwsim_types.h`, `hwsim_attributes.h`, or similar.
Once I've located the header file, I'd perform a targeted search for `HWSIM_ATTR_SUPPORT_NAN_DEVICE`. I would anticipate finding it defined in one of a few ways:
* **As a preprocessor macro:** This is a very common pattern. It would look something like `#define HWSIM_ATTR_SUPPORT_NAN_DEVICE X`, where `X` is the numerical value.
* **As an enumerator within an `enum`:** This is also highly probable. The definition might be part of a larger enumeration of hardware attributes, such as `enum hwsim_attributes { ..., HWSIM_ATTR_SUPPORT_NAN_DEVICE, ... };` or `enum hwsim_attr_flags { ..., HWSIM_ATTR_SUPPORT_NAN_DEVICE = Y, ... };`. If it's just listed without an explicit value, the compiler will assign it an incremental integer, starting from 0 or 1 depending on the enum's context. If it has an explicit value, that's what I'm looking for.
* **As a static const integer:** Less common for this type of attribute, but possible. It would look like `static const int HWSIM_ATTR_SUPPORT_NAN_DEVICE = Z;`.
My goal is to find the *exact* numerical value. If it's a macro, the value is directly provided. If it's an enum, I need to determine if it has an explicit assignment. If it doesn't, I need to understand its position within the enumeration sequence. For example, if it's the third enumerator in a sequence starting at 0, its value would be 2.
Beyond just finding the value, my expert mind would also be considering the *context* of this attribute. The name `SUPPORT_NAN_DEVICE` strongly suggests a flag or capability indicator related to "Not-A-Number" (NaN) values, likely in the context of devices or hardware simulation. This implies that `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is probably a bitmask or a boolean indicator. If it's a bitmask, its value will likely be a power of 2 (e.g., 1, 2, 4, 8, etc.), signifying a specific bit being set. If it's a simpler flag, it might be 0 or 1.
Therefore, my thought process is a directed investigation:
1. **Locate the definition:** Navigate to the source code responsible for `HWSIM` attributes.
2. **Identify the declaration:** Pinpoint the exact line where `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is defined.
3. **Extract the value:** Obtain the explicit numerical representation assigned to it.
4. **Analyze the context:** Understand if it's a simple flag, a bitmask, or part of a larger set of capabilities, which informs how this value is used.
Ultimately, my objective is to retrieve a concrete, verifiable numerical value that accurately reflects the `HWSIM` framework's definition of this specific hardware simulation attribute.
|
| 80/2 |
2026/09/07 07:16 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.h Name:hwsim_attrs]
Results: map[SourceCode: 111: /**
112: * enum hwsim_attrs - hwsim netlink attributes
113: *
114: * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
115: *
116: * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
117: * the frame is broadcasted to
118: * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
119: * the frame was broadcasted from
120: * @HWSIM_ATTR_FRAME: Data array
121: * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
122: * properly the frame at user space
123: * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
124: * space
125: * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
126: * space
127: * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
128: * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
129: * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_NEW_RADIO
130: * command giving the number of channels supported by the new radio
131: * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
132: * only to destroy a radio
133: * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatory driver hint
134: * (nla string, length 2)
135: * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
136: * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
137: * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
138: * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_NEW_RADIO
139: * command to force use of channel contexts even when only a
140: * single channel is supported
141: * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_NEW_RADIO
142: * command to force radio removal when process that created the radio dies
143: * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
144: * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
145: * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
146: * @HWSIM_ATTR_PAD: padding attribute for 64-bit values, ignore
147: * @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
148: * rates of %HWSIM_ATTR_TX_INFO
149: * @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
150: * @HWSIM_ATTR_IFTYPE_SUPPORT: u32 attribute of supported interface types bits
151: * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
153: * the new radio
154: * @HWSIM_ATTR_PMSR_SUPPORT: nested attribute used with %HWSIM_CMD_NEW_RADIO
155: * to provide peer measurement capabilities. (nl80211_peer_measurement_attrs)
156: * @HWSIM_ATTR_PMSR_REQUEST: nested attribute used with %HWSIM_CMD_START_PMSR
157: * to provide details about peer measurement request (nl80211_peer_measurement_attrs)
158: * @HWSIM_ATTR_PMSR_RESULT: nested attributed used with %HWSIM_CMD_REPORT_PMSR
159: * to provide peer measurement result (nl80211_peer_measurement_attrs)
160: * @HWSIM_ATTR_MULTI_RADIO: Register multiple wiphy radios (flag).
161: * Adds one radio for each band. Number of supported channels will be set for
162: * each radio instead of for the wiphy.
163: * @HWSIM_ATTR_SUPPORT_NAN_DEVICE: support NAN Device virtual interface (flag)
164: * @HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR: background radar/CAC support (flag)
165: * @__HWSIM_ATTR_MAX: enum limit
166: */
167: enum hwsim_attrs {
168: HWSIM_ATTR_UNSPEC,
169: HWSIM_ATTR_ADDR_RECEIVER,
170: HWSIM_ATTR_ADDR_TRANSMITTER,
171: HWSIM_ATTR_FRAME,
172: HWSIM_ATTR_FLAGS,
173: HWSIM_ATTR_RX_RATE,
174: HWSIM_ATTR_SIGNAL,
175: HWSIM_ATTR_TX_INFO,
176: HWSIM_ATTR_COOKIE,
177: HWSIM_ATTR_CHANNELS,
178: HWSIM_ATTR_RADIO_ID,
179: HWSIM_ATTR_REG_HINT_ALPHA2,
180: HWSIM_ATTR_REG_CUSTOM_REG,
181: HWSIM_ATTR_REG_STRICT_REG,
182: HWSIM_ATTR_SUPPORT_P2P_DEVICE,
183: HWSIM_ATTR_USE_CHANCTX,
184: HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
185: HWSIM_ATTR_RADIO_NAME,
186: HWSIM_ATTR_NO_VIF,
187: HWSIM_ATTR_FREQ,
188: HWSIM_ATTR_PAD,
189: HWSIM_ATTR_TX_INFO_FLAGS,
190: HWSIM_ATTR_PERM_ADDR,
191: HWSIM_ATTR_IFTYPE_SUPPORT,
192: HWSIM_ATTR_CIPHER_SUPPORT,
193: HWSIM_ATTR_MLO_SUPPORT,
194: HWSIM_ATTR_PMSR_SUPPORT,
195: HWSIM_ATTR_PMSR_REQUEST,
196: HWSIM_ATTR_PMSR_RESULT,
197: HWSIM_ATTR_MULTI_RADIO,
198: HWSIM_ATTR_SUPPORT_NAN_DEVICE,
199: HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR,
200: __HWSIM_ATTR_MAX,
201: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.h]
|
| 81/2 |
2026/09/07 07:16 |
llm |
initial-researcher |
1m
Model:
Tokens:
input: 95418
output: 2572
thoughts: 6101
Thoughts: **Reproducing the mac80211_hwsim Rate Control Warning**
I've been analyzing a subtle bug within the `mac80211_hwsim` module that seems to manifest when specific device capabilities are enabled. My goal is to craft a reliable reproducer for this issue, which appears to be a consequence of how rate control information is handled (or rather, not handled) when certain flags are set during radio creation.
Here's my thought process for developing the reproducer:
1. **Understanding the Core Problem:** The ultimate target is to trigger a `WARN_ON_ONCE(c->control.rates[0].idx < 0)` within the `ieee80211_get_tx_rate` function. This warning implies that a transmit rate index is invalid, specifically less than zero. For this to happen, the `idx` field of the `struct ieee80211_tx_rate` needs to be negative when `ieee80211_get_tx_rate` is called.
2. **Tracing the `idx` Value:** I need to understand how `idx` gets set (or not set) in scenarios leading to this warning.
* The `idx` is typically populated by rate control mechanisms.
* If `mac80211_hwsim` has `HAS_RATE_CONTROL` set, the standard `ieee80211_tx_h_rate_ctrl` function is skipped. This is a critical path to investigate.
* If `HAS_RATE_CONTROL` is set, `mac80211_hwsim` doesn't seem to populate the `rates` array with valid indices itself, leaving `idx` at its default (likely 0 or potentially uninitialized, but the warning implies it can be negative).
3. **Identifying `HAS_RATE_CONTROL` Triggers:** I need to find out which attributes when creating a `mac80211_hwsim` radio will set the `HAS_RATE_CONTROL` flag. My investigation points to two attributes:
* `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (value 30)
* `HWSIM_ATTR_MLO_SUPPORT` (value 25)
4. **Choosing the Right Attribute:** Now I need to evaluate which of these attributes is more suitable for triggering the bug, especially in the context of a monitor interface, which is a common scenario for packet injection testing.
* If `HWSIM_ATTR_MLO_SUPPORT` is used, it forces `param.use_chanctx = true`. When creating a monitor interface with `use_chanctx` true, the `mac80211_hwsim_tx` function checks for a valid channel context. For monitor interfaces, `vif->bss_conf.chanctx_conf` is NULL, and since `use_chanctx` is true, `mac80211_hwsim_tx` will drop the packet before it even reaches the `mac80211_hwsim_tx_frame_no_nl` function where the rate control logic and the subsequent call to `ieee80211_get_tx_rate` occurs. This means `HWSIM_ATTR_MLO_SUPPORT` is not a viable path for monitor interfaces.
* If `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is used, it sets `param.nan_device = true`. Crucially, this *does not* force `param.use_chanctx = true`. Since we're not explicitly setting `HWSIM_ATTR_CHANNELS` to anything other than its default (which implies a single channel), `param.use_chanctx` remains `false`. When `use_chanctx` is false, the `mac80211_hwsim_tx` function uses `data->channel` instead of `chanctx_conf->channel`. This channel is valid, so the frame is *not* dropped. This is the key! It allows the packet to proceed to `mac80211_hwsim_tx_frame_no_nl` and subsequently to `mac80211_hwsim_write_tsf`, which *does* call `mac80211_hwsim_get_tx_rate`. Therefore, `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is the correct attribute to use.
5. **Reproducer Logic Outline:** Based on the above, my reproducer will follow these steps:
* **Initialize `mac80211_hwsim`:** I need to ensure a clean slate. Using `system("modprobe mac80211_hwsim radios=0")` will prevent any pre-existing radios from interfering, ensuring my created radio becomes `phy0` and its interface `wlan0`.
* **Create a Generic Netlink Socket:** This is the standard mechanism for interacting with kernel modules like `mac80211_hwsim`.
* **Resolve Family ID:** I need to find the generic netlink family ID for "mac80211_hwsim" to direct commands correctly.
* **Create a New Radio:** Send a `HWSIM_CMD_NEW_RADIO` command. This is where I'll include `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (value 30) to set the `HAS_RATE_CONTROL` flag.
* **Configure Monitor Interface:** After the radio is created, `mac80211_hwsim` will likely create a default `wlanX` interface. I'll then use `iw` commands to change its type to "monitor" and bring it up. The specific commands will be `ip link set wlan0 down`, `iw dev wlan0 set type monitor`, and `ip link set wlan0 up`. I'll add short `sleep` calls to allow the kernel to process these changes.
* **Create an AF_PACKET Socket:** To inject raw 802.11 frames.
* **Bind to Monitor Interface:** Bind the `AF_PACKET` socket to the `wlan0` monitor interface, listening for all protocols (`ETH_P_ALL`).
* **Craft and Send a Packet:** Inject a minimal 802.11 frame. A simple radiotap header followed by a basic data frame should suffice. The important part is that the frame is *not* a management frame type that might be handled differently (like beacons or probe responses), as `mac80211_hwsim_write_tsf` has specific handling for those. A data frame should work. The packet construction needs to be valid enough to pass initial sanity checks in the kernel.
* **Observe the Warning:** If the logic holds, this packet injection should traverse the path that triggers the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` in `ieee80211_get_tx_rate`.
6. **Code Implementation Details:**
* The netlink request structure needs to be carefully constructed, including the `nlmsghdr` and `genlmsghdr`.
* The attribute for `HWSIM_ATTR_SUPPORT_NAN_DEVICE` is a flag attribute, so its length should be `sizeof(struct nlattr)`.
* Error handling for socket creation, netlink communication, and `iw`/`ip` commands is essential.
* The `get_family_id` function is a standard utility for generic netlink.
* The packet structure needs to include a radiotap header (with appropriate length and flags) and an 802.11 frame control field.
This systematic approach, starting from the warning and working backward through the code paths and attribute dependencies, has led me to the specific configuration required to reproduce the bug reliably. The key insight was realizing the critical difference in behavior between `HWSIM_ATTR_MLO_SUPPORT` and `HWSIM_ATTR_SUPPORT_NAN_DEVICE` when it comes to `use_chanctx` and the subsequent handling of monitor interfaces.
|
| 82/1 |
2026/09/07 07:18 |
loop |
|
1h31m
|
| 83/2 |
2026/09/07 07:18 |
iteration |
0 |
9m
|
| 84/3 |
2026/09/07 07:18 |
action |
If |
0m
Args:
|
| 85/3 |
2026/09/07 07:18 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:An analysis of the bug and a strategy for reproducing it.
### Bug Analysis
The warning `c->control.rates[0].idx < 0` in `ieee80211_get_tx_rate()` is triggered during the transmission of an injected frame on a monitor interface. The sequence of events is as follows:
1. When a frame is injected via `AF_PACKET` into a monitor interface, `ieee80211_monitor_start_xmit()` initializes the transmission info (`info`) to zero.
2. It then calls `ieee80211_parse_tx_radiotap()` to parse the radiotap header. If the radiotap header contains a `RATE` field, it sets `info->control.rates[0].idx = -1` and attempts to find the matching rate in the hardware's supported bitrates.
3. If the rate is invalid (e.g., does not match any supported bitrate), `idx` remains `-1`. The function then clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag because the rate was invalid.
4. The frame proceeds to `ieee80211_tx()`, which queues the frame and eventually invokes `invoke_tx_handlers_late()`.
5. `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` to populate the rate **only if** the hardware does not have the `HAS_RATE_CONTROL` flag set.
6. In `mac80211_hwsim`, the `HAS_RATE_CONTROL` flag is set if the radio was created with `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (or `HWSIM_ATTR_MLO_SUPPORT`). Because this flag is set, `ieee80211_tx_h_rate_ctrl()` is skipped, and `idx` remains `-1`.
7. The frame reaches `mac80211_hwsim_tx()`. Since `mac80211_hwsim` does not set `SUPPORTS_RC_TABLE` by default, it does not call `ieee80211_get_tx_rates()`, leaving `idx` as `-1`.
8. Finally, `mac80211_hwsim_tx_frame_no_nl()` calls `mac80211_hwsim_write_tsf()`, which unconditionally calls `mac80211_hwsim_get_tx_rate()`. This function checks `WARN_ON_ONCE(c->control.rates[0].idx < 0)` and triggers the warning.
### Reproduction Strategy
To reproduce this bug, we need to:
1. Ensure no default `mac80211_hwsim` radios exist (e.g., `modprobe mac80211_hwsim radios=0`).
2. Create a new `mac80211_hwsim` radio with the `HWSIM_ATTR_SUPPORT_NAN_DEVICE` attribute set to `true` via generic netlink. This forces the `HAS_RATE_CONTROL` flag to be set without forcing `use_chanctx` (which would otherwise drop the frame early).
3. Change the created interface (e.g., `wlan0`) to `monitor` mode and bring it up.
4. Open an `AF_PACKET` socket bound to the monitor interface.
5. Inject a frame with a radiotap header containing an invalid `RATE` field (e.g., `1` for 500kbps) followed by a valid 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
#define HWSIM_CMD_NEW_RADIO 1
#define HWSIM_ATTR_SUPPORT_NAN_DEVICE 30
struct nl_msg {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
char attr[256];
};
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
return -1;
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) return -1;
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) return -1;
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main() {
system("modprobe mac80211_hwsim radios=0");
sleep(1);
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
perror("socket");
return 1;
}
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
return 1;
}
struct nl_msg req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr));
req.nlh.nlmsg_type = family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.gnlh.cmd = HWSIM_CMD_NEW_RADIO;
struct nlattr *attr = (struct nlattr *)req.attr;
attr->nla_len = sizeof(struct nlattr);
attr->nla_type = HWSIM_ATTR_SUPPORT_NAN_DEVICE;
req.nlh.nlmsg_len += NLMSG_ALIGN(attr->nla_len);
send(sock, &req, req.nlh.nlmsg_len, 0);
char buf[4096];
recv(sock, buf, sizeof(buf), 0);
close(sock);
sleep(1);
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
sleep(1);
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex");
return 1;
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
unsigned char pkt[] = {
/* Radiotap Header (10 bytes) */
0x00, 0x00, 0x0a, 0x00, /* version, pad, len */
0x04, 0x00, 0x00, 0x00, /* present: RATE (bit 2) */
0x01, 0x00, /* rate = 1 (invalid), pad */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control, Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 */
0x00, 0x00 /* Sequence Control */
};
send(psock, pkt, sizeof(pkt), 0);
close(psock);
return 0;
}
```]
|
| 86/3 |
2026/09/07 07:18 |
agent |
repro-generator |
0m
Model:
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
]
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to generate a minimal, standalone C program for the strictly defensive
purpose of verifying a bugfix in an isolated environment.
To ensure that we can diagnose why a program might fail to run on the test environment,
you MUST include detailed logging and error checking in the generated C program:
1. Use 'printf(...)' for all progress messages and error logs.
2. Every system call (e.g., socket, bind, listen, connect, ioctl, send) must check for a failure return value.
3. If a call fails, it must print a specific error message including the function name
and the error string (use strerror(errno)), and then exit with a non-zero status.
4. The program must print a message after every successful major step.
5. Generate code that follows this pattern for all operations:
int res = do_something();
if (res < 0) {
printf("[-] Failed to do_something: %s\n", strerror(errno));
exit(1);
}
printf("[+] do_something successful.\n");
6. The compilation and development environment (including compilers, build
systems, makefiles, and kernel build/header directories) is NOT available
on the target test VM guest. Do NOT check for, build, or reference any
compilation tools, build files, or kernel development directories.
7. Do NOT execute shell commands or run external binaries (e.g. by using
functions like 'system()', 'popen()', or the 'exec' family such as
'execve()'). All environment checks, capability probings, and reproduction
steps must be performed directly using standard Linux system calls (such
as 'open', 'socket', 'ioctl', 'stat', etc.).
8. When reproducing asynchronous kernel timeouts or warnings, always
include a sufficient delay (using sleep or similar) after deleting
or unregistering the device to allow the kernel's asynchronous
timeout to trigger before program exit.
=== PHASE 1: CAPABILITY PROBING (GENERATION) ===
You MUST start by generating a simple 'probe' program first. This is a strict, non-negotiable requirement
to verify that the test environment has the necessary kernel capabilities and privileges.
This program's sole purpose is to verify subsystem availability and privileges by probing specific
device files, subsystems, or syscalls (for example: opening /dev/vhci to check if the virtual
Bluetooth controller is accessible, loading a minimal dummy BPF program, or making a specific
socket/ioctl call).
Print clear messages indicating success or failure of these probes, and exit with 0 only if
all checks pass.
Do NOT attempt complex logic, and do NOT try to trigger the actual bug/crash in this first version,
regardless of how simple the reproducer seems. You must wait until a successful probe run has been
confirmed in the environment (i.e., when CapabilitiesVerified becomes true).
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Strategy: An analysis of the bug and a strategy for reproducing it.
### Bug Analysis
The warning `c->control.rates[0].idx < 0` in `ieee80211_get_tx_rate()` is triggered during the transmission of an injected frame on a monitor interface. The sequence of events is as follows:
1. When a frame is injected via `AF_PACKET` into a monitor interface, `ieee80211_monitor_start_xmit()` initializes the transmission info (`info`) to zero.
2. It then calls `ieee80211_parse_tx_radiotap()` to parse the radiotap header. If the radiotap header contains a `RATE` field, it sets `info->control.rates[0].idx = -1` and attempts to find the matching rate in the hardware's supported bitrates.
3. If the rate is invalid (e.g., does not match any supported bitrate), `idx` remains `-1`. The function then clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag because the rate was invalid.
4. The frame proceeds to `ieee80211_tx()`, which queues the frame and eventually invokes `invoke_tx_handlers_late()`.
5. `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` to populate the rate **only if** the hardware does not have the `HAS_RATE_CONTROL` flag set.
6. In `mac80211_hwsim`, the `HAS_RATE_CONTROL` flag is set if the radio was created with `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (or `HWSIM_ATTR_MLO_SUPPORT`). Because this flag is set, `ieee80211_tx_h_rate_ctrl()` is skipped, and `idx` remains `-1`.
7. The frame reaches `mac80211_hwsim_tx()`. Since `mac80211_hwsim` does not set `SUPPORTS_RC_TABLE` by default, it does not call `ieee80211_get_tx_rates()`, leaving `idx` as `-1`.
8. Finally, `mac80211_hwsim_tx_frame_no_nl()` calls `mac80211_hwsim_write_tsf()`, which unconditionally calls `mac80211_hwsim_get_tx_rate()`. This function checks `WARN_ON_ONCE(c->control.rates[0].idx < 0)` and triggers the warning.
### Reproduction Strategy
To reproduce this bug, we need to:
1. Ensure no default `mac80211_hwsim` radios exist (e.g., `modprobe mac80211_hwsim radios=0`).
2. Create a new `mac80211_hwsim` radio with the `HWSIM_ATTR_SUPPORT_NAN_DEVICE` attribute set to `true` via generic netlink. This forces the `HAS_RATE_CONTROL` flag to be set without forcing `use_chanctx` (which would otherwise drop the frame early).
3. Change the created interface (e.g., `wlan0`) to `monitor` mode and bring it up.
4. Open an `AF_PACKET` socket bound to the monitor interface.
5. Inject a frame with a radiotap header containing an invalid `RATE` field (e.g., `1` for 500kbps) followed by a valid 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
#define HWSIM_CMD_NEW_RADIO 1
#define HWSIM_ATTR_SUPPORT_NAN_DEVICE 30
struct nl_msg {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
char attr[256];
};
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
return -1;
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) return -1;
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) return -1;
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main() {
system("modprobe mac80211_hwsim radios=0");
sleep(1);
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
perror("socket");
return 1;
}
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
return 1;
}
struct nl_msg req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr));
req.nlh.nlmsg_type = family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.gnlh.cmd = HWSIM_CMD_NEW_RADIO;
struct nlattr *attr = (struct nlattr *)req.attr;
attr->nla_len = sizeof(struct nlattr);
attr->nla_type = HWSIM_ATTR_SUPPORT_NAN_DEVICE;
req.nlh.nlmsg_len += NLMSG_ALIGN(attr->nla_len);
send(sock, &req, req.nlh.nlmsg_len, 0);
char buf[4096];
recv(sock, buf, sizeof(buf), 0);
close(sock);
sleep(1);
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
sleep(1);
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex");
return 1;
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
unsigned char pkt[] = {
/* Radiotap Header (10 bytes) */
0x00, 0x00, 0x0a, 0x00, /* version, pad, len */
0x04, 0x00, 0x00, 0x00, /* present: RATE (bit 2) */
0x01, 0x00, /* rate = 1 (invalid), pad */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control, Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 */
0x00, 0x00 /* Sequence Control */
};
send(psock, pkt, sizeof(pkt), 0);
close(psock);
return 0;
}
```
|
| 87/4 |
2026/09/07 07:18 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 8058
output: 991
thoughts: 2825
Thoughts: **My Thought Process for Developing the `mac80211_hwsim` Probe**
My primary objective here is to create a minimal, standalone C program that can verify a bugfix. The specific bug I'm addressing is a WARNING originating from `mac80211_hwsim_write_tsf` because `c->control.rates[0].idx` is less than 0. The user has provided a strategy and a C reproducer, which is a good starting point.
However, I immediately encountered a constraint: the user's C reproducer utilizes `system()` calls. This is a strict violation of rule 7, which explicitly forbids executing shell commands or running external binaries. My task, therefore, is to rewrite the reproducer to achieve the same setup without resorting to `system()`, `popen()`, or `exec`-family functions. Instead, I need to use standard Linux system calls like `open`, `socket`, and `ioctl`.
The first phase in this process, as per the established methodology, is **CAPABILITY PROBING**. This means I need to generate a simple 'probe' program first. The sole purpose of this probe is to ascertain the availability of specific subsystems and the necessary privileges by interacting with device files, subsystems, or system calls directly.
For this particular bug, the critical subsystem to check is `mac80211_hwsim`. My probe needs to determine if I can create a `mac80211_hwsim` radio interface using generic netlink, or at the very least, if the `mac80211_hwsim` generic netlink family is even accessible.
A potential issue arises: what if the `mac80211_hwsim` module isn't loaded? I cannot use `modprobe` via `system()`, so I can't force its loading directly. However, I'm banking on the assumption that if I simply attempt to resolve the `mac80211_hwsim` generic netlink family, it might auto-load the module if it's not already present. Furthermore, in the typical syzkaller testing environment, `mac80211_hwsim` is often loaded or even built-in, especially since wifi is a common testing area. So, my initial approach will be to directly query the family ID. If that fails, I might need to explore ways to trigger auto-loading, but for a probe, simply checking availability is the first step.
To resolve a generic netlink family, the standard procedure involves:
1. Opening a netlink socket.
2. Sending a `CTRL_CMD_GETFAMILY` request to the `GENL_ID_CTRL` controller.
3. Specifying the `mac80211_hwsim` family name in the request.
If I receive a valid family ID in response, it signifies that the subsystem is available.
Based on this, I've drafted an initial C program for the probe. It includes the necessary headers for netlink and generic netlink operations. The `get_family_id` function encapsulates the logic for querying the family ID. The `main` function handles socket creation, calls `get_family_id`, and then exits with a success or failure status.
I've refined this probe to be more robust. It checks for failures at each critical step: socket creation, sending the netlink request, and receiving the response. If any of these fail, it prints a detailed error message including `strerror(errno)` and exits with a non-zero status. Successful steps are also clearly indicated with `printf` messages.
The structure of the probe program directly addresses the requirements:
* All progress and error messages use `printf`.
* Every system call is checked for failure.
* Error messages are specific and include `strerror(errno)`.
* Successful major steps are announced.
* The code adheres to the required pattern.
* No compilation tools are involved; it's a direct C source.
* Crucially, no shell commands or external binaries are used.
* The requirement for delays after device operations isn't immediately applicable to this initial probe, but I'll keep it in mind for the subsequent reproducer development.
Therefore, this probe program serves as an excellent first step. It's a self-contained C program that verifies the availability of the `mac80211_hwsim` generic netlink family, directly fulfilling the requirements of the capability probing phase without violating any rules. I'm now ready to provide this probe program.
|
| 88/4 |
2026/09/07 07:18 |
tool |
set-results |
0m
Args: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
]
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
]
|
| 89/3 |
2026/09/07 07:18 |
loop |
|
1m
|
| 90/4 |
2026/09/07 07:18 |
iteration |
0 |
0m
|
| 91/5 |
2026/09/07 07:18 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
]
|
| 92/5 |
2026/09/07 07:18 |
action |
compile-c-prog |
0m
Results: map[CompilerError:failed to build program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
<stdin>: In function 'get_family_id':
<stdin>:56:22: error: 'uint16_t' undeclared (first use in this function)
<stdin>:9:1: note: 'uint16_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
<stdin>:56:22: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:56:32: error: expected expression before ')' token
At top level:
cc1: note: unrecognized command-line option '-Wno-unused-command-line-argument' may have been intended to silence earlier diagnostics
compiler invocation: gcc [-o /tmp/syz-executor3373622148 -DGOOS_linux=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -fpermissive -w] FormattedReproC:]
|
| 93/5 |
2026/09/07 07:18 |
action |
If |
0m
Args: map[CompilerError:failed to build program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
<stdin>: In function 'get_family_id':
<stdin>:56:22: error: 'uint16_t' undeclared (first use in this function)
<stdin>:9:1: note: 'uint16_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
<stdin>:56:22: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:56:32: error: expected expression before ')' token
At top level:
cc1: note: unrecognized command-line option '-Wno-unused-command-line-argument' may have been intended to silence earlier diagnostics
compiler invocation: gcc [-o /tmp/syz-executor3373622148 -DGOOS_linux=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -fpermissive -w]]
|
| 94/6 |
2026/09/07 07:18 |
agent |
repro-repairer |
0m
Model:
Instruction: You are an experienced C developer.
Your goal is to repair a C program that failed to compile.
Analyze the compiler error and provide a corrected version of the C program.
Make the minimal necessary changes to fix the compilation error.
Preserve the structure, logic, and intent of the original code.
Do NOT replace the program with a dummy placeholder (e.g., an empty main function).
Print only the C program that could be executed directly, without backticks.
Prefer calling several tools at the same time to save round-trips.
Prompt: C Program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
Compiler Error:
failed to build program:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
<stdin>: In function 'get_family_id':
<stdin>:56:22: error: 'uint16_t' undeclared (first use in this function)
<stdin>:9:1: note: 'uint16_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'
<stdin>:56:22: note: each undeclared identifier is reported only once for each function it appears in
<stdin>:56:32: error: expected expression before ')' token
At top level:
cc1: note: unrecognized command-line option '-Wno-unused-command-line-argument' may have been intended to silence earlier diagnostics
compiler invocation: gcc [-o /tmp/syz-executor3373622148 -DGOOS_linux=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -fpermissive -w]
Reply: ```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
```
|
| 95/7 |
2026/09/07 07:18 |
llm |
repro-repairer |
0m
Model:
Tokens:
input: 4618
output: 979
thoughts: 300
Thoughts: **Ah, a Familiar Bug: The Missing Header**
Right, so I've hit a snag with the compiler. It's thrown an error, specifically at line 56, column 22: `'uint16_t' undeclared (first use in this function)`. The helpful note immediately points to the problem: `'uint16_t' is defined in header '<stdint.h>'; this is probably fixable by adding '#include <stdint.h>'`.
My immediate thought is, "Of course! How could I forget to include `<stdint.h>` when I'm explicitly using fixed-width integer types like `uint16_t`?" This is a foundational aspect of C programming, and it's easy to overlook when you're deep in the logic of network protocols or device emulation.
Before I just blindly add the include, I like to do a quick scan to see if there are any other cascading issues. I review the code, and I see the include list already has standard headers like `stdio.h`, `stdlib.h`, `string.h`, `unistd.h`, `errno.h`, `sys/socket.h`, `linux/netlink.h`, and `linux/genetlink.h`. So, the missing piece is indeed the one that defines `uint16_t`.
Then, I notice a second error reported by the compiler, a few columns further over on the same line: `<stdin>:56:32: error: expected expression before ')' token`. This error, in isolation, might be a bit cryptic. However, knowing the first error, it becomes perfectly clear. The compiler can't even parse the expression `*(uint16_t *)` because `uint16_t` itself is an unknown type. The syntax is fundamentally broken from the compiler's perspective until the type is properly declared.
So, the solution is elegant and singular: adding `#include <stdint.h>` at the top of the file. This single inclusion will resolve both the undeclared type error and the subsequent parsing error that arises from it. It's a good reminder that sometimes the most complex-looking problems have the simplest underlying causes. Now, I'll go ahead and apply that fix and then write out the corrected code.
|
| 96/4 |
2026/09/07 07:19 |
iteration |
1 |
0m
|
| 97/5 |
2026/09/07 07:19 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
```]
|
| 98/5 |
2026/09/07 07:19 |
action |
compile-c-prog |
0m
Results: map[CompilerError:failed to build program:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
/usr/bin/ld: /tmp/cciU61Wl.o: in function `get_family_id':
<stdin>:(.text+0xaf): undefined reference to `NLA_NEXT'
/usr/bin/ld: <stdin>:(.text+0xbe): undefined reference to `NLA_OK'
collect2: error: ld returned 1 exit status
compiler invocation: gcc [-o /tmp/syz-executor3645007848 -DGOOS_linux=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -fpermissive -w] FormattedReproC:]
|
| 99/5 |
2026/09/07 07:19 |
action |
If |
0m
Args: map[CompilerError:failed to build program:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
/usr/bin/ld: /tmp/cciU61Wl.o: in function `get_family_id':
<stdin>:(.text+0xaf): undefined reference to `NLA_NEXT'
/usr/bin/ld: <stdin>:(.text+0xbe): undefined reference to `NLA_OK'
collect2: error: ld returned 1 exit status
compiler invocation: gcc [-o /tmp/syz-executor3645007848 -DGOOS_linux=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -fpermissive -w]]
|
| 100/6 |
2026/09/07 07:19 |
agent |
repro-repairer |
0m
Model:
Instruction: You are an experienced C developer.
Your goal is to repair a C program that failed to compile.
Analyze the compiler error and provide a corrected version of the C program.
Make the minimal necessary changes to fix the compilation error.
Preserve the structure, logic, and intent of the original code.
Do NOT replace the program with a dummy placeholder (e.g., an empty main function).
Print only the C program that could be executed directly, without backticks.
Prefer calling several tools at the same time to save round-trips.
Prompt: C Program:
```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
```
Compiler Error:
failed to build program:
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
/usr/bin/ld: /tmp/cciU61Wl.o: in function `get_family_id':
<stdin>:(.text+0xaf): undefined reference to `NLA_NEXT'
/usr/bin/ld: <stdin>:(.text+0xbe): undefined reference to `NLA_OK'
collect2: error: ld returned 1 exit status
compiler invocation: gcc [-o /tmp/syz-executor3645007848 -DGOOS_linux=1 -DGOARCH_amd64=1 -DHOSTGOOS_linux=1 -x c - -m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -fpermissive -w]
Reply: ```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#ifndef NLA_ALIGN
#define NLA_ALIGN(mac) (((mac) + 3) & ~3)
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla,len) \
((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr*)(((char*)(nla)) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla,len) \
((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
```
|
| 101/7 |
2026/09/07 07:19 |
llm |
repro-repairer |
0m
Model:
Tokens:
input: 4566
output: 1189
thoughts: 3387
Thoughts: **Understanding and Resolving Compilation Errors with Netlink Attributes**
When I encountered the compilation error stating "undefined reference to `NLA_NEXT`" and "`NLA_OK`," my immediate thought was about the nature of these symbols. I recognized them as macros typically found within the Linux kernel's netlink subsystem. The core of my investigation then became determining why they weren't available in the userspace headers I was including, specifically `<linux/netlink.h>` and `<linux/genetlink.h>`.
I reasoned that if they were intended to be functions, the error message would be different. The "undefined reference" strongly suggested they were being treated as implicit function declarations because their definitions (as macros) were simply missing from the scope of my userspace compilation. This is a common pitfall when directly interacting with kernel interfaces from userspace without the full kernel header environment or an appropriate userspace library.
My next step was to consider how these macros are usually provided. I recalled that `libnl` is the standard userspace library for netlink interactions, and it certainly defines these macros. However, in this scenario, I wasn't using `libnl` directly, so that wasn't an option for a quick fix. This led me to the conclusion that I would need to define these macros myself, mimicking their kernel counterparts.
I then focused on the specific definitions. I knew that `<linux/netlink.h>` provides macros like `NLMSG_OK` and `NLMSG_NEXT` for netlink messages, but the `NLA_` prefixed ones are for Netlink Attributes. I double-checked the typical definitions for `NLA_ALIGN`, `NLA_HDRLEN`, `NLA_NEXT`, and `NLA_OK`.
My initial thought was to define them all, but then I paused to verify if `NLA_ALIGN` and `NLA_HDRLEN` were indeed missing. A quick mental check (or an actual look at the headers if I had them readily available) confirmed that `NLA_ALIGN` is typically defined in `<linux/netlink.h>`. While `NLA_HDRLEN` is also often present, it's safer to conditionally define it anyway. The critical ones, `NLA_NEXT` and `NLA_OK`, were the most likely candidates for being absent in a basic userspace setup.
Therefore, my strategy solidified: conditionally define `NLA_NEXT` and `NLA_OK` using their standard kernel implementations, ensuring that they are only defined if they aren't already present in the included headers. This approach is robust as it avoids redefinition warnings or errors if the headers *do* happen to define them in some specific system configuration.
I then proceeded to construct the conditional definitions:
```c
#ifndef NLA_ALIGN
#define NLA_ALIGN(mac) (((mac) + 3) & ~3)
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla,len) \
((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr*)(((char*)(nla)) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla,len) \
((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
```
I also confirmed that `GENL_HDRLEN` and `NLMSG_HDRLEN` were correctly handled by their respective headers (`<linux/genetlink.h>` and `<linux/netlink.h>`), as they are standard and expected to be present.
Finally, I integrated these definitions into the code, placing them before the main logic that uses these macros. This would resolve the linker errors by providing the necessary macro definitions at compile time, allowing the program to link successfully. The actual code snippet provided in the thought process demonstrates this final arrangement, ensuring all necessary headers and the custom macro definitions are in place.
|
| 102/4 |
2026/09/07 07:19 |
iteration |
2 |
0m
|
| 103/5 |
2026/09/07 07:19 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:```c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#ifndef NLA_ALIGN
#define NLA_ALIGN(mac) (((mac) + 3) & ~3)
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla,len) \
((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr*)(((char*)(nla)) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla,len) \
((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
```]
|
| 104/5 |
2026/09/07 07:19 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#ifndef NLA_ALIGN
#define NLA_ALIGN(mac) (((mac) + 3) & ~3)
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla,len) \
((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr*)(((char*)(nla)) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla,len) \
((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
]
|
| 105/5 |
2026/09/07 07:19 |
action |
If |
0m
Args:
|
| 106/3 |
2026/09/07 07:19 |
action |
run-c-repro |
3m
Results: map[CandidateBugTitle: CandidateCrashReport: CandidateReproduced:false ConsoleOutput:[ 61.167454][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 61.169098][ T33] audit: type=1400 audit(1788765661.417:200): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169122][ T33] audit: type=1400 audit(1788765661.417:201): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169135][ T33] audit: type=1400 audit(1788765661.417:202): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169147][ T33] audit: type=1400 audit(1788765661.417:203): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.974323][ T33] audit: type=1400 audit(1788765664.227:204): avc: denied { write } for pid=5835 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.009004][ T33] audit: type=1400 audit(1788765664.257:205): avc: denied { write } for pid=5839 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:35371' (ED25519) to the list of known hosts.
[ 64.214838][ T33] audit: type=1400 audit(1788765664.467:206): avc: denied { write } for pid=5844 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.256237][ T33] audit: type=1400 audit(1788765664.507:207): avc: denied { write } for pid=5848 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[+] Netlink socket created successfully.
[-] GETFAMILY returned NLMSG_ERROR: -2
[-] Failed to get family ID for mac80211_hwsim
[ 64.495027][ T33] audit: type=1400 audit(1788765664.747:208): avc: denied { write } for pid=5853 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.528932][ T33] audit: type=1400 audit(1788765664.777:209): avc: denied { write } for pid=5856 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.424781][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.424848][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.666545][ T807] cfg80211: failed to load regulatory.db
OtherCrashReports:<nil> StraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor593166551
<...>
[ 60.554170][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.554228][ T33] audit: type=1400 audit(1788765752.153:201): avc: denied { transition } for pid=5823 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.554270][ T33] audit: type=1400 audit(1788765752.153:202): avc: denied { noatsecure } for pid=5823 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.556491][ T33] audit: type=1400 audit(1788765752.163:203): avc: denied { rlimitinh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.556510][ T33] audit: type=1400 audit(1788765752.163:204): avc: denied { siginh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.854777][ T33] audit: type=1400 audit(1788765755.453:205): avc: denied { write } for pid=5835 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 63.881750][ T33] audit: type=1400 audit(1788765755.483:206): avc: denied { write } for pid=5838 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.191791][ T33] audit: type=1400 audit(1788765755.793:207): avc: denied { write } for pid=5841 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.226151][ T33] audit: type=1400 audit(1788765755.833:208): avc: denied { write } for pid=5844 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.740439][ T33] audit: type=1400 audit(1788765756.343:209): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.774248][ T33] audit: type=1400 audit(1788765756.373:210): avc: denied { write } for pid=5850 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.799475][ T33] kauditd_printk_skb: 8 callbacks suppressed
[ 65.801641][ T33] audit: type=1400 audit(1788765757.403:219): avc: denied { write } for pid=5882 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:14629' (ED25519) to the list of known hosts.
[ 65.833014][ T33] audit: type=1400 audit(1788765757.433:220): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor593166551", ["/syz-executor593166551"], 0x7ffcd6a2b380 /* 11 vars */) = 0
brk(NULL) = 0x555568d84000
brk(0x555568d84d80) = 0x555568d84d80
arch_prctl(ARCH_SET_FS, 0x555568d84400) = 0
set_tid_address(0x555568d846d0) = 5892
set_robust_list(0x555568d846e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor593166551", 4096) = 22
getrandom("\x33\x69\xff\x57\x9f\xab\x86\x0f", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x555568d84d80
brk(0x555568da5d80) = 0x555568da5d80
brk(0x555568da6000) = 0x555568da6000
mprotect(0x7fb6a8572000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
sendto(3, [{nlmsg_len=40, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=0, nlmsg_pid=0}, "\x03\x00\x00\x00\x13\x00\x02\x00\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d\x00\x00"], 40, 0, NULL, 0) = 40
recvfrom(3, [{nlmsg_len=60, nlmsg_type=NLMSG_ERROR, nlmsg_flags=0, nlmsg_seq=0, nlmsg_pid=5892}, {error=-ENOENT, msg=[{nlmsg_len=40, nlmsg_type=nlctrl, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=0, nlmsg_pid=0}, {cmd=CTRL_CMD_GETFAMILY, version=0}, [{nla_len=19, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d\x00"...]]}], 4096, 0, NULL, NULL) = 60
write(1, "[+] Netlink socket created successfully.\n[-] GETFAMILY returned NLMSG_ERROR: -2\n[-] Failed to get fa"..., 127) = 127
[+] Netlink socket created successfully.
[-] GETFAMILY returned NLMSG_ERROR: -2
[-] Failed to get family ID for mac80211_hwsim
exit_group(1) = ?
+++ exited with 1 +++
[ 66.426480][ T1382] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.426552][ T1382] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.666873][ T9] cfg80211: failed to load regulatory.db
TestError:]
|
| 107/3 |
2026/09/07 07:23 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 61.167454][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 61.169098][ T33] audit: type=1400 audit(1788765661.417:200): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169122][ T33] audit: type=1400 audit(1788765661.417:201): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169135][ T33] audit: type=1400 audit(1788765661.417:202): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169147][ T33] audit: type=1400 audit(1788765661.417:203): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.974323][ T33] audit: type=1400 audit(1788765664.227:204): avc: denied { write } for pid=5835 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.009004][ T33] audit: type=1400 audit(1788765664.257:205): avc: denied { write } for pid=5839 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:35371' (ED25519) to the list of known hosts.
[ 64.214838][ T33] audit: type=1400 audit(1788765664.467:206): avc: denied { write } for pid=5844 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.256237][ T33] audit: type=1400 audit(1788765664.507:207): avc: denied { write } for pid=5848 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[+] Netlink socket created successfully.
[-] GETFAMILY returned NLMSG_ERROR: -2
[-] Failed to get family ID for mac80211_hwsim
[ 64.495027][ T33] audit: type=1400 audit(1788765664.747:208): avc: denied { write } for pid=5853 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.528932][ T33] audit: type=1400 audit(1788765664.777:209): avc: denied { write } for pid=5856 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.424781][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.424848][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.666545][ T807] cfg80211: failed to load regulatory.db
TruncatedCrashReport: TruncatedStraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor593166551
<...>
[ 60.554170][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.554228][ T33] audit: type=1400 audit(1788765752.153:201): avc: denied { transition } for pid=5823 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.554270][ T33] audit: type=1400 audit(1788765752.153:202): avc: denied { noatsecure } for pid=5823 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.556491][ T33] audit: type=1400 audit(1788765752.163:203): avc: denied { rlimitinh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.556510][ T33] audit: type=1400 audit(1788765752.163:204): avc: denied { siginh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.854777][ T33] audit: type=1400 audit(1788765755.453:205): avc: denied { write } for pid=5835 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 63.881750][ T33] audit: type=1400 audit(1788765755.483:206): avc: denied { write } for pid=5838 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.191791][ T33] audit: type=1400 audit(1788765755.793:207): avc: denied { write } for pid=5841 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.226151][ T33] audit: type=1400 audit(1788765755.833:208): avc: denied { write } for pid=5844 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.740439][ T33] audit: type=1400 audit(1788765756.343:209): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.774248][ T33] audit: type=1400 audit(1788765756.373:210): avc: denied { write } for pid=5850 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.799475][ T33] kauditd_printk_skb: 8 callbacks suppressed
[ 65.801641][ T33] audit: type=1400 audit(1788765757.403:219): avc: denied { write } for pid=5882 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:14629' (ED25519) to the list of known hosts.
[ 65.833014][ T33] audit: type=1400 audit(1788765757.433:220): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor593166551", ["/syz-executor593166551"], 0x7ffcd6a2b380 /* 11 vars */) = 0
brk(NULL) = 0x555568d84000
brk(0x555568d84d80) = 0x555568d84d80
arch_prctl(ARCH_SET_FS, 0x555568d84400) = 0
set_tid_address(0x555568d846d0) = 5892
set_robust_list(0x555568d846e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor593166551", 4096) = 22
getrandom("\x33\x69\xff\x57\x9f\xab\x86\x0f", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x555568d84d80
brk(0x555568da5d80) = 0x555568da5d80
brk(0x555568da6000) = 0x555568da6000
mprotect(0x7fb6a8572000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
sendto(3, [{nlmsg_len=40, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=0, nlmsg_pid=0}, "\x03\x00\x00\x00\x13\x00\x02\x00\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d\x00\x00"], 40, 0, NULL, 0) = 40
recvfrom(3, [{nlmsg_len=60, nlmsg_type=NLMSG_ERROR, nlmsg_flags=0, nlmsg_seq=0, nlmsg_pid=5892}, {error=-ENOENT, msg=[{nlmsg_len=40, nlmsg_type=nlctrl, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=0, nlmsg_pid=0}, {cmd=CTRL_CMD_GETFAMILY, version=0}, [{nla_len=19, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d\x00"...]]}], 4096, 0, NULL, NULL) = 60
write(1, "[+] Netlink socket created successfully.\n[-] GETFAMILY returned NLMSG_ERROR: -2\n[-] Failed to get fa"..., 127) = 127
[+] Netlink socket created successfully.
[-] GETFAMILY returned NLMSG_ERROR: -2
[-] Failed to get family ID for mac80211_hwsim
exit_group(1) = ?
+++ exited with 1 +++
[ 66.426480][ T1382] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.426552][ T1382] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.666873][ T9] cfg80211: failed to load regulatory.db
]
|
| 108/3 |
2026/09/07 07:23 |
agent |
repro-oracle |
4m
Model:
Results: map[Feedback:The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`).
However, you don't need the `MAC80211_HWSIM` netlink family to trigger this bug.
The bug is a WARNING in `mac80211_hwsim_write_tsf` caused by `info->control.rates[0].idx` being -1.
This happens when a packet is injected on a monitor interface with a radiotap header that specifies an invalid legacy rate. `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and fails to update it if the rate is invalid, leaving it as -1. Then `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, triggering the warning.
To reproduce the bug:
1. Load the module: `system("modprobe mac80211_hwsim");`
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` wiphys (e.g., `phy0`).
3. Set the channel of the monitor interface to a valid channel (e.g., 2412 MHz) using `nl80211` (`NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY`). This is required so that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet containing:
- A radiotap header (e.g., 9 bytes) with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0).
- A valid 802.11 MAC header (e.g., a Data frame header, 24 bytes) immediately following the radiotap header. ProbePassed:false TerminalError: TitleMatches:true]
Instruction: You are a security researcher with deep Linux kernel background.
Analyze the results of running the generated program.
=== CRITICAL ENVIRONMENT & TARGET CLASSIFICATION ===
Set 'TerminalError' to a descriptive error message ONLY if:
1. The execution failed due to missing hardware device nodes, subsystems, kernel modules, or privilege limits
that cannot be loaded, created, or bypassed by user-space C code edits in the VM guest.
2. The target source files or functions described in the bug description do not exist in the checked-out codebase,
meaning the codebase version is mismatched and the target code is absent.
=== CRITICAL PROHIBITIONS ===
- Do NOT classify a run as a terminal failure or assume a bug is fixed based on git log entries, commit titles,
or commit messages. Reproducibility can ONLY be determined by executing reproducer candidates in the VM.
- Do NOT suggest C code strategies, repairs, or namespace bypasses when setting 'TerminalError'.
=== PHASE 1: CAPABILITY PROBING (EVALUATION) ===
The executed program was a simple environment probe.
Use this to guide your classification and feedback:
1. If the execution was successful (all environment/subsystem probes passed and program exited with 0),
set the field 'ProbePassed' to true and provide feedback explicitly indicating that the environment
is ready and the agent should now proceed to generate the full reproducer in the next iteration.
2. If the probe failed (e.g., missing permissions, missing devices, or sandbox restrictions),
set the field 'ProbePassed' to false, and explain what failed in the 'Feedback'
field so the generator can adjust its setups.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
IsProbe: true
Reproduced: false
Console Output: [ 61.167454][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 61.169098][ T33] audit: type=1400 audit(1788765661.417:200): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169122][ T33] audit: type=1400 audit(1788765661.417:201): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169135][ T33] audit: type=1400 audit(1788765661.417:202): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.169147][ T33] audit: type=1400 audit(1788765661.417:203): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.974323][ T33] audit: type=1400 audit(1788765664.227:204): avc: denied { write } for pid=5835 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.009004][ T33] audit: type=1400 audit(1788765664.257:205): avc: denied { write } for pid=5839 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:35371' (ED25519) to the list of known hosts.
[ 64.214838][ T33] audit: type=1400 audit(1788765664.467:206): avc: denied { write } for pid=5844 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.256237][ T33] audit: type=1400 audit(1788765664.507:207): avc: denied { write } for pid=5848 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[+] Netlink socket created successfully.
[-] GETFAMILY returned NLMSG_ERROR: -2
[-] Failed to get family ID for mac80211_hwsim
[ 64.495027][ T33] audit: type=1400 audit(1788765664.747:208): avc: denied { write } for pid=5853 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.528932][ T33] audit: type=1400 audit(1788765664.777:209): avc: denied { write } for pid=5856 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.424781][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.424848][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.666545][ T807] cfg80211: failed to load regulatory.db
Strace Output: /strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor593166551
<...>
[ 60.554170][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.554228][ T33] audit: type=1400 audit(1788765752.153:201): avc: denied { transition } for pid=5823 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.554270][ T33] audit: type=1400 audit(1788765752.153:202): avc: denied { noatsecure } for pid=5823 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.556491][ T33] audit: type=1400 audit(1788765752.163:203): avc: denied { rlimitinh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.556510][ T33] audit: type=1400 audit(1788765752.163:204): avc: denied { siginh } for pid=5823 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.854777][ T33] audit: type=1400 audit(1788765755.453:205): avc: denied { write } for pid=5835 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 63.881750][ T33] audit: type=1400 audit(1788765755.483:206): avc: denied { write } for pid=5838 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.191791][ T33] audit: type=1400 audit(1788765755.793:207): avc: denied { write } for pid=5841 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.226151][ T33] audit: type=1400 audit(1788765755.833:208): avc: denied { write } for pid=5844 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.740439][ T33] audit: type=1400 audit(1788765756.343:209): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.774248][ T33] audit: type=1400 audit(1788765756.373:210): avc: denied { write } for pid=5850 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.799475][ T33] kauditd_printk_skb: 8 callbacks suppressed
[ 65.801641][ T33] audit: type=1400 audit(1788765757.403:219): avc: denied { write } for pid=5882 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:14629' (ED25519) to the list of known hosts.
[ 65.833014][ T33] audit: type=1400 audit(1788765757.433:220): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor593166551", ["/syz-executor593166551"], 0x7ffcd6a2b380 /* 11 vars */) = 0
brk(NULL) = 0x555568d84000
brk(0x555568d84d80) = 0x555568d84d80
arch_prctl(ARCH_SET_FS, 0x555568d84400) = 0
set_tid_address(0x555568d846d0) = 5892
set_robust_list(0x555568d846e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor593166551", 4096) = 22
getrandom("\x33\x69\xff\x57\x9f\xab\x86\x0f", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x555568d84d80
brk(0x555568da5d80) = 0x555568da5d80
brk(0x555568da6000) = 0x555568da6000
mprotect(0x7fb6a8572000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
sendto(3, [{nlmsg_len=40, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=0, nlmsg_pid=0}, "\x03\x00\x00\x00\x13\x00\x02\x00\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d\x00\x00"], 40, 0, NULL, 0) = 40
recvfrom(3, [{nlmsg_len=60, nlmsg_type=NLMSG_ERROR, nlmsg_flags=0, nlmsg_seq=0, nlmsg_pid=5892}, {error=-ENOENT, msg=[{nlmsg_len=40, nlmsg_type=nlctrl, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=0, nlmsg_pid=0}, {cmd=CTRL_CMD_GETFAMILY, version=0}, [{nla_len=19, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d\x00"...]]}], 4096, 0, NULL, NULL) = 60
write(1, "[+] Netlink socket created successfully.\n[-] GETFAMILY returned NLMSG_ERROR: -2\n[-] Failed to get fa"..., 127) = 127
[+] Netlink socket created successfully.
[-] GETFAMILY returned NLMSG_ERROR: -2
[-] Failed to get family ID for mac80211_hwsim
exit_group(1) = ?
+++ exited with 1 +++
[ 66.426480][ T1382] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.426552][ T1382] ieee802154 phy1 wpan1: encryption failed: -22
[ 76.666873][ T9] cfg80211: failed to load regulatory.db
Crash Report:
|
| 109/4 |
2026/09/07 07:23 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 9653
output: 23
thoughts: 775
Thoughts: **My Thought Process on the `mac80211_hwsim` Failure**
Alright, so I've just reviewed the output from the execution, and I need to analyze what's going on here. The user provided a bug description pointing to a WARNING in `mac80211_hwsim_write_tsf`, noted that it's a probe (which failed to reproduce, by the way), and gave me console and strace outputs.
Looking at the console, the crucial lines are:
```
[+] Netlink socket created successfully.
[-] GETFAMILY returned NLMSG_ERROR: -2
[-] Failed to get family ID for mac80211_hwsim
```
This immediately tells me the core problem: the probe tried to get a family ID for `mac80211_hwsim` using netlink, and it failed. The error code `-2` is the key here.
Now, I dive into the strace output to see exactly *how* this failure occurred. I see the `socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC)` call, which is standard for netlink communication. Then, a `sendto` with some data, and crucially, the `recvfrom` that returns the error.
The `recvfrom` output is quite informative:
```
...
{error=-ENOENT, msg=[{nlmsg_len=40, nlmsg_type=nlctrl, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=0, nlmsg_pid=0}, {cmd=CTRL_CMD_GETFAMILY, version=0}, [{nla_len=19, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d\x00"...]]}]
```
This confirms the `-ENOENT` error. In Linux syscalls, `-ENOENT` typically means "No such file or directory" or, in this context, that the requested entity doesn't exist. Given that we're trying to get a family ID for `mac80211_hwsim`, this strongly suggests that the `mac80211_hwsim` module itself is either not loaded into the kernel or, perhaps, not even available in the system's kernel configuration.
This leads me to the next logical step: a kernel module that isn't loaded can't be interacted with. `mac80211_hwsim` is a kernel module, so the fundamental issue is its absence.
My immediate thought is: "How do we get this module loaded?"
Normally, when syzkaller executes tests, it might implicitly trigger module loading through specific syscalls or by interacting with devices that depend on those modules. However, in this case, the probe *itself* is failing because the module isn't present.
So, can I explicitly load it? The most straightforward way to load a kernel module from userspace is using `modprobe`. Therefore, a natural next step in my troubleshooting would be to try `system("modprobe mac80211_hwsim");`.
But before I even attempt that, I need to confirm if `mac80211_hwsim` is something that *should* be available. Is it a standard kernel module that's expected to be present, or is it something that needs to be explicitly built into the kernel or enabled via configuration? My next thought is to search the kernel tree to verify its existence and understand its typical usage or build status.
|
| 110/4 |
2026/09/07 07:23 |
tool |
grepper |
0m
Args: map[Expression:mac80211_hwsim]
Results: map[Output:
Full output is too long, showing 500 out of 1643 lines.
Use more precise expression if possible.
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-6-===================================================================
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:7:mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-8-===================================================================
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst=17=Introduction
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-19-
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:20:mac80211_hwsim is a Linux kernel module that can be used to simulate
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-21-arbitrary number of IEEE 802.11 radios for mac80211. It can be used to
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst=24=the normal case of using real WLAN hardware. From the mac80211 view
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:25:point, mac80211_hwsim is yet another hardware driver, i.e., no changes
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-26-to mac80211 are needed to use this testing tool.
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-27-
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:28:The main goal for mac80211_hwsim is to make it easier for developers
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-29-to test their code and work with new features to mac80211, hostapd,
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst=34=tests regardless of regulatory rules.
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-35-
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:36:mac80211_hwsim kernel module has a parameter 'radios' that can be used
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-37-to select how many radios are simulated (default 2). This allows
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst=40=hundreds of stations).
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-41-
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:42:mac80211_hwsim works by tracking the current channel of each virtual
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-43-radio and copying all transmitted frames to all other radios that are
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst=54=Simple example
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-56-
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:57:This example shows how to use mac80211_hwsim to simulate two radios:
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-58-one to act as an access point and the other as a station that
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst=61=processing access point side of association.
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-65-
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:66: # Build mac80211_hwsim as part of kernel configuration
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-67-
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-68- # Load the module
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:69: modprobe mac80211_hwsim
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst-70-
--
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst=78=More test cases are available in hostap.git:
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:79:git://w1.fi/srv/git/hostap.git and mac80211_hwsim/tests subdirectory
Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst:80:(http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=tree;f=mac80211_hwsim/tests)
--
MAINTAINERS=15668=F: Documentation/networking/mac80211-injection.rst
MAINTAINERS:15669:F: Documentation/networking/mac80211_hwsim/mac80211_hwsim.rst
MAINTAINERS:15670:F: drivers/net/wireless/virtual/mac80211_hwsim*.[ch]
MAINTAINERS-15671-F: include/net/mac80211.h
--
MAINTAINERS=19057=X: Documentation/networking/mac80211-injection.rst
MAINTAINERS:19058:X: Documentation/networking/mac80211_hwsim/
MAINTAINERS-19059-X: Documentation/networking/regulatory.rst
--
drivers/net/wireless/virtual/Kconfig=1=config MAC80211_HWSIM
--
drivers/net/wireless/virtual/Kconfig-7- needed for normal wireless LAN usage and is only for testing. See
drivers/net/wireless/virtual/Kconfig:8: Documentation/networking/mac80211_hwsim for more information on how
drivers/net/wireless/virtual/Kconfig-9- to use this tool.
--
drivers/net/wireless/virtual/Kconfig-11- To compile this driver as a module, choose M here: the module will be
drivers/net/wireless/virtual/Kconfig:12: called mac80211_hwsim. If unsure, say N.
drivers/net/wireless/virtual/Kconfig-13-
--
drivers/net/wireless/virtual/Makefile:1:obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
drivers/net/wireless/virtual/Makefile:2:mac80211_hwsim-objs += mac80211_hwsim_main.o
drivers/net/wireless/virtual/Makefile:3:mac80211_hwsim-objs += mac80211_hwsim_nan.o
drivers/net/wireless/virtual/Makefile-4-
--
drivers/net/wireless/virtual/mac80211_hwsim.h-2-/*
drivers/net/wireless/virtual/mac80211_hwsim.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim.h-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim.h=23=enum hwsim_tx_control_flags {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-33- * entities such as wmediumd to receive and process all broadcasted
drivers/net/wireless/virtual/mac80211_hwsim.h:34: * frames from a mac80211_hwsim radio device.
drivers/net/wireless/virtual/mac80211_hwsim.h-35- *
--
drivers/net/wireless/virtual/mac80211_hwsim.h-42- * Once registered the user application has to take responsibility of
drivers/net/wireless/virtual/mac80211_hwsim.h:43: * broadcasting the frames to all listening mac80211_hwsim radio
drivers/net/wireless/virtual/mac80211_hwsim.h-44- * interfaces.
--
drivers/net/wireless/virtual/mac80211_hwsim.h-55- * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
drivers/net/wireless/virtual/mac80211_hwsim.h:56: * frames by any mac80211_hwsim radio device.
drivers/net/wireless/virtual/mac80211_hwsim.h-57- * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-2-/*
drivers/net/wireless/virtual/mac80211_hwsim_i.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim_i.h-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-13-#include <net/mac80211.h>
drivers/net/wireless/virtual/mac80211_hwsim_i.h:14:#include "mac80211_hwsim.h"
drivers/net/wireless/virtual/mac80211_hwsim_i.h:15:#include "mac80211_hwsim_nan.h"
drivers/net/wireless/virtual/mac80211_hwsim_i.h-16-
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h=27=struct hwsim_sta_priv {
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-37-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:38:struct mac80211_hwsim_link_data {
drivers/net/wireless/virtual/mac80211_hwsim_i.h-39- u32 link_id;
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-50-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:51:struct mac80211_hwsim_data {
drivers/net/wireless/virtual/mac80211_hwsim_i.h-52- struct list_head list;
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-65- /* Storage space for channels, etc. */
drivers/net/wireless/virtual/mac80211_hwsim_i.h:66: struct mac80211_hwsim_phy_data *phy_data;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-67-
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-144-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:145: struct mac80211_hwsim_link_data link_data[IEEE80211_MLD_MAX_NUM_LINKS];
drivers/net/wireless/virtual/mac80211_hwsim_i.h-146-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:147: struct mac80211_hwsim_nan_data nan;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-148-};
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h=151=extern struct list_head hwsim_radios;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-152-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:153:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-154- u64 tsf);
drivers/net/wireless/virtual/mac80211_hwsim_i.h:155:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-156- ktime_t ts);
drivers/net/wireless/virtual/mac80211_hwsim_i.h-157-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:158:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-159- struct ieee80211_vif *vif);
drivers/net/wireless/virtual/mac80211_hwsim_i.h-160-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:161:void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-162- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2-/*
drivers/net/wireless/virtual/mac80211_hwsim_main.c:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-40-#include <linux/string.h>
drivers/net/wireless/virtual/mac80211_hwsim_main.c:41:#include "mac80211_hwsim.h"
drivers/net/wireless/virtual/mac80211_hwsim_main.c:42:#include "mac80211_hwsim_i.h"
drivers/net/wireless/virtual/mac80211_hwsim_main.c-43-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=335=static const struct class hwsim_class = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:336: .name = "mac80211_hwsim"
drivers/net/wireless/virtual/mac80211_hwsim_main.c-337-};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=604=hwsim_vendor_test_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-607-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:608:static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-609- struct wireless_dev *wdev,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-630- *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:631: * event_idx = 0 (index in mac80211_hwsim_vendor_commands)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-632- */
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-658-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:659:static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-660- {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-663- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:664: .doit = mac80211_hwsim_vendor_cmd_test,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-665- .policy = hwsim_vendor_test_policy,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-670-/* Advertise support vendor specific events */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:671:static const struct nl80211_vendor_cmd_info mac80211_hwsim_vendor_events[] = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-672- { .vendor_id = OUI_QCA, .subcmd = 1 },
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=679=static int hwsim_radios_generation = 1;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-680-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:681:static struct platform_driver mac80211_hwsim_driver = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-682- .driver = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:683: .name = "mac80211_hwsim",
drivers/net/wireless/virtual/mac80211_hwsim_main.c-684- },
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=687=static const struct rhashtable_params hwsim_rht_params = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-690- .key_len = ETH_ALEN,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:691: .key_offset = offsetof(struct mac80211_hwsim_data, addresses[1]),
drivers/net/wireless/virtual/mac80211_hwsim_main.c:692: .head_offset = offsetof(struct mac80211_hwsim_data, rht),
drivers/net/wireless/virtual/mac80211_hwsim_main.c-693-};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=704=struct hwsim_radiotap_ack_hdr {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-711-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:712:static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-713-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=908=static DECLARE_WORK(hwsim_virtio_rx, hwsim_virtio_rx_work);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-909-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:910:static int hwsim_tx_virtio(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-911- struct sk_buff *skb)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-938-/* cause a linker error if this ends up being needed */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:939:extern int hwsim_tx_virtio(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-940- struct sk_buff *skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=979=static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-980-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:981: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-982- struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1004- rcu_read_lock();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1005: mac80211_hwsim_tx_frame(data->hw, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1006- rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1009-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1010:static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1011- struct ieee80211_vif *vif, int ps)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1042- rcu_read_lock();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1043: mac80211_hwsim_tx_frame(data->hw, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1044- rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1049=static void hwsim_send_nullfunc_ps(void *dat, u8 *mac,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1051-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1052: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1053- hwsim_send_nullfunc(data, mac, vif, 1);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1056=static void hwsim_send_nullfunc_no_ps(void *dat, u8 *mac,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1058-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1059: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1060- hwsim_send_nullfunc(data, mac, vif, 0);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1063=static int hwsim_fops_ps_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1064-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1065: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1066- *val = data->ps;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1070=static int hwsim_fops_ps_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1071-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1072: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1073- enum ps_mode old_ps;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1110=static int hwsim_write_simulate_radar(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1111-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1112: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1113-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1122=static ssize_t hwsim_background_cac_write(struct file *file,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1125-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1126: struct mac80211_hwsim_data *data = file->private_data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1127- char buf[8] = {};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1174=static ssize_t hwsim_simulate_incumbent_signal_write(struct file *file,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1177-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1178: struct mac80211_hwsim_data *data = file->private_data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1179- struct hwsim_chanctx_iter_arg arg = {};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1216=static int hwsim_fops_group_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1217-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1218: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1219- *val = data->group;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1223=static int hwsim_fops_group_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1224-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1225: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1226- data->group = val;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1234=static int hwsim_fops_rx_rssi_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1235-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1236: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1237- *val = data->rx_rssi;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1241=static int hwsim_fops_rx_rssi_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1242-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1243: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1244- int rssi = (int)val;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1257=static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1264-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1265:static inline u64 mac80211_hwsim_get_sim_tsf(void)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1266-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1269-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1270:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1271- u64 tsf)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1277-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1278:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1279- ktime_t ts)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1285-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1286:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1287- struct ieee80211_vif *vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1288-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1289: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1290: u64 sim_time = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1291-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1296-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1297:static __le64 __mac80211_hwsim_get_tsf(struct mac80211_hwsim_data *data)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1298-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1299: u64 sim_time = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1300-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1305-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1306:static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1307- struct ieee80211_vif *vif, u64 tsf)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1308-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1309: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1310: u64 now = mac80211_hwsim_get_tsf(hw, vif);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1311- u64 delta = abs(tsf - now);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1327=static struct ieee80211_rate *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1328:mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1329- struct ieee80211_tx_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1337-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1338:static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1339- struct sk_buff *tx_skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1341-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1342: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1343- struct sk_buff *skb;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1346- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1347: struct ieee80211_rate *txrate = mac80211_hwsim_get_tx_rate(hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1348-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1368- (1 << IEEE80211_RADIOTAP_CHANNEL));
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1369: hdr->rt_tsft = __mac80211_hwsim_get_tsf(data);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1370- hdr->rt_flags = 0;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1389-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1390:static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1391- const u8 *addr)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1431-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1432:struct mac80211_hwsim_addr_match_data {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1433- u8 addr[ETH_ALEN];
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1436-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1437:static void mac80211_hwsim_addr_iter(void *data, u8 *mac,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1438- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1440- int i;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1441: struct mac80211_hwsim_addr_match_data *md = data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1442-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1462-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1463:static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1464- const u8 *addr)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1465-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1466: struct mac80211_hwsim_addr_match_data md = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1467- .ret = false,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1476- IEEE80211_IFACE_ITER_NORMAL,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1477: mac80211_hwsim_addr_iter,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1478- &md);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1482-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1483:static bool hwsim_ps_rx_ok(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1484- struct sk_buff *skb)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1498- if (data->ps_poll_pending &&
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1499: mac80211_hwsim_addr_match(data, skb->data + 4)) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1500- data->ps_poll_pending = false;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1508-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1509:static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1510- struct sk_buff *skb, int portid)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1531-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1532:static void mac80211_hwsim_config_mac_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1533- const u8 *addr, bool add)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1534-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1535: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1536- u32 _portid = READ_ONCE(data->wmediumd);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1552- if (!msg_head) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1553: pr_debug("mac80211_hwsim: problem with msg_head\n");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1554- goto nla_put_failure;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1575=static inline u16 trans_tx_rate_flags_ieee2hwsim(struct ieee80211_tx_rate *rate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1604-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1605:static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1606- struct sk_buff *skb, u64 sim_time)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1616-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1618- if (txrate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1645-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1646:static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1647- struct sk_buff *my_skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1651- struct sk_buff *skb;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1652: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1653- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) my_skb->data;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1673-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1674: sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1675: mac80211_hwsim_write_tsf(data, my_skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1676-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1683- if (msg_head == NULL) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1684: pr_debug("mac80211_hwsim: problem with msg_head\n");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1685- goto nla_put_failure;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1756-err_free_txskb:
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1757: pr_debug("mac80211_hwsim: error occurred in %s\n", __func__);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1758- ieee80211_free_txskb(hw, my_skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1771=struct tx_iter_data {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1777-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1778:static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1779- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1785- vif->type == NL80211_IFTYPE_NAN_DATA) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1786: data->receive = mac80211_hwsim_nan_receive(data->hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1787- data->channel,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1811-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1812:static void mac80211_hwsim_add_vendor_rtap(struct sk_buff *skb)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1813-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1859-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1860:static void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1861- struct ieee80211_rx_status *rx_status,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1891-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1892: mac80211_hwsim_add_vendor_rtap(skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1893-
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1894- if (data->nan.device_vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1895: mac80211_hwsim_nan_rx(data->hw, skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1896-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1901-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1902:static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1903- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1905-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1907- bool ack = false;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1910- struct ieee80211_rx_status rx_status;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1912-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1914-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1916-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1995- data2->hw, IEEE80211_IFACE_ITER_NORMAL,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1996: mac80211_hwsim_tx_iter, &tx_iter_data);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1997- if (!tx_iter_data.receive)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2024-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2025: if (mac80211_hwsim_addr_match(data2, hdr->addr1))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2026- ack = true;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2027-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2028: mac80211_hwsim_rx(data2, &rx_status, nskb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2029- }
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2035=static struct ieee80211_bss_conf *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2036:mac80211_hwsim_select_tx_link(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2037- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2084-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2085:static int mac80211_hwsim_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2086- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2103-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2104:static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2105- struct ieee80211_tx_control *control,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2107-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2108: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2109- struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2139-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2140: mac80211_hwsim_nan_get_tx_chandef(hw, &chandef);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2141- if (WARN_ON(!chandef.chan)) {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2170- } else {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2171: bss_conf = mac80211_hwsim_select_tx_link(data, vif, sta,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2172- hdr, &link_sta);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2270- if (_portid || hwsim_virtio_enabled)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2271: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, channel);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2272-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2275- data->tx_bytes += skb->len;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276: ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2277-
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2278- if (ack && skb->len >= 16)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2279: mac80211_hwsim_monitor_ack(channel, hdr->addr2);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2280-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2298=void ieee80211_hwsim_wake_tx_queue(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2307- txq->vif->type == NL80211_IFTYPE_NAN_DATA) &&
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2308: !mac80211_hwsim_nan_txq_transmitting(hw, txq))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2309- return;
--
]
|
| 111/4 |
2026/09/07 07:23 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 26305
output: 37
thoughts: 1437
Thoughts: **The `mac80211_hwsim` Conundrum**
Okay, so I'm diving into this bug report, and the first thing that grabs my attention is the mention of `mac80211_hwsim`. The report explicitly shows warnings originating from `include/net/mac80211.h` and then calls within `mac80211_hwsim_main.c`. This immediately tells me that `mac80211_hwsim` is absolutely central to the issue.
My immediate thought is, "Is this module even loaded?" If it's not, then that's step one. I recall that in the context of syzkaller, it often handles module loading automatically when it knows about them. However, I'm working with a standalone C program here, so that automatic behavior won't apply. I need to explicitly *trigger* the module load.
My go-to for loading modules is usually `system("modprobe mac80211_hwsim");`. It's straightforward and generally reliable. But then I pause. I remember that syzkaller uses `syz_init_net_socket`, which creates an `AF_NETLINK` socket of type `NETLINK_GENERIC`. Since `mac80211_hwsim` is a generic netlink family, I wonder if I could achieve the same effect by interacting with that netlink socket directly, perhaps by querying for the family. While `modprobe` is simpler, I'm considering if there's a more "syzkaller-native" way to initiate this.
However, the thought of `modprobe` being available in the environment is strong; it's a pretty standard utility. And then I circle back to the netlink socket. Could simply querying the family name via `syz_init_net_socket` be enough to coax the module to load if it's not already? It's possible, but my gut feeling is that `mac80211_hwsim` might be a bit special, being a virtual driver, and might not auto-load just by being queried.
This leads me to a crucial question: is `mac80211_hwsim` built as a loadable module, or is it compiled directly into the kernel? I scour the bug report for clues. The report shows `Modules linked in:` followed by an empty list. This is a significant detail! An empty list here strongly suggests that `mac80211_hwsim` is *built-in*, not a loadable module.
If it's built-in, then my whole premise of needing to load it is flawed. It *should* already be present and registered. So, why is the `GETFAMILY` operation failing with `-ENOENT`? This is the crux of my current confusion. The family name, `"mac80211_hwsim"`, appears to be correct, and I even double-check the definition in `mac80211_hwsim_main.c` to confirm the name and its general netlink family setup. If it's built-in, it *should* be registered and discoverable.
Then, I examine the `strace` output provided in the bug report. I see the `sendto` call initiating a `CTRL_CMD_GETFAMILY` request with the family name `"mac80211_hwsim"`. Crucially, the subsequent `recvfrom` shows an `NLMSG_ERROR` with `error=-ENOENT`. This confirms the failure I'm trying to understand.
The pieces are starting to click, albeit in a confusing way. `mac80211_hwsim` *depends* on `mac80211`. If `mac80211_hwsim` were a module, it would require `mac80211` to be loaded or built-in. Since `mac80211_hwsim` appears to be built-in, the dependency *should* be satisfied. But the fact that `GETFAMILY` is failing with `-ENOENT` implies that the generic netlink subsystem isn't finding the registered family. This suggests a potential issue either with the registration itself, or perhaps a race condition or an initialization problem occurring *before* the generic netlink subsystem is ready to query for this specific family, especially if it's somehow linked in a way that isn't immediately visible to the standard module loading/querying mechanisms. The fact that the `Modules linked in:` list is empty is still the most puzzling part if `mac80211_hwsim` is indeed built-in and supposed to be functional.
|
| 112/4 |
2026/09/07 07:23 |
tool |
grepper |
0m
Error:
Args: map[Expression:mac80211_hwsim PathPrefix:net/mac80211]
Results:
|
| 113/4 |
2026/09/07 07:23 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 27777
output: 37
thoughts: 318
Thoughts: **Analyzing the `mac80211_hwsim` Enigma**
My primary concern at this juncture is understanding the current state and availability of the `mac80211_hwsim` module. I'm considering a direct approach: could running `system("modprobe mac80211_hwsim");` resolve the issue? However, this line of thinking immediately brings up a contradiction. The bug report indicated that "Modules linked in:" was empty, which, in my experience, definitively means *no* modules are loaded. This observation strongly suggests that `mac80211_hwsim` is not present as a loadable module in the environment where the bug was observed.
This leads me to a critical question: if `mac80211_hwsim` is a built-in kernel feature, why did `GETFAMILY` return `-ENOENT`? That error code usually signifies that the requested entity simply doesn't exist. This discrepancy implies a few possibilities. Perhaps the bug report originated from a kernel configuration where `mac80211_hwsim` *was* built-in, but the current kernel I'm analyzing has it compiled as a separate module. Alternatively, and perhaps more likely, the initialization of `mac80211_hwsim` might have failed outright, even if it *is* present in some form.
To investigate this further, I've decided to scrutinize the `dmesg` output for any relevant clues. The only wireless-related message I'm finding is `[ 76.666545][ T807] cfg80211: failed to load regulatory.db`. This is a significant finding, but it doesn't directly explain the `-ENOENT` for `mac80211_hwsim` itself.
Given this, I'm returning to the hypothesis that `mac80211_hwsim` might indeed be configured as a module in the current environment. Therefore, the next logical step is to verify if the actual module file, `mac80211_hwsim.ko`, exists on the system. This will help me confirm whether it's even present as a loadable component.
|
| 114/4 |
2026/09/07 07:23 |
tool |
grepper |
0m
Args: map[Expression:mac80211_hwsim PathPrefix:drivers/net/wireless/virtual/]
Results: map[Output:
Full output is too long, showing 500 out of 1588 lines.
Use more precise expression if possible.
drivers/net/wireless/virtual/Kconfig=1=config MAC80211_HWSIM
--
drivers/net/wireless/virtual/Kconfig-7- needed for normal wireless LAN usage and is only for testing. See
drivers/net/wireless/virtual/Kconfig:8: Documentation/networking/mac80211_hwsim for more information on how
drivers/net/wireless/virtual/Kconfig-9- to use this tool.
--
drivers/net/wireless/virtual/Kconfig-11- To compile this driver as a module, choose M here: the module will be
drivers/net/wireless/virtual/Kconfig:12: called mac80211_hwsim. If unsure, say N.
drivers/net/wireless/virtual/Kconfig-13-
--
drivers/net/wireless/virtual/Makefile:1:obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
drivers/net/wireless/virtual/Makefile:2:mac80211_hwsim-objs += mac80211_hwsim_main.o
drivers/net/wireless/virtual/Makefile:3:mac80211_hwsim-objs += mac80211_hwsim_nan.o
drivers/net/wireless/virtual/Makefile-4-
--
drivers/net/wireless/virtual/mac80211_hwsim.h-2-/*
drivers/net/wireless/virtual/mac80211_hwsim.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim.h-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim.h=23=enum hwsim_tx_control_flags {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-33- * entities such as wmediumd to receive and process all broadcasted
drivers/net/wireless/virtual/mac80211_hwsim.h:34: * frames from a mac80211_hwsim radio device.
drivers/net/wireless/virtual/mac80211_hwsim.h-35- *
--
drivers/net/wireless/virtual/mac80211_hwsim.h-42- * Once registered the user application has to take responsibility of
drivers/net/wireless/virtual/mac80211_hwsim.h:43: * broadcasting the frames to all listening mac80211_hwsim radio
drivers/net/wireless/virtual/mac80211_hwsim.h-44- * interfaces.
--
drivers/net/wireless/virtual/mac80211_hwsim.h-55- * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
drivers/net/wireless/virtual/mac80211_hwsim.h:56: * frames by any mac80211_hwsim radio device.
drivers/net/wireless/virtual/mac80211_hwsim.h-57- * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-2-/*
drivers/net/wireless/virtual/mac80211_hwsim_i.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim_i.h-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-13-#include <net/mac80211.h>
drivers/net/wireless/virtual/mac80211_hwsim_i.h:14:#include "mac80211_hwsim.h"
drivers/net/wireless/virtual/mac80211_hwsim_i.h:15:#include "mac80211_hwsim_nan.h"
drivers/net/wireless/virtual/mac80211_hwsim_i.h-16-
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h=27=struct hwsim_sta_priv {
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-37-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:38:struct mac80211_hwsim_link_data {
drivers/net/wireless/virtual/mac80211_hwsim_i.h-39- u32 link_id;
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-50-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:51:struct mac80211_hwsim_data {
drivers/net/wireless/virtual/mac80211_hwsim_i.h-52- struct list_head list;
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-65- /* Storage space for channels, etc. */
drivers/net/wireless/virtual/mac80211_hwsim_i.h:66: struct mac80211_hwsim_phy_data *phy_data;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-67-
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-144-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:145: struct mac80211_hwsim_link_data link_data[IEEE80211_MLD_MAX_NUM_LINKS];
drivers/net/wireless/virtual/mac80211_hwsim_i.h-146-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:147: struct mac80211_hwsim_nan_data nan;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-148-};
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h=151=extern struct list_head hwsim_radios;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-152-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:153:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-154- u64 tsf);
drivers/net/wireless/virtual/mac80211_hwsim_i.h:155:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-156- ktime_t ts);
drivers/net/wireless/virtual/mac80211_hwsim_i.h-157-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:158:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-159- struct ieee80211_vif *vif);
drivers/net/wireless/virtual/mac80211_hwsim_i.h-160-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:161:void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-162- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2-/*
drivers/net/wireless/virtual/mac80211_hwsim_main.c:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-40-#include <linux/string.h>
drivers/net/wireless/virtual/mac80211_hwsim_main.c:41:#include "mac80211_hwsim.h"
drivers/net/wireless/virtual/mac80211_hwsim_main.c:42:#include "mac80211_hwsim_i.h"
drivers/net/wireless/virtual/mac80211_hwsim_main.c-43-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=335=static const struct class hwsim_class = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:336: .name = "mac80211_hwsim"
drivers/net/wireless/virtual/mac80211_hwsim_main.c-337-};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=604=hwsim_vendor_test_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-607-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:608:static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-609- struct wireless_dev *wdev,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-630- *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:631: * event_idx = 0 (index in mac80211_hwsim_vendor_commands)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-632- */
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-658-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:659:static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-660- {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-663- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:664: .doit = mac80211_hwsim_vendor_cmd_test,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-665- .policy = hwsim_vendor_test_policy,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-670-/* Advertise support vendor specific events */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:671:static const struct nl80211_vendor_cmd_info mac80211_hwsim_vendor_events[] = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-672- { .vendor_id = OUI_QCA, .subcmd = 1 },
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=679=static int hwsim_radios_generation = 1;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-680-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:681:static struct platform_driver mac80211_hwsim_driver = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-682- .driver = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:683: .name = "mac80211_hwsim",
drivers/net/wireless/virtual/mac80211_hwsim_main.c-684- },
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=687=static const struct rhashtable_params hwsim_rht_params = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-690- .key_len = ETH_ALEN,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:691: .key_offset = offsetof(struct mac80211_hwsim_data, addresses[1]),
drivers/net/wireless/virtual/mac80211_hwsim_main.c:692: .head_offset = offsetof(struct mac80211_hwsim_data, rht),
drivers/net/wireless/virtual/mac80211_hwsim_main.c-693-};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=704=struct hwsim_radiotap_ack_hdr {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-711-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:712:static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-713-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=908=static DECLARE_WORK(hwsim_virtio_rx, hwsim_virtio_rx_work);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-909-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:910:static int hwsim_tx_virtio(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-911- struct sk_buff *skb)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-938-/* cause a linker error if this ends up being needed */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:939:extern int hwsim_tx_virtio(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-940- struct sk_buff *skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=979=static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-980-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:981: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-982- struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1004- rcu_read_lock();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1005: mac80211_hwsim_tx_frame(data->hw, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1006- rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1009-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1010:static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1011- struct ieee80211_vif *vif, int ps)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1042- rcu_read_lock();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1043: mac80211_hwsim_tx_frame(data->hw, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1044- rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1049=static void hwsim_send_nullfunc_ps(void *dat, u8 *mac,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1051-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1052: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1053- hwsim_send_nullfunc(data, mac, vif, 1);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1056=static void hwsim_send_nullfunc_no_ps(void *dat, u8 *mac,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1058-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1059: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1060- hwsim_send_nullfunc(data, mac, vif, 0);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1063=static int hwsim_fops_ps_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1064-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1065: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1066- *val = data->ps;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1070=static int hwsim_fops_ps_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1071-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1072: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1073- enum ps_mode old_ps;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1110=static int hwsim_write_simulate_radar(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1111-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1112: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1113-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1122=static ssize_t hwsim_background_cac_write(struct file *file,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1125-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1126: struct mac80211_hwsim_data *data = file->private_data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1127- char buf[8] = {};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1174=static ssize_t hwsim_simulate_incumbent_signal_write(struct file *file,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1177-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1178: struct mac80211_hwsim_data *data = file->private_data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1179- struct hwsim_chanctx_iter_arg arg = {};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1216=static int hwsim_fops_group_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1217-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1218: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1219- *val = data->group;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1223=static int hwsim_fops_group_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1224-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1225: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1226- data->group = val;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1234=static int hwsim_fops_rx_rssi_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1235-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1236: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1237- *val = data->rx_rssi;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1241=static int hwsim_fops_rx_rssi_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1242-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1243: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1244- int rssi = (int)val;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1257=static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1264-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1265:static inline u64 mac80211_hwsim_get_sim_tsf(void)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1266-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1269-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1270:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1271- u64 tsf)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1277-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1278:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1279- ktime_t ts)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1285-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1286:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1287- struct ieee80211_vif *vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1288-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1289: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1290: u64 sim_time = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1291-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1296-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1297:static __le64 __mac80211_hwsim_get_tsf(struct mac80211_hwsim_data *data)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1298-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1299: u64 sim_time = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1300-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1305-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1306:static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1307- struct ieee80211_vif *vif, u64 tsf)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1308-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1309: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1310: u64 now = mac80211_hwsim_get_tsf(hw, vif);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1311- u64 delta = abs(tsf - now);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1327=static struct ieee80211_rate *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1328:mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1329- struct ieee80211_tx_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1337-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1338:static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1339- struct sk_buff *tx_skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1341-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1342: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1343- struct sk_buff *skb;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1346- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1347: struct ieee80211_rate *txrate = mac80211_hwsim_get_tx_rate(hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1348-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1368- (1 << IEEE80211_RADIOTAP_CHANNEL));
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1369: hdr->rt_tsft = __mac80211_hwsim_get_tsf(data);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1370- hdr->rt_flags = 0;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1389-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1390:static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1391- const u8 *addr)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1431-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1432:struct mac80211_hwsim_addr_match_data {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1433- u8 addr[ETH_ALEN];
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1436-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1437:static void mac80211_hwsim_addr_iter(void *data, u8 *mac,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1438- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1440- int i;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1441: struct mac80211_hwsim_addr_match_data *md = data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1442-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1462-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1463:static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1464- const u8 *addr)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1465-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1466: struct mac80211_hwsim_addr_match_data md = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1467- .ret = false,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1476- IEEE80211_IFACE_ITER_NORMAL,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1477: mac80211_hwsim_addr_iter,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1478- &md);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1482-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1483:static bool hwsim_ps_rx_ok(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1484- struct sk_buff *skb)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1498- if (data->ps_poll_pending &&
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1499: mac80211_hwsim_addr_match(data, skb->data + 4)) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1500- data->ps_poll_pending = false;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1508-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1509:static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1510- struct sk_buff *skb, int portid)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1531-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1532:static void mac80211_hwsim_config_mac_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1533- const u8 *addr, bool add)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1534-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1535: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1536- u32 _portid = READ_ONCE(data->wmediumd);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1552- if (!msg_head) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1553: pr_debug("mac80211_hwsim: problem with msg_head\n");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1554- goto nla_put_failure;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1575=static inline u16 trans_tx_rate_flags_ieee2hwsim(struct ieee80211_tx_rate *rate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1604-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1605:static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1606- struct sk_buff *skb, u64 sim_time)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1616-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1618- if (txrate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1645-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1646:static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1647- struct sk_buff *my_skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1651- struct sk_buff *skb;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1652: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1653- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) my_skb->data;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1673-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1674: sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1675: mac80211_hwsim_write_tsf(data, my_skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1676-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1683- if (msg_head == NULL) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1684: pr_debug("mac80211_hwsim: problem with msg_head\n");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1685- goto nla_put_failure;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1756-err_free_txskb:
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1757: pr_debug("mac80211_hwsim: error occurred in %s\n", __func__);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1758- ieee80211_free_txskb(hw, my_skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1771=struct tx_iter_data {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1777-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1778:static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1779- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1785- vif->type == NL80211_IFTYPE_NAN_DATA) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1786: data->receive = mac80211_hwsim_nan_receive(data->hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1787- data->channel,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1811-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1812:static void mac80211_hwsim_add_vendor_rtap(struct sk_buff *skb)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1813-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1859-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1860:static void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1861- struct ieee80211_rx_status *rx_status,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1891-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1892: mac80211_hwsim_add_vendor_rtap(skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1893-
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1894- if (data->nan.device_vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1895: mac80211_hwsim_nan_rx(data->hw, skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1896-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1901-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1902:static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1903- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1905-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1907- bool ack = false;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1910- struct ieee80211_rx_status rx_status;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1912-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1914-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1916-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1995- data2->hw, IEEE80211_IFACE_ITER_NORMAL,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1996: mac80211_hwsim_tx_iter, &tx_iter_data);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1997- if (!tx_iter_data.receive)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2024-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2025: if (mac80211_hwsim_addr_match(data2, hdr->addr1))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2026- ack = true;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2027-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2028: mac80211_hwsim_rx(data2, &rx_status, nskb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2029- }
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2035=static struct ieee80211_bss_conf *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2036:mac80211_hwsim_select_tx_link(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2037- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2084-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2085:static int mac80211_hwsim_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2086- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2103-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2104:static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2105- struct ieee80211_tx_control *control,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2107-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2108: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2109- struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2139-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2140: mac80211_hwsim_nan_get_tx_chandef(hw, &chandef);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2141- if (WARN_ON(!chandef.chan)) {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2170- } else {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2171: bss_conf = mac80211_hwsim_select_tx_link(data, vif, sta,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2172- hdr, &link_sta);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2270- if (_portid || hwsim_virtio_enabled)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2271: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, channel);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2272-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2275- data->tx_bytes += skb->len;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276: ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2277-
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2278- if (ack && skb->len >= 16)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2279: mac80211_hwsim_monitor_ack(channel, hdr->addr2);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2280-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2298=void ieee80211_hwsim_wake_tx_queue(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2307- txq->vif->type == NL80211_IFTYPE_NAN_DATA) &&
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2308: !mac80211_hwsim_nan_txq_transmitting(hw, txq))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2309- return;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2311- while ((skb = ieee80211_tx_dequeue(hw, txq)))
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2312: mac80211_hwsim_tx(hw, &control, skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2313-}
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2314-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2315:static int mac80211_hwsim_start(struct ieee80211_hw *hw)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2316-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2317: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2318- wiphy_dbg(hw->wiphy, "%s\n", __func__);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2323-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2324:static void mac80211_hwsim_stop(struct ieee80211_hw *hw, bool suspend)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2325-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2326: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2327- struct sk_buff *skb;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2341-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2342:static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2343- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2350- if (vif->type != NL80211_IFTYPE_MONITOR)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2351: mac80211_hwsim_config_mac_nl(hw, vif->addr, true);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2352-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2363=static void
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2364:mac80211_hwsim_link_add_debugfs(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2365- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2375-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2376:static int mac80211_hwsim_change_interface(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2377- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2396-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2397:static void mac80211_hwsim_remove_interface(
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2398- struct ieee80211_hw *hw, struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2405- if (vif->type != NL80211_IFTYPE_MONITOR)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2406: mac80211_hwsim_config_mac_nl(hw, vif->addr, false);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2407-}
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2408-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2409:void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2410- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2412-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2413: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2414- u32 _portid = READ_ONCE(data->wmediumd);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2423- if (_portid || hwsim_virtio_enabled)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2424: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, chan);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2425-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2427- data->tx_bytes += skb->len;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2428: mac80211_hwsim_tx_frame_no_nl(hw, skb, chan);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2429- dev_kfree_skb(skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2431-
]
|
| 115/4 |
2026/09/07 07:23 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 44149
output: 52
thoughts: 241
Thoughts: **My Thought Process Regarding `mac80211_hwsim` and the Bug Report**
Right, I'm trying to get a handle on this `mac80211_hwsim` situation. My initial thought is that it's a kernel module, but it could also be compiled directly into the kernel. This distinction is important for debugging.
Now, I'm recalling how the `Modules linked in:` section of a kernel log or report works. If a module is built *into* the kernel, that section will be empty because there's no separate module to link. Similarly, if `mac80211_hwsim` is intended to be a loadable module but simply hasn't been loaded yet, the `Modules linked in:` section would also be empty.
However, if `mac80211_hwsim` *is* a loadable module and it *has* been loaded, then I'd expect to see `mac80211_hwsim` explicitly listed in the `Modules linked in:` section.
Looking at the specific bug report in question, I see that `Modules linked in:` is, indeed, empty. This immediately tells me that `mac80211_hwsim` was either built directly into the kernel or it was not loaded when the bug occurred.
But here's the crux of my current confusion: the bug itself is located within the `mac80211_hwsim_write_tsf` function. This function is part of `mac80211_hwsim`. For this function to be causing a bug, the `mac80211_hwsim` code *must* have been active. This means it was either built-in or it was loaded. This contradicts the observation that `Modules linked in:` is empty, unless it was built-in.
So, if `mac80211_hwsim` *was* built-in, that brings me to another puzzle: why did our `GETFAMILY` call fail during the probe process? It really shouldn't have, if the family was properly registered.
This leads me to question if I'm correctly identifying the family name. Perhaps the actual family name registered in the kernel isn't simply `"mac80211_hwsim"` as I might have assumed. My next step is to dive into the source code and examine the definition of `hwsim_genl_family` to confirm the exact name and registration details. That's where I'll find the answer to why `GETFAMILY` might have failed.
|
| 116/4 |
2026/09/07 07:23 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:hwsim_genl_family]
Results: map[SourceCode:7147: static struct genl_family hwsim_genl_family __ro_after_init = {
7148: .name = "MAC80211_HWSIM",
7149: .version = 1,
7150: .maxattr = HWSIM_ATTR_MAX,
7151: .policy = hwsim_genl_policy,
7152: .netnsok = true,
7153: .module = THIS_MODULE,
7154: .small_ops = hwsim_ops,
7155: .n_small_ops = ARRAY_SIZE(hwsim_ops),
7156: .resv_start_op = HWSIM_CMD_REPORT_PMSR + 1, // match with __HWSIM_CMD_MAX
7157: .mcgrps = hwsim_mcgrps,
7158: .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
7159: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 117/4 |
2026/09/07 07:23 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 44726
output: 60
thoughts: 847
Thoughts: **My Thought Process Regarding the MAC80211_HWSIM Issue**
Ah, I've been scrutinizing this probe output and it seems the core of the problem lies with case sensitivity. The family name is clearly defined as `"MAC80211_HWSIM"` (all uppercase), yet the probe is attempting to use `"mac80211_hwsim"` (lowercase). I can see this explicitly in the `sendto` call: the hex string `\x6d\x61\x63\x38\x30\x32\x31\x31\x5f\x68\x77\x73\x69\x6d` decodes directly to `"mac80211_hwsim"`. This mismatch in casing is almost certainly why the probe failed.
Now, I'm considering whether the `mac80211_hwsim` module itself needs to be loaded. If it's a loadable module, then simply correcting the case in the probe won't be enough; we'll need to ensure it's actually present. If it's built directly into the kernel, it's already there. My initial thought is to simply instruct the agent to use the correct uppercase name, `"MAC80211_HWSIM"`.
However, I need to be pragmatic. Even if I fix the name, if `mac80211_hwsim` is a module, it might not be loaded. So, I'm thinking about how to address this. I should check the typical syzkaller kernel configurations. In many cases, `CONFIG_MAC80211_HWSIM` is enabled with `y`, meaning it's built-in. But to be absolutely safe, I should consider advising the agent to use the correct uppercase name *and* concurrently attempt to load the module using `system("modprobe mac80211_hwsim")`. This way, I cover both possibilities: it's either built-in and the name fix will work, or it's a module and `modprobe` will bring it in.
Looking further at the bug report, I see references to `mac80211_hwsim_write_tsf` and `mac80211_hwsim_get_tx_rate` within `drivers/net/wireless/virtual/mac80211_hwsim_main.c`. This reinforces my understanding that the `mac80211_hwsim` component is indeed the one we're interacting with, and its naming convention is crucial. My focus remains on ensuring the correct identification and potential loading of this module.
|
| 118/4 |
2026/09/07 07:24 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_get_tx_rate]
Results: map[SourceCode:1327: static struct ieee80211_rate *
1328: mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
1329: struct ieee80211_tx_info *info)
1330: {
1331: if (info->control.rates[0].flags &
1332: (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
1333: return NULL;
1334:
1335: return ieee80211_get_tx_rate(hw, info);
1336: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 119/4 |
2026/09/07 07:24 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 45851
output: 49
thoughts: 16
Thoughts: **My Deep Dive into `ieee80211_get_tx_rate`**
Okay, so I'm tracing the flow, and it leads me to this function: `ieee80211_get_tx_rate`. This immediately tells me I'm in the heart of the Wi-Fi transmission rate selection logic. My immediate thought is, "This is where the magic happens – the dynamic adaptation to the wireless environment."
I expect this function to be critical for performance. It's not just about picking *a* rate; it's about picking the *optimal* rate at any given moment. This means it's likely to be influenced by a whole host of factors I need to consider. What are those factors?
First, I'll be looking for how it assesses the *current channel conditions*. This is paramount. Is the signal strength good or bad? Is there a lot of noise or interference? This will involve looking at metrics like Received Signal Strength Indicator (RSSI), Signal-to-Noise Ratio (SNR), and potentially even estimates of packet error rate (PER) or Channel Quality Indicator (CQI) if they're available at this stage.
Then, I need to understand *how it uses historical data*. The system doesn't operate in a vacuum. It has learned from past transmissions. So, I'll be searching for mechanisms that track successful transmissions, retransmissions, and their associated rates. This is where the adaptive part comes in – if a certain rate consistently fails, the algorithm should learn to avoid it. Conversely, if a higher rate proves reliable, it should be favored.
Furthermore, I'm going to be scrutinizing the *algorithms employed*. Is it a simple lookup table based on signal strength? Or something more sophisticated like a rate control algorithm (e.g., Minstrel, ARF, RRAA)? I'm particularly interested in the decision-making process: what are the thresholds? What are the penalties for choosing a rate that's too high (leading to excessive retransmissions) versus too low (leading to throughput limitations)?
I also need to consider *the context of the connection itself*. What is the capabilities of the client device? Not all clients support the same set of rates or modulation schemes. The AP needs to know this to avoid sending frames at a rate the client can't decode. So, I'll be checking if this function consults the client's advertised capabilities.
And what about *network congestion*? While `ieee80211_get_tx_rate` is primarily about physical layer (PHY) adaptation, it's not entirely divorced from the MAC layer. If the transmission queue is building up, it might indirectly influence the decision, though this is less likely to be the *primary* driver compared to channel conditions.
Finally, I'll be thinking about *edge cases and robustness*. What happens during initial association? What happens if conditions change drastically and rapidly? Does the algorithm have a fallback mechanism? Does it avoid "sticky" states where it gets stuck on a suboptimal rate?
In essence, when I land on `ieee80211_get_tx_rate`, my mind is already whirring with these questions, preparing to dissect the code to understand how it intelligently navigates the complex and ever-changing Wi-Fi landscape to maximize throughput and reliability.
|
| 120/4 |
2026/09/07 07:24 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/net/mac80211.h Name:ieee80211_get_tx_rate]
Results: map[SourceCode:3409: static inline struct ieee80211_rate *
3410: ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
3411: const struct ieee80211_tx_info *c)
3412: {
3413: if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
3414: return NULL;
3415:
3416: if (c->band >= NUM_NL80211_BANDS)
3417: return NULL;
3418:
3419: return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
3420: }
SourceFile:include/net/mac80211.h]
|
| 121/4 |
2026/09/07 07:24 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 46147
output: 59
thoughts: 108
Thoughts: **My Thought Process Regarding the `WARN_ON_ONCE` in `mac80211_hwsim_write_tsf`**
Alright, I've encountered this `WARN_ON_ONCE(c->control.rates[0].idx < 0)` warning. My immediate interpretation is that the `idx` field within the first rate control structure, `c->control.rates[0]`, is unexpectedly negative.
Now, the crucial question for me is: how did this `idx` get to be a negative value in the first place? I understand that `c` here is actually a pointer to a `struct ieee80211_tx_info`, which I'll be referring to as `info` from now on for clarity in my own head. So, I'm asking myself, "How could `info->control.rates[0].idx` possibly become negative?"
To answer this, my next logical step is to trace the origin of this `info` pointer. Specifically, I need to examine the `mac80211_hwsim_write_tsf` function to see precisely where and how this `info` structure is populated or passed into the relevant code path where the warning is triggered. That's where the root cause will likely lie.
|
| 122/4 |
2026/09/07 07:24 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_write_tsf]
Results: map[SourceCode:1605: static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
1606: struct sk_buff *skb, u64 sim_time)
1607: {
1608: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1609: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1610: struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1611: struct ieee80211_rate *txrate;
1612: /* TODO: get MCS */
1613: int bitrate = 100;
1614:
1615: spin_lock_bh(&data->tsf_offset_lock);
1616:
1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
1618: if (txrate)
1619: bitrate = txrate->bitrate;
1620:
1621: if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
1622: ieee80211_is_probe_resp(hdr->frame_control)) {
1623: mgmt->u.probe_resp.timestamp =
1624: cpu_to_le64(sim_time + data->tsf_offset +
1625: 24 * 8 * 10 / bitrate);
1626: } else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
1627: ieee80211_is_beacon(mgmt->frame_control)) {
1628: mgmt->u.beacon.timestamp = cpu_to_le64(sim_time +
1629: data->tsf_offset +
1630: 24 * 8 * 10 /
1631: bitrate);
1632: } else if (skb->len >= offsetofend(struct ieee80211_ext,
1633: u.s1g_beacon.timestamp) &&
1634: ieee80211_is_s1g_beacon(mgmt->frame_control)) {
1635: struct ieee80211_ext *ext = (void *)mgmt;
1636:
1637: ext->u.s1g_beacon.timestamp = cpu_to_le32(sim_time +
1638: data->tsf_offset +
1639: 10 * 8 * 10 /
1640: bitrate);
1641: }
1642:
1643: spin_unlock_bh(&data->tsf_offset_lock);
1644: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 123/4 |
2026/09/07 07:24 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 47156
output: 50
thoughts: 556
Thoughts: **My Thought Process on Investigating a Packet Transmission from an `AF_PACKET` Monitor Interface**
Alright, I'm looking at this call trace, and my immediate thought is, "Okay, someone's pushing a packet out. Where is it coming from, and how is it being handled?" The trace itself gives me a clear path:
`mac80211_hwsim_tx_frame_no_nl` -> `mac80211_hwsim_tx` -> `ieee80211_tx_frags` -> `__ieee80211_tx` -> `ieee80211_tx` -> `ieee80211_monitor_start_xmit` -> ... -> `packet_snd` -> `packet_sendmsg`
What immediately jumps out at me is the very beginning of the user-space interaction: `packet_snd` and `packet_sendmsg`. This tells me that the packet's journey started from the user space, specifically via an `AF_PACKET` socket. This is a common mechanism for applications to interact directly with network devices, especially for raw packet manipulation.
The next crucial piece of information is the presence of `ieee80211_monitor_start_xmit`. The function name itself is highly suggestive. It implies that this transmission is occurring on a Wi-Fi interface that's configured in monitor mode. Monitor mode is designed for passive packet capturing and analysis, not typically for sending arbitrary frames. This raises a flag: why would a packet be *sent* from a monitor interface? This is a bit unusual, and my immediate thought is that this might be for testing, debugging, or perhaps a very specific application scenario where the user needs to craft and inject frames.
The `mac80211_hwsim` functions at the top of the trace point towards the virtual Wi-Fi hardware simulation module. This further reinforces the idea that this isn't a typical real-world hardware transmission but rather a controlled environment, likely for development or testing purposes. The `hwsim` driver is designed to mimic the behavior of a real Wi-Fi device, and in this context, it's facilitating the transmission of frames originating from user space through the `mac80211` stack.
So, to summarize my initial thought process: I see a packet originating from user space via `AF_PACKET`. It's being processed by the `mac80211` Wi-Fi driver stack. The critical observation is that it's traversing a path that leads to `ieee80211_monitor_start_xmit`, indicating an attempt to send a packet *from* a monitor interface, which is an atypical use case for monitor mode. The `hwsim` driver presence suggests this is within a simulated environment, likely for testing or development. My next logical step would be to delve into the implementation of `ieee80211_monitor_start_xmit` to understand precisely *how* it's handling this unexpected transmission request and what implications it might have.
|
| 124/4 |
2026/09/07 07:24 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_monitor_start_xmit]
Results: map[SourceCode:2324: netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2325: struct net_device *dev)
2326: {
2327: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2328: struct ieee80211_chanctx_conf *chanctx_conf;
2329: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2330: struct ieee80211_hdr *hdr;
2331: struct ieee80211_sub_if_data *tmp_sdata, *sdata;
2332: struct cfg80211_chan_def *chandef;
2333: u16 len_rthdr;
2334: int hdrlen;
2335:
2336: sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2337: if (unlikely(!ieee80211_sdata_running(sdata)))
2338: goto fail;
2339:
2340: memset(info, 0, sizeof(*info));
2341: info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
2342: IEEE80211_TX_CTL_INJECTED;
2343:
2344: /* Sanity-check the length of the radiotap header */
2345: if (!ieee80211_validate_radiotap_len(skb))
2346: goto fail;
2347:
2348: /* we now know there is a radiotap header with a length we can use */
2349: len_rthdr = ieee80211_get_radiotap_len(skb->data);
2350:
2351: /*
2352: * fix up the pointers accounting for the radiotap
2353: * header still being in there. We are being given
2354: * a precooked IEEE80211 header so no need for
2355: * normal processing
2356: */
2357: skb_set_mac_header(skb, len_rthdr);
2358: /*
2359: * these are just fixed to the end of the rt area since we
2360: * don't have any better information and at this point, nobody cares
2361: */
2362: skb_set_network_header(skb, len_rthdr);
2363: skb_set_transport_header(skb, len_rthdr);
2364:
2365: if (skb->len < len_rthdr + 2)
2366: goto fail;
2367:
2368: hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
2369: hdrlen = ieee80211_hdrlen(hdr->frame_control);
2370:
2371: if (skb->len < len_rthdr + hdrlen)
2372: goto fail;
2373:
2374: /*
2375: * Initialize skb->protocol if the injected frame is a data frame
2376: * carrying a rfc1042 header
2377: */
2378: if (ieee80211_is_data(hdr->frame_control) &&
2379: skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) {
2380: u8 *payload = (u8 *)hdr + hdrlen;
2381:
2382: if (ether_addr_equal(payload, rfc1042_header))
2383: skb->protocol = cpu_to_be16((payload[6] << 8) |
2384: payload[7]);
2385: }
2386:
2387: rcu_read_lock();
2388:
2389: /*
2390: * We process outgoing injected frames that have a local address
2391: * we handle as though they are non-injected frames.
2392: * This code here isn't entirely correct, the local MAC address
2393: * isn't always enough to find the interface to use; for proper
2394: * VLAN support we have an nl80211-based mechanism.
2395: *
2396: * This is necessary, for example, for old hostapd versions that
2397: * don't use nl80211-based management TX/RX.
2398: */
2399: list_for_each_entry_rcu(tmp_sdata, &local->interfaces, list) {
2400: if (!ieee80211_sdata_running(tmp_sdata))
2401: continue;
2402: if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2403: tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2404: continue;
2405: if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) {
2406: sdata = tmp_sdata;
2407: break;
2408: }
2409: }
2410:
2411: chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
2412: if (!chanctx_conf) {
2413: tmp_sdata = rcu_dereference(local->monitor_sdata);
2414: if (tmp_sdata)
2415: chanctx_conf =
2416: rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf);
2417: }
2418:
2419: if (!chanctx_conf) {
2420: struct ieee80211_chanctx *ctx;
2421: bool first = true;
2422:
2423: list_for_each_entry_rcu(ctx, &local->chanctx_list, list) {
2424: if (!first)
2425: goto fail_rcu;
2426: chanctx_conf = &ctx->conf;
2427: first = false;
2428: }
2429: }
2430:
2431: if (chanctx_conf)
2432: chandef = &chanctx_conf->def;
2433: else
2434: goto fail_rcu;
2435:
2436: /*
2437: * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still
2438: * shouldn't transmit on disabled channels.
2439: */
2440: if (!cfg80211_chandef_usable(local->hw.wiphy, chandef,
2441: IEEE80211_CHAN_DISABLED))
2442: goto fail_rcu;
2443:
2444: /*
2445: * Frame injection is not allowed if beaconing is not allowed
2446: * or if we need radar detection. Beaconing is usually not allowed when
2447: * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
2448: * Passive scan is also used in world regulatory domains where
2449: * your country is not known and as such it should be treated as
2450: * NO TX unless the channel is explicitly allowed in which case
2451: * your current regulatory domain would not have the passive scan
2452: * flag.
2453: *
2454: * Since AP mode uses monitor interfaces to inject/TX management
2455: * frames we can make AP mode the exception to this rule once it
2456: * supports radar detection as its implementation can deal with
2457: * radar detection by itself. We can do that later by adding a
2458: * monitor flag interfaces used for AP support.
2459: */
2460: if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
2461: sdata->vif.type))
2462: goto fail_rcu;
2463:
2464: info->band = chandef->chan->band;
2465:
2466: /* Initialize skb->priority according to frame type and TID class,
2467: * with respect to the sub interface that the frame will actually
2468: * be transmitted on. If the DONT_REORDER flag is set, the original
2469: * skb-priority is preserved to assure frames injected with this
2470: * flag are not reordered relative to each other.
2471: */
2472: ieee80211_select_queue_80211(sdata, skb, hdr);
2473: skb_set_queue_mapping(skb, ieee80211_ac_from_tid(skb->priority));
2474:
2475: /*
2476: * Process the radiotap header. This will now take into account the
2477: * selected chandef above to accurately set injection rates and
2478: * retransmissions.
2479: */
2480: if (!ieee80211_parse_tx_radiotap(skb, dev))
2481: goto fail_rcu;
2482:
2483: /* remove the injection radiotap header */
2484: skb_pull(skb, len_rthdr);
2485:
2486: ieee80211_xmit(sdata, NULL, skb);
2487: rcu_read_unlock();
2488:
2489: return NETDEV_TX_OK;
2490:
2491: fail_rcu:
2492: rcu_read_unlock();
2493: fail:
2494: dev_kfree_skb(skb);
2495: return NETDEV_TX_OK; /* meaning, we dealt with the skb */
2496: }
SourceFile:net/mac80211/tx.c]
|
| 125/4 |
2026/09/07 07:24 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 50702
output: 51
thoughts: 64
Thoughts: **My Thought Process on `ieee80211_monitor_start_xmit` and `ieee80211_parse_tx_radiotap`**
Okay, so I'm diving into the `ieee80211_monitor_start_xmit` function, and right off the bat, I see this call to `ieee80211_parse_tx_radiotap(skb, dev)`. This immediately flags itself as a critical step. My understanding is that `ieee80211_monitor_start_xmit` is where the kernel's 802.11 driver logic for transmitting packets in monitor mode gets initiated. Given that, the parsing of Radiotap headers is absolutely essential for constructing the correct frame that will eventually be sent out onto the air. Radiotap, for me, is the standard mechanism for injecting metadata into monitor mode frames, and it dictates a lot of the low-level transmission parameters – things like channel, power, antenna selection, and other flags that are crucial for a successful and properly characterized transmission.
Therefore, my immediate next step, as a seasoned expert in this domain, is to thoroughly examine the `ieee80211_parse_tx_radiotap` function itself. I need to understand *precisely* how it's processing the `skb` (which represents the network packet buffer) and the `dev` (the network device). I'm looking for:
* **Input Validation:** What checks are performed on the incoming `skb` to ensure it's a valid candidate for transmission, especially with respect to the Radiotap header?
* **Radiotap Field Extraction:** Which specific Radiotap fields are being parsed? How are they mapped to the driver's internal structures or device capabilities? Are there common fields like `IEEE80211_RADIOTAP_CHANNEL`, `IEEE80211_RADIOTAP_TX_POWER`, or `IEEE80211_RADIOTAP_FLAGS` that are being prioritized?
* **Error Handling:** What happens if the Radiotap header is malformed, incomplete, or contains values that are out of bounds for the specific hardware (`dev`)? How are these errors propagated or handled to prevent misconfiguration or transmission failures?
* **Metadata Application:** How is the parsed Radiotap information ultimately applied to the packet's transmission parameters? Does it directly configure hardware registers, set internal driver flags, or influence the generation of the actual 802.11 MAC frame?
* **Interaction with `dev`:** The presence of `dev` as an argument is significant. It suggests that the parsing process is not purely generic but is also taking into account the capabilities and configuration of the specific wireless device. I'll be keen to see how the function uses `dev` to validate Radiotap parameters or to select appropriate transmission settings.
Essentially, I'm thinking about this as the bridge between user-space directives (or higher-level kernel modules) that want to craft specific monitor mode transmissions, and the actual hardware's ability to execute them. `ieee80211_parse_tx_radiotap` is where that translation happens, and getting it right is paramount for reliable and precise packet injection in monitor mode.
|
| 126/4 |
2026/09/07 07:25 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_parse_tx_radiotap]
Results: map[SourceCode:2106: bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
2107: struct net_device *dev)
2108: {
2109: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2110: struct ieee80211_radiotap_iterator iterator;
2111: struct ieee80211_radiotap_header *rthdr =
2112: (struct ieee80211_radiotap_header *) skb->data;
2113: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2114: int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
2115: NULL);
2116: u16 txflags;
2117: u16 rate = 0;
2118: bool rate_found = false;
2119: u8 rate_retries = 0;
2120: u16 rate_flags = 0;
2121: u8 mcs_known, mcs_flags, mcs_bw;
2122: u16 vht_known;
2123: u8 vht_mcs = 0, vht_nss = 0;
2124: int i;
2125:
2126: if (!ieee80211_validate_radiotap_len(skb))
2127: return false;
2128:
2129: info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
2130: IEEE80211_TX_CTL_DONTFRAG;
2131:
2132: /*
2133: * for every radiotap entry that is present
2134: * (ieee80211_radiotap_iterator_next returns -ENOENT when no more
2135: * entries present, or -EINVAL on error)
2136: */
2137:
2138: while (!ret) {
2139: ret = ieee80211_radiotap_iterator_next(&iterator);
2140:
2141: if (ret)
2142: continue;
2143:
2144: /* see if this argument is something we can use */
2145: switch (iterator.this_arg_index) {
2146: /*
2147: * You must take care when dereferencing iterator.this_arg
2148: * for multibyte types... the pointer is not aligned. Use
2149: * get_unaligned((type *)iterator.this_arg) to dereference
2150: * iterator.this_arg for type "type" safely on all arches.
2151: */
2152: case IEEE80211_RADIOTAP_FLAGS:
2153: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
2154: /*
2155: * this indicates that the skb we have been
2156: * handed has the 32-bit FCS CRC at the end...
2157: * we should react to that by snipping it off
2158: * because it will be recomputed and added
2159: * on transmission
2160: */
2161: if (skb->len < (iterator._max_length + FCS_LEN))
2162: return false;
2163:
2164: skb_trim(skb, skb->len - FCS_LEN);
2165: }
2166: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
2167: info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
2168: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
2169: info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
2170: break;
2171:
2172: case IEEE80211_RADIOTAP_TX_FLAGS:
2173: txflags = get_unaligned_le16(iterator.this_arg);
2174: if (txflags & IEEE80211_RADIOTAP_F_TX_NOACK)
2175: info->flags |= IEEE80211_TX_CTL_NO_ACK;
2176: if (txflags & IEEE80211_RADIOTAP_F_TX_NOSEQNO)
2177: info->control.flags |= IEEE80211_TX_CTRL_NO_SEQNO;
2178: if (txflags & IEEE80211_RADIOTAP_F_TX_ORDER)
2179: info->control.flags |=
2180: IEEE80211_TX_CTRL_DONT_REORDER;
2181: break;
2182:
2183: case IEEE80211_RADIOTAP_RATE:
2184: rate = *iterator.this_arg;
2185: rate_flags = 0;
2186: rate_found = true;
2187: break;
2188:
2189: case IEEE80211_RADIOTAP_ANTENNA:
2190: /* this can appear multiple times, keep a bitmap */
2191: /* control.antennas is only a 2-bit bitmap */
2192: if (*iterator.this_arg < 2)
2193: info->control.antennas |= BIT(*iterator.this_arg);
2194: break;
2195:
2196: case IEEE80211_RADIOTAP_DATA_RETRIES:
2197: rate_retries = *iterator.this_arg;
2198: break;
2199:
2200: case IEEE80211_RADIOTAP_MCS:
2201: mcs_known = iterator.this_arg[0];
2202: mcs_flags = iterator.this_arg[1];
2203: if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
2204: break;
2205:
2206: rate_found = true;
2207: rate = iterator.this_arg[2];
2208: rate_flags = IEEE80211_TX_RC_MCS;
2209:
2210: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
2211: mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
2212: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2213:
2214: mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
2215: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
2216: mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
2217: rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
2218:
2219: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC &&
2220: mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC)
2221: info->flags |= IEEE80211_TX_CTL_LDPC;
2222:
2223: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
2224: u8 stbc = u8_get_bits(mcs_flags,
2225: IEEE80211_RADIOTAP_MCS_STBC_MASK);
2226:
2227: info->flags |=
2228: u32_encode_bits(stbc,
2229: IEEE80211_TX_CTL_STBC);
2230: }
2231: break;
2232:
2233: case IEEE80211_RADIOTAP_VHT:
2234: vht_known = get_unaligned_le16(iterator.this_arg);
2235: rate_found = true;
2236:
2237: rate_flags = IEEE80211_TX_RC_VHT_MCS;
2238: if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
2239: (iterator.this_arg[2] &
2240: IEEE80211_RADIOTAP_VHT_FLAG_SGI))
2241: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2242: if (vht_known &
2243: IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
2244: if (iterator.this_arg[3] == 1)
2245: rate_flags |=
2246: IEEE80211_TX_RC_40_MHZ_WIDTH;
2247: else if (iterator.this_arg[3] == 4)
2248: rate_flags |=
2249: IEEE80211_TX_RC_80_MHZ_WIDTH;
2250: else if (iterator.this_arg[3] == 11)
2251: rate_flags |=
2252: IEEE80211_TX_RC_160_MHZ_WIDTH;
2253: }
2254:
2255: vht_mcs = iterator.this_arg[4] >> 4;
2256: if (vht_mcs > 11)
2257: vht_mcs = 0;
2258: vht_nss = iterator.this_arg[4] & 0xF;
2259: if (!vht_nss || vht_nss > 8)
2260: vht_nss = 1;
2261: break;
2262:
2263: /*
2264: * Please update the file
2265: * Documentation/networking/mac80211-injection.rst
2266: * when parsing new fields here.
2267: */
2268:
2269: default:
2270: break;
2271: }
2272: }
2273:
2274: if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
2275: return false;
2276:
2277: if (rate_found) {
2278: struct ieee80211_supported_band *sband =
2279: local->hw.wiphy->bands[info->band];
2280:
2281: info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
2282:
2283: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
2284: info->control.rates[i].idx = -1;
2285: info->control.rates[i].flags = 0;
2286: info->control.rates[i].count = 0;
2287: }
2288:
2289: if (rate_flags & IEEE80211_TX_RC_MCS) {
2290: /* reset antennas if not enough */
2291: if (IEEE80211_HT_MCS_CHAINS(rate) >
2292: hweight8(info->control.antennas))
2293: info->control.antennas = 0;
2294:
2295: info->control.rates[0].idx = rate;
2296: } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
2297: /* reset antennas if not enough */
2298: if (vht_nss > hweight8(info->control.antennas))
2299: info->control.antennas = 0;
2300:
2301: ieee80211_rate_set_vht(info->control.rates, vht_mcs,
2302: vht_nss);
2303: } else if (sband) {
2304: for (i = 0; i < sband->n_bitrates; i++) {
2305: if (rate * 5 != sband->bitrates[i].bitrate)
2306: continue;
2307:
2308: info->control.rates[0].idx = i;
2309: break;
2310: }
2311: }
2312:
2313: if (info->control.rates[0].idx < 0)
2314: info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
2315:
2316: info->control.rates[0].flags = rate_flags;
2317: info->control.rates[0].count = min_t(u8, rate_retries + 1,
2318: local->hw.max_rate_tries);
2319: }
2320:
2321: return true;
2322: }
SourceFile:net/mac80211/tx.c]
|
| 127/4 |
2026/09/07 07:25 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 54670
output: 53
thoughts: 3492
Thoughts: **A Deep Dive into a Potential mac80211_hwsim Rate Injection Bug**
I've been analyzing a fascinating piece of code related to rate injection in `mac80211_hwsim`, and I've uncovered a situation that I believe leads to a warning in `ieee80211_get_tx_rate` within the `mac80211_hwsim_write_tsf` function. My thought process has been a journey of stepping through the logic, identifying potential inconsistencies, and tracing the execution flow.
It starts with the `if (rate_found)` block. Here, a specific transmission rate is being prepared for injection into the `info->control.rates` structure. The code initializes an array of rate entries, setting their index to -1, flags to 0, and count to 0. Then, it attempts to populate `info->control.rates[0]` based on whether the `rate_flags` indicate an MCS rate, a VHT MCS rate, or a legacy rate.
My first point of concern arises when `info->control.rates[0].idx < 0`. The code correctly unsets the `IEEE80211_TX_CTRL_RATE_INJECT` flag, which is a sensible action to indicate that rate injection isn't fully successful. However, what's striking is that it leaves `info->control.rates[0].idx` still set to `-1`. This seems like a potential inconsistency.
This leads me to trace the subsequent execution. I see that `mac80211_hwsim_write_tsf` is called, and this function, in turn, calls `mac80211_hwsim_get_tx_rate`. Now, `mac80211_hwsim_get_tx_rate` has a crucial check:
```c
if (info->control.rates[0].flags &
(IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
return NULL;
return ieee80211_get_tx_rate(hw, info);
```
This means that if the flags *don't* indicate MCS or VHT MCS (i.e., it's a legacy rate), it proceeds to call `ieee80211_get_tx_rate`. And importantly, `ieee80211_get_tx_rate` has its own safeguard:
```c
if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
return NULL;
```
Here's where my alarm bells ring. If the rate injection failed (resulting in `info->control.rates[0].idx` being `-1`), and the rate was not an MCS/VHT MCS rate, `mac80211_hwsim_get_tx_rate` will call `ieee80211_get_tx_rate`, which will then hit the `WARN_ON_ONCE`.
Let's backtrack to how `info->control.rates[0].idx` might end up as `-1` in this specific scenario. If `rate_flags` is not `IEEE80211_TX_RC_MCS` or `IEEE80211_TX_RC_VHT_MCS` (meaning it's a legacy rate) and `sband` is present, the code iterates through `sband->bitrates`. If `rate * 5` does not match any `sband->bitrates[i].bitrate`, then `info->control.rates[0].idx` remains `-1`. Despite the `IEEE80211_TX_CTRL_RATE_INJECT` flag being cleared, `info->control.rates[0].idx` is still `-1`.
The critical observation is that `mac80211_hwsim_write_tsf` calls `mac80211_hwsim_get_tx_rate(data->hw, info)` *unconditionally*, without checking the `IEEE80211_TX_CTRL_RATE_INJECT` flag. This means that even if rate injection failed and the flag was cleared, the function will still attempt to get a TX rate, potentially leading to the warning if `info->control.rates[0].idx` is indeed `-1`.
My current understanding is that the bug is triggered by injecting a packet on a monitor interface using `mac80211_hwsim`. Specifically, it occurs when a radiotap header with the `IEEE80211_RADIOTAP_RATE` field is present, but the specified rate value doesn't correspond to any of the supported legacy rates in the `sband`. This leads `ieee80211_parse_tx_radiotap` (or similar logic) to set `info->control.rates[0].idx` to `-1`. Subsequently, `mac80211_hwsim_write_tsf` calls `mac80211_hwsim_get_tx_rate`, which then triggers the `WARN_ON_ONCE` in `ieee80211_get_tx_rate`.
Therefore, to reproduce this, I believe we need:
1. The `mac80211_hwsim` module loaded.
2. A monitor interface created on one of the `mac80211_hwsim` radios.
3. A raw packet injected via an `AF_PACKET` socket bound to this monitor interface.
4. This packet must contain a radiotap header with `IEEE80211_RADIOTAP_RATE` set, and the rate value itself must be invalid (not matching any supported legacy rate).
The agent's probe failing with `-ENOENT` for `mac80211_hwsim` suggests the module wasn't loaded. The family name, "MAC80211_HWSIM" (uppercase), is also a detail to be mindful of. Crucially, I believe the `MAC80211_HWSIM` netlink family itself might not be strictly necessary to *trigger* the bug; rather, it's the existence of `mac80211_hwsim` radios and the ability to create a monitor interface on them that is key. Then, using `nl80211` to create a monitor interface and `AF_PACKET` to inject a malformed radiotap packet is the path to reproduction.
|
| 128/4 |
2026/09/07 07:25 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/radiotap.c Name:ieee80211_radiotap_iterator_next]
Results: map[SourceCode: 204: int ieee80211_radiotap_iterator_next(
205: struct ieee80211_radiotap_iterator *iterator)
206: {
207: while (1) {
208: int hit = 0;
209: int pad, align, size, subns;
210: uint32_t oui;
211:
212: /* if no more EXT bits, that's it */
213: if ((iterator->_arg_index % 32) == IEEE80211_RADIOTAP_EXT &&
214: !(iterator->_bitmap_shifter & 1))
215: return -ENOENT;
216:
217: if (!(iterator->_bitmap_shifter & 1))
218: goto next_entry; /* arg not present */
219:
220: /* get alignment/size of data */
221: switch (iterator->_arg_index % 32) {
222: case IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE:
223: case IEEE80211_RADIOTAP_EXT:
224: align = 1;
225: size = 0;
226: break;
227: case IEEE80211_RADIOTAP_VENDOR_NAMESPACE:
228: align = 2;
229: size = 6;
230: break;
231: default:
232: if (!iterator->current_namespace ||
233: iterator->_arg_index >= iterator->current_namespace->n_bits) {
234: align = 0;
235: } else {
236: align = iterator->current_namespace->align_size[iterator->_arg_index].align;
237: size = iterator->current_namespace->align_size[iterator->_arg_index].size;
238: }
239: if (!align) {
240: if (iterator->current_namespace == &radiotap_ns)
241: return -ENOENT;
242: /* skip all subsequent data */
243: iterator->_arg = iterator->_next_ns_data;
244: /* give up on this namespace */
245: iterator->current_namespace = NULL;
246: goto next_entry;
247: }
248: break;
249: }
250:
251: /*
252: * arg is present, account for alignment padding
253: *
254: * Note that these alignments are relative to the start
255: * of the radiotap header. There is no guarantee
256: * that the radiotap header itself is aligned on any
257: * kind of boundary.
258: *
259: * The above is why get_unaligned() is used to dereference
260: * multibyte elements from the radiotap area.
261: */
262:
263: pad = ((unsigned long)iterator->_arg -
264: (unsigned long)iterator->_rtheader) & (align - 1);
265:
266: if (pad)
267: iterator->_arg += align - pad;
268:
269: if (iterator->_arg_index % 32 == IEEE80211_RADIOTAP_VENDOR_NAMESPACE) {
270: int vnslen;
271:
272: if ((unsigned long)iterator->_arg + size -
273: (unsigned long)iterator->_rtheader >
274: (unsigned long)iterator->_max_length)
275: return -EINVAL;
276:
277: oui = (*iterator->_arg << 16) |
278: (*(iterator->_arg + 1) << 8) |
279: *(iterator->_arg + 2);
280: subns = *(iterator->_arg + 3);
281:
282: find_ns(iterator, oui, subns);
283:
284: vnslen = get_unaligned_le16(iterator->_arg + 4);
285: iterator->_next_ns_data = iterator->_arg + size + vnslen;
286: if (!iterator->current_namespace)
287: size += vnslen;
288: }
289:
290: /*
291: * this is what we will return to user, but we need to
292: * move on first so next call has something fresh to test
293: */
294: iterator->this_arg_index = iterator->_arg_index;
295: iterator->this_arg = iterator->_arg;
296: iterator->this_arg_size = size;
297:
298: /* internally move on the size of this arg */
299: iterator->_arg += size;
300:
301: /*
302: * check for insanity where we are given a bitmap that
303: * claims to have more arg content than the length of the
304: * radiotap section. We will normally end up equalling this
305: * max_length on the last arg, never exceeding it.
306: */
307:
308: if ((unsigned long)iterator->_arg -
309: (unsigned long)iterator->_rtheader >
310: (unsigned long)iterator->_max_length)
311: return -EINVAL;
312:
313: /* these special ones are valid in each bitmap word */
314: switch (iterator->_arg_index % 32) {
315: case IEEE80211_RADIOTAP_VENDOR_NAMESPACE:
316: iterator->_reset_on_ext = 1;
317:
318: iterator->is_radiotap_ns = 0;
319: /*
320: * If parser didn't register this vendor
321: * namespace with us, allow it to show it
322: * as 'raw. Do do that, set argument index
323: * to vendor namespace.
324: */
325: iterator->this_arg_index =
326: IEEE80211_RADIOTAP_VENDOR_NAMESPACE;
327: if (!iterator->current_namespace)
328: hit = 1;
329: goto next_entry;
330: case IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE:
331: iterator->_reset_on_ext = 1;
332: iterator->current_namespace = &radiotap_ns;
333: iterator->is_radiotap_ns = 1;
334: goto next_entry;
335: case IEEE80211_RADIOTAP_EXT:
336: /*
337: * bit 31 was set, there is more
338: * -- move to next u32 bitmap
339: */
340: iterator->_bitmap_shifter =
341: get_unaligned_le32(iterator->_next_bitmap);
342: iterator->_next_bitmap++;
343: if (iterator->_reset_on_ext)
344: iterator->_arg_index = 0;
345: else
346: iterator->_arg_index++;
347: iterator->_reset_on_ext = 0;
348: break;
349: default:
350: /* we've got a hit! */
351: hit = 1;
352: next_entry:
353: iterator->_bitmap_shifter >>= 1;
354: iterator->_arg_index++;
355: }
356:
357: /* if we found a valid arg earlier, return it now */
358: if (hit)
359: return 0;
360: }
361: }
SourceFile:net/wireless/radiotap.c]
|
| 129/4 |
2026/09/07 07:25 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 60541
output: 58
thoughts: 3182
Thoughts: **Summary of Thought Process Regarding `mac80211_hwsim` Bug Reproduction**
**The Core of the Problem: Unexpected Warning**
I've been investigating a warning that's being triggered within the `mac80211_hwsim` module. My goal is to reliably reproduce this warning, which seems to stem from an issue with how transmit rates are handled when injecting packets.
**Initial Investigation of the Warning Trigger**
The warning itself is `WARN_ON_ONCE(c->control.rates[0].idx < 0)`. This clearly indicates that the `idx` field in the `rates` control structure is expected to be non-negative, but it's somehow ending up as -1.
I traced this back to the `mac80211_hwsim_write_tsf` function. It unconditionally calls `mac80211_hwsim_get_tx_rate(data->hw, info)`, and it's within `mac80211_hwsim_get_tx_rate` that `info->control.rates[0].idx` is checked.
**The Radiotap Header is Key**
My understanding is that `info->control.rates` is populated by parsing a radiotap header, specifically the `IEEE80211_RADIOTAP_RATE` field. I noted that `IEEE80211_RADIOTAP_RATE` corresponds to bit 2 in the `it_present` field of the radiotap header.
I constructed a hypothetical radiotap header for this scenario:
```c
struct {
u8 it_version; // 0
u8 it_pad; // 0
u16 it_len; // 9 (calculated based on fields)
u32 it_present; // 1 << 2 (only RATE is set)
u8 rate; // 0 (or any invalid rate)
}
```
This specific structure, with `it_len` as 9 bytes and `it_present` only having bit 2 set, is what I believe is the trigger. The crucial part is that the `rate` field, when it's supposed to be parsed and translated into `info->control.rates[0].idx`, is not found to be valid within the supported rates.
**The Role of `ieee80211_parse_tx_radiotap`**
I examined `ieee80211_parse_tx_radiotap`. The function initializes `info->control.rates[i].idx` to -1 for all rate entries. If it finds a valid rate from the radiotap header and successfully maps it to a supported rate in the `sband->bitrates`, it updates `idx` to the correct index. However, if the `IEEE80211_RADIOTAP_RATE` is present but the provided rate value doesn't correspond to any supported rate, it leaves `idx` as -1. This is precisely the condition that leads to the warning.
**The Need for a Valid 802.11 Header**
Crucially, the `ieee80211_monitor_start_xmit` function checks for a valid 802.11 header *after* the radiotap header. I calculated the minimum length for this: a Data frame header is 24 bytes. So, the packet needs to have at least the radiotap header plus the 802.11 header.
**Refining the Reproduction Steps**
Based on this, I've developed a more precise set of steps to reproduce the bug:
1. **Load the Module:** Ensure the `mac80211_hwsim` module is loaded. `system("modprobe mac80211_hwsim");` is the standard way to do this. I confirmed that `modprobe` is synchronous, so the hardware should be available immediately after.
2. **Create a Monitor Interface:** Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the simulated wiphys provided by `mac80211_hwsim` (e.g., `phy0`).
3. **Bring Up the Interface:** The monitor interface needs to be brought up (`IFF_UP`). I also considered the necessity of setting a valid channel. While `mac80211_hwsim` usually defaults to a channel, to be absolutely robust, using `nl80211` to set the channel (e.g., to 2412 MHz) is a good practice, though likely not strictly necessary for this specific bug.
4. **Open a Packet Socket:** Create an `AF_PACKET` socket (type `SOCK_RAW`, protocol `ETH_P_ALL`) and bind it to the newly created monitor interface.
5. **Inject the Malformed Packet:** This is the critical step. The packet must contain:
* A **radiotap header**: This header needs to be constructed with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0). A minimal header of 9 bytes should suffice if `IEEE80211_RADIOTAP_RATE` is the only flag set.
* A **valid 802.11 MAC header**: This must immediately follow the radiotap header. A Data frame header, 24 bytes in length, is a good example. The total packet length will be at least 33 bytes (9 + 24).
**Addressing the Initial Probe Failure**
The initial probe failed. I noted that it returned `-ENOENT`, indicating the `mac80211_hwsim` module wasn't loaded or the netlink family name was incorrect. The probe specifically tried to use the netlink family `"MAC80211_HWSIM"`, but it failed to get the family ID. This suggests two possibilities:
* The module wasn't loaded.
* The family name is case-sensitive and `"MAC80211_HWSIM"` was used incorrectly.
However, I realized that the *trigger* for the bug (the warning) doesn't actually require interaction with the `MAC80211_HWSIM` netlink family itself. The bug manifests when injecting raw packets.
**Refining Feedback for the Agent**
Therefore, my feedback for the agent needs to reflect these findings:
* `ProbePassed` should be `false` because the probe exited with a non-zero status.
* The feedback should clearly explain *why* it failed (module not loaded or incorrect netlink family usage, leading to `ENOENT`).
* It should then pivot to explain that the *actual bug reproduction* doesn't rely on the `MAC80211_HWSIM` netlink family.
* The detailed reproduction steps, as outlined above, should be provided.
* I also confirmed that `mac80211_hwsim` is indeed a loadable module, so `system("modprobe mac80211_hwsim");` is the correct approach for setup.
**Final Check on Edge Cases**
I re-evaluated the condition `info->control.rates[0].idx < 0`. I confirmed that the initial zeroing of `info` sets `idx` to 0, which is valid. The `-1` only gets set if `ieee80211_parse_tx_radiotap` finds the `IEEE80211_RADIOTAP_RATE` flag but fails to validate the rate, leaving the initialized `-1` in place. This reinforces that providing an invalid rate in the radiotap header is essential.
I also revisited the `cfg80211_chandef_usable` check, concluding that while a valid channel is necessary for general operation, `mac80211_hwsim` typically provides a default channel, so explicitly setting it might not be mandatory for triggering this *specific* warning, but it's good practice for a robust reproducer.
In essence, my thought process has moved from identifying the symptom (the warning) to understanding the exact code path that causes it, determining the precise input required (a malformed radiotap header followed by a valid 802.11 header), and formulating clear, actionable steps for reproduction.
|
| 130/4 |
2026/09/07 07:26 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_add_interface]
Results: map[SourceCode:2342: static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw,
2343: struct ieee80211_vif *vif)
2344: {
2345: wiphy_dbg(hw->wiphy, "%s (type=%d mac_addr=%pM)\n",
2346: __func__, ieee80211_vif_type_p2p(vif),
2347: vif->addr);
2348: hwsim_set_magic(vif);
2349:
2350: if (vif->type != NL80211_IFTYPE_MONITOR)
2351: mac80211_hwsim_config_mac_nl(hw, vif->addr, true);
2352:
2353: vif->cab_queue = 0;
2354: vif->hw_queue[IEEE80211_AC_VO] = 0;
2355: vif->hw_queue[IEEE80211_AC_VI] = 1;
2356: vif->hw_queue[IEEE80211_AC_BE] = 2;
2357: vif->hw_queue[IEEE80211_AC_BK] = 3;
2358:
2359: return 0;
2360: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 131/4 |
2026/09/07 07:26 |
llm |
repro-oracle |
1m
Model:
Tokens:
input: 64195
output: 606
thoughts: 1875
Thoughts: **My Thought Process Regarding the `mac80211_hwsim` Bug**
Initially, I was focused on the absence of a "channel setting" within the context of a monitor interface. My understanding was that `mac80211` core generally dictates the channel, and for monitor interfaces, it might not be automatically set unless explicitly configured or inherited from the `wiphy`. I recalled that the `ieee80211_monitor_start_xmit` function explicitly looks for a `chanctx_conf`. If it can't find one, it fails. This led me to question how a monitor interface typically acquires its channel context.
My initial thoughts then turned to the usual methods of setting channels: using `NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY` with the appropriate channel attributes. An alternative seemed to be creating a standard managed interface (like `wlan0`), bringing it up to acquire a channel, and then creating a monitor interface on the same `wiphy`, expecting it to inherit that channel context. I also considered that `mac80211_hwsim` often creates multiple interfaces (`wlan0`, `wlan1`) by default, and I wondered if bringing up `wlan0` first would establish a channel context that a subsequent monitor interface could use. I concluded that a more direct approach would be to instruct the agent to explicitly set the channel for the monitor interface using `nl80211` commands, specifically to 2412 MHz (channel 1), to guarantee the presence of `chanctx_conf`.
However, my focus shifted when I realized the probe failure was related to a `-ENOENT` return, indicating the `mac80211_hwsim` module might not be loaded or there was a case sensitivity issue with the family name (which is `MAC80211_HWSIM`, not `mac80211_hwsim`). More importantly, I understood that the `MAC80211_HWSIM` netlink family wasn't actually necessary to trigger the bug I was investigating.
The core of the bug, I discovered, is a WARNING originating in `mac80211_hwsim_write_tsf`. This warning is triggered because `info->control.rates[0].idx` ends up being -1. This specific scenario arises when a packet is sent on a monitor interface with a radiotap header that includes an invalid legacy rate. The `ieee80211_parse_tx_radiotap` function initializes this `idx` to -1. If the rate provided in the radiotap header is invalid, this function fails to update `idx`, leaving it as -1. Subsequently, `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, which then leads to the warning.
To reliably reproduce this, my refined steps are:
1. Ensure the `mac80211_hwsim` module is loaded.
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` virtual Wi-Fi devices (like `phy0`).
3. Crucially, set the channel for this monitor interface using `nl80211` (e.g., `NL80211_CMD_SET_CHANNEL` to 2412 MHz). This is essential to ensure that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`, bypassing the initial issue I was concerned about.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket in raw mode (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet. This packet needs to contain:
* A radiotap header, specifically with the `it_present` field indicating the presence of `IEEE80211_RADIOTAP_RATE` (bit 2), and the `rate` field set to an invalid value, such as 0.
* Immediately following the radiotap header, a valid 802.11 MAC header. While initially I thought specific frame types might matter, I re-checked and found that `mac80211_hwsim_write_tsf` *calls* `mac80211_hwsim_get_tx_rate` *before* checking the frame type. This means a simple Data frame header is sufficient to trigger the bug, though Probe Response or Beacon frames would also work. The key is the invalid rate in the radiotap header.
I also confirmed that `mac80211_hwsim` does indeed create `phy0` and `phy1` upon module loading, so the agent can simply select a `wiphy` index and proceed. Regarding the radiotap parsing, `ieee80211_validate_radiotap_len` ensures the packet is at least the minimum length, and my planned packet length (9 bytes for radiotap + 24 bytes for 802.11 header = 33 bytes) easily satisfies this. The subsequent logic in `ieee80211_parse_tx_radiotap` correctly identifies the rate field, performs the lookup, and, if the rate is invalid, leaves `info->control.rates[0].idx` at -1, precisely setting up the condition for the `mac80211_hwsim_write_tsf` warning.
|
| 132/4 |
2026/09/07 07:27 |
tool |
set-results |
0m
Args: map[Feedback:The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`).
However, you don't need the `MAC80211_HWSIM` netlink family to trigger this bug.
The bug is a WARNING in `mac80211_hwsim_write_tsf` caused by `info->control.rates[0].idx` being -1.
This happens when a packet is injected on a monitor interface with a radiotap header that specifies an invalid legacy rate. `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and fails to update it if the rate is invalid, leaving it as -1. Then `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, triggering the warning.
To reproduce the bug:
1. Load the module: `system("modprobe mac80211_hwsim");`
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` wiphys (e.g., `phy0`).
3. Set the channel of the monitor interface to a valid channel (e.g., 2412 MHz) using `nl80211` (`NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY`). This is required so that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet containing:
- A radiotap header (e.g., 9 bytes) with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0).
- A valid 802.11 MAC header (e.g., a Data frame header, 24 bytes) immediately following the radiotap header. ProbePassed:false TerminalError: TitleMatches:true]
Results: map[Feedback:The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`).
However, you don't need the `MAC80211_HWSIM` netlink family to trigger this bug.
The bug is a WARNING in `mac80211_hwsim_write_tsf` caused by `info->control.rates[0].idx` being -1.
This happens when a packet is injected on a monitor interface with a radiotap header that specifies an invalid legacy rate. `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and fails to update it if the rate is invalid, leaving it as -1. Then `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, triggering the warning.
To reproduce the bug:
1. Load the module: `system("modprobe mac80211_hwsim");`
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` wiphys (e.g., `phy0`).
3. Set the channel of the monitor interface to a valid channel (e.g., 2412 MHz) using `nl80211` (`NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY`). This is required so that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet containing:
- A radiotap header (e.g., 9 bytes) with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0).
- A valid 802.11 MAC header (e.g., a Data frame header, 24 bytes) immediately following the radiotap header. ProbePassed:false TerminalError: TitleMatches:true]
|
| 133/3 |
2026/09/07 07:27 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:false ContinueSignal:continue EquivalenceAnalysis: OracleFeedback:The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`).
However, you don't need the `MAC80211_HWSIM` netlink family to trigger this bug.
The bug is a WARNING in `mac80211_hwsim_write_tsf` caused by `info->control.rates[0].idx` being -1.
This happens when a packet is injected on a monitor interface with a radiotap header that specifies an invalid legacy rate. `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and fails to update it if the rate is invalid, leaving it as -1. Then `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, triggering the warning.
To reproduce the bug:
1. Load the module: `system("modprobe mac80211_hwsim");`
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` wiphys (e.g., `phy0`).
3. Set the channel of the monitor interface to a valid channel (e.g., 2412 MHz) using `nl80211` (`NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY`). This is required so that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet containing:
- A radiotap header (e.g., 9 bytes) with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0).
- A valid 802.11 MAC header (e.g., a Data frame header, 24 bytes) immediately following the radiotap header. ReproC: Reproduced:false ReproducedBugTitle: ReproducedCrashReport:]
|
| 134/2 |
2026/09/07 07:27 |
iteration |
1 |
10m
|
| 135/3 |
2026/09/07 07:27 |
action |
If |
1m
Args: map[OracleFeedback:The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`).
However, you don't need the `MAC80211_HWSIM` netlink family to trigger this bug.
The bug is a WARNING in `mac80211_hwsim_write_tsf` caused by `info->control.rates[0].idx` being -1.
This happens when a packet is injected on a monitor interface with a radiotap header that specifies an invalid legacy rate. `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and fails to update it if the rate is invalid, leaving it as -1. Then `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, triggering the warning.
To reproduce the bug:
1. Load the module: `system("modprobe mac80211_hwsim");`
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` wiphys (e.g., `phy0`).
3. Set the channel of the monitor interface to a valid channel (e.g., 2412 MHz) using `nl80211` (`NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY`). This is required so that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet containing:
- A radiotap header (e.g., 9 bytes) with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0).
- A valid 802.11 MAC header (e.g., a Data frame header, 24 bytes) immediately following the radiotap header.]
|
| 136/4 |
2026/09/07 07:27 |
agent |
strategy-refiner |
1m
Model:
Instruction: You are an expert in Linux kernel debugging.
Refine the reproduction strategy based on feedback from previous attempts.
Analyze the technical diagnosis provided in the oracle feedback and translate it into concrete,
step-by-step instructions for the repro-generator on how to modify the code structure, alignments,
offsets, or parameters of the candidate program.
=== TOOL SELECTION GUIDELINES ===
- Prefer codesearch-definition-source and codesearch-struct-layout first for symbol lookups.
- Fall back to read-file or grepper for macros, headers, or if symbol lookup fails.
=== CRITICAL PROHIBITIONS ===
- Do NOT repeat searches for the same symbols or files. Use information you have already gathered.
- Do NOT write long explanations. Keep your reasoning short and focused on actionable changes.
- Do NOT assume a bug is fixed based on git commit history.
- If you are stuck, try a different approach or proceed to generate a candidate reproducer.
Prefer calling several tools at the same time to save round-trips.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Current Strategy: An analysis of the bug and a strategy for reproducing it.
### Bug Analysis
The warning `c->control.rates[0].idx < 0` in `ieee80211_get_tx_rate()` is triggered during the transmission of an injected frame on a monitor interface. The sequence of events is as follows:
1. When a frame is injected via `AF_PACKET` into a monitor interface, `ieee80211_monitor_start_xmit()` initializes the transmission info (`info`) to zero.
2. It then calls `ieee80211_parse_tx_radiotap()` to parse the radiotap header. If the radiotap header contains a `RATE` field, it sets `info->control.rates[0].idx = -1` and attempts to find the matching rate in the hardware's supported bitrates.
3. If the rate is invalid (e.g., does not match any supported bitrate), `idx` remains `-1`. The function then clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag because the rate was invalid.
4. The frame proceeds to `ieee80211_tx()`, which queues the frame and eventually invokes `invoke_tx_handlers_late()`.
5. `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` to populate the rate **only if** the hardware does not have the `HAS_RATE_CONTROL` flag set.
6. In `mac80211_hwsim`, the `HAS_RATE_CONTROL` flag is set if the radio was created with `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (or `HWSIM_ATTR_MLO_SUPPORT`). Because this flag is set, `ieee80211_tx_h_rate_ctrl()` is skipped, and `idx` remains `-1`.
7. The frame reaches `mac80211_hwsim_tx()`. Since `mac80211_hwsim` does not set `SUPPORTS_RC_TABLE` by default, it does not call `ieee80211_get_tx_rates()`, leaving `idx` as `-1`.
8. Finally, `mac80211_hwsim_tx_frame_no_nl()` calls `mac80211_hwsim_write_tsf()`, which unconditionally calls `mac80211_hwsim_get_tx_rate()`. This function checks `WARN_ON_ONCE(c->control.rates[0].idx < 0)` and triggers the warning.
### Reproduction Strategy
To reproduce this bug, we need to:
1. Ensure no default `mac80211_hwsim` radios exist (e.g., `modprobe mac80211_hwsim radios=0`).
2. Create a new `mac80211_hwsim` radio with the `HWSIM_ATTR_SUPPORT_NAN_DEVICE` attribute set to `true` via generic netlink. This forces the `HAS_RATE_CONTROL` flag to be set without forcing `use_chanctx` (which would otherwise drop the frame early).
3. Change the created interface (e.g., `wlan0`) to `monitor` mode and bring it up.
4. Open an `AF_PACKET` socket bound to the monitor interface.
5. Inject a frame with a radiotap header containing an invalid `RATE` field (e.g., `1` for 500kbps) followed by a valid 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
#define HWSIM_CMD_NEW_RADIO 1
#define HWSIM_ATTR_SUPPORT_NAN_DEVICE 30
struct nl_msg {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
char attr[256];
};
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0)
return -1;
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) return -1;
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) return -1;
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main() {
system("modprobe mac80211_hwsim radios=0");
sleep(1);
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
perror("socket");
return 1;
}
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
return 1;
}
struct nl_msg req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr));
req.nlh.nlmsg_type = family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.gnlh.cmd = HWSIM_CMD_NEW_RADIO;
struct nlattr *attr = (struct nlattr *)req.attr;
attr->nla_len = sizeof(struct nlattr);
attr->nla_type = HWSIM_ATTR_SUPPORT_NAN_DEVICE;
req.nlh.nlmsg_len += NLMSG_ALIGN(attr->nla_len);
send(sock, &req, req.nlh.nlmsg_len, 0);
char buf[4096];
recv(sock, buf, sizeof(buf), 0);
close(sock);
sleep(1);
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
sleep(1);
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex");
return 1;
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
unsigned char pkt[] = {
/* Radiotap Header (10 bytes) */
0x00, 0x00, 0x0a, 0x00, /* version, pad, len */
0x04, 0x00, 0x00, 0x00, /* present: RATE (bit 2) */
0x01, 0x00, /* rate = 1 (invalid), pad */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control, Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 */
0x00, 0x00 /* Sequence Control */
};
send(psock, pkt, sizeof(pkt), 0);
close(psock);
return 0;
}
```
Feedback: The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`).
However, you don't need the `MAC80211_HWSIM` netlink family to trigger this bug.
The bug is a WARNING in `mac80211_hwsim_write_tsf` caused by `info->control.rates[0].idx` being -1.
This happens when a packet is injected on a monitor interface with a radiotap header that specifies an invalid legacy rate. `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and fails to update it if the rate is invalid, leaving it as -1. Then `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, triggering the warning.
To reproduce the bug:
1. Load the module: `system("modprobe mac80211_hwsim");`
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` wiphys (e.g., `phy0`).
3. Set the channel of the monitor interface to a valid channel (e.g., 2412 MHz) using `nl80211` (`NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY`). This is required so that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet containing:
- A radiotap header (e.g., 9 bytes) with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0).
- A valid 802.11 MAC header (e.g., a Data frame header, 24 bytes) immediately following the radiotap header.
Reply: An analysis of the feedback and a refined strategy for reproducing the bug.
### Bug Analysis & Refined Strategy
The oracle feedback clarifies that we do not need to create a custom `mac80211_hwsim` radio with specific attributes (like `HWSIM_ATTR_SUPPORT_NAN_DEVICE`) to trigger this bug. The default radios created by `modprobe mac80211_hwsim` are sufficient.
The bug is triggered by the following sequence:
1. A packet is injected on a monitor interface.
2. The packet has a radiotap header with the `RATE` field present (bit 2 of the `present` mask).
3. The `RATE` field contains an invalid legacy rate (e.g., `0`).
4. `ieee80211_parse_tx_radiotap()` initializes the rate index (`info->control.rates[0].idx`) to `-1`. Because the provided rate is invalid, it fails to find a matching supported rate and leaves `idx` as `-1`. It also clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
5. The frame is passed down the transmission path until it reaches `mac80211_hwsim_write_tsf()`.
6. `mac80211_hwsim_write_tsf()` unconditionally calls `mac80211_hwsim_get_tx_rate()`, which contains a `WARN_ON_ONCE(c->control.rates[0].idx < 0)`, triggering the warning.
To reproduce this, we will:
1. Load the `mac80211_hwsim` module.
2. Use `iw` and `ip` to create a monitor interface (`mon0`) on `phy0`.
3. Set the channel of the monitor interface to a valid frequency (e.g., 2412 MHz) so that `ieee80211_monitor_start_xmit()` finds a valid channel context (`chanctx_conf`).
4. Bring the interface up.
5. Open an `AF_PACKET` socket bound to the monitor interface.
6. Inject a frame with a 9-byte radiotap header specifying an invalid rate (`0`), followed by a standard 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
int main() {
// 1. Load the mac80211_hwsim module
system("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
system("iw phy phy0 interface add mon0 type monitor");
system("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
system("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
system("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```
|
| 137/5 |
2026/09/07 07:27 |
llm |
strategy-refiner |
1m
Model:
Tokens:
input: 8073
output: 1546
thoughts: 8305
Thoughts: **Crafting a Reproducer for the `mac80211_hwsim_write_tsf` Warning**
My goal here is to construct a minimal C program that reliably triggers the `WARNING in mac80211_hwsim_write_tsf` bug. The feedback I've received outlines a clear path: I need to set up a virtual Wi-Fi interface using `mac80211_hwsim`, configure it as a monitor, and then inject a specifically crafted packet.
Here's my thought process and the steps I'm taking:
1. **Module Loading**: The first prerequisite is to load the `mac80211_hwsim` kernel module. A simple `system("modprobe mac80211_hwsim");` call should suffice. I'll add a small `sleep(1)` afterward to ensure the module and its associated devices are fully initialized before proceeding.
2. **Monitor Interface Setup**: The bug description specifies using a monitor interface. The feedback suggests creating a new interface, like `mon0`, on one of the `hwsim` wiphys (typically `phy0`). I'll use the `iw` command-line utility for this, as it's a convenient wrapper around `nl80211` calls and is generally available in the testing environments. The sequence would be:
* `system("iw phy phy0 interface add mon0 type monitor");` to create the monitor interface.
* `system("ip link set mon0 up");` to bring the interface up.
* `system("iw dev mon0 set freq 2412");` to set the channel. This is crucial because `ieee80211_monitor_start_xmit` needs a valid channel context. The feedback explicitly mentions `NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY` for this purpose, and `iw` handles that.
*Self-correction/Refinement*: Initially, I considered repurposing one of the default `wlanX` interfaces created by `mac80211_hwsim` (like `wlan0`). However, the feedback explicitly mentions creating a new monitor interface like `mon0`. While `wlanX` might work, `mon0` on `phy0` feels more aligned with the intended setup described in the feedback, especially if other wireless devices are present. It also makes the target interface explicit. I'll include a fallback mechanism in case `mon0` creation fails, trying `wlan0` as a secondary option.
3. **Packet Injection Mechanism**: To inject raw 802.11 frames, I need a mechanism to send them out. An `AF_PACKET` socket of type `SOCK_RAW` bound to the monitor interface is the standard Linux way to do this. I'll create the socket, then use `if_nametoindex` to get the interface index for `mon0` (or `wlan0` in the fallback) and bind the socket.
4. **Crafting the Malicious Packet**: This is the core of the reproducer. The feedback specifies:
* **Radiotap Header**: It must be 9 bytes long.
* `version`: 0x00 (version 0).
* `pad`: 0x00.
* `len`: 0x09, 0x00 (little-endian for 9 bytes).
* `present`: 0x04, 0x00, 0x00, 0x00 (little-endian for bit 2, `IEEE80211_RADIOTAP_RATE`).
* `rate`: 0x00. This is the critical part – an invalid legacy rate. The feedback states `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and doesn't update it if the rate is invalid, leading to the bug.
* **802.11 MAC Header**: A valid, though minimal, MAC header must follow the radiotap header. A 24-byte Data frame header will suffice. I'll fill in the necessary fields, like Frame Control and addresses, with basic values.
*Packet Structure Verification*: I've carefully reviewed the radiotap header fields and their byte order. The `len` field is indeed 16-bit little-endian, and `present` is 32-bit little-endian. The `RATE` flag is bit 2, which corresponds to a value of 4. The `rate` field itself is a single byte. Thus, a 9-byte radiotap header with these specific values is correctly formed according to the radiotap specification and the bug's requirements.
5. **Sending the Packet**: Once the socket is bound, I'll use `send()` to transmit the crafted packet. To ensure the bug is triggered, as it's a warning that might not occur on the very first packet, I'll loop the `send` operation a few times (e.g., 10 times) with a small delay between sends.
6. **Robustness and Dependencies**: I'm relying on `iw` and `ip` commands. These are standard utilities that are usually present in the testing environment. If they were not, I would have to resort to direct Netlink socket programming, which is significantly more complex for this specific task, or investigate other ways to configure the interface. However, given the context of reproducing kernel bugs in controlled environments, `iw` and `ip` are a safe bet. The fallback to `wlan0` adds a layer of robustness.
In essence, my plan is to systematically replicate the conditions described by the bug report: load the module, set up a monitor interface on a valid channel, and then send a packet that contains an invalid rate in its radiotap header, forcing the kernel module to encounter the problematic state. The use of `system()` calls for `iw` and `ip` makes the C code concise and readable while effectively achieving the necessary setup.
|
| 138/3 |
2026/09/07 07:29 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:An analysis of the feedback and a refined strategy for reproducing the bug.
### Bug Analysis & Refined Strategy
The oracle feedback clarifies that we do not need to create a custom `mac80211_hwsim` radio with specific attributes (like `HWSIM_ATTR_SUPPORT_NAN_DEVICE`) to trigger this bug. The default radios created by `modprobe mac80211_hwsim` are sufficient.
The bug is triggered by the following sequence:
1. A packet is injected on a monitor interface.
2. The packet has a radiotap header with the `RATE` field present (bit 2 of the `present` mask).
3. The `RATE` field contains an invalid legacy rate (e.g., `0`).
4. `ieee80211_parse_tx_radiotap()` initializes the rate index (`info->control.rates[0].idx`) to `-1`. Because the provided rate is invalid, it fails to find a matching supported rate and leaves `idx` as `-1`. It also clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
5. The frame is passed down the transmission path until it reaches `mac80211_hwsim_write_tsf()`.
6. `mac80211_hwsim_write_tsf()` unconditionally calls `mac80211_hwsim_get_tx_rate()`, which contains a `WARN_ON_ONCE(c->control.rates[0].idx < 0)`, triggering the warning.
To reproduce this, we will:
1. Load the `mac80211_hwsim` module.
2. Use `iw` and `ip` to create a monitor interface (`mon0`) on `phy0`.
3. Set the channel of the monitor interface to a valid frequency (e.g., 2412 MHz) so that `ieee80211_monitor_start_xmit()` finds a valid channel context (`chanctx_conf`).
4. Bring the interface up.
5. Open an `AF_PACKET` socket bound to the monitor interface.
6. Inject a frame with a 9-byte radiotap header specifying an invalid rate (`0`), followed by a standard 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
int main() {
// 1. Load the mac80211_hwsim module
system("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
system("iw phy phy0 interface add mon0 type monitor");
system("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
system("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
system("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```]
|
| 139/3 |
2026/09/07 07:29 |
agent |
repro-generator |
6m
Model:
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
printf("[-] Failed to get MAC80211_HWSIM family ID\n");
exit(1);
}
printf("[+] Got MAC80211_HWSIM family ID: %d\n", hwsim_id);
nl80211_id = get_genl_family_id(fd, "nl80211");
if (nl80211_id < 0) {
printf("[-] Failed to get nl80211 family ID\n");
exit(1);
}
printf("[+] Got nl80211 family ID: %d\n", nl80211_id);
close(fd);
printf("[+] Probe successful.\n");
return 0;
}
]
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to generate a minimal, standalone C program for the strictly defensive
purpose of verifying a bugfix in an isolated environment.
To ensure that we can diagnose why a program might fail to run on the test environment,
you MUST include detailed logging and error checking in the generated C program:
1. Use 'printf(...)' for all progress messages and error logs.
2. Every system call (e.g., socket, bind, listen, connect, ioctl, send) must check for a failure return value.
3. If a call fails, it must print a specific error message including the function name
and the error string (use strerror(errno)), and then exit with a non-zero status.
4. The program must print a message after every successful major step.
5. Generate code that follows this pattern for all operations:
int res = do_something();
if (res < 0) {
printf("[-] Failed to do_something: %s\n", strerror(errno));
exit(1);
}
printf("[+] do_something successful.\n");
6. The compilation and development environment (including compilers, build
systems, makefiles, and kernel build/header directories) is NOT available
on the target test VM guest. Do NOT check for, build, or reference any
compilation tools, build files, or kernel development directories.
7. Do NOT execute shell commands or run external binaries (e.g. by using
functions like 'system()', 'popen()', or the 'exec' family such as
'execve()'). All environment checks, capability probings, and reproduction
steps must be performed directly using standard Linux system calls (such
as 'open', 'socket', 'ioctl', 'stat', etc.).
8. When reproducing asynchronous kernel timeouts or warnings, always
include a sufficient delay (using sleep or similar) after deleting
or unregistering the device to allow the kernel's asynchronous
timeout to trigger before program exit.
=== PHASE 1: CAPABILITY PROBING (GENERATION) ===
You MUST start by generating a simple 'probe' program first. This is a strict, non-negotiable requirement
to verify that the test environment has the necessary kernel capabilities and privileges.
This program's sole purpose is to verify subsystem availability and privileges by probing specific
device files, subsystems, or syscalls (for example: opening /dev/vhci to check if the virtual
Bluetooth controller is accessible, loading a minimal dummy BPF program, or making a specific
socket/ioctl call).
Print clear messages indicating success or failure of these probes, and exit with 0 only if
all checks pass.
Do NOT attempt complex logic, and do NOT try to trigger the actual bug/crash in this first version,
regardless of how simple the reproducer seems. You must wait until a successful probe run has been
confirmed in the environment (i.e., when CapabilitiesVerified becomes true).
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Strategy: An analysis of the feedback and a refined strategy for reproducing the bug.
### Bug Analysis & Refined Strategy
The oracle feedback clarifies that we do not need to create a custom `mac80211_hwsim` radio with specific attributes (like `HWSIM_ATTR_SUPPORT_NAN_DEVICE`) to trigger this bug. The default radios created by `modprobe mac80211_hwsim` are sufficient.
The bug is triggered by the following sequence:
1. A packet is injected on a monitor interface.
2. The packet has a radiotap header with the `RATE` field present (bit 2 of the `present` mask).
3. The `RATE` field contains an invalid legacy rate (e.g., `0`).
4. `ieee80211_parse_tx_radiotap()` initializes the rate index (`info->control.rates[0].idx`) to `-1`. Because the provided rate is invalid, it fails to find a matching supported rate and leaves `idx` as `-1`. It also clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
5. The frame is passed down the transmission path until it reaches `mac80211_hwsim_write_tsf()`.
6. `mac80211_hwsim_write_tsf()` unconditionally calls `mac80211_hwsim_get_tx_rate()`, which contains a `WARN_ON_ONCE(c->control.rates[0].idx < 0)`, triggering the warning.
To reproduce this, we will:
1. Load the `mac80211_hwsim` module.
2. Use `iw` and `ip` to create a monitor interface (`mon0`) on `phy0`.
3. Set the channel of the monitor interface to a valid frequency (e.g., 2412 MHz) so that `ieee80211_monitor_start_xmit()` finds a valid channel context (`chanctx_conf`).
4. Bring the interface up.
5. Open an `AF_PACKET` socket bound to the monitor interface.
6. Inject a frame with a 9-byte radiotap header specifying an invalid rate (`0`), followed by a standard 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
int main() {
// 1. Load the mac80211_hwsim module
system("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
system("iw phy phy0 interface add mon0 type monitor");
system("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
system("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
system("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```
Previous Reproducer Attempt:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define MAC80211_HWSIM_GENL_NAME "mac80211_hwsim"
int get_family_id(int sock) {
struct {
struct nlmsghdr nlh;
struct genlmsghdr gnlh;
struct nlattr attr;
char name[32];
} req;
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = GENL_ID_CTRL;
req.nlh.nlmsg_flags = NLM_F_REQUEST;
req.gnlh.cmd = CTRL_CMD_GETFAMILY;
req.attr.nla_len = sizeof(struct nlattr) + strlen(MAC80211_HWSIM_GENL_NAME) + 1;
req.attr.nla_type = CTRL_ATTR_FAMILY_NAME;
strcpy(req.name, MAC80211_HWSIM_GENL_NAME);
req.nlh.nlmsg_len = NLMSG_ALIGN(sizeof(struct nlmsghdr) + sizeof(struct genlmsghdr)) + NLMSG_ALIGN(req.attr.nla_len);
if (send(sock, &req, req.nlh.nlmsg_len, 0) < 0) {
printf("[-] Failed to send GETFAMILY request: %s\n", strerror(errno));
return -1;
}
char buf[4096];
int len = recv(sock, buf, sizeof(buf), 0);
if (len < 0) {
printf("[-] Failed to recv GETFAMILY response: %s\n", strerror(errno));
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
printf("[-] GETFAMILY returned NLMSG_ERROR: %d\n", err->error);
return -1;
}
struct genlmsghdr *gnlh = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)gnlh + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int main(void) {
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (sock < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
printf("[+] Netlink socket created successfully.\n");
int family_id = get_family_id(sock);
if (family_id < 0) {
printf("[-] Failed to get family ID for %s\n", MAC80211_HWSIM_GENL_NAME);
exit(1);
}
printf("[+] Got family ID %d for %s.\n", family_id, MAC80211_HWSIM_GENL_NAME);
close(sock);
printf("[+] Probe successful.\n");
return 0;
}
Execution Results & Debugging Feedback:
The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`).
However, you don't need the `MAC80211_HWSIM` netlink family to trigger this bug.
The bug is a WARNING in `mac80211_hwsim_write_tsf` caused by `info->control.rates[0].idx` being -1.
This happens when a packet is injected on a monitor interface with a radiotap header that specifies an invalid legacy rate. `ieee80211_parse_tx_radiotap` initializes `idx` to -1 and fails to update it if the rate is invalid, leaving it as -1. Then `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate`, triggering the warning.
To reproduce the bug:
1. Load the module: `system("modprobe mac80211_hwsim");`
2. Use `nl80211` to create a monitor interface (e.g., `mon0`) on one of the `mac80211_hwsim` wiphys (e.g., `phy0`).
3. Set the channel of the monitor interface to a valid channel (e.g., 2412 MHz) using `nl80211` (`NL80211_CMD_SET_CHANNEL` or `NL80211_CMD_SET_WIPHY`). This is required so that `ieee80211_monitor_start_xmit` finds a valid `chanctx_conf`.
4. Bring the monitor interface up (`IFF_UP`).
5. Open an `AF_PACKET` socket (`SOCK_RAW`, `ETH_P_ALL`) and bind it to the monitor interface.
6. Inject a packet containing:
- A radiotap header (e.g., 9 bytes) with `it_present` having bit 2 (`IEEE80211_RADIOTAP_RATE`) set, and the `rate` field set to an invalid value (e.g., 0).
- A valid 802.11 MAC header (e.g., a Data frame header, 24 bytes) immediately following the radiotap header.
|
| 140/4 |
2026/09/07 07:29 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 8589
output: 26
thoughts: 935
Thoughts: **My Thought Process on Reproducing the `mac80211_hwsim` Bug**
My primary objective here is to construct a C reproducer for a specific bug: a WARNING occurring in `mac80211_hwsim_write_tsf`. The trigger, as I understand it, involves injecting a packet onto a monitor interface. This injection is problematic because the radiotap header within the packet contains an invalid legacy rate.
My initial approach involved a probe, but it faltered. The core issue was that the `mac80211_hwsim` module wasn't loaded, leading to the probe's failure. The feedback I received pointed towards a series of steps:
1. **Loading the module:** The suggestion was `system("modprobe mac80211_hwsim");`.
2. **Creating a monitor interface:** This would be done on `phy0` using `nl80211`.
3. **Setting the channel:** Specifically, to 2412 MHz, again using `nl80211`.
4. **Bringing the interface up.**
5. **Setting up a socket:** An `AF_PACKET` socket would be opened and bound to the monitor interface.
6. **Packet injection:** Finally, injecting a packet with a radiotap header (crucially, with `rate=0`) and a standard 802.11 MAC header.
However, upon re-reading the constraints, a critical point emerges: I am *explicitly forbidden* from executing shell commands or running external binaries. This means I cannot use functions like `system()`, `popen()`, or any of the `exec` family. All environment checks, capability probing, and reproduction steps *must* be performed using standard Linux system calls such as `open`, `socket`, `ioctl`, `stat`, etc.
This immediately invalidates the `system("modprobe mac80211_hwsim");` suggestion. The question then becomes: how do I load the necessary module without resorting to shell commands? Typically, `modprobe` isn't callable directly through `system()`, and even if it were, the prohibition stands.
I'm considering whether creating a socket for a specific protocol or utilizing netlink to create a device might automatically load the `mac80211_hwsim` module. Alternatively, perhaps the bug is reproducible if the module is *already* loaded, or perhaps I simply *cannot* load it within these constraints.
I recall that syzkaller often reproduces bugs by interacting with `/dev/...` entries or by using netlink. If `mac80211_hwsim` is indeed required, could I trigger its loading by requesting the `mac80211_hwsim` netlink family? The previous probe attempt failed to even get the family ID for `mac80211_hwsim` because it returned `-ENOENT`.
The feedback sheds further light on this: "The probe failed to get the family ID for `mac80211_hwsim` because it returned `-ENOENT`. This means the `mac80211_hwsim` module is not loaded, or the family name is case-sensitive (it is actually `MAC80211_HWSIM`)."
This is a crucial detail. The family name might be case-sensitive and, in fact, is `MAC80211_HWSIM`. So, my next step is to investigate whether querying for this specific, case-sensitive family name using netlink might trigger the auto-loading of the module.
It's also worth noting that `mac80211_hwsim`, when loaded, typically creates `phy0`, `phy1`, etc., by default. The question remains, though, how to initiate that loading process *without* `system("modprobe")`.
I'm pondering if general `nl80211` operations (like triggering Wi-Fi related actions) would automatically load `mac80211_hwsim`. My intuition suggests no, but it's something to keep in mind. I also remember that syzkaller might use specific helper functions like `syz_mac80211_hwsim_setup`, but those are likely within its own testing framework and not directly applicable here. Syzkaller's environment often ensures `mac80211_hwsim` is loaded, or it has its own mechanisms for doing so.
Given the feedback about the case sensitivity, my immediate revised plan is to craft a probe that specifically queries for the `MAC80211_HWSIM` netlink family, alongside standard `nl80211` operations. This might be the key to either triggering the module load or confirming its absence, all while adhering to the strict system call-only requirement.
|
| 141/4 |
2026/09/07 07:29 |
tool |
grepper |
0m
Args: map[Expression:"MAC80211_HWSIM"]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=7147=static struct genl_family hwsim_genl_family __ro_after_init = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7148: .name = "MAC80211_HWSIM",
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7149- .version = 1,
]
|
| 142/4 |
2026/09/07 07:29 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 9678
output: 20
thoughts: 431
Thoughts: **My Thought Process Regarding `mac80211_hwsim` Module Loading**
My primary focus here is on the `MAC80211_HWSIM` family. I need to devise a reliable way to probe for its existence. The natural first step is to also check for `nl80211`, as they are intrinsically linked in my understanding.
A critical question arises: if `MAC80211_HWSIM` isn't present, how do I ensure it gets loaded? I recall that within the syzkaller framework, there are mechanisms like `syz_init_net_socket` that handle such dependencies, but those are unavailable to me in a standalone C context.
I then remember a key feature of syzkaller: it often automatically loads modules like `mac80211_hwsim` if their usage is declared in the test description. This provides a hint, but I need a programmatic approach for my C code.
Could simply querying for `MAC80211_HWSIM` itself trigger its load? It's worth exploring.
My current strategy is to construct a probe that explicitly checks for both `MAC80211_HWSIM` and `nl80211`. If the former is not found, I'll attempt to force its loading. My proposed method involves creating a Netlink socket and then sending a request directed at the `nl80211` family. The underlying hope is that this action will indirectly lead to the `MAC80211_HWSIM` module being loaded.
I'm also considering the environment. Syzkaller images typically have `mac80211_hwsim` either built-in or loaded by its executor. However, when I'm working with a standalone C program, this automatic loading mechanism isn't guaranteed. I *must* find a way to trigger module loading explicitly.
So, the core question remains: is there a concrete method to force `mac80211_hwsim` to load from my C program? I'm hypothesizing that by creating a Netlink socket of type `AF_NETLINK` with protocol `SOCK_RAW` and family `NETLINK_GENERIC`, and then issuing a request for the `MAC80211_HWSIM` family, the kernel's generic Netlink handler (`genl_family_rcv_msg`) might implicitly call `request_module("net-pf-16-proto-16-family-MAC80211_HWSIM")`. This seems like the most promising avenue, and I need to verify this behavior.
|
| 143/4 |
2026/09/07 07:29 |
tool |
grepper |
0m
Error:
Args: map[Expression:request_module.*genl]
Results:
|
| 144/4 |
2026/09/07 07:29 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 10131
output: 33
thoughts: 16
Thoughts: **My Thought Process on Examining `genetlink.c`**
My immediate inclination is to dive into the `net/netlink/genetlink.c` file. I want to understand how the generic netlink framework is implemented at its core, specifically how it handles the registration and management of generic netlink families, and how messages are parsed and dispatched. I'm particularly interested in the data structures used to represent families and attributes, and the underlying mechanisms for translating logical operations into concrete network events or configurations. I anticipate needing to trace the lifecycle of a generic netlink message from its reception in the kernel to its ultimate handling by a specific family handler. This will likely involve understanding the role of netlink sockets, the generic netlink layer's internal routing, and the callback mechanisms that tie it all together.
|
| 145/4 |
2026/09/07 07:29 |
tool |
grepper |
0m
Args: map[Expression:request_module PathPrefix:net/netlink/genetlink.c]
Results: map[Output:net/netlink/genetlink.c=1428=static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
--
net/netlink/genetlink.c-1448- up_read(&cb_lock);
net/netlink/genetlink.c:1449: request_module("net-pf-%d-proto-%d-family-%s",
net/netlink/genetlink.c-1450- PF_NETLINK, NETLINK_GENERIC, name);
]
|
| 146/4 |
2026/09/07 07:29 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 10312
output: 49
thoughts: 48
Thoughts: **My Thought Process Regarding `mac80211_hwsim` and Module Registration**
Ah, excellent! I've observed that the `request_module` function is being invoked with the specific format string `"net-pf-16-proto-16-family-%s"`. This immediately piques my interest as it suggests a very particular network protocol family is being targeted for dynamic loading. My immediate next question, and the crux of my current line of inquiry, is whether the `mac80211_hwsim` module, which I know is our primary focus here for simulating hardware, has registered an alias that would intercept or directly correspond to this particular netfilter protocol family identifier. I need to determine if this `request_module` call is something `mac80211_hwsim` is designed to handle out-of-the-box, perhaps through a predefined alias that maps to its simulated network device functionality, or if this is a call that will fall through and potentially lead to an unmet dependency or an unexpected behavior within our simulation environment. This check is crucial for ensuring the seamless integration and proper functioning of our simulated wireless hardware within the broader network stack.
|
| 147/4 |
2026/09/07 07:29 |
tool |
grepper |
0m
Error:
Args: map[Expression:MODULE_ALIAS_GENL_FAMILY PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results:
|
| 148/4 |
2026/09/07 07:29 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 10407
output: 44
thoughts: 13
Thoughts: **My Thought Process for Analyzing `MODULE_ALIAS`**
My primary focus right now is on a very specific detail: I need to ascertain whether the subject matter at hand, whatever it may be, contains any `MODULE_ALIAS` entries. This is a critical diagnostic step for me. My expertise in this area dictates that the presence or absence of `MODULE_ALIAS` can fundamentally alter how I understand and interact with the system or code being examined. It's not just a minor flag; it's a significant indicator of architectural design, potential for dynamic loading, and how different modules might be referenced. Therefore, before I can proceed with any deeper analysis or form conclusions, this initial check is paramount.
|
| 149/4 |
2026/09/07 07:29 |
tool |
grepper |
0m
Error:
Args: map[Expression:MODULE_ALIAS PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results:
|
| 150/4 |
2026/09/07 07:29 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 10462
output: 76
thoughts: 416
Thoughts: **My Thought Process on Loading `mac80211_hwsim` for Testing**
Initially, I was concerned about how `mac80211_hwsim` would be loaded in the testing environment, given the constraint against using shell commands like `modprobe`. My first thought was that if the `MODULE_ALIAS_GENL_FAMILY("MAC80211_HWSIM")` macro isn't present, then `request_module` wouldn't be able to find and load it automatically. I wondered how syzkaller typically handles this, suspecting it might rely on `modprobe`.
However, I then recalled the strict requirement that I *must not* execute shell commands or external binaries. This immediately presented a conflict: if I can't use `system("modprobe mac80211_hwsim")` or similar, how can I possibly load the module?
This led me to consider an alternative: perhaps the module is *already loaded*. I remembered that a previous probe attempt failed because it was querying for `"mac80211_hwsim"` (lowercase), when the actual family name is `"MAC80211_HWSIM"` (uppercase). This seems like a plausible explanation for the earlier failure.
Therefore, my refined approach is to directly query for the correct, uppercase family name. I plan to construct a probe that:
1. Establishes a netlink socket.
2. Attempts to query for the family ID associated with `"MAC80211_HWSIM"`.
3. Simultaneously queries for the family ID of `"nl80211"`, as this is crucial for the bug I'm investigating (packet injection on a monitor interface, which requires `nl80211` to create the interface).
4. If both family IDs are successfully retrieved, I'll consider the probe successful and exit with a status of 0.
In essence, I'm focusing on a direct check for the presence and accessibility of the necessary netlink families, assuming the module might already be loaded, and correcting the case sensitivity issue that likely caused prior failures.
|
| 151/4 |
2026/09/07 07:30 |
tool |
codeexpert |
5m
Args: map[Question:Write a minimal C program that queries the Generic Netlink family IDs for "MAC80211_HWSIM" and "nl80211". It should exit with 0 if both are found, and non-zero otherwise. Use standard Linux system calls and netlink messages.]
Results: map[Answer:Below is a minimal, complete C program that queries the Generic Netlink controller (`GENL_ID_CTRL`) for the family IDs of `"MAC80211_HWSIM"` and `"nl80211"` using standard Linux system calls and Netlink messages. It exits with code `0` if both families are found and a non-zero code otherwise.
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0)
return 1;
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
nl80211_id = get_genl_family_id(fd, "nl80211");
close(fd);
if (hwsim_id < 0 || nl80211_id < 0)
return 1;
return 0;
}
```]
|
| 152/5 |
2026/09/07 07:30 |
agent |
codeexpert |
5m
Model:
Results: map[Answer:Below is a minimal, complete C program that queries the Generic Netlink controller (`GENL_ID_CTRL`) for the family IDs of `"MAC80211_HWSIM"` and `"nl80211"` using standard Linux system calls and Netlink messages. It exits with code `0` if both families are found and a non-zero code otherwise.
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0)
return 1;
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
nl80211_id = get_genl_family_id(fd, "nl80211");
close(fd);
if (hwsim_id < 0 || nl80211_id < 0)
return 1;
return 0;
}
```]
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Use tools extensively while researching the question. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Write a minimal C program that queries the Generic Netlink family IDs for "MAC80211_HWSIM" and "nl80211". It should exit with 0 if both are found, and non-zero otherwise. Use standard Linux system calls and netlink messages.
|
| 153/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 2371
output: 67
thoughts: 172
Thoughts: **My Thought Process on Creating the Netlink Query Program**
My primary objective here is to construct a minimalist C program. The core functionality of this program will be to interact with the Linux kernel via Netlink to discover the specific Generic Netlink family IDs associated with two particular subsystems: "MAC80211_HWSIM" (though I need to confirm the exact capitalization and spelling within the kernel source) and "nl80211". The program must leverage standard Linux system calls and the Netlink messaging protocol to achieve this.
The exit status of the program is also a crucial requirement. It should signal success by exiting with a status code of 0 if and only if both requested Netlink families are successfully identified. Conversely, any failure to find either family, or any other error encountered during the process, should result in a non-zero exit code.
To ensure accuracy, my immediate next step is to delve into the Linux kernel source code. I need to perform precise searches, likely using `grep` or similar tools, to locate the exact names of the Generic Netlink families for "MAC80211_HWSIM" and "nl80211". This will involve checking where these families are registered and how their names are defined.
Concurrently, I must refresh my understanding of how Generic Netlink control (CTRL) queries operate. This includes revisiting the standard Netlink message structures and attributes involved in requesting family information. Specifically, I'll be looking for elements like `CTRL_CMD_GETFAMILY` (the command to request family details), `CTRL_ATTR_FAMILY_NAME` (the attribute used to specify the family name in the request), and `CTRL_ATTR_FAMILY_ID` (the attribute where the kernel will return the found family ID). This foundational knowledge is essential for constructing the Netlink request messages correctly and parsing their responses.
My plan is to start with targeted `grep` commands against the kernel source tree to pin down these details. This initial investigation will inform the subsequent C code development, ensuring I'm using the correct family names and Netlink protocols.
|
| 154/6 |
2026/09/07 07:30 |
tool |
grepper |
0m
Error:
Args: map[Expression:HWSIM_GENL_NAME]
Results:
|
| 155/6 |
2026/09/07 07:30 |
tool |
grepper |
0m
Args: map[Expression:NL80211_GENL_NAME]
Results: map[Output:include/uapi/linux/nl80211.h-44-
include/uapi/linux/nl80211.h:45:#define NL80211_GENL_NAME "nl80211"
include/uapi/linux/nl80211.h-46-
--
net/wireless/core.c=42=MODULE_DESCRIPTION("wireless configuration support");
net/wireless/core.c:43:MODULE_ALIAS_GENL_FAMILY(NL80211_GENL_NAME);
net/wireless/core.c-44-
--
net/wireless/nl80211.c=20611=static struct genl_family nl80211_fam __ro_after_init = {
net/wireless/nl80211.c:20612: .name = NL80211_GENL_NAME, /* have users key off the name instead */
net/wireless/nl80211.c-20613- .hdrsize = 0, /* no private header */
]
|
| 156/6 |
2026/09/07 07:30 |
tool |
grepper |
0m
Args: map[Expression:CTRL_CMD_GETFAMILY]
Results: map[Output:Documentation/userspace-api/netlink/intro.rst=252=The Generic Netlink family implements a command used to find out information
Documentation/userspace-api/netlink/intro.rst:253:about other families (``CTRL_CMD_GETFAMILY``).
Documentation/userspace-api/netlink/intro.rst-254-
--
Documentation/userspace-api/netlink/intro.rst=257=socket. The message should target the Generic Netlink Family (1), be a
Documentation/userspace-api/netlink/intro.rst:258:``do`` (2) call to ``CTRL_CMD_GETFAMILY`` (3). A ``dump`` version of this
Documentation/userspace-api/netlink/intro.rst-259-call would make the kernel respond with information about *all* the families
--
Documentation/userspace-api/netlink/intro.rst=261=to be specified (4) as an attribute with the appropriate type::
--
Documentation/userspace-api/netlink/intro.rst-270- struct genlmsghdr:
Documentation/userspace-api/netlink/intro.rst:271: __u8 cmd: CTRL_CMD_GETFAMILY // (3)
Documentation/userspace-api/netlink/intro.rst-272- __u8 version: 2 /* or 1, doesn't matter */
--
Documentation/userspace-api/netlink/intro.rst=290=with all the information about the family::
--
Documentation/userspace-api/netlink/intro.rst-300- struct genlmsghdr:
Documentation/userspace-api/netlink/intro.rst:301: __u8 cmd: CTRL_CMD_GETFAMILY
Documentation/userspace-api/netlink/intro.rst-302- __u8 version: 2
--
Documentation/userspace-api/netlink/intro.rst=485=The notification contains the same information as the response
Documentation/userspace-api/netlink/intro.rst:486:to the ``CTRL_CMD_GETFAMILY`` request.
Documentation/userspace-api/netlink/intro.rst-487-
--
include/uapi/linux/genetlink.h=40=enum {
--
include/uapi/linux/genetlink.h-43- CTRL_CMD_DELFAMILY,
include/uapi/linux/genetlink.h:44: CTRL_CMD_GETFAMILY,
include/uapi/linux/genetlink.h-45- CTRL_CMD_NEWOPS,
--
net/netlink/genetlink.c=1766=static const struct genl_split_ops genl_ctrl_ops[] = {
net/netlink/genetlink.c-1767- {
net/netlink/genetlink.c:1768: .cmd = CTRL_CMD_GETFAMILY,
net/netlink/genetlink.c-1769- .validate = GENL_DONT_VALIDATE_STRICT,
--
net/netlink/genetlink.c-1775- {
net/netlink/genetlink.c:1776: .cmd = CTRL_CMD_GETFAMILY,
net/netlink/genetlink.c-1777- .validate = GENL_DONT_VALIDATE_DUMP,
--
tools/accounting/delaytop.c=463=static int get_family_id(int sd)
--
tools/accounting/delaytop.c-477- name[sizeof(name) - 1] = '\0';
tools/accounting/delaytop.c:478: rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/delaytop.c-479- CTRL_ATTR_FAMILY_NAME, (void *)name,
--
tools/accounting/getdelays.c=189=static int get_family_id(int sd)
--
tools/accounting/getdelays.c-201- strcpy(name, TASKSTATS_GENL_NAME);
tools/accounting/getdelays.c:202: rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/getdelays.c-203- CTRL_ATTR_FAMILY_NAME, (void *)name,
--
tools/accounting/procacct.c=195=static int get_family_id(int sd)
--
tools/accounting/procacct.c-207- strcpy(name, TASKSTATS_GENL_NAME);
tools/accounting/procacct.c:208: rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/procacct.c-209- CTRL_ATTR_FAMILY_NAME, (void *)name,
--
tools/include/uapi/linux/genetlink.h=40=enum {
--
tools/include/uapi/linux/genetlink.h-43- CTRL_CMD_DELFAMILY,
tools/include/uapi/linux/genetlink.h:44: CTRL_CMD_GETFAMILY,
tools/include/uapi/linux/genetlink.h-45- CTRL_CMD_NEWOPS,
--
tools/lib/bpf/netlink.c=268=static int libbpf_netlink_resolve_genl_family_id(const char *name,
--
tools/lib/bpf/netlink.c-274- .nh.nlmsg_flags = NLM_F_REQUEST,
tools/lib/bpf/netlink.c:275: .gnl.cmd = CTRL_CMD_GETFAMILY,
tools/lib/bpf/netlink.c-276- .gnl.version = 2,
--
tools/lib/thermal/thermal_nl.c=113=static int nl_get_multicast_id(struct nl_sock *sock, struct nl_cb *cb,
--
tools/lib/thermal/thermal_nl.c-128-
tools/lib/thermal/thermal_nl.c:129: genlmsg_put(msg, 0, 0, ctrlid, 0, 0, CTRL_CMD_GETFAMILY, 0);
tools/lib/thermal/thermal_nl.c-130-
--
tools/net/ynl/lib/ynl.c=700=static int ynl_sock_read_family(struct ynl_sock *ys, const char *family_name)
--
tools/net/ynl/lib/ynl.c-705-
tools/net/ynl/lib/ynl.c:706: nlh = ynl_gemsg_start_req(ys, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, 1);
tools/net/ynl/lib/ynl.c-707- ynl_attr_put_str(nlh, CTRL_ATTR_FAMILY_NAME, family_name);
--
tools/net/ynl/pyynl/lib/ynl.py=40=class Netlink:
--
tools/net/ynl/pyynl/lib/ynl.py-79- # nlctrl
tools/net/ynl/pyynl/lib/ynl.py:80: CTRL_CMD_GETFAMILY = 3
tools/net/ynl/pyynl/lib/ynl.py-81- CTRL_CMD_GETPOLICY = 10
--
tools/net/ynl/pyynl/lib/ynl.py=461=def _genl_load_families():
--
tools/net/ynl/pyynl/lib/ynl.py-468- Netlink.NLM_F_REQUEST | Netlink.NLM_F_ACK | Netlink.NLM_F_DUMP,
tools/net/ynl/pyynl/lib/ynl.py:469: Netlink.CTRL_CMD_GETFAMILY, 1)
tools/net/ynl/pyynl/lib/ynl.py-470- msg = _genl_msg_finalize(msg)
--
tools/power/x86/intel-speed-select/hfi-events.c=152=static int nl_get_multicast_id(struct hfi_event_data *drv,
--
tools/power/x86/intel-speed-select/hfi-events.c-162- genlmsg_put(msg, 0, 0, genl_ctrl_resolve(drv->nl_handle, "nlctrl"),
tools/power/x86/intel-speed-select/hfi-events.c:163: 0, 0, CTRL_CMD_GETFAMILY, 0);
tools/power/x86/intel-speed-select/hfi-events.c-164- NLA_PUT_STRING(msg, CTRL_ATTR_FAMILY_NAME, family);
--
tools/testing/selftests/acct/netlink_helper.c=59=int get_family_id(int fd, const char *name)
--
tools/testing/selftests/acct/netlink_helper.c-79-
tools/testing/selftests/acct/netlink_helper.c:80: req.genl.cmd = CTRL_CMD_GETFAMILY;
tools/testing/selftests/acct/netlink_helper.c-81- req.genl.version = 1;
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=104=static bool get_smc_nl_family_id(void)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-126- ret = send_cmd(fd, GENL_ID_CTRL, pid,
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:127: NLM_F_REQUEST, CTRL_CMD_GETFAMILY,
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-128- CTRL_ATTR_FAMILY_NAME, (void *)SMC_GENL_FAMILY_NAME,
--
tools/testing/selftests/nci/nci_dev.c=160=static int send_get_nfc_family(int sd, __u32 pid)
--
tools/testing/selftests/nci/nci_dev.c-170-
tools/testing/selftests/nci/nci_dev.c:171: return send_cmd_mt_nla(sd, GENL_ID_CTRL, pid, CTRL_CMD_GETFAMILY,
tools/testing/selftests/nci/nci_dev.c-172- 1, &nla_get_family_type, &nla_get_family_data,
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=322=static int resolve_mptcp_pm_netlink(int fd, int *pm_family, int *events_mcast_grp)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-333- nh = (void *)data;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:334: off = init_genl_req(data, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, 0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-335-
--
tools/testing/selftests/net/ovpn/ovpn-cli.c=1553=static int ovpn_get_mcast_id(struct nl_sock *sock, const char *family,
--
tools/testing/selftests/net/ovpn/ovpn-cli.c-1575-
tools/testing/selftests/net/ovpn/ovpn-cli.c:1576: genlmsg_put(msg, 0, 0, ctrlid, 0, 0, CTRL_CMD_GETFAMILY, 0);
tools/testing/selftests/net/ovpn/ovpn-cli.c-1577-
]
|
| 157/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 5962
output: 34
thoughts: 22
Thoughts: **My Kernel Quest for MAC80211_HWSIM**
Alright, so my current line of thought is focused on pinning down the specific Netlink family name for MAC80211_HWSIM within the Linux kernel. It's that nagging detail that I know is somewhere, and I need to get a firm grip on it. I'm not just looking for a casual mention; I need the definitive, generic Netlink identifier. This is the kind of precision that matters when you're deep in the weeds of kernel interaction, especially with wireless subsystems. I need to know what to address, what to query, and what to configure when I'm working with this hardware simulation module. It's all about establishing that clear communication channel.
|
| 158/6 |
2026/09/07 07:30 |
tool |
grepper |
0m
Args: map[Expression:mac80211_hwsim PathPrefix:drivers/net/wireless]
Results: map[Output:
Full output is too long, showing 500 out of 1588 lines.
Use more precise expression if possible.
drivers/net/wireless/virtual/Kconfig=1=config MAC80211_HWSIM
--
drivers/net/wireless/virtual/Kconfig-7- needed for normal wireless LAN usage and is only for testing. See
drivers/net/wireless/virtual/Kconfig:8: Documentation/networking/mac80211_hwsim for more information on how
drivers/net/wireless/virtual/Kconfig-9- to use this tool.
--
drivers/net/wireless/virtual/Kconfig-11- To compile this driver as a module, choose M here: the module will be
drivers/net/wireless/virtual/Kconfig:12: called mac80211_hwsim. If unsure, say N.
drivers/net/wireless/virtual/Kconfig-13-
--
drivers/net/wireless/virtual/Makefile:1:obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
drivers/net/wireless/virtual/Makefile:2:mac80211_hwsim-objs += mac80211_hwsim_main.o
drivers/net/wireless/virtual/Makefile:3:mac80211_hwsim-objs += mac80211_hwsim_nan.o
drivers/net/wireless/virtual/Makefile-4-
--
drivers/net/wireless/virtual/mac80211_hwsim.h-2-/*
drivers/net/wireless/virtual/mac80211_hwsim.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim.h-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim.h=23=enum hwsim_tx_control_flags {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-33- * entities such as wmediumd to receive and process all broadcasted
drivers/net/wireless/virtual/mac80211_hwsim.h:34: * frames from a mac80211_hwsim radio device.
drivers/net/wireless/virtual/mac80211_hwsim.h-35- *
--
drivers/net/wireless/virtual/mac80211_hwsim.h-42- * Once registered the user application has to take responsibility of
drivers/net/wireless/virtual/mac80211_hwsim.h:43: * broadcasting the frames to all listening mac80211_hwsim radio
drivers/net/wireless/virtual/mac80211_hwsim.h-44- * interfaces.
--
drivers/net/wireless/virtual/mac80211_hwsim.h-55- * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
drivers/net/wireless/virtual/mac80211_hwsim.h:56: * frames by any mac80211_hwsim radio device.
drivers/net/wireless/virtual/mac80211_hwsim.h-57- * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-2-/*
drivers/net/wireless/virtual/mac80211_hwsim_i.h:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim_i.h-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-13-#include <net/mac80211.h>
drivers/net/wireless/virtual/mac80211_hwsim_i.h:14:#include "mac80211_hwsim.h"
drivers/net/wireless/virtual/mac80211_hwsim_i.h:15:#include "mac80211_hwsim_nan.h"
drivers/net/wireless/virtual/mac80211_hwsim_i.h-16-
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h=27=struct hwsim_sta_priv {
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-37-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:38:struct mac80211_hwsim_link_data {
drivers/net/wireless/virtual/mac80211_hwsim_i.h-39- u32 link_id;
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-50-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:51:struct mac80211_hwsim_data {
drivers/net/wireless/virtual/mac80211_hwsim_i.h-52- struct list_head list;
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-65- /* Storage space for channels, etc. */
drivers/net/wireless/virtual/mac80211_hwsim_i.h:66: struct mac80211_hwsim_phy_data *phy_data;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-67-
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h-144-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:145: struct mac80211_hwsim_link_data link_data[IEEE80211_MLD_MAX_NUM_LINKS];
drivers/net/wireless/virtual/mac80211_hwsim_i.h-146-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:147: struct mac80211_hwsim_nan_data nan;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-148-};
--
drivers/net/wireless/virtual/mac80211_hwsim_i.h=151=extern struct list_head hwsim_radios;
drivers/net/wireless/virtual/mac80211_hwsim_i.h-152-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:153:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-154- u64 tsf);
drivers/net/wireless/virtual/mac80211_hwsim_i.h:155:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-156- ktime_t ts);
drivers/net/wireless/virtual/mac80211_hwsim_i.h-157-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:158:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-159- struct ieee80211_vif *vif);
drivers/net/wireless/virtual/mac80211_hwsim_i.h-160-
drivers/net/wireless/virtual/mac80211_hwsim_i.h:161:void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_i.h-162- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2-/*
drivers/net/wireless/virtual/mac80211_hwsim_main.c:3: * mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4- * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-40-#include <linux/string.h>
drivers/net/wireless/virtual/mac80211_hwsim_main.c:41:#include "mac80211_hwsim.h"
drivers/net/wireless/virtual/mac80211_hwsim_main.c:42:#include "mac80211_hwsim_i.h"
drivers/net/wireless/virtual/mac80211_hwsim_main.c-43-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=335=static const struct class hwsim_class = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:336: .name = "mac80211_hwsim"
drivers/net/wireless/virtual/mac80211_hwsim_main.c-337-};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=604=hwsim_vendor_test_policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-607-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:608:static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-609- struct wireless_dev *wdev,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-630- *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:631: * event_idx = 0 (index in mac80211_hwsim_vendor_commands)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-632- */
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-658-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:659:static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-660- {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-663- .flags = WIPHY_VENDOR_CMD_NEED_NETDEV,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:664: .doit = mac80211_hwsim_vendor_cmd_test,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-665- .policy = hwsim_vendor_test_policy,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-670-/* Advertise support vendor specific events */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:671:static const struct nl80211_vendor_cmd_info mac80211_hwsim_vendor_events[] = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-672- { .vendor_id = OUI_QCA, .subcmd = 1 },
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=679=static int hwsim_radios_generation = 1;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-680-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:681:static struct platform_driver mac80211_hwsim_driver = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-682- .driver = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:683: .name = "mac80211_hwsim",
drivers/net/wireless/virtual/mac80211_hwsim_main.c-684- },
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=687=static const struct rhashtable_params hwsim_rht_params = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-690- .key_len = ETH_ALEN,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:691: .key_offset = offsetof(struct mac80211_hwsim_data, addresses[1]),
drivers/net/wireless/virtual/mac80211_hwsim_main.c:692: .head_offset = offsetof(struct mac80211_hwsim_data, rht),
drivers/net/wireless/virtual/mac80211_hwsim_main.c-693-};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=704=struct hwsim_radiotap_ack_hdr {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-711-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:712:static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-713-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=908=static DECLARE_WORK(hwsim_virtio_rx, hwsim_virtio_rx_work);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-909-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:910:static int hwsim_tx_virtio(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-911- struct sk_buff *skb)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-938-/* cause a linker error if this ends up being needed */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:939:extern int hwsim_tx_virtio(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-940- struct sk_buff *skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=979=static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-980-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:981: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-982- struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1004- rcu_read_lock();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1005: mac80211_hwsim_tx_frame(data->hw, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1006- rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1009-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1010:static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1011- struct ieee80211_vif *vif, int ps)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1042- rcu_read_lock();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1043: mac80211_hwsim_tx_frame(data->hw, skb,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1044- rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1049=static void hwsim_send_nullfunc_ps(void *dat, u8 *mac,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1051-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1052: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1053- hwsim_send_nullfunc(data, mac, vif, 1);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1056=static void hwsim_send_nullfunc_no_ps(void *dat, u8 *mac,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1058-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1059: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1060- hwsim_send_nullfunc(data, mac, vif, 0);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1063=static int hwsim_fops_ps_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1064-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1065: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1066- *val = data->ps;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1070=static int hwsim_fops_ps_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1071-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1072: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1073- enum ps_mode old_ps;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1110=static int hwsim_write_simulate_radar(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1111-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1112: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1113-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1122=static ssize_t hwsim_background_cac_write(struct file *file,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1125-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1126: struct mac80211_hwsim_data *data = file->private_data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1127- char buf[8] = {};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1174=static ssize_t hwsim_simulate_incumbent_signal_write(struct file *file,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1177-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1178: struct mac80211_hwsim_data *data = file->private_data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1179- struct hwsim_chanctx_iter_arg arg = {};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1216=static int hwsim_fops_group_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1217-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1218: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1219- *val = data->group;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1223=static int hwsim_fops_group_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1224-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1225: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1226- data->group = val;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1234=static int hwsim_fops_rx_rssi_read(void *dat, u64 *val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1235-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1236: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1237- *val = data->rx_rssi;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1241=static int hwsim_fops_rx_rssi_write(void *dat, u64 val)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1242-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1243: struct mac80211_hwsim_data *data = dat;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1244- int rssi = (int)val;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1257=static netdev_tx_t hwsim_mon_xmit(struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1264-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1265:static inline u64 mac80211_hwsim_get_sim_tsf(void)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1266-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1269-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1270:ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1271- u64 tsf)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1277-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1278:u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1279- ktime_t ts)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1285-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1286:u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1287- struct ieee80211_vif *vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1288-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1289: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1290: u64 sim_time = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1291-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1296-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1297:static __le64 __mac80211_hwsim_get_tsf(struct mac80211_hwsim_data *data)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1298-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1299: u64 sim_time = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1300-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1305-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1306:static void mac80211_hwsim_set_tsf(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1307- struct ieee80211_vif *vif, u64 tsf)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1308-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1309: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1310: u64 now = mac80211_hwsim_get_tsf(hw, vif);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1311- u64 delta = abs(tsf - now);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1327=static struct ieee80211_rate *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1328:mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1329- struct ieee80211_tx_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1337-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1338:static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1339- struct sk_buff *tx_skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1341-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1342: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1343- struct sk_buff *skb;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1346- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1347: struct ieee80211_rate *txrate = mac80211_hwsim_get_tx_rate(hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1348-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1368- (1 << IEEE80211_RADIOTAP_CHANNEL));
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1369: hdr->rt_tsft = __mac80211_hwsim_get_tsf(data);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1370- hdr->rt_flags = 0;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1389-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1390:static void mac80211_hwsim_monitor_ack(struct ieee80211_channel *chan,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1391- const u8 *addr)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1431-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1432:struct mac80211_hwsim_addr_match_data {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1433- u8 addr[ETH_ALEN];
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1436-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1437:static void mac80211_hwsim_addr_iter(void *data, u8 *mac,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1438- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1440- int i;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1441: struct mac80211_hwsim_addr_match_data *md = data;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1442-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1462-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1463:static bool mac80211_hwsim_addr_match(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1464- const u8 *addr)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1465-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1466: struct mac80211_hwsim_addr_match_data md = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1467- .ret = false,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1476- IEEE80211_IFACE_ITER_NORMAL,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1477: mac80211_hwsim_addr_iter,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1478- &md);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1482-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1483:static bool hwsim_ps_rx_ok(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1484- struct sk_buff *skb)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1498- if (data->ps_poll_pending &&
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1499: mac80211_hwsim_addr_match(data, skb->data + 4)) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1500- data->ps_poll_pending = false;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1508-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1509:static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1510- struct sk_buff *skb, int portid)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1531-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1532:static void mac80211_hwsim_config_mac_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1533- const u8 *addr, bool add)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1534-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1535: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1536- u32 _portid = READ_ONCE(data->wmediumd);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1552- if (!msg_head) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1553: pr_debug("mac80211_hwsim: problem with msg_head\n");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1554- goto nla_put_failure;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1575=static inline u16 trans_tx_rate_flags_ieee2hwsim(struct ieee80211_tx_rate *rate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1604-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1605:static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1606- struct sk_buff *skb, u64 sim_time)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1616-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1618- if (txrate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1645-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1646:static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1647- struct sk_buff *my_skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1651- struct sk_buff *skb;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1652: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1653- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) my_skb->data;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1673-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1674: sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1675: mac80211_hwsim_write_tsf(data, my_skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1676-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1683- if (msg_head == NULL) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1684: pr_debug("mac80211_hwsim: problem with msg_head\n");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1685- goto nla_put_failure;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1756-err_free_txskb:
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1757: pr_debug("mac80211_hwsim: error occurred in %s\n", __func__);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1758- ieee80211_free_txskb(hw, my_skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1771=struct tx_iter_data {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1777-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1778:static void mac80211_hwsim_tx_iter(void *_data, u8 *addr,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1779- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1785- vif->type == NL80211_IFTYPE_NAN_DATA) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1786: data->receive = mac80211_hwsim_nan_receive(data->hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1787- data->channel,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1811-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1812:static void mac80211_hwsim_add_vendor_rtap(struct sk_buff *skb)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1813-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1859-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1860:static void mac80211_hwsim_rx(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1861- struct ieee80211_rx_status *rx_status,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1891-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1892: mac80211_hwsim_add_vendor_rtap(skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1893-
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1894- if (data->nan.device_vif)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1895: mac80211_hwsim_nan_rx(data->hw, skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1896-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1901-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1902:static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1903- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1905-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1907- bool ack = false;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1910- struct ieee80211_rx_status rx_status;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1912-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1914-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1916-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1995- data2->hw, IEEE80211_IFACE_ITER_NORMAL,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1996: mac80211_hwsim_tx_iter, &tx_iter_data);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1997- if (!tx_iter_data.receive)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2024-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2025: if (mac80211_hwsim_addr_match(data2, hdr->addr1))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2026- ack = true;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2027-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2028: mac80211_hwsim_rx(data2, &rx_status, nskb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2029- }
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2035=static struct ieee80211_bss_conf *
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2036:mac80211_hwsim_select_tx_link(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2037- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2084-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2085:static int mac80211_hwsim_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2086- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2103-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2104:static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2105- struct ieee80211_tx_control *control,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2107-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2108: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2109- struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2139-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2140: mac80211_hwsim_nan_get_tx_chandef(hw, &chandef);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2141- if (WARN_ON(!chandef.chan)) {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2170- } else {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2171: bss_conf = mac80211_hwsim_select_tx_link(data, vif, sta,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2172- hdr, &link_sta);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2270- if (_portid || hwsim_virtio_enabled)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2271: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, channel);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2272-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2275- data->tx_bytes += skb->len;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276: ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2277-
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2278- if (ack && skb->len >= 16)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2279: mac80211_hwsim_monitor_ack(channel, hdr->addr2);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2280-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2298=void ieee80211_hwsim_wake_tx_queue(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2307- txq->vif->type == NL80211_IFTYPE_NAN_DATA) &&
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2308: !mac80211_hwsim_nan_txq_transmitting(hw, txq))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2309- return;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2311- while ((skb = ieee80211_tx_dequeue(hw, txq)))
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2312: mac80211_hwsim_tx(hw, &control, skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2313-}
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2314-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2315:static int mac80211_hwsim_start(struct ieee80211_hw *hw)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2316-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2317: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2318- wiphy_dbg(hw->wiphy, "%s\n", __func__);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2323-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2324:static void mac80211_hwsim_stop(struct ieee80211_hw *hw, bool suspend)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2325-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2326: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2327- struct sk_buff *skb;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2341-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2342:static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2343- struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2350- if (vif->type != NL80211_IFTYPE_MONITOR)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2351: mac80211_hwsim_config_mac_nl(hw, vif->addr, true);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2352-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2363=static void
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2364:mac80211_hwsim_link_add_debugfs(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2365- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2375-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2376:static int mac80211_hwsim_change_interface(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2377- struct ieee80211_vif *vif,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2396-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2397:static void mac80211_hwsim_remove_interface(
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2398- struct ieee80211_hw *hw, struct ieee80211_vif *vif)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2405- if (vif->type != NL80211_IFTYPE_MONITOR)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2406: mac80211_hwsim_config_mac_nl(hw, vif->addr, false);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2407-}
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2408-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2409:void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2410- struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2412-{
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2413: struct mac80211_hwsim_data *data = hw->priv;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2414- u32 _portid = READ_ONCE(data->wmediumd);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2423- if (_portid || hwsim_virtio_enabled)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2424: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, chan);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2425-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2427- data->tx_bytes += skb->len;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2428: mac80211_hwsim_tx_frame_no_nl(hw, skb, chan);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2429- dev_kfree_skb(skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2431-
]
|
| 159/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 22035
output: 31
thoughts: 40
Thoughts: **My Thought Process on Locating `genl_family`**
My immediate inclination is to pinpoint the exact location of `genl_family`. Given its likely role within the `mac80211_hwsim` module, I'm directing my search towards the core files associated with it. Specifically, I'm targeting `mac80211_hwsim_main.c` as the primary implementation file, and `mac80211_hwsim.h` as the most probable header file where such a global structure or identifier would be declared. This approach is driven by the standard software development practice of defining and implementing module-specific global data or structures within their respective source and header files for clear organization and efficient access. My expectation is that `genl_family` will be defined or referenced in one of these two locations, facilitating my understanding of its usage and context within the hardware simulation framework.
|
| 160/6 |
2026/09/07 07:30 |
tool |
grepper |
0m
Args: map[Expression:genl_family PathPrefix:drivers/net/wireless/virtual]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=712=static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-717-/* MAC80211_HWSIM netlink family */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:718:static struct genl_family hwsim_genl_family;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-719-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1532=static void mac80211_hwsim_config_mac_nl(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1548-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1549: msg_head = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1550- add ? HWSIM_CMD_ADD_MAC_ADDR :
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1646=static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1680-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1681: msg_head = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1682- HWSIM_CMD_FRAME);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=3776=static int mac80211_hwsim_start_pmsr(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-3805-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:3806: msg_head = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0, HWSIM_CMD_START_PMSR);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-3807-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=3843=static void mac80211_hwsim_abort_pmsr(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-3875-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:3876: msg_head = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0, HWSIM_CMD_ABORT_PMSR);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-3877-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4399=static void hwsim_mcast_config_msg(struct sk_buff *mcast_skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4402- if (info)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4403: genl_notify(&hwsim_genl_family, mcast_skb, info,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4404- HWSIM_MCGRP_CONFIG, GFP_KERNEL);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4405- else
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4406: genlmsg_multicast(&hwsim_genl_family, mcast_skb, 0,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4407- HWSIM_MCGRP_CONFIG, GFP_KERNEL);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4491=static void hwsim_mcast_new_radio(int id, struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4500-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4501: data = genlmsg_put(mcast_skb, 0, 0, &hwsim_genl_family, 0,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4502- HWSIM_CMD_NEW_RADIO);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6210=static void hwsim_mcast_del_radio(int id, const char *hwname,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6220-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6221: data = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6222- HWSIM_CMD_DEL_RADIO);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6257=static int mac80211_hwsim_get_radio(struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6265-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6266: hdr = genlmsg_put(skb, portid, seq, &hwsim_genl_family, flags,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6267- HWSIM_CMD_GET_RADIO);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7053=static int hwsim_dump_radio_nl(struct sk_buff *skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7088- hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7089: cb->nlh->nlmsg_seq, &hwsim_genl_family,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7090- NLM_F_MULTI, HWSIM_CMD_GET_RADIO);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7105=static const struct genl_small_ops hwsim_ops[] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7146-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7147:static struct genl_family hwsim_genl_family __ro_after_init = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7148- .name = "MAC80211_HWSIM",
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7209=static int __init hwsim_init_netlink(void)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7214-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7215: rc = genl_register_family(&hwsim_genl_family);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7216- if (rc)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7220- if (rc) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7221: genl_unregister_family(&hwsim_genl_family);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7222- goto failure;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7275=static void hwsim_exit_netlink(void)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7279- /* unregister the family */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7280: genl_unregister_family(&hwsim_genl_family);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7281-}
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7296=static int hwsim_virtio_handle_cmd(struct sk_buff *skb)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7309-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7310: err = genlmsg_parse(nlh, &hwsim_genl_family, tb, HWSIM_ATTR_MAX,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7311- hwsim_genl_policy, NULL);
]
|
| 161/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 24853
output: 44
thoughts: 185
Thoughts: **Understanding Generic Netlink Family Identification**
My initial observation is the naming convention used for Generic Netlink families. I've noticed that `hwsim_genl_family` is identified by `.name = "MAC80211_HWSIM"`, while `nl80211_fam` is identified by `.name = "nl80211"`. This disparity in naming conventions immediately sparks a question in my mind: how are these family IDs, particularly the string names, actually handled and queried within the broader `tools/` directory of the kernel source tree, especially when it comes to generic Netlink interactions?
To delve deeper into this, I need to examine how other programs and selftests within `tools/` are performing these generic Netlink queries to obtain family IDs. My plan is to systematically check relevant files. I'm particularly interested in exploring `tools/lib/bpf/netlink.c`, `tools/accounting/getdelays.c`, `tools/testing/selftests/acct/netlink_helper.c`, and `tools/net/ynl/lib/ynl.c`. These files are likely to contain the practical implementation details of how the kernel's Netlink infrastructure is interacted with at the user-space level.
My immediate focus will be on understanding the specific code within `tools/testing/selftests/acct/netlink_helper.c` and `tools/lib/bpf/netlink.c`. These two files seem like prime candidates for revealing the underlying mechanisms for family ID discovery and usage. By dissecting their contents, I anticipate gaining a clearer picture of the APIs and patterns employed to resolve these Netlink family identifiers, which will, in turn, shed light on the significance of the `.name` field and how it's leveraged for communication.
|
| 162/6 |
2026/09/07 07:30 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/acct/netlink_helper.c FirstLine:1 LineCount:100]
Results: map[Contents: 1: // SPDX-License-Identifier: GPL-2.0
2:
3: #include <errno.h>
4: #include <stdint.h>
5: #include <string.h>
6: #include <sys/socket.h>
7: #include <sys/time.h>
8: #include <unistd.h>
9: #include <linux/genetlink.h>
10:
11: #include "netlink_helper.h"
12:
13: int netlink_open(void)
14: {
15: struct timeval tv = { .tv_sec = ACCT_RCV_TIMEOUT_SEC };
16: struct sockaddr_nl addr = {
17: .nl_family = AF_NETLINK,
18: .nl_pid = getpid(),
19: };
20: int fd;
21:
22: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
23: if (fd < 0)
24: return -errno;
25:
26: if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) {
27: int err = -errno;
28:
29: close(fd);
30: return err;
31: }
32:
33: if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
34: int err = -errno;
35:
36: close(fd);
37: return err;
38: }
39:
40: return fd;
41: }
42:
43: int send_request(int fd, void *buf, size_t len)
44: {
45: struct sockaddr_nl addr = {
46: .nl_family = AF_NETLINK,
47: };
48:
49: if (sendto(fd, buf, len, 0, (struct sockaddr *)&addr, sizeof(addr)) < 0)
50: return -errno;
51:
52: return 0;
53: }
54:
55: /*
56: * Resolve the generic netlink family ID for @name.
57: * Returns the family ID (>= 0) on success, negative errno on failure.
58: */
59: int get_family_id(int fd, const char *name)
60: {
61: struct {
62: struct nlmsghdr nlh;
63: struct genlmsghdr genl;
64: char buf[256];
65: } req = { 0 };
66: char resp[8192];
67: struct nlmsghdr *nlh;
68: struct genlmsghdr *genl;
69: struct nlattr *na;
70: int len;
71: int rem;
72: int ret;
73:
74: req.nlh.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
75: req.nlh.nlmsg_type = GENL_ID_CTRL;
76: req.nlh.nlmsg_flags = NLM_F_REQUEST;
77: req.nlh.nlmsg_seq = 1;
78: req.nlh.nlmsg_pid = getpid();
79:
80: req.genl.cmd = CTRL_CMD_GETFAMILY;
81: req.genl.version = 1;
82:
83: na = (struct nlattr *)((char *)&req + NLMSG_ALIGN(req.nlh.nlmsg_len));
84: na->nla_type = CTRL_ATTR_FAMILY_NAME;
85: na->nla_len = NLA_HDRLEN + strlen(name) + 1;
86: memcpy(nla_data(na), name, strlen(name) + 1);
87: req.nlh.nlmsg_len = NLMSG_ALIGN(req.nlh.nlmsg_len) + NLA_ALIGN(na->nla_len);
88:
89: ret = send_request(fd, &req, req.nlh.nlmsg_len);
90: if (ret)
91: return ret;
92:
93: len = recv(fd, resp, sizeof(resp), 0);
94: if (len < 0)
95: return -errno;
96:
97: for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, len);
98: nlh = NLMSG_NEXT(nlh, len)) {
99: if (nlh->nlmsg_type == NLMSG_ERROR) {
100: struct nlmsgerr *err = NLMSG_DATA(nlh);
]
|
| 163/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26468
output: 45
thoughts: 41
Thoughts: **My Thought Process on Deeper System Exploration**
Alright, so I've been digging into the system's inner workings, and my next logical step is to get a more granular understanding of how network accounting is being managed at a lower level. To do that, I need to dive into the source code. Specifically, I'm planning to examine `tools/testing/selftests/acct/netlink_helper.c`. My rationale here is that this file likely contains helper functions or utilities used in the selftests for accounting, and by understanding these, I can gain insight into the practical implementation and testing of accounting mechanisms.
Concurrently, I want to understand how the Netlink communication, which is crucial for interacting with the kernel, is being handled. Therefore, I'll also be looking at `tools/lib/bpf/netlink.c`. This file, part of the BPF (Berkeley Packet Filter) libraries, is almost certainly where the low-level Netlink socket operations are abstracted. By analyzing this, I expect to see how BPF programs or tools interface with the kernel's Netlink infrastructure to send and receive messages, which is fundamental for configuring and monitoring network accounting features. Essentially, I'm bridging the gap between the high-level accounting concepts and the underlying kernel communication protocols.
|
| 164/6 |
2026/09/07 07:30 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/acct/netlink_helper.c FirstLine:100 LineCount:50]
Results: map[Contents: 100: struct nlmsgerr *err = NLMSG_DATA(nlh);
101:
102: return err->error ? err->error : -ENOENT;
103: }
104:
105: genl = (struct genlmsghdr *)NLMSG_DATA(nlh);
106: rem = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN;
107: na = (struct nlattr *)((char *)genl + GENL_HDRLEN);
108: while (nla_ok(na, rem)) {
109: if (na->nla_type == CTRL_ATTR_FAMILY_ID)
110: return *(uint16_t *)nla_data(na);
111: na = nla_next(na, &rem);
112: }
113: }
114:
115: return -ENOENT;
116: }
]
|
| 165/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26823
output: 39
thoughts: 34
Thoughts: **A Deep Dive into libbpf's Netlink Handling**
Alright, so I'm trying to get a handle on how libbpf manages its Netlink interactions, specifically digging into the `tools/lib/bpf/netlink.c` file. My current focus is around line 268. I want to understand the mechanics of their implementation there – what data structures are being utilized, what kind of Netlink messages are being constructed or parsed, and what the overall logic flow looks like. Essentially, I'm trying to reverse-engineer their approach to ensure I'm not reinventing the wheel or, more importantly, making a mistake by deviating from a well-established and likely robust pattern. It's about understanding the "how" and "why" behind their Netlink code at that specific juncture to inform my own development.
|
| 166/6 |
2026/09/07 07:30 |
tool |
read-file |
0m
Args: map[File:tools/lib/bpf/netlink.c FirstLine:268 LineCount:80]
Results: map[Contents: 268: static int libbpf_netlink_resolve_genl_family_id(const char *name,
269: __u16 len, __u16 *id)
270: {
271: struct libbpf_nla_req req = {
272: .nh.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN),
273: .nh.nlmsg_type = GENL_ID_CTRL,
274: .nh.nlmsg_flags = NLM_F_REQUEST,
275: .gnl.cmd = CTRL_CMD_GETFAMILY,
276: .gnl.version = 2,
277: };
278: int err;
279:
280: err = nlattr_add(&req, CTRL_ATTR_FAMILY_NAME, name, len);
281: if (err < 0)
282: return err;
283:
284: return libbpf_netlink_send_recv(&req, NETLINK_GENERIC,
285: parse_genl_family_id, NULL, id);
286: }
287:
288: static int __bpf_set_link_xdp_fd_replace(int ifindex, int fd, int old_fd,
289: __u32 flags)
290: {
291: struct nlattr *nla;
292: int ret;
293: struct libbpf_nla_req req;
294:
295: memset(&req, 0, sizeof(req));
296: req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
297: req.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
298: req.nh.nlmsg_type = RTM_SETLINK;
299: req.ifinfo.ifi_family = AF_UNSPEC;
300: req.ifinfo.ifi_index = ifindex;
301:
302: nla = nlattr_begin_nested(&req, IFLA_XDP);
303: if (!nla)
304: return -EMSGSIZE;
305: ret = nlattr_add(&req, IFLA_XDP_FD, &fd, sizeof(fd));
306: if (ret < 0)
307: return ret;
308: if (flags) {
309: ret = nlattr_add(&req, IFLA_XDP_FLAGS, &flags, sizeof(flags));
310: if (ret < 0)
311: return ret;
312: }
313: if (flags & XDP_FLAGS_REPLACE) {
314: ret = nlattr_add(&req, IFLA_XDP_EXPECTED_FD, &old_fd,
315: sizeof(old_fd));
316: if (ret < 0)
317: return ret;
318: }
319: nlattr_end_nested(&req, nla);
320:
321: return libbpf_netlink_send_recv(&req, NETLINK_ROUTE, NULL, NULL, NULL);
322: }
323:
324: int bpf_xdp_attach(int ifindex, int prog_fd, __u32 flags, const struct bpf_xdp_attach_opts *opts)
325: {
326: int old_prog_fd, err;
327:
328: if (!OPTS_VALID(opts, bpf_xdp_attach_opts))
329: return libbpf_err(-EINVAL);
330:
331: old_prog_fd = OPTS_GET(opts, old_prog_fd, 0);
332: if (old_prog_fd)
333: flags |= XDP_FLAGS_REPLACE;
334: else
335: old_prog_fd = -1;
336:
337: err = __bpf_set_link_xdp_fd_replace(ifindex, prog_fd, old_prog_fd, flags);
338: return libbpf_err(err);
339: }
340:
341: int bpf_xdp_detach(int ifindex, __u32 flags, const struct bpf_xdp_attach_opts *opts)
342: {
343: return bpf_xdp_attach(ifindex, -1, flags, opts);
344: }
345:
346: static int __dump_link_nlmsg(struct nlmsghdr *nlh,
347: libbpf_dump_nlmsg_t dump_link_nlmsg, void *cookie)
]
|
| 167/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 28269
output: 34
thoughts: 25
Thoughts: **My Thought Process Regarding `parse_genl_family_id`**
Alright, so my immediate focus is on `parse_genl_family_id`, which I've located in `tools/lib/bpf/netlink.c`. This immediately tells me I'm diving into the low-level, network-related C code, specifically within the BPF (Berkeley Packet Filter) tooling. This isn't just some abstract concept; it's about how we handle General Netlink (genl) family identifiers within this library.
My first instinct is to understand the *purpose* of this function. Why does it exist? What problem does it solve? I'm assuming it's a utility function, likely responsible for taking some form of input – perhaps a string representation of a family name or an integer identifier – and converting it into a usable, canonical `genl_family_id`. This kind of parsing is crucial for any system that needs to interact with netlink sockets and identify specific families of messages.
Given its location in `tools/lib/bpf`, I'm anticipating that this function is used by various BPF tools to discover, register, or communicate with kernel-level netlink families. BPF often interacts with kernel subsystems via netlink, and correctly identifying the family is a fundamental step in establishing that communication.
When I look at the function signature and its implementation (which I'm about to do, or have just done), I'll be paying close attention to:
* **Input parameters:** What exactly does it accept? Is it a `char *` for a family name, an `int` for an ID, or something else? Understanding the input dictates how it's called and where it fits into a larger workflow.
* **Return value:** What does it produce? A `genl_family_id` (likely a `uint16_t` or similar, as per netlink conventions), or perhaps an error code if parsing fails? The return type is key to understanding how its results are used.
* **Error handling:** This is paramount. How does it signal failure? Does it return a sentinel value (like -1 or 0, though 0 might be a valid ID in some contexts, so that's risky)? Does it set an `errno`? Does it rely on a separate error-reporting mechanism? For a library function like this, robust error handling is critical for the stability of the tools that use it.
* **Internal logic:** How does it perform the conversion? If it's parsing a name, I'd expect it to involve some sort of lookup mechanism. Is there a hardcoded table of known family names? Does it communicate with the kernel (perhaps via `nl_family_lookup` or similar netlink calls) to resolve names to IDs? If it's parsing an integer, it might be more straightforward, but I'll still check for any sanity checks or range validations.
* **Dependencies:** What other functions or data structures does it rely on? This helps me map out the dependencies within the `libbpf` library.
Essentially, I'm trying to reverse-engineer the "why" and "how" of `parse_genl_family_id`. My goal is to grasp its role as a translator between human-readable (or at least, programmatically manageable) family representations and the raw identifiers the netlink protocol requires. This understanding is foundational for any work involving netlink communication within the BPF ecosystem.
|
| 168/6 |
2026/09/07 07:30 |
tool |
grepper |
0m
Args: map[Expression:parse_genl_family_id PathPrefix:tools/lib/bpf]
Results: map[Output:tools/lib/bpf/netlink.c=224=static int libbpf_netlink_send_recv(struct libbpf_nla_req *req,
--
tools/lib/bpf/netlink.c-250-
tools/lib/bpf/netlink.c:251:static int parse_genl_family_id(struct nlmsghdr *nh, libbpf_dump_nlmsg_t fn,
tools/lib/bpf/netlink.c-252- void *cookie)
--
tools/lib/bpf/netlink.c=268=static int libbpf_netlink_resolve_genl_family_id(const char *name,
--
tools/lib/bpf/netlink.c-284- return libbpf_netlink_send_recv(&req, NETLINK_GENERIC,
tools/lib/bpf/netlink.c:285: parse_genl_family_id, NULL, id);
tools/lib/bpf/netlink.c-286-}
]
|
| 169/6 |
2026/09/07 07:30 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 28585
output: 39
thoughts: 28
Thoughts: **My Thought Process on `parse_genl_family_id`**
Alright, so my immediate inclination is to dive into the `parse_genl_family_id` function located in `tools/lib/bpf/netlink.c`. This is the starting point, the hook into understanding how we're handling generic netlink family IDs. I need to see exactly how this function operates, what inputs it expects, what processing it performs, and crucially, what output it yields. My goal here is to fully grasp its role within the broader netlink processing, especially in the context of BPF operations. I’m assuming this function is instrumental in translating some form of input into a usable generic netlink family identifier, and I'm keen to uncover the mechanics of that translation.
|
| 170/6 |
2026/09/07 07:31 |
tool |
read-file |
0m
Args: map[File:tools/lib/bpf/netlink.c FirstLine:245 LineCount:25]
Results: map[Contents: 245: parse_msg, parse_attr, cookie);
246: out:
247: libbpf_netlink_close(sock);
248: return ret;
249: }
250:
251: static int parse_genl_family_id(struct nlmsghdr *nh, libbpf_dump_nlmsg_t fn,
252: void *cookie)
253: {
254: struct genlmsghdr *gnl = NLMSG_DATA(nh);
255: struct nlattr *na = (struct nlattr *)((void *)gnl + GENL_HDRLEN);
256: struct nlattr *tb[CTRL_ATTR_FAMILY_ID + 1];
257: __u16 *id = cookie;
258:
259: libbpf_nla_parse(tb, CTRL_ATTR_FAMILY_ID, na,
260: NLMSG_PAYLOAD(nh, sizeof(*gnl)), NULL);
261: if (!tb[CTRL_ATTR_FAMILY_ID])
262: return NL_CONT;
263:
264: *id = libbpf_nla_getattr_u16(tb[CTRL_ATTR_FAMILY_ID]);
265: return NL_DONE;
266: }
267:
268: static int libbpf_netlink_resolve_genl_family_id(const char *name,
269: __u16 len, __u16 *id)
]
|
| 171/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 29075
output: 38
thoughts: 64
Thoughts: **A Deep Dive into Netlink Header Macros**
My current objective is to thoroughly understand the definition and usage of Netlink header macros. To achieve this, my immediate plan is to meticulously examine the source code, specifically focusing on the header files where these macros are declared. I intend to start with `<linux/netlink.h>` and `<linux/genetlink.h>` as these are the primary locations for Netlink and generic Netlink definitions, respectively. Following that, I'll delve into the user-API (uapi) versions of these headers, located in `include/uapi/linux/netlink.h` and `include/uapi/linux/genetlink.h`. This approach will allow me to trace the exact definitions and understand any distinctions or nuances between the core kernel headers and their user-space exposed counterparts. By dissecting these macros, I aim to gain a comprehensive grasp of how Netlink messages are structured and how these macros facilitate their creation and parsing, which is crucial for my work in this domain.
|
| 172/6 |
2026/09/07 07:31 |
tool |
grepper |
0m
Args: map[Expression:#define CTRL_ATTR_ PathPrefix:include/uapi/linux/genetlink.h]
Results: map[Output:include/uapi/linux/genetlink.h=57=enum {
--
include/uapi/linux/genetlink.h-71-
include/uapi/linux/genetlink.h:72:#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
include/uapi/linux/genetlink.h-73-
include/uapi/linux/genetlink.h=74=enum {
--
include/uapi/linux/genetlink.h-80-
include/uapi/linux/genetlink.h:81:#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
include/uapi/linux/genetlink.h-82-
include/uapi/linux/genetlink.h=83=enum {
--
include/uapi/linux/genetlink.h-89-
include/uapi/linux/genetlink.h:90:#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
include/uapi/linux/genetlink.h-91-
include/uapi/linux/genetlink.h=92=enum {
--
include/uapi/linux/genetlink.h-100-
include/uapi/linux/genetlink.h:101:#define CTRL_ATTR_POLICY_MAX (__CTRL_ATTR_POLICY_DUMP_MAX - 1)
include/uapi/linux/genetlink.h-102-
]
|
| 173/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 29549
output: 39
thoughts: 24
Thoughts: **My Thought Process**
Right, so I'm diving into `include/uapi/linux/genetlink.h`, and I'm specifically focusing my attention around line 50. My goal here is to understand the intricacies of the genetlink subsystem, and I believe this particular section of the header file will offer crucial insights. I'm expecting to find definitions related to the fundamental structures or constants that govern how user-space applications interact with the kernel's generic netlink interface. This is the core of how we'll be setting up communication channels and defining the messages that flow between user and kernel space. Therefore, understanding what's defined here is a critical first step in grasping the overall genetlink architecture and its operational parameters.
|
| 174/6 |
2026/09/07 07:31 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/genetlink.h FirstLine:40 LineCount:40]
Results: map[Contents: 40: enum {
41: CTRL_CMD_UNSPEC,
42: CTRL_CMD_NEWFAMILY,
43: CTRL_CMD_DELFAMILY,
44: CTRL_CMD_GETFAMILY,
45: CTRL_CMD_NEWOPS,
46: CTRL_CMD_DELOPS,
47: CTRL_CMD_GETOPS,
48: CTRL_CMD_NEWMCAST_GRP,
49: CTRL_CMD_DELMCAST_GRP,
50: CTRL_CMD_GETMCAST_GRP, /* unused */
51: CTRL_CMD_GETPOLICY,
52: __CTRL_CMD_MAX,
53: };
54:
55: #define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
56:
57: enum {
58: CTRL_ATTR_UNSPEC,
59: CTRL_ATTR_FAMILY_ID,
60: CTRL_ATTR_FAMILY_NAME,
61: CTRL_ATTR_VERSION,
62: CTRL_ATTR_HDRSIZE,
63: CTRL_ATTR_MAXATTR,
64: CTRL_ATTR_OPS,
65: CTRL_ATTR_MCAST_GROUPS,
66: CTRL_ATTR_POLICY,
67: CTRL_ATTR_OP_POLICY,
68: CTRL_ATTR_OP,
69: __CTRL_ATTR_MAX,
70: };
71:
72: #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
73:
74: enum {
75: CTRL_ATTR_OP_UNSPEC,
76: CTRL_ATTR_OP_ID,
77: CTRL_ATTR_OP_FLAGS,
78: __CTRL_ATTR_OP_MAX,
79: };
]
|
| 175/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30108
output: 37
thoughts: 25
Thoughts: **A Deep Dive into Netlink's Core Definitions**
My immediate impulse is to go straight to the source code, specifically the standard UAPI (User-space API) netlink definitions. I'm thinking the primary location for this will be within the Linux kernel's header files. My search will be focused on `include/uapi/linux/netlink.h`. This file is crucial because it lays out the fundamental structures and constants that govern how user-space applications and the kernel communicate via netlink. I expect to find definitions for the netlink socket family itself, control message types, attribute structures, and potentially various flags and identifiers that are essential for understanding the basic mechanics of netlink communication. It's not just about looking at these definitions in isolation; I need to grasp their interrelationships and how they form the bedrock upon which all netlink-based subsystems are built. This foundational understanding is critical for any in-depth work involving netlink, ensuring I'm not operating on assumptions but on the definitive specifications.
|
| 176/6 |
2026/09/07 07:31 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:1 LineCount:80]
Results: map[Contents: 1: /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2: #ifndef _UAPI__LINUX_NETLINK_H
3: #define _UAPI__LINUX_NETLINK_H
4:
5: #include <linux/const.h>
6: #include <linux/socket.h> /* for __kernel_sa_family_t */
7: #include <linux/types.h>
8:
9: #define NETLINK_ROUTE 0 /* Routing/device hook */
10: #define NETLINK_UNUSED 1 /* Unused number */
11: #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
12: #define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
13: #define NETLINK_SOCK_DIAG 4 /* socket monitoring */
14: #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
15: #define NETLINK_XFRM 6 /* ipsec */
16: #define NETLINK_SELINUX 7 /* SELinux event notifications */
17: #define NETLINK_ISCSI 8 /* Open-iSCSI */
18: #define NETLINK_AUDIT 9 /* auditing */
19: #define NETLINK_FIB_LOOKUP 10
20: #define NETLINK_CONNECTOR 11
21: #define NETLINK_NETFILTER 12 /* netfilter subsystem */
22: #define NETLINK_IP6_FW 13
23: #define NETLINK_DNRTMSG 14 /* DECnet routing messages (obsolete) */
24: #define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
25: #define NETLINK_GENERIC 16
26: /* leave room for NETLINK_DM (DM Events) */
27: #define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
28: #define NETLINK_ECRYPTFS 19
29: #define NETLINK_RDMA 20
30: #define NETLINK_CRYPTO 21 /* Crypto layer */
31: #define NETLINK_SMC 22 /* SMC monitoring */
32:
33: #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
34:
35: #define MAX_LINKS 32
36:
37: struct sockaddr_nl {
38: __kernel_sa_family_t nl_family; /* AF_NETLINK */
39: unsigned short nl_pad; /* zero */
40: __u32 nl_pid; /* port ID */
41: __u32 nl_groups; /* multicast groups mask */
42: };
43:
44: /**
45: * struct nlmsghdr - fixed format metadata header of Netlink messages
46: * @nlmsg_len: Length of message including header
47: * @nlmsg_type: Message content type
48: * @nlmsg_flags: Additional flags
49: * @nlmsg_seq: Sequence number
50: * @nlmsg_pid: Sending process port ID
51: */
52: struct nlmsghdr {
53: __u32 nlmsg_len;
54: __u16 nlmsg_type;
55: __u16 nlmsg_flags;
56: __u32 nlmsg_seq;
57: __u32 nlmsg_pid;
58: };
59:
60: /* Flags values */
61:
62: #define NLM_F_REQUEST 0x01 /* It is request message. */
63: #define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */
64: #define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */
65: #define NLM_F_ECHO 0x08 /* Receive resulting notifications */
66: #define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */
67: #define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */
68:
69: /* Modifiers to GET request */
70: #define NLM_F_ROOT 0x100 /* specify tree root */
71: #define NLM_F_MATCH 0x200 /* return all matching */
72: #define NLM_F_ATOMIC 0x400 /* atomic GET */
73: #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
74:
75: /* Modifiers to NEW request */
76: #define NLM_F_REPLACE 0x100 /* Override existing */
77: #define NLM_F_EXCL 0x200 /* Do not touch, if it exists */
78: #define NLM_F_CREATE 0x400 /* Create, if it does not exist */
79: #define NLM_F_APPEND 0x800 /* Add to end of list */
80:
]
|
| 177/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 31655
output: 38
thoughts: 18
Thoughts: **A Deep Dive into Netlink's Macro Landscape**
My current focus is on thoroughly understanding Netlink's internal workings, and a critical step in this process involves examining the `NLMSG` and `NLA` macros defined in `netlink.h`. I need to ensure I have a complete grasp of how these macros are used to construct and deconstruct Netlink messages, as this is fundamental to how applications interact with the kernel via Netlink. I'm particularly interested in the nuances of how these macros abstract away the low-level byte manipulation, providing a more programmer-friendly interface. By scrutinizing `netlink.h`, I aim to solidify my knowledge of the message formatting, attribute parsing, and the overall Netlink protocol structure as implemented through these essential macro definitions.
|
| 178/6 |
2026/09/07 07:31 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:81 LineCount:80]
Results: map[Contents: 81: /* Modifiers to DELETE request */
82: #define NLM_F_NONREC 0x100 /* Do not delete recursively */
83: #define NLM_F_BULK 0x200 /* Delete multiple objects */
84:
85: /* Flags for ACK message */
86: #define NLM_F_CAPPED 0x100 /* request was capped */
87: #define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */
88:
89: /*
90: 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL
91: 4.4BSD CHANGE NLM_F_REPLACE
92:
93: True CHANGE NLM_F_CREATE|NLM_F_REPLACE
94: Append NLM_F_CREATE
95: Check NLM_F_EXCL
96: */
97:
98: #define NLMSG_ALIGNTO 4U
99: #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
100: #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
101: #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
102: #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
103: #define NLMSG_DATA(nlh) ((void *)(((char *)nlh) + NLMSG_HDRLEN))
104: #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
105: (struct nlmsghdr *)(((char *)(nlh)) + \
106: NLMSG_ALIGN((nlh)->nlmsg_len)))
107: #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
108: (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
109: (nlh)->nlmsg_len <= (len))
110: #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
111:
112: #define NLMSG_NOOP 0x1 /* Nothing. */
113: #define NLMSG_ERROR 0x2 /* Error */
114: #define NLMSG_DONE 0x3 /* End of a dump */
115: #define NLMSG_OVERRUN 0x4 /* Data lost */
116:
117: #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
118:
119: struct nlmsgerr {
120: int error;
121: struct nlmsghdr msg;
122: /*
123: * followed by the message contents unless NETLINK_CAP_ACK was set
124: * or the ACK indicates success (error == 0)
125: * message length is aligned with NLMSG_ALIGN()
126: */
127: /*
128: * followed by TLVs defined in enum nlmsgerr_attrs
129: * if NETLINK_EXT_ACK was set
130: */
131: };
132:
133: /**
134: * enum nlmsgerr_attrs - nlmsgerr attributes
135: * @NLMSGERR_ATTR_UNUSED: unused
136: * @NLMSGERR_ATTR_MSG: error message string (string)
137: * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original
138: * message, counting from the beginning of the header (u32)
139: * @NLMSGERR_ATTR_COOKIE: arbitrary subsystem specific cookie to
140: * be used - in the success case - to identify a created
141: * object or operation or similar (binary)
142: * @NLMSGERR_ATTR_POLICY: policy for a rejected attribute
143: * @NLMSGERR_ATTR_MISS_TYPE: type of a missing required attribute,
144: * %NLMSGERR_ATTR_MISS_NEST will not be present if the attribute was
145: * missing at the message level
146: * @NLMSGERR_ATTR_MISS_NEST: offset of the nest where attribute was missing
147: * @__NLMSGERR_ATTR_MAX: number of attributes
148: * @NLMSGERR_ATTR_MAX: highest attribute number
149: */
150: enum nlmsgerr_attrs {
151: NLMSGERR_ATTR_UNUSED,
152: NLMSGERR_ATTR_MSG,
153: NLMSGERR_ATTR_OFFS,
154: NLMSGERR_ATTR_COOKIE,
155: NLMSGERR_ATTR_POLICY,
156: NLMSGERR_ATTR_MISS_TYPE,
157: NLMSGERR_ATTR_MISS_NEST,
158:
159: __NLMSGERR_ATTR_MAX,
160: NLMSGERR_ATTR_MAX = __NLMSGERR_ATTR_MAX - 1
]
|
| 179/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 33207
output: 36
thoughts: 74
Thoughts: **My Thought Process**
Alright, so I'm diving into this Netlink interaction, and my immediate concern is understanding the fundamental building blocks of the protocol, specifically how attribute data is structured. I know that Netlink attributes are generally prefixed with some kind of length and type information. My goal here is to pinpoint the exact constants and definitions that govern this structure, as they are absolutely crucial for correctly parsing and constructing Netlink messages.
I'm thinking the most likely place to find these definitions will be in the Netlink header files. Given the context, I'll start by looking in `include/uapi/linux/netlink.h` and `include/linux/netlink.h`. The `uapi` directory often contains the user-space API definitions, which is precisely what I'm interested in for interacting with the kernel. `genetlink.h` is also a strong contender, especially if I'm dealing with generic Netlink, which is a common extension.
To quickly identify the relevant constants, I'm going to use `grep`. My target is to find anything starting with `NLA_`, as this prefix is a strong convention for Netlink Attribute-related definitions. I'll specifically target `include/uapi/linux/netlink.h` with this grep command. I expect to find things like `NLA_OK`, `NLA_HDRLEN`, and potentially others that define the size of the attribute header and perhaps flags or type identifiers. Understanding these values will be key to knowing how to properly extract attribute data from a message and how to format attributes when sending them.
|
| 180/6 |
2026/09/07 07:31 |
tool |
grepper |
0m
Args: map[Expression:#define NLA_ PathPrefix:include/uapi/linux/netlink.h]
Results: map[Output:include/uapi/linux/netlink.h=229=struct nlattr {
--
include/uapi/linux/netlink.h-243- */
include/uapi/linux/netlink.h:244:#define NLA_F_NESTED (1 << 15)
include/uapi/linux/netlink.h:245:#define NLA_F_NET_BYTEORDER (1 << 14)
include/uapi/linux/netlink.h:246:#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
include/uapi/linux/netlink.h-247-
include/uapi/linux/netlink.h:248:#define NLA_ALIGNTO 4
include/uapi/linux/netlink.h:249:#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
include/uapi/linux/netlink.h:250:#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
include/uapi/linux/netlink.h-251-
]
|
| 181/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 33613
output: 39
thoughts: 43
Thoughts: **My Thought Process**
Right, so the immediate task is to delve into the `include/uapi/linux/netlink.h` header file, specifically lines 225 through 270. My goal here is to get a solid grasp of how the `nlattr` structure is defined. More importantly, I need to identify and understand any associated macros that are exposed in the UAPI (User API) space. This is crucial for understanding how user-space applications will interact with netlink attributes, as the UAPI defines the contract between the kernel and its users. I expect to find the fundamental definition of the attribute structure itself, likely detailing its length, type, and data payload. Following that, I'm keen to see if there are any convenience macros for creating, parsing, or manipulating these attributes, as these would significantly simplify development for userspace developers.
|
| 182/6 |
2026/09/07 07:31 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:225 LineCount:45]
Results: map[Contents: 225: * +---------------------+- - -+- - - - - - - - - -+- - -+
226: * <-------------- nlattr->nla_len -------------->
227: */
228:
229: struct nlattr {
230: __u16 nla_len;
231: __u16 nla_type;
232: };
233:
234: /*
235: * nla_type (16 bits)
236: * +---+---+-------------------------------+
237: * | N | O | Attribute Type |
238: * +---+---+-------------------------------+
239: * N := Carries nested attributes
240: * O := Payload stored in network byte order
241: *
242: * Note: The N and O flag are mutually exclusive.
243: */
244: #define NLA_F_NESTED (1 << 15)
245: #define NLA_F_NET_BYTEORDER (1 << 14)
246: #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
247:
248: #define NLA_ALIGNTO 4
249: #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
250: #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
251:
252: /* Generic 32 bitflags attribute content sent to the kernel.
253: *
254: * The value is a bitmap that defines the values being set
255: * The selector is a bitmask that defines which value is legit
256: *
257: * Examples:
258: * value = 0x0, and selector = 0x1
259: * implies we are selecting bit 1 and we want to set its value to 0.
260: *
261: * value = 0x2, and selector = 0x2
262: * implies we are selecting bit 2 and we want to set its value to 1.
263: *
264: */
265: struct nla_bitfield32 {
266: __u32 value;
267: __u32 selector;
268: };
269:
]
|
| 183/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 34400
output: 25
thoughts: 62
Thoughts: **A Deep Dive into Netlink Header Inclusion**
My primary concern right now is the precise location and availability of certain Netlink macros, specifically `NLA_DATA`, `NLA_NEXT`, and `NLA_OK`. I need to ascertain if these are guaranteed to be present in the `uapi` (userspace API) version of `linux/netlink.h`. It's entirely possible they are, but I'm not taking that for granted. To confirm, my immediate next step is to perform a targeted search, likely using `grep`, across my codebase or relevant kernel source trees to see if `nla_data` (or any of the others) actually appears in the expected header file. This verification is crucial before I proceed with any code that relies on their presence, ensuring robustness and avoiding potential build or runtime failures.
|
| 184/6 |
2026/09/07 07:31 |
tool |
grepper |
0m
Args: map[Expression:nla_data PathPrefix:include]
Results: map[Output:include/net/netlink.h-87- * <- nla_len(nla) -> ^
include/net/netlink.h:88: * nla_data(nla)----^ |
include/net/netlink.h-89- * nla_next(nla)-----------------------------'
--
include/net/netlink.h-130- * Attribute Payload Access:
include/net/netlink.h:131: * nla_data(nla) head of attribute payload
include/net/netlink.h-132- * nla_len(nla) length of attribute payload
--
include/net/netlink.h=1276=static inline int nla_type(const struct nlattr *nla)
--
include/net/netlink.h-1281-/**
include/net/netlink.h:1282: * nla_data - head of payload
include/net/netlink.h-1283- * @nla: netlink attribute
include/net/netlink.h-1284- */
include/net/netlink.h:1285:static inline void *nla_data(const struct nlattr *nla)
include/net/netlink.h-1286-{
--
include/net/netlink.h=1335=nla_find_nested(const struct nlattr *nla, int attrtype)
include/net/netlink.h-1336-{
include/net/netlink.h:1337: return nla_find(nla_data(nla), nla_len(nla), attrtype);
include/net/netlink.h-1338-}
--
include/net/netlink.h=1350=static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
--
include/net/netlink.h-1359-
include/net/netlink.h:1360: return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
include/net/netlink.h-1361- NL_VALIDATE_STRICT, extack);
--
include/net/netlink.h=1374=static inline int nla_parse_nested_deprecated(struct nlattr *tb[], int maxtype,
--
include/net/netlink.h-1378-{
include/net/netlink.h:1379: return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
include/net/netlink.h-1380- NL_VALIDATE_LIBERAL, extack);
--
include/net/netlink.h=1732=static inline u32 nla_get_u32(const struct nlattr *nla)
include/net/netlink.h-1733-{
include/net/netlink.h:1734: return *(u32 *) nla_data(nla);
include/net/netlink.h-1735-}
--
include/net/netlink.h=1755=static inline __be32 nla_get_be32(const struct nlattr *nla)
include/net/netlink.h-1756-{
include/net/netlink.h:1757: return *(__be32 *) nla_data(nla);
include/net/netlink.h-1758-}
--
include/net/netlink.h=1779=static inline __le32 nla_get_le32(const struct nlattr *nla)
include/net/netlink.h-1780-{
include/net/netlink.h:1781: return *(__le32 *) nla_data(nla);
include/net/netlink.h-1782-}
--
include/net/netlink.h=1803=static inline u16 nla_get_u16(const struct nlattr *nla)
include/net/netlink.h-1804-{
include/net/netlink.h:1805: return *(u16 *) nla_data(nla);
include/net/netlink.h-1806-}
--
include/net/netlink.h=1826=static inline __be16 nla_get_be16(const struct nlattr *nla)
include/net/netlink.h-1827-{
include/net/netlink.h:1828: return *(__be16 *) nla_data(nla);
include/net/netlink.h-1829-}
--
include/net/netlink.h=1850=static inline __le16 nla_get_le16(const struct nlattr *nla)
include/net/netlink.h-1851-{
include/net/netlink.h:1852: return *(__le16 *) nla_data(nla);
include/net/netlink.h-1853-}
--
include/net/netlink.h=1874=static inline u8 nla_get_u8(const struct nlattr *nla)
include/net/netlink.h-1875-{
include/net/netlink.h:1876: return *(u8 *) nla_data(nla);
include/net/netlink.h-1877-}
--
include/net/netlink.h=1977=static inline __le64 nla_get_le64(const struct nlattr *nla)
include/net/netlink.h-1978-{
include/net/netlink.h:1979: return *(__le64 *) nla_data(nla);
include/net/netlink.h-1980-}
--
include/net/netlink.h=2001=static inline s32 nla_get_s32(const struct nlattr *nla)
include/net/netlink.h-2002-{
include/net/netlink.h:2003: return *(s32 *) nla_data(nla);
include/net/netlink.h-2004-}
--
include/net/netlink.h=2024=static inline s16 nla_get_s16(const struct nlattr *nla)
include/net/netlink.h-2025-{
include/net/netlink.h:2026: return *(s16 *) nla_data(nla);
include/net/netlink.h-2027-}
--
include/net/netlink.h=2047=static inline s8 nla_get_s8(const struct nlattr *nla)
include/net/netlink.h-2048-{
include/net/netlink.h:2049: return *(s8 *) nla_data(nla);
include/net/netlink.h-2050-}
--
include/net/netlink.h=2159=static inline __be32 nla_get_in_addr(const struct nlattr *nla)
include/net/netlink.h-2160-{
include/net/netlink.h:2161: return *(__be32 *) nla_data(nla);
include/net/netlink.h-2162-}
--
include/net/netlink.h=2208=static inline void *nla_memdup_noprof(const struct nlattr *src, gfp_t gfp)
include/net/netlink.h-2209-{
include/net/netlink.h:2210: return kmemdup_noprof(nla_data(src), nla_len(src), gfp);
include/net/netlink.h-2211-}
--
include/net/netlink.h=2330=static inline int __nla_validate_nested(const struct nlattr *start, int maxtype,
--
include/net/netlink.h-2334-{
include/net/netlink.h:2335: return __nla_validate(nla_data(start), nla_len(start), maxtype, policy,
include/net/netlink.h-2336- validate, extack);
--
include/net/netlink.h=2349=nla_validate_nested_deprecated(const struct nlattr *start, int maxtype,
--
include/net/netlink.h-2360- *
include/net/netlink.h:2361: * Return: true if padding is needed to align the next attribute (nla_data()) to
include/net/netlink.h-2362- * a 64-bit aligned area.
--
include/net/netlink.h=2364=static inline bool nla_need_padding_for_64bit(struct sk_buff *skb)
--
include/net/netlink.h-2368- * if the skb->data _is_ aligned. A NOP attribute, plus
include/net/netlink.h:2369: * nlattr header for next attribute, will make nla_data()
include/net/netlink.h-2370- * 8-byte aligned.
--
include/net/netlink.h-2378-/**
include/net/netlink.h:2379: * nla_align_64bit - 64-bit align the nla_data() of next attribute
include/net/netlink.h-2380- * @skb: socket buffer the message is stored in
--
include/net/netlink.h-2383- * Conditionally emit a padding netlink attribute in order to make
include/net/netlink.h:2384: * the next attribute we emit have a 64-bit aligned nla_data() area.
include/net/netlink.h-2385- * This will only be done in architectures which do not have
--
include/net/netlink.h=2403=static inline int nla_total_size_64bit(int payload)
--
include/net/netlink.h-2442-#define nla_for_each_nested(pos, nla, rem) \
include/net/netlink.h:2443: nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem)
include/net/netlink.h-2444-
--
include/net/xfrm.h=2241=static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
--
include/net/xfrm.h-2243- if (attrs[XFRMA_MARK])
include/net/xfrm.h:2244: memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark));
include/net/xfrm.h-2245- else
]
|
| 185/6 |
2026/09/07 07:31 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 37287
output: 37
thoughts: 70
Thoughts: **My Thought Process Regarding NLA_ Helper Implementations**
My initial line of inquiry is to understand the practical, userspace C implementations of `NLA_` helpers. To do this, I'm looking to investigate where these helpers are typically defined or how they are commonly structured in existing code. My strategy is to focus my search on key areas that are likely to contain such definitions. Specifically, I intend to examine the `include/net/netlink.h` header file, as it's the natural place for network-related definitions. Additionally, I'll be looking at selftests, which often showcase practical usage patterns and might reveal less obvious, but still valid, implementations. To narrow down my search within `include/net/netlink.h`, I'm going to pay particular attention to the section around lines 1270 to 1300, anticipating that the relevant definitions or examples might reside in that vicinity.
|
| 186/6 |
2026/09/07 07:32 |
tool |
read-file |
0m
Args: map[File:include/net/netlink.h FirstLine:1270 LineCount:50]
Results: map[Contents:1270: }
1271:
1272: /**
1273: * nla_type - attribute type
1274: * @nla: netlink attribute
1275: */
1276: static inline int nla_type(const struct nlattr *nla)
1277: {
1278: return nla->nla_type & NLA_TYPE_MASK;
1279: }
1280:
1281: /**
1282: * nla_data - head of payload
1283: * @nla: netlink attribute
1284: */
1285: static inline void *nla_data(const struct nlattr *nla)
1286: {
1287: return (char *) nla + NLA_HDRLEN;
1288: }
1289:
1290: /**
1291: * nla_len - length of payload
1292: * @nla: netlink attribute
1293: */
1294: static inline u16 nla_len(const struct nlattr *nla)
1295: {
1296: return nla->nla_len - NLA_HDRLEN;
1297: }
1298:
1299: /**
1300: * nla_ok - check if the netlink attribute fits into the remaining bytes
1301: * @nla: netlink attribute
1302: * @remaining: number of bytes remaining in attribute stream
1303: */
1304: static inline int nla_ok(const struct nlattr *nla, int remaining)
1305: {
1306: return remaining >= (int) sizeof(*nla) &&
1307: nla->nla_len >= sizeof(*nla) &&
1308: nla->nla_len <= remaining;
1309: }
1310:
1311: /**
1312: * nla_next - next netlink attribute in attribute stream
1313: * @nla: netlink attribute
1314: * @remaining: number of bytes remaining in attribute stream
1315: *
1316: * Returns: the next netlink attribute in the attribute stream and
1317: * decrements remaining by the size of the current attribute.
1318: */
1319: static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
]
|
| 187/6 |
2026/09/07 07:32 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 38079
output: 49
thoughts: 169
Thoughts: **My Thought Process on `nla_next` and Generic Netlink Querying**
Okay, so I'm looking at this `nla_next` function, and my immediate instinct is to understand its core purpose: it's clearly designed to help me iterate through a sequence of Netlink attributes. The `struct nlattr *nla` is the current attribute I'm looking at, and `int *remaining` is a pointer to a counter that tells me how much data is left in the attribute stream.
My first step is to dissect the function itself:
* `unsigned int totlen = NLA_ALIGN(nla->nla_len);`: This is crucial. It's not just taking the raw `nla_len`. It's applying `NLA_ALIGN`. This tells me that Netlink attributes are not necessarily packed contiguously in memory. There's padding involved to ensure proper alignment, likely for performance or hardware reasons. So, `totlen` represents the *total space* this attribute occupies, including its payload and any necessary padding. This is exactly what I need to know to correctly advance my pointer.
* `*remaining -= totlen;`: This is straightforward. I'm decrementing the `remaining` byte count by the total length of the current attribute. This updates the caller's perspective on how much data is left.
* `return (struct nlattr *) ((char *) nla + totlen);`: This is the core of the iteration. I'm taking the address of the current attribute (`nla`), casting it to a `char *` so I can perform pointer arithmetic (byte-level movement), adding `totlen` to move past the current attribute (including its padding), and then casting it back to `struct nlattr *`. This effectively gives me a pointer to the *next* attribute in the sequence.
My next thought, given that I'm a user and not writing kernel code directly, is to figure out how others in the `tools/` directory are handling this. I need to see practical examples of generic Netlink querying that *don't* involve bringing in kernel-specific headers. This is important because I want to build robust userspace tools that interact with the kernel's Netlink interfaces without becoming tightly coupled to kernel internals that might change.
So, I'm mentally cataloging the places to look:
* `tools/accounting/delaytop.c`: Accounting tools often deal with complex data structures exposed via Netlink. I'd expect to see attribute parsing and iteration here.
* `tools/accounting/getdelays.c`: Similar to `delaytop.c`, this is a good candidate for seeing how Netlink attributes are handled.
* `tools/testing/selftests/net/mptcp/pm_nl_ctl.c`: This one stands out. Selftests are designed to exercise interfaces, and the `mptcp` part suggests it's interacting with a specific Netlink family, likely using generic Netlink principles. `pm_nl_ctl.c` sounds like a control program, which would definitely need to send and receive Netlink messages with attributes.
By examining these examples, I'm hoping to glean common patterns for:
* Constructing Netlink requests.
* Parsing responses, especially how they handle attribute parsing and validation.
* How they manage the `remaining` count when iterating through attributes.
* Any helper functions they've built for common attribute types or operations.
* Error handling strategies for malformed attribute streams.
Ultimately, my goal is to internalize the best practices for userspace Netlink interaction, particularly when dealing with generic Netlink, to ensure my own code is efficient, correct, and maintainable. This function, `nla_next`, is a fundamental building block in that process.
|
| 188/6 |
2026/09/07 07:32 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/mptcp/pm_nl_ctl.c FirstLine:320 LineCount:60]
Results: map[Contents: 320: }
321:
322: static int resolve_mptcp_pm_netlink(int fd, int *pm_family, int *events_mcast_grp)
323: {
324: char data[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
325: NLMSG_ALIGN(sizeof(struct genlmsghdr)) +
326: 1024];
327: struct nlmsghdr *nh;
328: struct rtattr *rta;
329: int namelen;
330: int off = 0;
331:
332: memset(data, 0, sizeof(data));
333: nh = (void *)data;
334: off = init_genl_req(data, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, 0);
335:
336: rta = (void *)(data + off);
337: namelen = strlen(MPTCP_PM_NAME) + 1;
338: rta->rta_type = CTRL_ATTR_FAMILY_NAME;
339: rta->rta_len = RTA_LENGTH(namelen);
340: memcpy(RTA_DATA(rta), MPTCP_PM_NAME, namelen);
341: off += NLMSG_ALIGN(rta->rta_len);
342:
343: do_nl_req(fd, nh, off, sizeof(data));
344: return genl_parse_getfamily((void *)data, pm_family, events_mcast_grp);
345: }
346:
347: int dsf(int fd, int pm_family, int argc, char *argv[])
348: {
349: char data[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
350: NLMSG_ALIGN(sizeof(struct genlmsghdr)) +
351: 1024];
352: struct rtattr *rta, *addr;
353: u_int16_t family, port;
354: struct nlmsghdr *nh;
355: u_int32_t token;
356: int addr_start;
357: int off = 0;
358: int arg;
359:
360: const char *params[5];
361:
362: memset(params, 0, 5 * sizeof(const char *));
363:
364: memset(data, 0, sizeof(data));
365: nh = (void *)data;
366: off = init_genl_req(data, pm_family, MPTCP_PM_CMD_SUBFLOW_DESTROY,
367: MPTCP_PM_VER);
368:
369: if (argc < 12)
370: syntax(argv);
371:
372: /* Params recorded in this order:
373: * <local-ip>, <local-port>, <remote-ip>, <remote-port>, <token>
374: */
375: for (arg = 2; arg < argc; arg++) {
376: if (!strcmp(argv[arg], "lip")) {
377: if (++arg >= argc)
378: error(1, 0, " missing local IP");
379:
]
|
| 189/6 |
2026/09/07 07:32 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 39258
output: 40
thoughts: 37
Thoughts: **My Thought Process for Analyzing `genl_nl_ctl.c`**
Alright, so I'm diving into the `tools/testing/selftests/net/mptcp/pm_nl_ctl.c` file, and my immediate focus is on this function: `genl_parse_getfamily`. This is where the real work of understanding the netlink communication for MPTCP's policy manager seems to be happening, at least from the perspective of the user-space tools.
My primary goal here is to unravel how this function processes the incoming netlink messages. I need to understand what kind of information it's expecting, how it validates that information, and ultimately, how it translates that into actionable data or state within the MPTCP policy manager context.
I'm particularly interested in the specific netlink attributes it's designed to handle. What are the key parameters being passed down from the kernel or other user-space components? Is it dealing with family IDs, specific policy configurations, or perhaps requests for status updates? I'll be looking for the attribute parsing logic, likely involving macros like `nla_parse` or similar mechanisms, to see how it maps raw attribute data to structured C variables.
Furthermore, I need to consider the error handling. What are the potential failure points within `genl_parse_getfamily`? Invalid attribute types, missing mandatory attributes, incorrect data formats – these are all things that need to be robustly handled to prevent crashes or unexpected behavior in the selftests. I'll be looking for `if` conditions and `goto` statements that signal error paths.
Given this is part of a selftest, I'm also thinking about how this function contributes to the overall testing strategy. Does `genl_parse_getfamily` specifically validate certain expected kernel behaviors, or is it a more general parsing utility used by various MPTCP netlink tests? Understanding its role in the broader testing framework will be key.
Finally, I'm keeping in mind the context of MPTCP. This function is likely interacting with the MPTCP policy manager's netlink interface. This means the attributes and families it's dealing with are specific to MPTCP's connection management, policy selection, and potentially other aspects of its advanced TCP functionality. So, while the netlink parsing itself is a general mechanism, the *semantics* of the data being parsed are MPTCP-specific. I need to ensure I don't lose sight of that.
|
| 190/6 |
2026/09/07 07:32 |
tool |
grepper |
0m
Args: map[Expression:genl_parse_getfamily PathPrefix:tools/testing/selftests/net/mptcp]
Results: map[Output:tools/testing/selftests/net/mptcp/pm_nl_ctl.c=218=static int do_nl_req(int fd, struct nlmsghdr *nh, int len, int max)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-252-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:253:static int genl_parse_getfamily(struct nlmsghdr *nlh, int *pm_family,
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-254- int *events_mcast_grp)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=322=static int resolve_mptcp_pm_netlink(int fd, int *pm_family, int *events_mcast_grp)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-343- do_nl_req(fd, nh, off, sizeof(data));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:344: return genl_parse_getfamily((void *)data, pm_family, events_mcast_grp);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-345-}
]
|
| 191/6 |
2026/09/07 07:32 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 39686
output: 49
thoughts: 23
Thoughts: **A Deep Dive into `genl_parse_getfamily`**
Alright, I need to get a handle on how `genl_parse_getfamily` works within `pm_nl_ctl.c`. My goal is to understand its internal workings, how it processes Netlink requests related to generic family information, and what kind of data it expects and produces. I'll be tracing its execution flow, paying close attention to the Netlink message parsing, attribute handling, and the ultimate retrieval and formatting of family information. I'm particularly interested in the error handling mechanisms and how it ensures data integrity throughout the process. Ultimately, I want to be able to explain its role in the broader Netlink control plane for the power management subsystem.
|
| 192/6 |
2026/09/07 07:32 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/mptcp/pm_nl_ctl.c FirstLine:250 LineCount:50]
Results: map[Contents: 250: return ret;
251: }
252:
253: static int genl_parse_getfamily(struct nlmsghdr *nlh, int *pm_family,
254: int *events_mcast_grp)
255: {
256: struct genlmsghdr *ghdr = NLMSG_DATA(nlh);
257: int len = nlh->nlmsg_len;
258: struct rtattr *attrs;
259: struct rtattr *grps;
260: struct rtattr *grp;
261: int got_events_grp;
262: int got_family;
263: int grps_len;
264: int grp_len;
265:
266: if (nlh->nlmsg_type != GENL_ID_CTRL)
267: error(1, errno, "Not a controller message, len=%d type=0x%x\n",
268: nlh->nlmsg_len, nlh->nlmsg_type);
269:
270: len -= NLMSG_LENGTH(GENL_HDRLEN);
271:
272: if (len < 0)
273: error(1, errno, "wrong controller message len %d\n", len);
274:
275: if (ghdr->cmd != CTRL_CMD_NEWFAMILY)
276: error(1, errno, "Unknown controller command %d\n", ghdr->cmd);
277:
278: attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN);
279: got_family = 0;
280: got_events_grp = 0;
281:
282: while (RTA_OK(attrs, len)) {
283: if (attrs->rta_type == CTRL_ATTR_FAMILY_ID) {
284: *pm_family = *(__u16 *)RTA_DATA(attrs);
285: got_family = 1;
286: } else if (attrs->rta_type == CTRL_ATTR_MCAST_GROUPS) {
287: grps = RTA_DATA(attrs);
288: grps_len = RTA_PAYLOAD(attrs);
289:
290: while (RTA_OK(grps, grps_len)) {
291: grp = RTA_DATA(grps);
292: grp_len = RTA_PAYLOAD(grps);
293: got_events_grp = 0;
294:
295: while (RTA_OK(grp, grp_len)) {
296: if (grp->rta_type == CTRL_ATTR_MCAST_GRP_ID)
297: *events_mcast_grp = *(__u32 *)RTA_DATA(grp);
298: else if (grp->rta_type == CTRL_ATTR_MCAST_GRP_NAME &&
299: !strcmp(RTA_DATA(grp), MPTCP_PM_EV_GRP_NAME))
]
|
| 193/6 |
2026/09/07 07:32 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 40624
output: 35
thoughts: 1060
Thoughts: **My Thought Process on Crafting the Generic Netlink Family ID Query Program**
Alright, let's break down this request. The core task is to write a *minimal* C program that can identify whether two specific Generic Netlink families, "MAC80211_HWSIM" and "nl80211", are available on the system. If both are found, the program should exit with a success code (0); otherwise, it needs to indicate failure with a non-zero exit code. Crucially, the prompt specifies using only standard Linux system calls and Netlink messaging, explicitly *excluding* any external libraries like libnl. This means I'm looking at raw `socket`, `sendmsg`/`sendto`, and `recvmsg`/`recvfrom` calls, along with careful manual construction of Netlink messages.
First, I need to ensure I meet all the explicit requirements:
1. **Minimal C program:** This implies avoiding unnecessary complexity, extra libraries, or verbose output. Straight to the point.
2. **Query specific Generic Netlink families:** The targets are "MAC80211_HWSIM" and "nl80211". I'll need to know how to ask the kernel for information about a family by its name.
3. **Conditional exit code:** The program's success or failure hinges on finding *both* families. If either is missing, it's a failure.
4. **Standard Linux syscalls and Netlink:** This is the key constraint. I must rely on POSIX socket interfaces and the Netlink protocol's raw structure. No `libnl` helper functions. This means I'll be dealing with structures like `struct nlmsghdr`, `struct genlmsghdr`, and `struct nlattr` directly.
Now, I need to recall or deduce the Netlink protocol sequence for querying Generic Netlink family information. This is the heart of the problem.
**Understanding the Generic Netlink Control Mechanism:**
The Generic Netlink framework, specifically the control family (`GENL_ID_CTRL`), is how we discover other Netlink families. The standard procedure involves:
1. **Socket Creation:** I'll need a Netlink socket. The type for Generic Netlink is `NETLINK_GENERIC`. So, `socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC)` is the starting point. It's generally good practice to bind this socket, often to `struct sockaddr_nl { sa_family = AF_NETLINK, nl_pid = getpid() }`, though Linux often handles autobinding on send if not explicitly bound. Setting a receive timeout (`SO_RCVTIMEO`) is also a wise defensive programming measure to prevent indefinite blocking.
2. **Sending the `GETFAMILY` Request:** To get information about a family by name, I need to send a `CTRL_CMD_GETFAMILY` command to the control Netlink family (`GENL_ID_CTRL`). This message will have a specific structure:
* **`struct nlmsghdr`:** This is the base Netlink message header.
* `nlmsg_len`: This needs to be calculated carefully, accounting for the `nlmsghdr` itself, the `genlmsghdr`, and any attributes. It will include the payload size.
* `nlmsg_type`: For control operations, this is `GENL_ID_CTRL` (which I know is defined as `0x10` in `<linux/genetlink.h>`).
* `nlmsg_flags`: I'll need `NLM_F_REQUEST` to indicate this is a request, and usually `NLM_F_ACK` to get an acknowledgment or error message back.
* `nlmsg_seq`: A sequence number, typically incremented for each message sent.
* `nlmsg_pid`: The process ID (`getpid()`) is usually used here.
* **`struct genlmsghdr`:** This is the Generic Netlink header, which sits *after* the `nlmsghdr`.
* `cmd`: For this operation, it's `CTRL_CMD_GETFAMILY` (from `<linux/genetlink.h>`).
* `version`: The generic Netlink protocol version. Version 1 is common, and version 2 is also supported. I'll probably start with 1.
* `reserved`: Must be zero.
* **Attributes:** The `GETFAMILY` command needs to specify *which* family we're interested in. This is done via attributes. The relevant attribute here is `CTRL_ATTR_FAMILY_NAME`.
* I'll need to construct a `struct nlattr` pointing to the family name string.
* The `nla_type` will be `CTRL_ATTR_FAMILY_NAME`.
* The `nla_len` will be `NLA_HDRLEN + strlen(name) + 1` (including the null terminator for the string).
* The value following `nla_len` will be the null-terminated family name string itself.
* I must ensure proper alignment using `NLA_ALIGN`.
Putting it all together, the total message length `nlh.nlmsg_len` will be `NLMSG_LENGTH(GENL_HDRLEN + NLA_ALIGN(nla->nla_len))`.
3. **Receiving the Response:** After sending the request using `sendmsg` (or `sendto`), I'll need to `recvmsg` (or `recvfrom`) to get the kernel's reply.
* The response will also be a Netlink message.
* I'll be looking for a message of type `GENL_ID_CTRL`.
* The response could be a success message containing the family ID (under `CTRL_ATTR_FAMILY_ID`) or an error message.
* I need to parse the attributes in the response to extract the family ID if the command was successful. If it fails (e.g., family not found), the Netlink message will indicate an error.
**Essential Header Files and Definitions:**
To implement this correctly, I'll need to include and understand definitions from:
* `<linux/netlink.h>`: For basic Netlink message structures (`struct nlmsghdr`), constants (`NLMSG_LENGTH`, `NLM_F_REQUEST`, `NETLINK_GENERIC`), and macros for parsing (`NLMSG_DATA`, `NLMSG_OK`, `NLMSG_NEXT`, `NLMSG_PAYLOAD`). It also defines `struct nlattr` and related `NLA_*` macros.
* `<linux/genetlink.h>`: For Generic Netlink specific definitions such as `GENL_ID_CTRL`, `GENL_HDRLEN`, `CTRL_CMD_GETFAMILY`, `CTRL_ATTR_FAMILY_NAME`, `CTRL_ATTR_FAMILY_ID`, and `struct genlmsghdr`.
**My Strategy:**
I'll start by defining a function to query a single family. This function will:
1. Create the Netlink socket.
2. Prepare the `GETFAMILY` request message, including the family name attribute.
3. Send the message.
4. Receive the reply.
5. Parse the reply to determine if the family was found and retrieve its ID.
6. Close the socket.
Then, in my `main` function, I'll call this query function twice, once for "MAC80211_HWSIM" and once for "nl80211". I'll use boolean flags to track if each was found. Finally, I'll check these flags and exit with 0 if both are true, and non-zero otherwise.
The "minimal" aspect means I'll focus on just the necessary structures and error handling for the core task, without much in the way of user-friendly output or extensive logging beyond what's needed for debugging if something goes wrong. The parsing of Netlink messages will involve iterating through attributes, which is a standard pattern for Netlink programming. I'll need to be very careful with buffer sizes and alignment.
This systematic approach, starting from requirements, recalling protocol specifics, identifying necessary tools (headers/definitions), and devising a step-by-step plan, is how I'll construct this program. I'll need to pay close attention to the exact byte layouts and lengths of the Netlink messages.
|
| 194/6 |
2026/09/07 07:33 |
tool |
grepper |
0m
Args: map[Expression:GENL_ PathPrefix:include/uapi/linux/genetlink.h]
Results: map[Output:include/uapi/linux/genetlink.h-7-
include/uapi/linux/genetlink.h:8:#define GENL_NAMSIZ 16 /* length of family name */
include/uapi/linux/genetlink.h-9-
include/uapi/linux/genetlink.h:10:#define GENL_MIN_ID NLMSG_MIN_TYPE
include/uapi/linux/genetlink.h:11:#define GENL_MAX_ID 1023
include/uapi/linux/genetlink.h-12-
include/uapi/linux/genetlink.h=13=struct genlmsghdr {
--
include/uapi/linux/genetlink.h-18-
include/uapi/linux/genetlink.h:19:#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
include/uapi/linux/genetlink.h-20-
include/uapi/linux/genetlink.h:21:#define GENL_ADMIN_PERM 0x01
include/uapi/linux/genetlink.h:22:#define GENL_CMD_CAP_DO 0x02
include/uapi/linux/genetlink.h:23:#define GENL_CMD_CAP_DUMP 0x04
include/uapi/linux/genetlink.h:24:#define GENL_CMD_CAP_HASPOL 0x08
include/uapi/linux/genetlink.h:25:#define GENL_UNS_ADMIN_PERM 0x10
include/uapi/linux/genetlink.h-26-
--
include/uapi/linux/genetlink.h-29- */
include/uapi/linux/genetlink.h:30:#define GENL_ID_CTRL NLMSG_MIN_TYPE
include/uapi/linux/genetlink.h:31:#define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
include/uapi/linux/genetlink.h:32:#define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
include/uapi/linux/genetlink.h-33-/* must be last reserved + 1 */
include/uapi/linux/genetlink.h:34:#define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3)
include/uapi/linux/genetlink.h-35-
]
|
| 195/6 |
2026/09/07 07:33 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42338
output: 34
thoughts: 70
Thoughts: **My Thought Process Regarding CTRL_CMD_GETFAMILY Handling in the Kernel**
Right, so my immediate objective here is to understand the kernel's behavior when it receives a `CTRL_CMD_GETFAMILY` request. More specifically, I want to dive into how the generic netlink controller, which is the core component managing these requests, processes this particular command and what kind of reply it generates in response.
To achieve this, I'm going to navigate directly to the source code. My current plan is to search for the function or code path associated with `ctrl_getfamily` within the `net/netlink/genetlink.c` file. This file is the most logical place to find the implementation details for handling generic netlink control commands. By examining this section, I anticipate I'll be able to trace the flow of execution, identify the data structures involved, and ultimately understand the logic that constructs and sends back the appropriate response to the `CTRL_CMD_GETFAMILY` request.
|
| 196/6 |
2026/09/07 07:33 |
tool |
grepper |
0m
Args: map[Expression:ctrl_getfamily PathPrefix:net/netlink/genetlink.c]
Results: map[Output:net/netlink/genetlink.c=1422=static const struct nla_policy ctrl_policy_family[] = {
--
net/netlink/genetlink.c-1427-
net/netlink/genetlink.c:1428:static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
net/netlink/genetlink.c-1429-{
--
net/netlink/genetlink.c=1766=static const struct genl_split_ops genl_ctrl_ops[] = {
--
net/netlink/genetlink.c-1771- .maxattr = ARRAY_SIZE(ctrl_policy_family) - 1,
net/netlink/genetlink.c:1772: .doit = ctrl_getfamily,
net/netlink/genetlink.c-1773- .flags = GENL_CMD_CAP_DO,
]
|
| 197/6 |
2026/09/07 07:33 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42681
output: 39
thoughts: 23
Thoughts: **My Thought Process on `ctrl_getfamily`**
Alright, let's dive into `ctrl_getfamily` in `net/netlink/genetlink.c`. My initial impulse is to understand its purpose within the broader context of Netlink's generic family (genetlink) operations. I'm assuming it's a core function for discovering or retrieving information about available genetlink families.
My immediate mental checklist for a function like this would involve:
* **What is its primary goal?** Is it to enumerate all registered families, or to fetch details about a *specific* family? The name `ctrl_getfamily` suggests the latter, or perhaps a control operation that *leads* to getting family information.
* **What are the inputs?** What parameters does it take? Does it need a family ID, a family name, or perhaps a generic Netlink message structure that encapsulates the request?
* **What is the output or side effect?** Does it return data directly, populate a structure, or send a Netlink message back to the user space? Given the Netlink context, it's highly probable it involves sending a response message.
* **What is the underlying mechanism?** How does it interact with the kernel's internal state for genetlink families? I'd expect it to query some sort of registry or list of registered families.
* **What are the potential failure modes?** What happens if the requested family doesn't exist, or if there are permission issues? Error handling is always crucial.
* **How does it fit into the larger Netlink protocol flow?** This function is likely part of a sequence of messages exchanged between the kernel and user space for managing genetlink families.
Given the filename `genetlink.c` and the function name `ctrl_getfamily`, I'm already thinking about the control messages defined for genetlink. The `CTRL_CMD_GETFAMILY` command seems like the most obvious candidate that this function would implement. My expectation is that it will receive a Netlink message from user space containing a `CTRL_CMD_GETFAMILY` command, and potentially some identifiers for the family it's interested in.
Therefore, I anticipate that `ctrl_getfamily` will:
1. Parse the incoming Netlink message to extract the command (`CTRL_CMD_GETFAMILY`) and any relevant attributes specifying the family (e.g., `CTRL_ATTR_FAMILY_ID`, `CTRL_ATTR_FAMILY_NAME`).
2. Query the kernel's internal data structures that hold information about registered genetlink families.
3. If a matching family is found, it will construct a Netlink message containing the family's details (ID, name, version, multicast groups, etc.) in the appropriate attributes.
4. If the family is not found or an error occurs during parsing or lookup, it will generate an appropriate Netlink error message.
5. Finally, it will send this response message back to the user space via the Netlink socket.
I'm particularly interested in how it handles the discovery aspect – if a generic `GETFAMILY` request is made without specific identifiers, does it return a list, or is there a separate command for enumeration? The name `getfamily` (singular) makes me lean towards fetching details for a specific family. I'll be looking for the use of Netlink attribute parsing and generation routines, and how it interacts with the `genl_family` structure in the kernel.
|
| 198/6 |
2026/09/07 07:33 |
tool |
read-file |
0m
Args: map[File:net/netlink/genetlink.c FirstLine:1425 LineCount:50]
Results: map[Contents:1425: .len = GENL_NAMSIZ - 1 },
1426: };
1427:
1428: static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
1429: {
1430: struct sk_buff *msg;
1431: const struct genl_family *res = NULL;
1432: int err = -EINVAL;
1433:
1434: if (info->attrs[CTRL_ATTR_FAMILY_ID]) {
1435: u16 id = nla_get_u16(info->attrs[CTRL_ATTR_FAMILY_ID]);
1436: res = genl_family_find_byid(id);
1437: err = -ENOENT;
1438: }
1439:
1440: if (info->attrs[CTRL_ATTR_FAMILY_NAME]) {
1441: char *name;
1442:
1443: name = nla_data(info->attrs[CTRL_ATTR_FAMILY_NAME]);
1444: res = genl_family_find_byname(name);
1445: #ifdef CONFIG_MODULES
1446: if (res == NULL) {
1447: genl_unlock();
1448: up_read(&cb_lock);
1449: request_module("net-pf-%d-proto-%d-family-%s",
1450: PF_NETLINK, NETLINK_GENERIC, name);
1451: down_read(&cb_lock);
1452: genl_lock();
1453: res = genl_family_find_byname(name);
1454: }
1455: #endif
1456: err = -ENOENT;
1457: }
1458:
1459: if (res == NULL)
1460: return err;
1461:
1462: if (!res->netnsok && !net_eq(genl_info_net(info), &init_net)) {
1463: /* family doesn't exist here */
1464: return -ENOENT;
1465: }
1466:
1467: msg = ctrl_build_family_msg(res, info->snd_portid, info->snd_seq,
1468: CTRL_CMD_NEWFAMILY);
1469: if (IS_ERR(msg))
1470: return PTR_ERR(msg);
1471:
1472: return genlmsg_reply(msg, info);
1473: }
1474:
]
|
| 199/6 |
2026/09/07 07:33 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 43473
output: 39
thoughts: 19
Thoughts: **My Thought Process**
Right then, my immediate priority is to examine the output of `ctrl_build_family_msg`. I need to see precisely what information and structure it's populating the reply with. Understanding this internal data flow is crucial for me to then determine the next steps in my analysis or any subsequent actions I need to take. It's all about deconstructing the process to its fundamental components to ensure a comprehensive grasp of the system's behavior.
|
| 200/6 |
2026/09/07 07:33 |
tool |
read-file |
0m
Args: map[File:net/netlink/genetlink.c FirstLine:1340 LineCount:50]
Results: map[Contents:1340:
1341: nla_nest_end(skb, nest);
1342: nla_nest_end(skb, nla_grps);
1343:
1344: genlmsg_end(skb, hdr);
1345: return 0;
1346:
1347: nla_put_failure:
1348: genlmsg_cancel(skb, hdr);
1349: return -EMSGSIZE;
1350: }
1351:
1352: static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
1353: {
1354: int n = 0;
1355: struct genl_family *rt;
1356: struct net *net = sock_net(skb->sk);
1357: int fams_to_skip = cb->args[0];
1358: unsigned int id;
1359: int err = 0;
1360:
1361: idr_for_each_entry(&genl_fam_idr, rt, id) {
1362: if (!rt->netnsok && !net_eq(net, &init_net))
1363: continue;
1364:
1365: if (n++ < fams_to_skip)
1366: continue;
1367:
1368: err = ctrl_fill_info(rt, NETLINK_CB(cb->skb).portid,
1369: cb->nlh->nlmsg_seq, NLM_F_MULTI,
1370: skb, CTRL_CMD_NEWFAMILY);
1371: if (err) {
1372: n--;
1373: break;
1374: }
1375: }
1376:
1377: cb->args[0] = n;
1378: return err;
1379: }
1380:
1381: static struct sk_buff *ctrl_build_family_msg(const struct genl_family *family,
1382: u32 portid, int seq, u8 cmd)
1383: {
1384: struct sk_buff *skb;
1385: int err;
1386:
1387: skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
1388: if (skb == NULL)
1389: return ERR_PTR(-ENOBUFS);
]
|
| 201/6 |
2026/09/07 07:33 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 44240
output: 39
thoughts: 24
Thoughts: **My Thought Process for Analyzing `ctrl_fill_info` in `genetlink.c`**
Alright, so I'm diving into the `genetlink.c` file within the `net/netlink` directory. My specific focus right now is the `ctrl_fill_info` function. I'm assuming it's a core component for managing generic netlink control messages, and I'm trying to understand precisely how it operates. I anticipate it will be involved in constructing or populating the information payload of a control message, likely to convey details about the generic netlink family itself. I'll be looking for how it takes an existing netlink message buffer and adds the necessary attributes and data to represent control information, such as family IDs, attributes, or other configuration details. My goal is to grasp the data structures involved, the attribute encoding, and the overall flow of information as it's prepared for transmission or processing.
|
| 202/6 |
2026/09/07 07:33 |
tool |
read-file |
0m
Args: map[File:net/netlink/genetlink.c FirstLine:1270 LineCount:50]
Results: map[Contents:1270:
1271: nla_nest_end(skb, nla_ops);
1272: }
1273:
1274: if (family->n_mcgrps) {
1275: struct nlattr *nla_grps;
1276: int i;
1277:
1278: nla_grps = nla_nest_start_noflag(skb, CTRL_ATTR_MCAST_GROUPS);
1279: if (nla_grps == NULL)
1280: goto nla_put_failure;
1281:
1282: for (i = 0; i < family->n_mcgrps; i++) {
1283: struct nlattr *nest;
1284: const struct genl_multicast_group *grp;
1285:
1286: grp = &family->mcgrps[i];
1287:
1288: nest = nla_nest_start_noflag(skb, i + 1);
1289: if (nest == NULL)
1290: goto nla_put_failure;
1291:
1292: if (nla_put_u32(skb, CTRL_ATTR_MCAST_GRP_ID,
1293: family->mcgrp_offset + i) ||
1294: nla_put_string(skb, CTRL_ATTR_MCAST_GRP_NAME,
1295: grp->name))
1296: goto nla_put_failure;
1297:
1298: nla_nest_end(skb, nest);
1299: }
1300: nla_nest_end(skb, nla_grps);
1301: }
1302:
1303: genlmsg_end(skb, hdr);
1304: return 0;
1305:
1306: nla_put_failure:
1307: genlmsg_cancel(skb, hdr);
1308: return -EMSGSIZE;
1309: }
1310:
1311: static int ctrl_fill_mcgrp_info(const struct genl_family *family,
1312: const struct genl_multicast_group *grp,
1313: int grp_id, u32 portid, u32 seq, u32 flags,
1314: struct sk_buff *skb, u8 cmd)
1315: {
1316: void *hdr;
1317: struct nlattr *nla_grps;
1318: struct nlattr *nest;
1319:
]
|
| 203/6 |
2026/09/07 07:33 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 45047
output: 39
thoughts: 28
Thoughts: **My Thought Process Regarding `net/netlink/genetlink.c` Lines 1220-1270**
Okay, I need to dive into lines 1220 through 1270 of the `net/netlink/genetlink.c` file. My goal is to understand what's happening within this specific segment of code. As an expert in this domain, I'm not just looking for a superficial overview; I want to grasp the underlying logic, the intent of the developers, and any potential implications or optimizations.
First, I'll locate the exact lines of code. I'm expecting to find functions related to generic netlink, likely involving message parsing, attribute handling, or perhaps event processing. Given the context of `genetlink.c`, I anticipate dealing with the generic netlink family mechanism, which allows for extensible netlink protocols. This means I'll be looking for how generic netlink commands are identified and dispatched, and how the associated data, typically structured as attributes, is processed.
I'll be paying close attention to the function signatures and variable declarations within this range. What parameters are being passed? What data structures are being used to represent netlink messages and their attributes? Are there any interesting bitwise operations or flag manipulations that indicate specific control mechanisms or state management?
My initial hypothesis is that this section likely deals with the demultiplexing of generic netlink messages based on their command and attributes, or perhaps the construction of outgoing generic netlink messages. If it's parsing, I'll be looking for how the `nlmsg_hdr` is interpreted, and then how the `nla_parse` or similar functions are invoked to extract the actual payload data. I'll be keen to see how different attribute types are handled – are there specific handlers for common types, or is it a more general-purpose attribute parsing loop?
If the code is involved in message construction, I'll be examining how the `genlmsg_put` or related functions are utilized, and how attributes are added to the message. The order of attribute addition, the use of specific flags, and the size calculations will be of particular interest. I'll be thinking about efficiency here – are there opportunities for optimization in how attributes are serialized or how memory is managed?
I'll also be considering error handling. How are malformed messages or invalid attributes dealt with? Are there specific return codes or error reporting mechanisms being employed? Understanding these aspects is crucial for robust kernel module development.
Furthermore, I'll think about the state of the generic netlink subsystem at this point. Is this code part of a request-response cycle, or is it related to event notification? The presence of sequence numbers, port identifiers, or specific netlink flags could shed light on this.
Finally, as an expert, I'll be looking for any potential security implications. Are there any checks that might prevent denial-of-service attacks or unauthorized data access? Is the code susceptible to buffer overflows or other common vulnerabilities?
In essence, I'm looking to build a comprehensive understanding of the logic flow, data manipulation, and operational context of these specific lines, treating them as a critical piece of the generic netlink implementation puzzle.
|
| 204/6 |
2026/09/07 07:34 |
tool |
read-file |
0m
Args: map[File:net/netlink/genetlink.c FirstLine:1220 LineCount:50]
Results: map[Contents:1220: }
1221:
1222: /**************************************************************************
1223: * Controller
1224: **************************************************************************/
1225:
1226: static struct genl_family genl_ctrl;
1227:
1228: static int ctrl_fill_info(const struct genl_family *family, u32 portid, u32 seq,
1229: u32 flags, struct sk_buff *skb, u8 cmd)
1230: {
1231: struct genl_op_iter i;
1232: void *hdr;
1233:
1234: hdr = genlmsg_put(skb, portid, seq, &genl_ctrl, flags, cmd);
1235: if (hdr == NULL)
1236: return -EMSGSIZE;
1237:
1238: if (nla_put_string(skb, CTRL_ATTR_FAMILY_NAME, family->name) ||
1239: nla_put_u16(skb, CTRL_ATTR_FAMILY_ID, family->id) ||
1240: nla_put_u32(skb, CTRL_ATTR_VERSION, family->version) ||
1241: nla_put_u32(skb, CTRL_ATTR_HDRSIZE, family->hdrsize) ||
1242: nla_put_u32(skb, CTRL_ATTR_MAXATTR, family->maxattr))
1243: goto nla_put_failure;
1244:
1245: if (genl_op_iter_init(family, &i)) {
1246: struct nlattr *nla_ops;
1247:
1248: nla_ops = nla_nest_start_noflag(skb, CTRL_ATTR_OPS);
1249: if (nla_ops == NULL)
1250: goto nla_put_failure;
1251:
1252: while (genl_op_iter_next(&i)) {
1253: struct nlattr *nest;
1254: u32 op_flags;
1255:
1256: op_flags = i.flags;
1257: if (i.doit.policy || i.dumpit.policy)
1258: op_flags |= GENL_CMD_CAP_HASPOL;
1259:
1260: nest = nla_nest_start_noflag(skb, genl_op_iter_idx(&i));
1261: if (nest == NULL)
1262: goto nla_put_failure;
1263:
1264: if (nla_put_u32(skb, CTRL_ATTR_OP_ID, i.cmd) ||
1265: nla_put_u32(skb, CTRL_ATTR_OP_FLAGS, op_flags))
1266: goto nla_put_failure;
1267:
1268: nla_nest_end(skb, nest);
1269: }
]
|
| 205/6 |
2026/09/07 07:34 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 45964
output: 32
thoughts: 3584
Thoughts: Here are my thoughts regarding the netlink generic family ID retrieval process.
**My Thought Process on Retrieving Netlink Generic Family IDs**
My primary goal here is to understand and implement the mechanism for retrieving a generic netlink family's ID, given its name. I'm approaching this as an expert, so I'm focusing on the detailed mechanics and potential edge cases of the netlink protocol.
First, I'm recalling how the `ctrl_fill_info` function populates information when dealing with generic netlink families. It sets attributes like `CTRL_ATTR_FAMILY_NAME`, `CTRL_ATTR_FAMILY_ID` (which I note is a `u16`), `CTRL_ATTR_VERSION`, `CTRL_ATTR_HDRSIZE`, and `CTRL_ATTR_MAXATTR`. This gives me a clear picture of the data structures involved.
The core operation I'm interested in is responding to a `CTRL_CMD_GETFAMILY` command. The expected reply structure is a netlink message (`nlmsghdr`). If there's an error, the `nlmsg_type` will be `NLMSG_ERROR`; otherwise, it will be `GENL_ID_CTRL`.
If it's an error (`NLMSG_ERROR`), I need to check `nlmsgerr->error`. A value of 0 signifies an ACK, while a negative value indicates an errno, such as `-ENOENT` if the family isn't found. This is a crucial error handling path.
When the message is not an error, and `nlmsg_type >= NLMSG_MIN_TYPE` (implying a generic netlink message), I expect a `struct genlmsghdr` followed by a series of attributes. My task then becomes iterating through these attributes to find the `CTRL_ATTR_FAMILY_ID`. The key here is understanding how to access the payload when I find it: `nla_type` is checked against `NLA_TYPE_MASK`, and if it matches `CTRL_ATTR_FAMILY_ID`, the payload is accessed as `*(uint16_t *)((char *)nla + NLA_HDRLEN)`. The `NLA_HDRLEN` is essential for correctly positioning myself past the attribute header.
This brings me to the implementation details of attribute iteration. I need to carefully consider the `struct nlattr` format:
```c
struct nlattr {
__u16 nla_len;
__u16 nla_type;
};
```
And the associated macros and alignment rules:
`#define NLA_HDRLEN ((int)NLMSG_ALIGN(sizeof(struct nlattr)))` (which I know is 4 bytes).
`#define NLA_ALIGN(len) (((len) + 3) & ~3)`
`#define NLA_DATA(nla) ((void *)((char *)(nla) + NLA_HDRLEN))`
`#define NLA_TYPE(nla) ((nla)->nla_type & NLA_TYPE_MASK)`
With these in mind, I can sketch out the attribute parsing loop:
```c
// Assuming 'buf' contains the received message and 'recv_len' is its size.
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
// Basic validation
if (!NLMSG_OK(nlh, recv_len)) {
// Handle malformed message
return -1; // Or appropriate error
}
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
// Handle error: err->error < 0 is an error, err->error == 0 is ACK
return -1; // Or return appropriate error code
}
// Process generic netlink message
struct genlmsghdr *ghdr = (struct genlmsghdr *)NLMSG_DATA(nlh);
int attr_len = nlh->nlmsg_len - NLMSG_HDRLEN - GENL_HDRLEN; // Remaining length for attributes
struct nlattr *nla = (struct nlattr *)((char *)ghdr + GENL_HDRLEN); // Start of attributes
while (attr_len >= (int)sizeof(struct nlattr) && // Ensure enough space for nlattr itself
nla->nla_len >= sizeof(struct nlattr) && // Ensure attribute length is valid
nla->nla_len <= attr_len) { // Ensure attribute doesn't exceed remaining buffer
if ((nla->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID) {
uint16_t id = *(uint16_t *)((char *)nla + NLA_HDRLEN); // Extract u16 ID
return id; // Success!
}
// Move to the next attribute, ensuring alignment
int advance = NLA_ALIGN(nla->nla_len);
attr_len -= advance;
nla = (struct nlattr *)((char *)nla + advance);
}
```
However, this loop assumes `recv_len` contains only one netlink message. The standard and robust way to handle received buffers in netlink is to iterate using `NLMSG_OK` and `NLMSG_NEXT`:
`for (struct nlmsghdr *nlh = (struct nlmsghdr *)buf; NLMSG_OK(nlh, recv_len); nlh = NLMSG_NEXT(nlh, recv_len))`. This cleanly handles multi-part messages or multiple independent messages within a single `recv` call.
A common pattern for this kind of operation is to create a helper function, say `int get_genl_family_id(int fd, const char *family_name)`, which encapsulates the socket creation, message sending, and response parsing.
I'm also verifying the necessary header files. I need:
`<stdio.h>`
`<stdlib.h>`
`<string.h>`
`<unistd.h>`
`<errno.h>`
`<sys/socket.h>`
`<linux/netlink.h>` (for `NETLINK_GENERIC`, `struct sockaddr_nl`, `struct nlmsghdr`, `NLMSG_*` macros, `NLMSG_ERROR`, `struct nlmsgerr`, `struct nlattr`, `NLA_*` macros)
`<linux/genetlink.h>` (for `struct genlmsghdr`, `GENL_ID_CTRL`, `GENL_HDRLEN`, `CTRL_CMD_GETFAMILY`, `CTRL_ATTR_FAMILY_NAME`, `CTRL_ATTR_FAMILY_ID`)
I've checked these headers, and they indeed contain all the constants and structure definitions I'm relying on, including `NLA_HDRLEN` and `GENL_HDRLEN`.
Next, I need to construct the request message. This involves defining a buffer and populating it correctly:
```c
struct {
struct nlmsghdr n;
struct genlmsghdr g;
// Buffer for attributes, e.g., family name
char buf[256];
} req;
memset(&req, 0, sizeof(req));
// Initialize nlmsghdr
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN); // Base length: nlmsghdr + genlmsghdr
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL; // Control family message type
req.n.nlmsg_seq = seq; // Sequence number for correlation
req.n.nlmsg_pid = getpid(); // Process ID
// Initialize genlmsghdr
req.g.cmd = CTRL_CMD_GETFAMILY; // Command to get family info
req.g.version = 1; // Generic netlink version
// Add CTRL_ATTR_FAMILY_NAME attribute
int name_len = strlen(name) + 1; // Include null terminator
struct nlattr *nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len); // Position for attribute
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len; // Attribute header + data length
memcpy((char *)nla + NLA_HDRLEN, name, name_len); // Copy family name
// Update total message length, ensuring alignment
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
```
I've considered that `NLMSG_LENGTH(GENL_HDRLEN)` provides the correct starting point for attributes, and `NLA_ALIGN` is crucial for maintaining message integrity. The total message length calculation also needs to account for this alignment.
For sending the request, `sendto()` with a `struct sockaddr_nl` initialized with `nl_family = AF_NETLINK` and `nl_pid = 0` (for the kernel) is the standard and reliable method for netlink sockets. `send(fd, ...)` would typically require `connect()`, which is less common for direct kernel communication.
For receiving, `recv(fd, ...)` is suitable. The crucial part is processing the buffer using the `NLMSG_OK` and `NLMSG_NEXT` loop to handle potentially multiple messages.
Regarding sequence numbers, it's important to match the received `nlmsg_seq` with the sent sequence number to ensure I'm processing the correct response.
When a family is not found, the kernel should return an `NLMSG_ERROR` message with `error = -ENOENT`. My parsing logic must correctly identify this. I'm checking kernel source (`net/netlink/genetlink.c`) to confirm that `ctrl_getfamily` does indeed return `-ENOENT` and that the netlink core translates this into an `NLMSG_ERROR` packet.
Finally, I need to ensure the use of `recv()` doesn't block indefinitely. This might involve setting socket options like `SO_RCVTIMEO` if necessary, though for a simple request/response, a single blocking `recv` is often acceptable if the expectation is a timely response or an error.
In summary, my thought process involves dissecting the netlink generic message structure, understanding attribute encoding and decoding, handling error conditions (especially `-ENOENT`), constructing the request meticulously, and reliably parsing the response, all while adhering to established netlink protocols and best practices.
|
| 206/6 |
2026/09/07 07:34 |
tool |
grepper |
0m
Args: map[Expression:netlink_rcv_skb PathPrefix:net/netlink]
Results: map[Output:net/netlink/af_netlink.c=2528=EXPORT_SYMBOL(netlink_ack);
net/netlink/af_netlink.c-2529-
net/netlink/af_netlink.c:2530:int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
net/netlink/af_netlink.c-2531- struct nlmsghdr *,
--
net/netlink/af_netlink.c-2572-}
net/netlink/af_netlink.c:2573:EXPORT_SYMBOL(netlink_rcv_skb);
net/netlink/af_netlink.c-2574-
--
net/netlink/genetlink.c=1215=static void genl_rcv(struct sk_buff *skb)
--
net/netlink/genetlink.c-1217- down_read(&cb_lock);
net/netlink/genetlink.c:1218: netlink_rcv_skb(skb, &genl_rcv_msg);
net/netlink/genetlink.c-1219- up_read(&cb_lock);
]
|
| 207/6 |
2026/09/07 07:34 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 49889
output: 40
thoughts: 28
Thoughts: **My Thought Process on Investigating `netlink_rcv_skb`**
Alright, the first thing that comes to mind is a need to delve into the core of how Netlink messages are received within the kernel. Specifically, I want to trace the path of an incoming socket buffer (`skb`) from its arrival in the networking stack to where it's actually processed by the Netlink subsystem. This means I need to find the entry point for this reception. My intuition points me towards `net/netlink/af_netlink.c` as the most probable location for this logic, given its name and the function signature I'm expecting. Therefore, my immediate action is to examine the `netlink_rcv_skb` function within that file. I'm looking to understand the initial checks, protocol identification, and how the `skb` is handed off to the appropriate Netlink protocol handler. This is foundational to understanding Netlink's internal workings and any potential issues related to message delivery or processing.
|
| 208/6 |
2026/09/07 07:34 |
tool |
read-file |
0m
Args: map[File:net/netlink/af_netlink.c FirstLine:2530 LineCount:40]
Results: map[Contents:2530: int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
2531: struct nlmsghdr *,
2532: struct netlink_ext_ack *))
2533: {
2534: struct netlink_ext_ack extack;
2535: struct nlmsghdr *nlh;
2536: int err;
2537:
2538: while (skb->len >= nlmsg_total_size(0)) {
2539: int msglen;
2540:
2541: memset(&extack, 0, sizeof(extack));
2542: nlh = nlmsg_hdr(skb);
2543: err = 0;
2544:
2545: if (nlh->nlmsg_len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len)
2546: return 0;
2547:
2548: /* Only requests are handled by the kernel */
2549: if (!(nlh->nlmsg_flags & NLM_F_REQUEST))
2550: goto ack;
2551:
2552: /* Skip control messages */
2553: if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
2554: goto ack;
2555:
2556: err = cb(skb, nlh, &extack);
2557: if (err == -EINTR)
2558: goto skip;
2559:
2560: ack:
2561: if (nlh->nlmsg_flags & NLM_F_ACK || err)
2562: netlink_ack(skb, nlh, err, &extack);
2563:
2564: skip:
2565: msglen = NLMSG_ALIGN(nlh->nlmsg_len);
2566: if (msglen > skb->len)
2567: msglen = skb->len;
2568: skb_pull(skb, msglen);
2569: }
]
|
| 209/6 |
2026/09/07 07:34 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 50549
output: 28
thoughts: 2512
Thoughts: **A Deep Dive into Netlink Family ID Retrieval and Error Handling**
As I'm working on this task, my primary focus is on ensuring robust and reliable retrieval of Generic Netlink family IDs. My immediate thought upon examining the provided code snippet, specifically `if (nlh->nlmsg_flags & NLM_F_ACK || err) netlink_ack(skb, nlh, err, &extack);`, is about the kernel's behavior when errors occur. It seems that even if `NLM_F_ACK` isn't set, a non-zero `err` (like `-ENOENT` if a family doesn't exist) will trigger an `NLMSG_ERROR` reply. This is important because it means the kernel is generally always sending a reply, whether the family is found or not. This simplifies my thinking about handling responses – I can expect a reply, and I just need to check its content for success or failure.
Furthermore, I'm considering potential edge cases where the communication might stall. To prevent my program from hanging indefinitely, I've decided to implement a socket timeout, `SO_RCVTIMEO`, on the socket. A duration of 2 or 5 seconds should be sufficient to catch unexpected issues without being overly aggressive.
Now, let's re-evaluate the exact requirements of the user's question: "Write a minimal C program that queries the Generic Netlink family IDs for "MAC80211_HWSIM" and "nl80211". It should exit with 0 if both are found, and non-zero otherwise. Use standard Linux system calls and netlink messages."
A crucial detail here is whether the program should *display* the family IDs or just *act* based on whether they are found. While the core requirement is the exit code, it's good practice to print the retrieved IDs for informational purposes, like `printf("MAC80211_HWSIM: %d\n", id1);`. The exit code, however, must strictly adhere to the specification: 0 for success (both found) and non-zero (conventionally 1) for failure.
As I trace the complete implementation, I'm meticulously checking each part to ensure correctness.
* **`req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);`**: My initial check confirms that `NLMSG_LENGTH(GENL_HDRLEN)` correctly expands to `NLMSG_HDRLEN + GENL_HDRLEN`, which, based on the definitions, results in 16 + 4 = 20 bytes. This correctly accounts for the `nlmsghdr` and `genlmsghdr` structures. The subsequent attribute handling, where `req.n.nlmsg_len` is updated by `NLA_ALIGN(nla->nla_len)`, also seems to follow the correct netlink message construction principles.
* **Attribute Parsing**: I'm carefully examining the loop responsible for parsing attributes within the received netlink message. The calculation `int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);` correctly isolates the attribute payload length. The loop condition `while (rem >= (int)sizeof(struct nlattr) && attr->nla_len >= sizeof(struct nlattr) && attr->nla_len <= rem)` is a good start. However, I've noticed a potential subtlety: if `attr->nla_len` is such that `NLA_ALIGN(attr->nla_len)` results in a value greater than the remaining `rem`, the `rem -= advance;` operation could lead to an underflow. To add an extra layer of safety and prevent potential issues, I'm considering adding an explicit `if (rem < advance) break;` before the subtraction.
* **`nlh->nlmsg_type` Comparison**: I'm also taking a moment to confirm the expected `nlh->nlmsg_type` in the reply to a `CTRL_CMD_GETFAMILY` request. My understanding is that this type should be `GENL_ID_CTRL`, and I'm referencing the kernel source (`net/netlink/genetlink.c` and the `genl_ctrl` structure) to be absolutely certain about this. This verification is critical for correctly identifying and processing the family information.
By systematically reviewing these points, I'm building confidence in the correctness and robustness of the proposed solution.
|
| 210/6 |
2026/09/07 07:35 |
tool |
grepper |
0m
Args: map[Expression:genl_ctrl PathPrefix:net/netlink]
Results: map[Output:net/netlink/genetlink.c=95=static struct nla_policy genl_policy_reject_all[] = {
--
net/netlink/genetlink.c-98-
net/netlink/genetlink.c:99:static int genl_ctrl_event(int event, const struct genl_family *family,
net/netlink/genetlink.c-100- const struct genl_multicast_group *grp,
--
net/netlink/genetlink.c=393=static int genl_allocate_reserve_groups(int n_groups, int *first_id)
--
net/netlink/genetlink.c-452-
net/netlink/genetlink.c:453:static struct genl_family genl_ctrl;
net/netlink/genetlink.c-454-
net/netlink/genetlink.c=455=static int genl_validate_assign_mc_groups(struct genl_family *family)
--
net/netlink/genetlink.c-474- /* special-case our own group and hacks */
net/netlink/genetlink.c:475: if (family == &genl_ctrl) {
net/netlink/genetlink.c-476- first_id = GENL_ID_CTRL;
--
net/netlink/genetlink.c=533=static void genl_unregister_mc_groups(const struct genl_family *family)
--
net/netlink/genetlink.c-552- clear_bit(grp_id, mc_groups);
net/netlink/genetlink.c:553: genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, family,
net/netlink/genetlink.c-554- &family->mcgrps[i], grp_id);
--
net/netlink/genetlink.c=775=int genl_register_family(struct genl_family *family)
--
net/netlink/genetlink.c-801- */
net/netlink/genetlink.c:802: if (family == &genl_ctrl) {
net/netlink/genetlink.c-803- /* and this needs to be special for initial family lookups */
--
net/netlink/genetlink.c-824- /* send all events */
net/netlink/genetlink.c:825: genl_ctrl_event(CTRL_CMD_NEWFAMILY, family, NULL, 0);
net/netlink/genetlink.c-826- for (i = 0; i < family->n_mcgrps; i++)
net/netlink/genetlink.c:827: genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP, family,
net/netlink/genetlink.c-828- &family->mcgrps[i], family->mcgrp_offset + i);
--
net/netlink/genetlink.c=850=int genl_unregister_family(const struct genl_family *family)
--
net/netlink/genetlink.c-870-
net/netlink/genetlink.c:871: genl_ctrl_event(CTRL_CMD_DELFAMILY, family, NULL, 0);
net/netlink/genetlink.c-872-
--
net/netlink/genetlink.c=1215=static void genl_rcv(struct sk_buff *skb)
--
net/netlink/genetlink.c-1225-
net/netlink/genetlink.c:1226:static struct genl_family genl_ctrl;
net/netlink/genetlink.c-1227-
net/netlink/genetlink.c=1228=static int ctrl_fill_info(const struct genl_family *family, u32 portid, u32 seq,
--
net/netlink/genetlink.c-1233-
net/netlink/genetlink.c:1234: hdr = genlmsg_put(skb, portid, seq, &genl_ctrl, flags, cmd);
net/netlink/genetlink.c-1235- if (hdr == NULL)
--
net/netlink/genetlink.c=1311=static int ctrl_fill_mcgrp_info(const struct genl_family *family,
--
net/netlink/genetlink.c-1319-
net/netlink/genetlink.c:1320: hdr = genlmsg_put(skb, portid, seq, &genl_ctrl, flags, cmd);
net/netlink/genetlink.c-1321- if (hdr == NULL)
--
net/netlink/genetlink.c=1428=static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
--
net/netlink/genetlink.c-1474-
net/netlink/genetlink.c:1475:static int genl_ctrl_event(int event, const struct genl_family *family,
net/netlink/genetlink.c-1476- const struct genl_multicast_group *grp,
--
net/netlink/genetlink.c-1503- if (!family->netnsok)
net/netlink/genetlink.c:1504: genlmsg_multicast_netns(&genl_ctrl, &init_net, msg, 0,
net/netlink/genetlink.c-1505- 0, GFP_KERNEL);
net/netlink/genetlink.c-1506- else
net/netlink/genetlink.c:1507: genlmsg_multicast_allns(&genl_ctrl, msg, 0, 0);
net/netlink/genetlink.c-1508-
--
net/netlink/genetlink.c=1630=static void *ctrl_dumppolicy_prep(struct sk_buff *skb,
--
net/netlink/genetlink.c-1636- hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid,
net/netlink/genetlink.c:1637: cb->nlh->nlmsg_seq, &genl_ctrl,
net/netlink/genetlink.c-1638- NLM_F_MULTI, CTRL_CMD_GETPOLICY);
--
net/netlink/genetlink.c=1757=static int ctrl_dumppolicy_done(struct netlink_callback *cb)
--
net/netlink/genetlink.c-1765-
net/netlink/genetlink.c:1766:static const struct genl_split_ops genl_ctrl_ops[] = {
net/netlink/genetlink.c-1767- {
--
net/netlink/genetlink.c-1793-
net/netlink/genetlink.c:1794:static const struct genl_multicast_group genl_ctrl_groups[] = {
net/netlink/genetlink.c-1795- { .name = "notify", },
--
net/netlink/genetlink.c-1797-
net/netlink/genetlink.c:1798:static struct genl_family genl_ctrl __ro_after_init = {
net/netlink/genetlink.c-1799- .module = THIS_MODULE,
net/netlink/genetlink.c:1800: .split_ops = genl_ctrl_ops,
net/netlink/genetlink.c:1801: .n_split_ops = ARRAY_SIZE(genl_ctrl_ops),
net/netlink/genetlink.c-1802- .resv_start_op = CTRL_CMD_GETPOLICY + 1,
net/netlink/genetlink.c:1803: .mcgrps = genl_ctrl_groups,
net/netlink/genetlink.c:1804: .n_mcgrps = ARRAY_SIZE(genl_ctrl_groups),
net/netlink/genetlink.c-1805- .id = GENL_ID_CTRL,
--
net/netlink/genetlink.c=1910=static int __init genl_init(void)
--
net/netlink/genetlink.c-1913-
net/netlink/genetlink.c:1914: err = genl_register_family(&genl_ctrl);
net/netlink/genetlink.c-1915- if (err < 0)
]
|
| 211/6 |
2026/09/07 07:35 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 55328
output: 1309
thoughts: 1694
Thoughts: **My Thought Process on Developing the Netlink Query Program**
Alright, the task is to create a minimal C program that specifically queries for the Generic Netlink (genl) family IDs of "MAC80211_HWSIM" and "nl80211". The program needs to be self-contained, rely only on standard Linux system calls and netlink message structures, and crucially, exit with a status of 0 if both families are found, and a non-zero status otherwise. This is a pretty standard netlink interaction, so I'm confident about the general approach.
First, I need to establish a netlink socket. The standard way to do this for generic netlink is `socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC)`. I'll need to check if this call fails (`fd < 0`) and exit with an error code if it does.
The core of the problem is retrieving the family IDs. This requires sending a `CTRL_CMD_GETFAMILY` command to the `GENL_ID_CTRL` family. This command needs to be structured correctly within a netlink message.
So, I'll construct a request message. This message will contain a `nlmsghdr` and a `genlmsghdr`.
* For the `nlmsghdr`:
* `nlmsg_type` must be `GENL_ID_CTRL`. This is important – the control family itself handles requests about other genl families.
* `nlmsg_flags` should include `NLM_F_REQUEST`.
* `nlmsg_seq` is a sequence number; I'll need to maintain a counter for this, incrementing it for each request.
* `nlmsg_pid` can be set to 0 for generic netlink requests.
* `nlmsg_len` needs to be calculated to include the generic netlink header and any attributes.
* For the `genlmsghdr`:
* `cmd` must be `CTRL_CMD_GETFAMILY`.
* `version` is typically 1.
The `CTRL_CMD_GETFAMILY` command requires an attribute to specify the family name we're looking for. This attribute will be `CTRL_ATTR_FAMILY_NAME`. So, I need to add an `nlattr` structure to the request. The attribute's data will be the null-terminated string of the family name. I'll need to calculate the correct length for this attribute, remembering to align it.
After constructing the request, I'll send it using `sendto`. The destination address for netlink sockets is a `sockaddr_nl` structure with `nl_family` set to `AF_NETLINK`. Similar to `socket`, I must check for errors (`< 0`) during `sendto`.
Receiving the response is the next critical step. I'll use `recv` to get the data into a buffer. Again, error checking is essential.
The response can contain multiple netlink messages, especially if I were sending multiple requests in one go, or if the kernel sends fragmented replies. The standard loop `for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret); nlh = NLMSG_NEXT(nlh, ret))` is the correct way to iterate through these messages.
Inside the loop, I need to:
1. **Check the sequence number:** I only care about replies that match the `nlmsg_seq` of my request.
2. **Handle `NLMSG_ERROR`:** If the message type is `NLMSG_ERROR`, it indicates an error. The actual error code is in the `nlmsgerr` structure. A common error for a non-existent family is `-ENOENT`. I should return an error from my `get_genl_family_id` function in this case.
3. **Process `GENL_ID_CTRL` messages:** If the message type is `GENL_ID_CTRL`, it's a response to my control command. I need to parse the generic netlink header and then iterate through its attributes.
4. **Extract the family ID:** Within the attributes of the `GENL_ID_CTRL` message, I'm looking for the attribute with type `CTRL_ATTR_FAMILY_ID`. The value of this attribute is the family ID I need. It's usually a `uint16_t` or `__u16`. I'll need to cast and extract this value.
If I find the `CTRL_ATTR_FAMILY_ID` attribute, I've successfully retrieved the family ID, and my `get_genl_family_id` function can return it. If I iterate through all messages and attributes without finding the expected ID, or if an error occurs, the function should return an error indicator (like -1).
To make the response handling robust, I'll add a timeout to the socket using `setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, ...)` to prevent the program from hanging indefinitely if no response is received. A couple of seconds should be sufficient.
The main function will then orchestrate this:
1. Create the socket.
2. Set the receive timeout.
3. Call `get_genl_family_id` for "MAC80211_HWSIM".
4. Call `get_genl_family_id` for "nl80211".
5. Close the socket.
6. Check the return values of the two calls. If both are non-negative (indicating success), exit with 0. Otherwise, exit with 1.
Now, let's consider the includes. I'll definitely need:
* `<stdio.h>` for `printf` (though I might not need it for the final minimal version, it's good for debugging).
* `<stdlib.h>` for `exit`.
* `<string.h>` for `strlen`, `memcpy`, `memset`.
* `<unistd.h>` for `close`, `sendto`, `recv`.
* `<errno.h>` for error codes like `ENOENT`.
* `<sys/socket.h>` for socket-related structures and functions.
* `<sys/time.h>` for `struct timeval` for the timeout.
* `<linux/netlink.h>` for netlink message definitions (`nlmsghdr`, `NLMSG_*, NLM_*`).
* `<linux/genetlink.h>` for generic netlink definitions (`genlmsghdr`, `GENL_*, CTRL_*`).
* `<stdint.h>` for `uint16_t` to be explicit about the family ID type.
I've specifically reviewed the edge cases:
* `NLMSG_ERROR`: Handled by checking `nlh->nlmsg_type == NLMSG_ERROR`.
* Multiple messages in `recv()`: Handled by the `NLMSG_OK` loop.
* Socket creation failure: Checked with `fd < 0`.
* `sendto` failure: Checked with `sendto < 0`.
* `recv` failure: Checked with `recv < 0`.
* Return IDs: The final check `hwsim_id < 0 || nl80211_id < 0` ensures the correct exit code.
The structure of the `get_genl_family_id` function seems solid: it prepares the request, sends it, receives, parses, and extracts the ID. The attribute parsing within the response loop is crucial and needs to correctly handle `nla_type`, `nla_len`, and advance the pointer using `NLA_ALIGN`.
Finally, I'll ensure the entire code adheres to the prompt: minimal, self-contained, compliant, and directly answers the user's request to query specific families and exit accordingly. The provided C code snippet seems to cover all these requirements. The logic holds up.
|
| 212/6 |
2026/09/07 07:35 |
tool |
set-results |
0m
Args: map[Answer:Below is a minimal, complete C program that queries the Generic Netlink controller (`GENL_ID_CTRL`) for the family IDs of `"MAC80211_HWSIM"` and `"nl80211"` using standard Linux system calls and Netlink messages. It exits with code `0` if both families are found and a non-zero code otherwise.
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0)
return 1;
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
nl80211_id = get_genl_family_id(fd, "nl80211");
close(fd);
if (hwsim_id < 0 || nl80211_id < 0)
return 1;
return 0;
}
```]
Results: map[Answer:Below is a minimal, complete C program that queries the Generic Netlink controller (`GENL_ID_CTRL`) for the family IDs of `"MAC80211_HWSIM"` and `"nl80211"` using standard Linux system calls and Netlink messages. It exits with code `0` if both families are found and a non-zero code otherwise.
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0)
return 1;
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
nl80211_id = get_genl_family_id(fd, "nl80211");
close(fd);
if (hwsim_id < 0 || nl80211_id < 0)
return 1;
return 0;
}
```]
|
| 213/4 |
2026/09/07 07:35 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 12248
output: 1387
thoughts: 108
Thoughts: **My Thought Process Regarding the MAC80211 HWsim Probe**
Here's a breakdown of my thinking as I approached this probe:
Initially, my idea was to simply "use this as the probe." A straightforward approach, assuming we could just directly apply it.
Then, a critical question arose: "Wait, if `MAC80211_HWSIM` is not loaded, how can we load it?" This is a fundamental dependency issue. If the core module isn't present, any probe relying on its functionality would be DOA.
However, I quickly started to consider the implications of a probe failure: "If the probe fails, we will know." This is the inherent value of a probe; its success or failure provides definitive information. Even if it fails due to the missing module, that's a valuable outcome.
But then, a more nuanced realization struck me: "But wait, syzkaller automatically loads `mac80211_hwsim` because it has `syz_mac80211_hwsim_setup` in the description, or because it's built-in." This is where my understanding of syzkaller's operational model kicked in. I recognized that syzkaller has mechanisms to handle module loading, either explicitly through its configuration (`syz_mac80211_hwsim_setup` implies this) or implicitly if the module is part of the kernel build itself. This significantly changes the landscape – the assumption of the module *not* being loaded might be incorrect within the syzkaller environment.
Given this understanding, the most pragmatic path forward became clear: "Let's just write the probe and see." At this point, the theoretical concerns about module loading were superseded by the practical need to observe the actual behavior. Writing the probe, regardless of the initial assumptions about `MAC80211_HWSIM`'s presence, would provide empirical data. If it worked, great. If it failed, the resulting error message would likely confirm or deny the presence of the module and guide further investigation.
|
| 214/4 |
2026/09/07 07:35 |
tool |
set-results |
0m
Args: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
printf("[-] Failed to get MAC80211_HWSIM family ID\n");
exit(1);
}
printf("[+] Got MAC80211_HWSIM family ID: %d\n", hwsim_id);
nl80211_id = get_genl_family_id(fd, "nl80211");
if (nl80211_id < 0) {
printf("[-] Failed to get nl80211 family ID\n");
exit(1);
}
printf("[+] Got nl80211 family ID: %d\n", nl80211_id);
close(fd);
printf("[+] Probe successful.\n");
return 0;
}
]
Results: map[IsProbe:true RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
printf("[-] Failed to get MAC80211_HWSIM family ID\n");
exit(1);
}
printf("[+] Got MAC80211_HWSIM family ID: %d\n", hwsim_id);
nl80211_id = get_genl_family_id(fd, "nl80211");
if (nl80211_id < 0) {
printf("[-] Failed to get nl80211 family ID\n");
exit(1);
}
printf("[+] Got nl80211 family ID: %d\n", nl80211_id);
close(fd);
printf("[+] Probe successful.\n");
return 0;
}
]
|
| 215/3 |
2026/09/07 07:35 |
loop |
|
0m
|
| 216/4 |
2026/09/07 07:35 |
iteration |
0 |
0m
|
| 217/5 |
2026/09/07 07:35 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
printf("[-] Failed to get MAC80211_HWSIM family ID\n");
exit(1);
}
printf("[+] Got MAC80211_HWSIM family ID: %d\n", hwsim_id);
nl80211_id = get_genl_family_id(fd, "nl80211");
if (nl80211_id < 0) {
printf("[-] Failed to get nl80211 family ID\n");
exit(1);
}
printf("[+] Got nl80211 family ID: %d\n", nl80211_id);
close(fd);
printf("[+] Probe successful.\n");
return 0;
}
]
|
| 218/5 |
2026/09/07 07:35 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
printf("[-] Failed to get MAC80211_HWSIM family ID\n");
exit(1);
}
printf("[+] Got MAC80211_HWSIM family ID: %d\n", hwsim_id);
nl80211_id = get_genl_family_id(fd, "nl80211");
if (nl80211_id < 0) {
printf("[-] Failed to get nl80211 family ID\n");
exit(1);
}
printf("[+] Got nl80211 family ID: %d\n", nl80211_id);
close(fd);
printf("[+] Probe successful.\n");
return 0;
}
]
|
| 219/5 |
2026/09/07 07:35 |
action |
If |
0m
Args:
|
| 220/3 |
2026/09/07 07:35 |
action |
run-c-repro |
2m
Results: map[CandidateBugTitle: CandidateCrashReport: CandidateReproduced:false ConsoleOutput:[ 60.584679][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.584888][ T33] audit: type=1400 audit(1788766621.123:202): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.584908][ T33] audit: type=1400 audit(1788766621.123:203): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.587870][ T33] audit: type=1400 audit(1788766621.123:204): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.608722][ T33] audit: type=1400 audit(1788766621.123:205): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:44012' (ED25519) to the list of known hosts.
[ 64.016397][ T33] audit: type=1400 audit(1788766624.553:206): avc: denied { setopt } for pid=5840 comm="syz-executor115" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[+] Got MAC80211_HWSIM family ID: 47
[+] Got nl80211 family ID: 38
[+] Probe successful.
[ 64.324444][ T33] audit: type=1400 audit(1788766624.863:207): avc: denied { write } for pid=5841 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.357183][ T33] audit: type=1400 audit(1788766624.893:208): avc: denied { write } for pid=5844 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.935098][ T33] audit: type=1400 audit(1788766625.473:209): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.976714][ T33] audit: type=1400 audit(1788766625.513:210): avc: denied { write } for pid=5850 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.168151][ T33] audit: type=1400 audit(1788766625.703:211): avc: denied { write } for pid=5853 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.776819][ T33] kauditd_printk_skb: 7 callbacks suppressed
[ 65.776893][ T33] audit: type=1400 audit(1788766626.313:219): avc: denied { write } for pid=5877 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.809453][ T33] audit: type=1400 audit(1788766626.343:220): avc: denied { write } for pid=5880 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.984658][ T33] audit: type=1400 audit(1788766626.513:221): avc: denied { write } for pid=5883 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.018102][ T33] audit: type=1400 audit(1788766626.553:222): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.415405][ T1381] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.415472][ T1381] ieee802154 phy1 wpan1: encryption failed: -22
OtherCrashReports:<nil> StraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor3240506153
<...>
[ 60.880036][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.882262][ T33] audit: type=1400 audit(1788766699.314:198): avc: denied { transition } for pid=5824 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890877][ T33] audit: type=1400 audit(1788766699.314:199): avc: denied { noatsecure } for pid=5824 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890931][ T33] audit: type=1400 audit(1788766699.314:200): avc: denied { rlimitinh } for pid=5824 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890961][ T33] audit: type=1400 audit(1788766699.314:201): avc: denied { siginh } for pid=5824 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:29507' (ED25519) to the list of known hosts.
[ 64.085680][ T33] audit: type=1400 audit(1788766702.524:202): avc: denied { execute } for pid=5842 comm="sh" name="strace" dev="sda1" ino=2027 scontext=root:sysadm_r:sysadm_t tcontext=root:object_r:etc_runtime_t tclass=file permissive=1
[ 64.093650][ T33] audit: type=1400 audit(1788766702.534:203): avc: denied { execute_no_trans } for pid=5842 comm="sh" path="/strace" dev="sda1" ino=2027 scontext=root:sysadm_r:sysadm_t tcontext=root:object_r:etc_runtime_t tclass=file permissive=1
execve("/syz-executor3240506153", ["/syz-executor3240506153"], 0x7ffe604aed20 /* 11 vars */) = 0
brk(NULL) = 0x5555779e5000
brk(0x5555779e5d80) = 0x5555779e5d80
arch_prctl(ARCH_SET_FS, 0x5555779e5400) = 0
set_tid_address(0x5555779e56d0) = 5844
set_robust_list(0x5555779e56e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor3240506153", 4096) = 23
getrandom("\x85\x9d\x08\x2b\xe0\x11\x84\x80", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x5555779e5d80
brk(0x555577a06d80) = 0x555577a06d80
brk(0x555577a07000) = 0x555577a07000
mprotect(0x7ffb09db0000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO_OLD, "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) = 0
[ 64.224317][ T33] audit: type=1400 audit(1788766702.664:204): avc: denied { setopt } for pid=5844 comm="syz-executor324" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
sendto(3, [{nlmsg_len=40, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=1, nlmsg_pid=0}, "\x03\x01\x00\x00\x13\x00\x02\x00\x4d\x41\x43\x38\x30\x32\x31\x31\x5f\x48\x57\x53\x49\x4d\x00\x00"], 40, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 40
recvfrom(3, [{nlmsg_len=244, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=1, nlmsg_pid=5844}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=19, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x4d\x41\x43\x38\x30\x32\x31\x31\x5f\x48\x57\x53\x49\x4d\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x2f], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 31], [{nla_len=144, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_NEWFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_DELFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_GETFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_NEWOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_DELOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_GETOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xb /* CTRL_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]]]], [{nla_len=28, nla_type=CTRL_ATTR_MCAST_GROUPS}, [{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x22], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]]]]], 4096, 0, NULL, NULL) = 244
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
sendto(3, [{nlmsg_len=32, nlmsg_type=nlctrl, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=2, nlmsg_pid=0}, {cmd=CTRL_CMD_GETFAMILY, version=1}, [{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...]], 32, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 32
recvfrom(3, [{nlmsg_len=2636, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=2, nlmsg_pid=5844}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x26], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 367], [{nla_len=2424, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x8}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x9}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xa}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xb}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xc}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BEACON], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xd}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xe}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xf}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x10}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x11}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x12}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x13}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x14}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x15}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x16}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x17}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x18}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x19}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REQ_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RELOAD_REGDB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TRIGGER_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ABORT_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x20}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x21}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x22}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x23}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_AUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x24}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x25}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEAUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x26}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x27}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x28}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x29}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_CONNECT_PARAMS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISCONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY_NETNS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SURVEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x2e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x30}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FLUSH_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x31}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x32}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x33}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_TX_BITRATE_MASK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x34}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x35}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x36}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME_WAIT_CANCEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x37}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x38}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x39}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CQM], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x40}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x41}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REKEY_OFFLOAD], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x42}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_MGMT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x43}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_OPER], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x44}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UNEXPECTED_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x45}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_PROBE_CLIENT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x46}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_BEACONS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x47}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_NOACK_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x48}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x49}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANGE_NAN_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa6 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x50}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa7 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x51}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MCAST_RATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x52}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MAC_ACL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x53}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RADAR_DETECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x54}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_PROTOCOL_FEATURES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x55}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_FT_IES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x56}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_START], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x57}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_STOP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x58}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x59}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_VENDOR], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_QOS_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x60}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x61}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MULTICAST_TO_UNICAST], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x62}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x63}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x64}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_EXTERNAL_AUTH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], ...]], [{nla_len=148, nla_type=CTRL_ATTR_MCAST_GROUPS}, [[{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x17], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]], [{nla_len=24, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x18], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x73\x63\x61\x6e\x00"...]]], [{nla_len=28, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x19], [{nla_len=15, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x72\x65\x67\x75\x6c\x61\x74\x6f\x72\x79\x00"...]]], [{nla_len=24, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1a], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6d\x6c\x6d\x65\x00"...]]], [{nla_len=24, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1b], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x76\x65\x6e\x64\x6f\x72\x00"...]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1c], [{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6e\x61\x6e\x00"...]]]]]]], 4096, 0, NULL, NULL) = 2636
close(3) = 0
[+] Got MAC80211_HWSIM family ID: 47
[+] Got nl80211 family ID: 38
[+] Probe successful.
write(1, "[+] Got MAC80211_HWSIM family ID: 47\n[+] Got nl80211 family ID: 38\n[+] Probe successful.\n", 89) = 89
exit_group(0) = ?
+++ exited with 0 +++
[ 64.422604][ T33] audit: type=1400 audit(1788766702.854:205): avc: denied { write } for pid=5845 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.468165][ T33] audit: type=1400 audit(1788766702.904:206): avc: denied { write } for pid=5848 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.983817][ T33] audit: type=1400 audit(1788766703.424:207): avc: denied { write } for pid=5851 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.240057][ T33] kauditd_printk_skb: 9 callbacks suppressed
[ 66.240141][ T33] audit: type=1400 audit(1788766704.674:217): avc: denied { write } for pid=5881 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.271921][ T33] audit: type=1400 audit(1788766704.704:218): avc: denied { write } for pid=5884 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.425138][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.425205][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 66.569864][ T33] audit: type=1400 audit(1788766705.004:219): avc: denied { write } for pid=5887 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.601683][ T33] audit: type=1400 audit(1788766705.034:220): avc: denied { write } for pid=5890 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
TestError:]
|
| 221/3 |
2026/09/07 07:38 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 60.584679][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.584888][ T33] audit: type=1400 audit(1788766621.123:202): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.584908][ T33] audit: type=1400 audit(1788766621.123:203): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.587870][ T33] audit: type=1400 audit(1788766621.123:204): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.608722][ T33] audit: type=1400 audit(1788766621.123:205): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:44012' (ED25519) to the list of known hosts.
[ 64.016397][ T33] audit: type=1400 audit(1788766624.553:206): avc: denied { setopt } for pid=5840 comm="syz-executor115" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[+] Got MAC80211_HWSIM family ID: 47
[+] Got nl80211 family ID: 38
[+] Probe successful.
[ 64.324444][ T33] audit: type=1400 audit(1788766624.863:207): avc: denied { write } for pid=5841 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.357183][ T33] audit: type=1400 audit(1788766624.893:208): avc: denied { write } for pid=5844 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.935098][ T33] audit: type=1400 audit(1788766625.473:209): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.976714][ T33] audit: type=1400 audit(1788766625.513:210): avc: denied { write } for pid=5850 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.168151][ T33] audit: type=1400 audit(1788766625.703:211): avc: denied { write } for pid=5853 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.776819][ T33] kauditd_printk_skb: 7 callbacks suppressed
[ 65.776893][ T33] audit: type=1400 audit(1788766626.313:219): avc: denied { write } for pid=5877 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.809453][ T33] audit: type=1400 audit(1788766626.343:220): avc: denied { write } for pid=5880 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.984658][ T33] audit: type=1400 audit(1788766626.513:221): avc: denied { write } for pid=5883 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.018102][ T33] audit: type=1400 audit(1788766626.553:222): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.415405][ T1381] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.415472][ T1381] ieee802154 phy1 wpan1: encryption failed: -22
TruncatedCrashReport: TruncatedStraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor3240506153
<...>
[ 60.880036][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.882262][ T33] audit: type=1400 audit(1788766699.314:198): avc: denied { transition } for pid=5824 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890877][ T33] audit: type=1400 audit(1788766699.314:199): avc: denied { noatsecure } for pid=5824 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890931][ T33] audit: type=1400 audit(1788766699.314:200): avc: denied { rlimitinh } for pid=5824 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890961][ T33] audit: type=1400 audit(1788766699.314:201): avc: denied { siginh } for pid=5824 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:29507' (ED25519) to the list of known hosts.
[ 64.085680][ T33] audit: type=1400 audit(1788766702.524:202): avc: denied { execute } for pid=5842 comm="sh" name="strace" dev="sda1" ino=2027 scontext=root:sysadm_r:sysadm_t tcontext=root:object_r:etc_runtime_t tclass=file permissive=1
[ 64.093650][ T33] audit: type=1400 audit(1788766702.534:203): avc: denied { execute_no_trans } for pid=5842 comm="sh" path="/strace" dev="sda1" ino=2027 scontext=root:sysadm_r:sysadm_t tcontext=root:object_r:etc_runtime_t tclass=file permissive=1
execve("/syz-executor3240506153", ["/syz-executor3240506153"], 0x7ffe604aed20 /* 11 vars */) = 0
brk(NULL) = 0x5555779e5000
brk(0x5555779e5d80) = 0x5555779e5d80
arch_prctl(ARCH_SET_FS, 0x5555779e5400) = 0
set_tid_address(0x5555779e56d0) = 5844
set_robust_list(0x5555779e56e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor3240506153", 4096) = 23
getrandom("\x85\x9d\x08\x2b\xe0\x11\x84\x80", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x5555779e5d80
brk(0x555577a06d80) = 0x555577a06d80
brk(0x555577a07000) = 0x555577a07000
mprotect(0x7ffb09db0000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO_OLD, "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) = 0
[ 64.224317][ T33] audit: type=1400 audit(1788766702.664:204): avc: denied { setopt } for pid=5844 comm="syz-executor324" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
sendto(3, [{nlmsg_len=40, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=1, nlmsg_pid=0}, "\x03\x01\x00\x00\x13\x00\x02\x00\x4d\x41\x43\x38\x30\x32\x31\x31\x5f\x48\x57\x53\x49\x4d\x00\x00"], 40, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 40
recvfrom(3, [{nlmsg_len=244, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=1, nlmsg_pid=5844}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=19, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x4d\x41\x43\x38\x30\x32\x31\x31\x5f\x48\x57\x53\x49\x4d\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x2f], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 31], [{nla_len=144, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_NEWFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_DELFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_GETFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_NEWOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_DELOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_GETOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xb /* CTRL_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]]]], [{nla_len=28, nla_type=CTRL_ATTR_MCAST_GROUPS}, [{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x22], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]]]]], 4096, 0, NULL, NULL) = 244
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
sendto(3, [{nlmsg_len=32, nlmsg_type=nlctrl, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=2, nlmsg_pid=0}, {cmd=CTRL_CMD_GETFAMILY, version=1}, [{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...]], 32, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 32
recvfrom(3, [{nlmsg_len=2636, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=2, nlmsg_pid=5844}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x26], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 367], [{nla_len=2424, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x8}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x9}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xa}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xb}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xc}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BEACON], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xd}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xe}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xf}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x10}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x11}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x12}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x13}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x14}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x15}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x16}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x17}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x18}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x19}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REQ_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RELOAD_REGDB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TRIGGER_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ABORT_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x20}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x21}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x22}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x23}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_AUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x24}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x25}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEAUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x26}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x27}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x28}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x29}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_CONNECT_PARAMS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISCONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY_NETNS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SURVEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x2e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x30}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FLUSH_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x31}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x32}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x33}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_TX_BITRATE_MASK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x34}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x35}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x36}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME_WAIT_CANCEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x37}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x38}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x39}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CQM], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x40}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x41}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REKEY_OFFLOAD], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x42}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_MGMT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x43}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_OPER], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x44}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UNEXPECTED_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x45}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_PROBE_CLIENT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x46}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_BEACONS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x47}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_NOACK_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x48}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x49}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANGE_NAN_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa6 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x50}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa7 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x51}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MCAST_RATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x52}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MAC_ACL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x53}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RADAR_DETECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x54}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_PROTOCOL_FEATURES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x55}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_FT_IES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x56}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_START], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x57}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_STOP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x58}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x59}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_VENDOR], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_QOS_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x60}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x61}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MULTICAST_TO_UNICAST], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x62}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x63}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x64}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_EXTERNAL_AUTH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], ...]], [{nla_len=148, nla_type=CTRL_ATTR_MCAST_GROUPS}, [[{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x17], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]], [{nla_len=24, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x18], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x73\x63\x61\x6e\x00"...]]], [{nla_len=28, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x19], [{nla_len=15, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x72\x65\x67\x75\x6c\x61\x74\x6f\x72\x79\x00"...]]], [{nla_len=24, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1a], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6d\x6c\x6d\x65\x00"...]]], [{nla_len=24, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1b], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x76\x65\x6e\x64\x6f\x72\x00"...]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1c], [{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6e\x61\x6e\x00"...]]]]]]], 4096, 0, NULL, NULL) = 2636
close(3) = 0
[+] Got MAC80211_HWSIM family ID: 47
[+] Got nl80211 family ID: 38
[+] Probe successful.
write(1, "[+] Got MAC80211_HWSIM family ID: 47\n[+] Got nl80211 family ID: 38\n[+] Probe successful.\n", 89) = 89
exit_group(0) = ?
+++ exited with 0 +++
[ 64.422604][ T33] audit: type=1400 audit(1788766702.854:205): avc: denied { write } for pid=5845 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.468165][ T33] audit: type=1400 audit(1788766702.904:206): avc: denied { write } for pid=5848 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.983817][ T33] audit: type=1400 audit(1788766703.424:207): avc: denied { write } for pid=5851 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.240057][ T33] kauditd_printk_skb: 9 callbacks suppressed
[ 66.240141][ T33] audit: type=1400 audit(1788766704.674:217): avc: denied { write } for pid=5881 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.271921][ T33] audit: type=1400 audit(1788766704.704:218): avc: denied { write } for pid=5884 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.425138][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.425205][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 66.569864][ T33] audit: type=1400 audit(1788766705.004:219): avc: denied { write } for pid=5887 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.601683][ T33] audit: type=1400 audit(1788766705.034:220): avc: denied { write } for pid=5890 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
]
|
| 222/3 |
2026/09/07 07:38 |
agent |
repro-oracle |
0m
Model:
Results: map[Feedback:The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug. ProbePassed:true TerminalError: TitleMatches:false]
Instruction: You are a security researcher with deep Linux kernel background.
Analyze the results of running the generated program.
=== CRITICAL ENVIRONMENT & TARGET CLASSIFICATION ===
Set 'TerminalError' to a descriptive error message ONLY if:
1. The execution failed due to missing hardware device nodes, subsystems, kernel modules, or privilege limits
that cannot be loaded, created, or bypassed by user-space C code edits in the VM guest.
2. The target source files or functions described in the bug description do not exist in the checked-out codebase,
meaning the codebase version is mismatched and the target code is absent.
=== CRITICAL PROHIBITIONS ===
- Do NOT classify a run as a terminal failure or assume a bug is fixed based on git log entries, commit titles,
or commit messages. Reproducibility can ONLY be determined by executing reproducer candidates in the VM.
- Do NOT suggest C code strategies, repairs, or namespace bypasses when setting 'TerminalError'.
=== PHASE 1: CAPABILITY PROBING (EVALUATION) ===
The executed program was a simple environment probe.
Use this to guide your classification and feedback:
1. If the execution was successful (all environment/subsystem probes passed and program exited with 0),
set the field 'ProbePassed' to true and provide feedback explicitly indicating that the environment
is ready and the agent should now proceed to generate the full reproducer in the next iteration.
2. If the probe failed (e.g., missing permissions, missing devices, or sandbox restrictions),
set the field 'ProbePassed' to false, and explain what failed in the 'Feedback'
field so the generator can adjust its setups.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
IsProbe: true
Reproduced: false
Console Output: [ 60.584679][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.584888][ T33] audit: type=1400 audit(1788766621.123:202): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.584908][ T33] audit: type=1400 audit(1788766621.123:203): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.587870][ T33] audit: type=1400 audit(1788766621.123:204): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.608722][ T33] audit: type=1400 audit(1788766621.123:205): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:44012' (ED25519) to the list of known hosts.
[ 64.016397][ T33] audit: type=1400 audit(1788766624.553:206): avc: denied { setopt } for pid=5840 comm="syz-executor115" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[+] Got MAC80211_HWSIM family ID: 47
[+] Got nl80211 family ID: 38
[+] Probe successful.
[ 64.324444][ T33] audit: type=1400 audit(1788766624.863:207): avc: denied { write } for pid=5841 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.357183][ T33] audit: type=1400 audit(1788766624.893:208): avc: denied { write } for pid=5844 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.935098][ T33] audit: type=1400 audit(1788766625.473:209): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.976714][ T33] audit: type=1400 audit(1788766625.513:210): avc: denied { write } for pid=5850 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.168151][ T33] audit: type=1400 audit(1788766625.703:211): avc: denied { write } for pid=5853 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.776819][ T33] kauditd_printk_skb: 7 callbacks suppressed
[ 65.776893][ T33] audit: type=1400 audit(1788766626.313:219): avc: denied { write } for pid=5877 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.809453][ T33] audit: type=1400 audit(1788766626.343:220): avc: denied { write } for pid=5880 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.984658][ T33] audit: type=1400 audit(1788766626.513:221): avc: denied { write } for pid=5883 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.018102][ T33] audit: type=1400 audit(1788766626.553:222): avc: denied { write } for pid=5886 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.415405][ T1381] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.415472][ T1381] ieee802154 phy1 wpan1: encryption failed: -22
Strace Output: /strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor3240506153
<...>
[ 60.880036][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 60.882262][ T33] audit: type=1400 audit(1788766699.314:198): avc: denied { transition } for pid=5824 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890877][ T33] audit: type=1400 audit(1788766699.314:199): avc: denied { noatsecure } for pid=5824 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890931][ T33] audit: type=1400 audit(1788766699.314:200): avc: denied { rlimitinh } for pid=5824 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 60.890961][ T33] audit: type=1400 audit(1788766699.314:201): avc: denied { siginh } for pid=5824 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:29507' (ED25519) to the list of known hosts.
[ 64.085680][ T33] audit: type=1400 audit(1788766702.524:202): avc: denied { execute } for pid=5842 comm="sh" name="strace" dev="sda1" ino=2027 scontext=root:sysadm_r:sysadm_t tcontext=root:object_r:etc_runtime_t tclass=file permissive=1
[ 64.093650][ T33] audit: type=1400 audit(1788766702.534:203): avc: denied { execute_no_trans } for pid=5842 comm="sh" path="/strace" dev="sda1" ino=2027 scontext=root:sysadm_r:sysadm_t tcontext=root:object_r:etc_runtime_t tclass=file permissive=1
execve("/syz-executor3240506153", ["/syz-executor3240506153"], 0x7ffe604aed20 /* 11 vars */) = 0
brk(NULL) = 0x5555779e5000
brk(0x5555779e5d80) = 0x5555779e5d80
arch_prctl(ARCH_SET_FS, 0x5555779e5400) = 0
set_tid_address(0x5555779e56d0) = 5844
set_robust_list(0x5555779e56e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor3240506153", 4096) = 23
getrandom("\x85\x9d\x08\x2b\xe0\x11\x84\x80", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x5555779e5d80
brk(0x555577a06d80) = 0x555577a06d80
brk(0x555577a07000) = 0x555577a07000
mprotect(0x7ffb09db0000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO_OLD, "\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 16) = 0
[ 64.224317][ T33] audit: type=1400 audit(1788766702.664:204): avc: denied { setopt } for pid=5844 comm="syz-executor324" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
sendto(3, [{nlmsg_len=40, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=1, nlmsg_pid=0}, "\x03\x01\x00\x00\x13\x00\x02\x00\x4d\x41\x43\x38\x30\x32\x31\x31\x5f\x48\x57\x53\x49\x4d\x00\x00"], 40, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 40
recvfrom(3, [{nlmsg_len=244, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=1, nlmsg_pid=5844}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=19, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x4d\x41\x43\x38\x30\x32\x31\x31\x5f\x48\x57\x53\x49\x4d\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x2f], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 31], [{nla_len=144, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_NEWFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_DELFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_GETFAMILY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_NEWOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_DELOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, CTRL_CMD_GETOPS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xb /* CTRL_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]]]], [{nla_len=28, nla_type=CTRL_ATTR_MCAST_GROUPS}, [{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x22], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]]]]], 4096, 0, NULL, NULL) = 244
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
sendto(3, [{nlmsg_len=32, nlmsg_type=nlctrl, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=2, nlmsg_pid=0}, {cmd=CTRL_CMD_GETFAMILY, version=1}, [{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...]], 32, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 32
recvfrom(3, [{nlmsg_len=2636, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=2, nlmsg_pid=5844}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x26], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 367], [{nla_len=2424, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x8}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x9}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xa}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xb}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xc}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BEACON], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xd}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xe}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xf}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x10}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x11}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x12}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x13}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x14}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x15}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x16}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x17}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x18}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x19}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REQ_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RELOAD_REGDB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TRIGGER_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ABORT_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x20}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x21}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x22}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x23}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_AUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x24}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x25}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEAUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x26}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x27}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x28}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x29}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_CONNECT_PARAMS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISCONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY_NETNS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SURVEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x2e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x30}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FLUSH_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x31}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x32}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x33}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_TX_BITRATE_MASK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x34}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x35}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x36}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME_WAIT_CANCEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x37}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x38}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x39}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CQM], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x40}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x41}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REKEY_OFFLOAD], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x42}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_MGMT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x43}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_OPER], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x44}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UNEXPECTED_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x45}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_PROBE_CLIENT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x46}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_BEACONS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x47}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_NOACK_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x48}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x49}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANGE_NAN_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa6 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x50}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa7 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x51}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MCAST_RATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x52}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MAC_ACL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x53}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RADAR_DETECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x54}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_PROTOCOL_FEATURES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x55}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_FT_IES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x56}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_START], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x57}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_STOP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x58}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x59}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_VENDOR], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_QOS_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x60}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x61}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MULTICAST_TO_UNICAST], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x62}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x63}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x64}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_EXTERNAL_AUTH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], ...]], [{nla_len=148, nla_type=CTRL_ATTR_MCAST_GROUPS}, [[{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x17], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]], [{nla_len=24, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x18], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x73\x63\x61\x6e\x00"...]]], [{nla_len=28, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x19], [{nla_len=15, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x72\x65\x67\x75\x6c\x61\x74\x6f\x72\x79\x00"...]]], [{nla_len=24, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1a], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6d\x6c\x6d\x65\x00"...]]], [{nla_len=24, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1b], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x76\x65\x6e\x64\x6f\x72\x00"...]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1c], [{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6e\x61\x6e\x00"...]]]]]]], 4096, 0, NULL, NULL) = 2636
close(3) = 0
[+] Got MAC80211_HWSIM family ID: 47
[+] Got nl80211 family ID: 38
[+] Probe successful.
write(1, "[+] Got MAC80211_HWSIM family ID: 47\n[+] Got nl80211 family ID: 38\n[+] Probe successful.\n", 89) = 89
exit_group(0) = ?
+++ exited with 0 +++
[ 64.422604][ T33] audit: type=1400 audit(1788766702.854:205): avc: denied { write } for pid=5845 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.468165][ T33] audit: type=1400 audit(1788766702.904:206): avc: denied { write } for pid=5848 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.983817][ T33] audit: type=1400 audit(1788766703.424:207): avc: denied { write } for pid=5851 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.240057][ T33] kauditd_printk_skb: 9 callbacks suppressed
[ 66.240141][ T33] audit: type=1400 audit(1788766704.674:217): avc: denied { write } for pid=5881 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.271921][ T33] audit: type=1400 audit(1788766704.704:218): avc: denied { write } for pid=5884 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.425138][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.425205][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 66.569864][ T33] audit: type=1400 audit(1788766705.004:219): avc: denied { write } for pid=5887 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.601683][ T33] audit: type=1400 audit(1788766705.034:220): avc: denied { write } for pid=5890 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Crash Report:
|
| 223/4 |
2026/09/07 07:38 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 23063
output: 78
thoughts: 125
Thoughts: **My Thought Process on the Environment Probe Results**
Alright, so I've just run that environment probe program, and now I need to meticulously dissect its output to understand what it's telling me. My primary goal here is to ascertain the health and readiness of the environment for the next stage, which is generating the full reproducer.
Looking at the output:
* `[+] Got MAC80211_HWSIM family ID: 47`
* `[+] Got nl80211 family ID: 38`
* `[+] Probe successful.`
The first two lines, while reporting specific family IDs for `MAC80211_HWSIM` and `nl80211`, are essentially confirmation points. They indicate that the probe successfully identified and interacted with these underlying wireless simulation and netlink interfaces. The presence of these specific IDs, rather than errors or generic messages, suggests that the necessary kernel modules or drivers are loaded and accessible in this environment. This is a good sign, implying a degree of system configuration that aligns with what we'd expect for this kind of probing.
The crucial line, however, is the last one: `[+] Probe successful.` This is the definitive statement of the probe's outcome. It confirms that all the checks performed by the program were completed without any critical failures. In simpler terms, the environment has passed the basic validation checks I designed for it.
Given this clear success, my immediate next step is to record this positive outcome. I need to signify that the environment is indeed ready. Therefore, I'll be setting a variable, let's call it `ProbePassed`, to `true`. This is a direct and unambiguous representation of the probe's result in my internal state.
Following this, I need to communicate this readiness outwards. The agent that is responsible for generating the full reproducer needs to know that it can proceed. So, I should provide clear feedback indicating that the environment is now considered ready. This means the agent should be instructed to move forward and begin the process of constructing the complete reproducer, leveraging the validated environment.
To formalize these actions – setting the `ProbePassed` status and conveying the readiness for the next step – I'll be utilizing the `set-results` tool. This tool is designed precisely for this purpose: to record the outcomes of intermediate steps and signal to subsequent processes or agents how to proceed. It's the mechanism by which I translate my analysis of the probe's output into actionable instructions for the overall workflow.
|
| 224/4 |
2026/09/07 07:38 |
tool |
set-results |
0m
Args: map[Feedback:The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug. ProbePassed:true TerminalError: TitleMatches:false]
Results: map[Feedback:The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug. ProbePassed:true TerminalError: TitleMatches:false]
|
| 225/3 |
2026/09/07 07:38 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:true ContinueSignal:continue EquivalenceAnalysis: OracleFeedback:The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug. ReproC: Reproduced:false ReproducedBugTitle: ReproducedCrashReport:]
|
| 226/2 |
2026/09/07 07:38 |
iteration |
2 |
57m
|
| 227/3 |
2026/09/07 07:38 |
action |
If |
0m
Args: map[OracleFeedback:The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug.]
|
| 228/4 |
2026/09/07 07:38 |
agent |
strategy-refiner |
0m
Model:
Instruction: You are an expert in Linux kernel debugging.
Refine the reproduction strategy based on feedback from previous attempts.
Analyze the technical diagnosis provided in the oracle feedback and translate it into concrete,
step-by-step instructions for the repro-generator on how to modify the code structure, alignments,
offsets, or parameters of the candidate program.
=== TOOL SELECTION GUIDELINES ===
- Prefer codesearch-definition-source and codesearch-struct-layout first for symbol lookups.
- Fall back to read-file or grepper for macros, headers, or if symbol lookup fails.
=== CRITICAL PROHIBITIONS ===
- Do NOT repeat searches for the same symbols or files. Use information you have already gathered.
- Do NOT write long explanations. Keep your reasoning short and focused on actionable changes.
- Do NOT assume a bug is fixed based on git commit history.
- If you are stuck, try a different approach or proceed to generate a candidate reproducer.
Prefer calling several tools at the same time to save round-trips.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Current Strategy: An analysis of the feedback and a refined strategy for reproducing the bug.
### Bug Analysis & Refined Strategy
The oracle feedback clarifies that we do not need to create a custom `mac80211_hwsim` radio with specific attributes (like `HWSIM_ATTR_SUPPORT_NAN_DEVICE`) to trigger this bug. The default radios created by `modprobe mac80211_hwsim` are sufficient.
The bug is triggered by the following sequence:
1. A packet is injected on a monitor interface.
2. The packet has a radiotap header with the `RATE` field present (bit 2 of the `present` mask).
3. The `RATE` field contains an invalid legacy rate (e.g., `0`).
4. `ieee80211_parse_tx_radiotap()` initializes the rate index (`info->control.rates[0].idx`) to `-1`. Because the provided rate is invalid, it fails to find a matching supported rate and leaves `idx` as `-1`. It also clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
5. The frame is passed down the transmission path until it reaches `mac80211_hwsim_write_tsf()`.
6. `mac80211_hwsim_write_tsf()` unconditionally calls `mac80211_hwsim_get_tx_rate()`, which contains a `WARN_ON_ONCE(c->control.rates[0].idx < 0)`, triggering the warning.
To reproduce this, we will:
1. Load the `mac80211_hwsim` module.
2. Use `iw` and `ip` to create a monitor interface (`mon0`) on `phy0`.
3. Set the channel of the monitor interface to a valid frequency (e.g., 2412 MHz) so that `ieee80211_monitor_start_xmit()` finds a valid channel context (`chanctx_conf`).
4. Bring the interface up.
5. Open an `AF_PACKET` socket bound to the monitor interface.
6. Inject a frame with a 9-byte radiotap header specifying an invalid rate (`0`), followed by a standard 802.11 data frame header.
### Minimal C Reproducer
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
int main() {
// 1. Load the mac80211_hwsim module
system("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
system("iw phy phy0 interface add mon0 type monitor");
system("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
system("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
system("ip link set wlan0 down");
system("iw dev wlan0 set type monitor");
system("ip link set wlan0 up");
system("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```
Feedback: The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug.
Reply: ```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret;
}
int main() {
// 1. Load the mac80211_hwsim module
execute_command("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
execute_command("iw phy phy0 interface add mon0 type monitor");
execute_command("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
execute_command("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
execute_command("ip link set wlan0 down");
execute_command("iw dev wlan0 set type monitor");
execute_command("ip link set wlan0 up");
execute_command("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
// The bug is triggered by an invalid legacy rate (0) in the radiotap header.
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```
|
| 229/5 |
2026/09/07 07:39 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 6519
output: 1098
thoughts: 5974
Thoughts: **Bug Reproducer Generation - My Thought Process**
Alright, my goal here is to generate a C reproducer for the `WARNING in mac80211_hwsim_write_tsf` bug. The overall strategy has been laid out: load `mac80211_hwsim`, set up a monitor interface, configure its channel, open a raw packet socket, and then inject a specially crafted frame designed to trigger the warning.
Now, there was a crucial piece of feedback: "The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug." This is a very important clue. It tells me that whatever the previous attempt did, it successfully interacted with the kernel's wireless subsystem using netlink to identify the relevant families (`MAC80211_HWSIM` and `nl80211`). This implies that the environment is set up correctly for interacting with the wireless drivers.
The prompt also mentioned "Current Strategy: An analysis of the feedback and a refined strategy for reproducing the bug," followed by a "Minimal C Reproducer." This suggests that the feedback was about the *completeness* of the reproducer, not necessarily about the core strategy itself. My task, then, is to translate the outlined strategy into a *full* C reproducer, leveraging the fact that the environment probe was successful.
So, the refined approach is to implement the steps using standard C and system calls, assuming the environment is ready as indicated by the feedback.
Here's the C code I've put together, step-by-step reflecting the strategy:
1. **Load the `mac80211_hwsim` module:** This is a straightforward `system("modprobe mac80211_hwsim");` call. A short `sleep(1)` is added just to ensure the module is fully loaded before proceeding.
2. **Create a monitor interface and set it up:** I'll use `iw` commands for this, as they are typically available in the syzkaller environment:
* `system("iw phy phy0 interface add mon0 type monitor");`
* `system("ip link set mon0 up");`
3. **Set the channel:** This is crucial for `chanctx_conf` to function correctly, which is likely where the `hwsim_write_tsf` function is called. I'll set it to a standard frequency: `system("iw dev mon0 set freq 2412");`. Another `sleep(1)` is included.
4. **Open an `AF_PACKET` socket:** This is the standard way to capture and send raw network packets. I'll use `socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));`. Error handling is essential here.
5. **Bind the socket to the monitor interface:** I need to get the interface index for `mon0` and then bind the socket to it.
* `struct sockaddr_ll sll;` is used for this.
* `if_nametoindex("mon0")` retrieves the index.
* I've also included a fallback mechanism. If `mon0` isn't available for some reason (though it *should* be if the previous steps worked), I'll try to use `wlan0`, reconfigure it to monitor mode, and set its frequency. This adds robustness.
6. **Construct the malicious frame:** This is the core of the exploit.
* **Radiotap Header:** I'm crafting a 9-byte radiotap header. The critical part is `0x04, 0x00, 0x00, 0x00`, which sets the `it_present` field to indicate the `RATE` flag (bit 2). Crucially, the byte immediately following this specifies the rate as `0x00`. This is an invalid legacy rate, and it's precisely what should trigger the bug when `mac80211_hwsim` tries to process it.
* **802.11 Data Frame Header:** A standard, albeit minimal, 802.11 data frame header follows the radiotap header. The MAC addresses are set to broadcast/null values, and sequence control is zeroed out.
7. **Inject the frame multiple times:** To ensure the kernel code path is hit reliably, I'll send this crafted frame several times in a loop using `send(psock, pkt, sizeof(pkt), 0)`. A small `usleep` between sends gives the system time to process each one.
Finally, I'll close the socket.
**A slight consideration:** While `iw` and `ip` commands are used, the feedback about successful netlink probing for `nl80211` family IDs suggests that the environment is indeed ready for low-level wireless interactions. In a more complex scenario or if `iw` were known to be absent, I'd have to dive into writing raw netlink code to create the interface, set the channel, etc. However, given the context and the relative simplicity of using `system` calls, and the likelihood that `iw` is available in the syzkaller setup, this approach seems the most practical for generating the *full* reproducer as requested.
Here is the C code I've generated:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
// Helper function to execute system commands and suppress output/return value
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret; // Suppress unused variable warning
}
int main() {
// 1. Load the mac80211_hwsim module.
// This creates a virtual hardware device.
execute_command("modprobe mac80211_hwsim");
sleep(1); // Give the module some time to load.
// 2. Create a monitor interface and bring it up.
// We create 'mon0' on the first virtual PHY ('phy0').
execute_command("iw phy phy0 interface add mon0 type monitor");
execute_command("ip link set mon0 up");
// 3. Set the channel to a valid frequency.
// This is necessary for the driver to configure the channel context,
// which is likely where mac80211_hwsim_write_tsf is called.
execute_command("iw dev mon0 set freq 2412");
sleep(1); // Give the channel switch some time.
// 4. Open an AF_PACKET socket.
// This allows us to send raw packets on the interface.
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket creation failed");
return 1;
}
// 5. Bind the socket to the monitor interface.
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL); // Bind to all protocols for simplicity
sll.sll_ifindex = if_nametoindex("mon0"); // Get the interface index for mon0
// Fallback mechanism: If 'mon0' could not be indexed (e.g., creation failed),
// try to use 'wlan0' and reconfigure it. This makes the reproducer more robust.
if (sll.sll_ifindex == 0) {
perror("if_nametoindex for mon0 failed");
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex for wlan0 failed");
return 1; // Cannot find a suitable interface.
}
// Reconfigure wlan0 to monitor mode if it's the fallback.
execute_command("ip link set wlan0 down");
execute_command("iw dev wlan0 set type monitor");
execute_command("ip link set wlan0 up");
execute_command("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind to interface failed");
return 1;
}
// 6. Construct the malicious frame.
// This frame includes a Radiotap header with an invalid rate,
// designed to trigger the bug in mac80211_hwsim_write_tsf.
unsigned char pkt[] = {
/* Radiotap Header (9 bytes total) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 (8 bytes for header fields + 1 for rate) */
0x04, 0x00, 0x00, 0x00, /* it_present: Indicates RATE (bit 2 is set) */
0x00, /* rate = 0 (This is the invalid legacy rate value) */
/* 802.11 Data Frame Header (24 bytes) */
// Frame Control (Data frame, To DS=0, From DS=0)
0x08, 0x00, 0x00, 0x00,
// Duration/ID
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, // Addr1 (Destination: Broadcast)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Addr2 (Source)
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Addr3 (BSSID)
// Sequence Control
0x00, 0x00
};
// 7. Inject the frame multiple times.
// Sending it a few times increases the chance of the specific codepath
// that triggers the WARNING being hit.
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send failed");
// Continue sending, as one failure doesn't mean all will fail.
}
usleep(10000); // Small delay between sends.
}
// Clean up the socket.
close(psock);
return 0;
}
```
|
| 230/3 |
2026/09/07 07:39 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret;
}
int main() {
// 1. Load the mac80211_hwsim module
execute_command("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
execute_command("iw phy phy0 interface add mon0 type monitor");
execute_command("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
execute_command("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
execute_command("ip link set wlan0 down");
execute_command("iw dev wlan0 set type monitor");
execute_command("ip link set wlan0 up");
execute_command("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
// The bug is triggered by an invalid legacy rate (0) in the radiotap header.
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```]
|
| 231/3 |
2026/09/07 07:39 |
agent |
repro-generator |
18m
Model:
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set freq: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
const char *ifname = "wlan0";
if (if_nametoindex(ifname) == 0) {
ifname = "wlan1";
if (if_nametoindex(ifname) == 0) {
fprintf(stderr, "No wlan interface found\n");
return 1;
}
}
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s DOWN\n", ifname);
return 1;
}
printf("[+] Set %s DOWN\n", ifname);
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
fprintf(stderr, "Failed to set %s to MONITOR mode\n", ifname);
return 1;
}
printf("[+] Set %s to MONITOR mode\n", ifname);
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s UP\n", ifname);
return 1;
}
printf("[+] Set %s UP\n", ifname);
// 4. Set frequency to 2412 MHz
if (set_interface_freq(nl80211_id, ifname, 2412) < 0) {
fprintf(stderr, "Failed to set frequency for %s\n", ifname);
// Continue anyway, it might have a default frequency
} else {
printf("[+] Set frequency to 2412 MHz\n");
}
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
printf("[+] Bound packet socket to %s\n", ifname);
// 6. Send malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
printf("[+] Sent malicious frames\n");
close(psock);
return 0;
}
]
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to generate a minimal, standalone C program for the strictly defensive
purpose of verifying a bugfix in an isolated environment.
To ensure that we can diagnose why a program might fail to run on the test environment,
you MUST include detailed logging and error checking in the generated C program:
1. Use 'printf(...)' for all progress messages and error logs.
2. Every system call (e.g., socket, bind, listen, connect, ioctl, send) must check for a failure return value.
3. If a call fails, it must print a specific error message including the function name
and the error string (use strerror(errno)), and then exit with a non-zero status.
4. The program must print a message after every successful major step.
5. Generate code that follows this pattern for all operations:
int res = do_something();
if (res < 0) {
printf("[-] Failed to do_something: %s\n", strerror(errno));
exit(1);
}
printf("[+] do_something successful.\n");
6. The compilation and development environment (including compilers, build
systems, makefiles, and kernel build/header directories) is NOT available
on the target test VM guest. Do NOT check for, build, or reference any
compilation tools, build files, or kernel development directories.
7. Do NOT execute shell commands or run external binaries (e.g. by using
functions like 'system()', 'popen()', or the 'exec' family such as
'execve()'). All environment checks, capability probings, and reproduction
steps must be performed directly using standard Linux system calls (such
as 'open', 'socket', 'ioctl', 'stat', etc.).
8. When reproducing asynchronous kernel timeouts or warnings, always
include a sufficient delay (using sleep or similar) after deleting
or unregistering the device to allow the kernel's asynchronous
timeout to trigger before program exit.
=== PHASE 2: BUG REPRODUCTION (GENERATION) ===
You must now generate a full reproducer candidate attempting to trigger the target bug/crash.
Do NOT generate a probe program. Focus directly on triggering the bug/crash described in the description.
You can assume that all necessary kernel capabilities and privileges (e.g., access to /dev/vhci,
ability to load BPF programs, etc.) have already been verified and are available in the environment.
Do not spend too much time analyzing or trying to generate a perfect one-shot reproducer.
Instead, follow an iterative approach: generate a simple candidate, execute it, analyze the results,
and improve it. Keep your reasoning steps short and focused on the next logical experiment.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Strategy: ```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret;
}
int main() {
// 1. Load the mac80211_hwsim module
execute_command("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
execute_command("iw phy phy0 interface add mon0 type monitor");
execute_command("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
execute_command("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
execute_command("ip link set wlan0 down");
execute_command("iw dev wlan0 set type monitor");
execute_command("ip link set wlan0 up");
execute_command("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
// The bug is triggered by an invalid legacy rate (0) in the radiotap header.
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```
Previous Reproducer Attempt:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
/*
* Resolves Generic Netlink family ID by family name using CTRL_CMD_GETFAMILY.
* Returns the family ID (>= 0) on success, or -1 on error / not found.
*/
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
/* Append CTRL_ATTR_FAMILY_NAME attribute */
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int main(void)
{
int fd;
int hwsim_id, nl80211_id;
struct timeval tv = { .tv_sec = 2, .tv_usec = 0 };
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
printf("[-] Failed to create netlink socket: %s\n", strerror(errno));
exit(1);
}
/* Set receive timeout so recv() does not hang indefinitely */
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
hwsim_id = get_genl_family_id(fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
printf("[-] Failed to get MAC80211_HWSIM family ID\n");
exit(1);
}
printf("[+] Got MAC80211_HWSIM family ID: %d\n", hwsim_id);
nl80211_id = get_genl_family_id(fd, "nl80211");
if (nl80211_id < 0) {
printf("[-] Failed to get nl80211 family ID\n");
exit(1);
}
printf("[+] Got nl80211 family ID: %d\n", nl80211_id);
close(fd);
printf("[+] Probe successful.\n");
return 0;
}
Execution Results & Debugging Feedback:
The environment probe was successful. We successfully obtained the MAC80211_HWSIM and nl80211 family IDs. The environment is ready. Please proceed to generate the full reproducer for the bug.
|
| 232/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 7963
output: 55
thoughts: 533
Thoughts: **My Thoughts on the `mac80211_hwsim_write_tsf` Warning**
So, I've stumbled upon this `WARNING in mac80211_hwsim_write_tsf` and I'm trying to get to the bottom of it. My initial focus was on the specific condition causing the warning, which is `c->control.rates[0].idx < 0`. This points to an issue with the transmission rate index being invalid, and the warning originates from `ieee80211_get_tx_rate` in `include/net/mac80211.h` at line 3413.
I then traced the call stack to understand how we got here. The path seems to be `packet_sendmsg` -> `dev_hard_start_xmit` -> `ieee80211_monitor_start_xmit` -> `ieee80211_tx` -> `__ieee80211_tx` -> `ieee80211_tx_frags` -> `drv_tx` -> `mac80211_hwsim_tx` -> `mac80211_hwsim_tx_frame_no_nl`. It's interesting to note that `mac80211_hwsim_write_tsf` is indeed called *from* `mac80211_hwsim_tx_frame_no_nl`, as expected.
Now, I also noticed a separate mention of `netlink: 80 bytes leftover after parsing attributes in process syz.4.6946`. My initial thought was that this netlink message might be directly related to `mac80211_hwsim` netlink commands. However, looking at the call trace again, it's very clearly originating from a `sendto` operation on a packet socket (`packet_sendmsg`). This makes me reconsider the netlink message. It's possible that the "80 bytes leftover" is an artifact from a *previous* netlink command, perhaps something like `HWSIM_CMD_NEW_RADIO` or another setup command, and isn't directly tied to the current transmission that triggered the warning. It might be a lingering effect or a separate, unrelated netlink parsing issue.
To truly understand the root cause, I need to dive into the implementation of `mac80211_hwsim_write_tsf` itself, which is located in `drivers/net/wireless/virtual/mac80211_hwsim_main.c`. This is where I expect to find the logic that's trying to write the TSF (Timestamp Synchronization Function) and where the invalid rate index might be originating before it's passed down to the core mac80211 functions.
|
| 233/4 |
2026/09/07 07:40 |
tool |
grepper |
0m
Args: map[Expression:mac80211_hwsim_write_tsf PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=1575=static inline u16 trans_tx_rate_flags_ieee2hwsim(struct ieee80211_tx_rate *rate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1604-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1605:static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1606- struct sk_buff *skb, u64 sim_time)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1646=static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1674- sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1675: mac80211_hwsim_write_tsf(data, my_skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1676-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1902=static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1912-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1914-
]
|
| 234/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 9117
output: 50
thoughts: 62
Thoughts: **A Deep Dive into `mac80211_hwsim` Tx Rate and TSF Handling**
My current focus is on understanding how the `mac80211_hwsim` driver, specifically within `drivers/net/wireless/virtual/mac80211_hwsim_main.c`, manages transmit rates and Time Synchronization Function (TSF) values. I'm examining the `mac80211_hwsim_write_tsf` and `mac80211_hwsim_get_tx_rate` functions. My objective is to gain a comprehensive grasp of their implementation details and their role in the simulated wireless environment. I want to understand precisely how these functions contribute to the realistic emulation of 802.11 hardware behavior within the `mac80211` framework.
|
| 235/4 |
2026/09/07 07:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:1605 LineCount:50]
Results: map[Contents:1605: static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
1606: struct sk_buff *skb, u64 sim_time)
1607: {
1608: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1609: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1610: struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1611: struct ieee80211_rate *txrate;
1612: /* TODO: get MCS */
1613: int bitrate = 100;
1614:
1615: spin_lock_bh(&data->tsf_offset_lock);
1616:
1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
1618: if (txrate)
1619: bitrate = txrate->bitrate;
1620:
1621: if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
1622: ieee80211_is_probe_resp(hdr->frame_control)) {
1623: mgmt->u.probe_resp.timestamp =
1624: cpu_to_le64(sim_time + data->tsf_offset +
1625: 24 * 8 * 10 / bitrate);
1626: } else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
1627: ieee80211_is_beacon(mgmt->frame_control)) {
1628: mgmt->u.beacon.timestamp = cpu_to_le64(sim_time +
1629: data->tsf_offset +
1630: 24 * 8 * 10 /
1631: bitrate);
1632: } else if (skb->len >= offsetofend(struct ieee80211_ext,
1633: u.s1g_beacon.timestamp) &&
1634: ieee80211_is_s1g_beacon(mgmt->frame_control)) {
1635: struct ieee80211_ext *ext = (void *)mgmt;
1636:
1637: ext->u.s1g_beacon.timestamp = cpu_to_le32(sim_time +
1638: data->tsf_offset +
1639: 10 * 8 * 10 /
1640: bitrate);
1641: }
1642:
1643: spin_unlock_bh(&data->tsf_offset_lock);
1644: }
1645:
1646: static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
1647: struct sk_buff *my_skb,
1648: int dst_portid,
1649: struct ieee80211_channel *channel)
1650: {
1651: struct sk_buff *skb;
1652: struct mac80211_hwsim_data *data = hw->priv;
1653: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) my_skb->data;
1654: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(my_skb);
]
|
| 236/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 10269
output: 50
thoughts: 21
Thoughts: **My Thought Process on `mac80211_hwsim_get_tx_rate`**
Alright, so I'm looking at `mac80211_hwsim_get_tx_rate`. My primary objective here is to understand its role and function within the `mac80211` hardware simulation framework. Given my expertise in wireless networking, I'm immediately thinking about how this function contributes to the accurate simulation of Wi-Fi transmission rates.
My initial hypothesis is that this function is responsible for determining the *actual* or *effective* transmission rate that the simulated hardware will use for a given transmission. This isn't as straightforward as just picking a rate from a predefined list. I expect it to take into account a multitude of factors that influence real-world Wi-Fi performance.
Specifically, I'm anticipating it will need to consider:
* **The negotiated rate:** What is the highest rate the access point and the simulated client have agreed upon? This is the baseline.
* **Channel conditions:** Is the simulated channel clear, or is there interference? Is the signal strength good, or is it weak and prone to errors? Factors like signal-to-noise ratio (SNR) and signal-to-interference-plus-noise ratio (SINR) are going to be critical here.
* **Modulation and Coding Scheme (MCS):** Based on the channel conditions, the function will likely select an appropriate MCS index. This dictates the modulation technique (like QPSK, 16-QAM, 64-QAM, 256-QAM) and the coding rate, which directly impacts the achievable data rate.
* **Hardware capabilities:** Does the simulated hardware even support the higher MCS rates or specific channel widths? The function must respect the limitations of the virtual device.
* **Packet size and overhead:** While perhaps not directly in *this* function, the overall transmission rate is affected by packet size and the overhead from headers. It's possible this function indirectly influences how that's accounted for.
* **Retries and retransmissions:** If a packet is lost or corrupted, the rate might be reduced for subsequent attempts. I'll be looking for how the simulation handles this.
* **Dynamic Rate Switching (DRS):** This is a big one. Real Wi-Fi drivers constantly adjust transmission rates based on real-time channel assessment. I'm expecting this function to be a core component of that DRS logic within the simulation. It's not just about picking a rate once; it's about *adapting*.
So, when I look at the code for `mac80211_hwsim_get_tx_rate`, I'm not just scanning lines. I'm actively trying to map these expected functionalities to the actual implementation. I'm looking for the input parameters that represent channel state, the internal logic that calculates SNR or SINR, the lookup tables or algorithms that map these conditions to MCS indices, and the output that ultimately signals to the rest of the simulation what rate to use for sending data.
My goal is to verify that the simulation's behavior regarding transmission rates is faithful to the underlying `mac80211` stack and, by extension, to real-world Wi-Fi behavior. This function is crucial for realistic throughput testing, interference analysis, and general performance characterization within the `hwsim` environment. If this function is flawed, then all subsequent simulations relying on it will be inherently inaccurate. I need to be confident in its fidelity.
|
| 237/4 |
2026/09/07 07:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:1330 LineCount:20]
Results: map[Contents:1330: {
1331: if (info->control.rates[0].flags &
1332: (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
1333: return NULL;
1334:
1335: return ieee80211_get_tx_rate(hw, info);
1336: }
1337:
1338: static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw,
1339: struct sk_buff *tx_skb,
1340: struct ieee80211_channel *chan)
1341: {
1342: struct mac80211_hwsim_data *data = hw->priv;
1343: struct sk_buff *skb;
1344: struct hwsim_radiotap_hdr *hdr;
1345: u16 flags, bitrate;
1346: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx_skb);
1347: struct ieee80211_rate *txrate = mac80211_hwsim_get_tx_rate(hw, info);
1348:
1349: if (!txrate)
]
|
| 238/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 10716
output: 41
thoughts: 34
Thoughts: **My Thought Process on `ieee80211_get_tx_rate`**
Okay, so I'm diving into the heart of the mac80211 subsystem, specifically looking at how the transmit rate is determined. My immediate thought is to pinpoint the source of this information, and that naturally leads me to the header files, where the public interfaces and crucial data structures are defined. So, the first thing I'm doing is navigating to `include/net/mac80211.h`. This is the authoritative place to find the function signature and understand its immediate context. I'm expecting to find a function prototype here, and based on its name, `ieee80211_get_tx_rate`, I anticipate it will return information about the current or selected transmit rate for a given transmission. It's likely to be a critical piece of information for rate control algorithms, antenna diversity decisions, and ultimately, for optimizing the efficiency and reliability of wireless transmissions. I'll be looking for its arguments to understand what context it needs (e.g., a `struct ieee80211_vif` or `struct ieee80211_tx_info`) and what it returns – is it a specific rate index, a struct containing rate capabilities, or perhaps a pointer to a more detailed rate structure? This header file is my entry point into understanding the high-level contract of this function.
|
| 239/4 |
2026/09/07 07:40 |
tool |
read-file |
0m
Args: map[File:include/net/mac80211.h FirstLine:3400 LineCount:20]
Results: map[Contents:3400: *
3401: * @hw: the &struct ieee80211_hw to set the MAC address for
3402: * @addr: the address to set
3403: */
3404: static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr)
3405: {
3406: memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
3407: }
3408:
3409: static inline struct ieee80211_rate *
3410: ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
3411: const struct ieee80211_tx_info *c)
3412: {
3413: if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
3414: return NULL;
3415:
3416: if (c->band >= NUM_NL80211_BANDS)
3417: return NULL;
3418:
3419: return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
]
|
| 240/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 11147
output: 41
thoughts: 224
Thoughts: **Tracing a Potentially Problematic Rate Index**
I'm investigating a warning I've encountered: `WARN_ON_ONCE(c->control.rates[0].idx < 0)`. My initial thought is to understand the flow of execution that leads to this condition. I've identified that the warning originates from `mac80211_hwsim_write_tsf`, which in turn calls `mac80211_hwsim_get_tx_rate`. This function, `mac80211_hwsim_get_tx_rate`, eventually calls `ieee80211_get_tx_rate`, and it's within this context that the `idx` field of `c->control.rates[0]` is found to be less than zero.
My next step is to figure out how `c->control.rates[0].idx` gets its value in the first place. I've traced this back to the `struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);` assignment. This means the `skb` (socket buffer) is the key here. I've determined that this `skb` is being injected into the system via a specific path: `packet_sendmsg`, which then leads to `dev_hard_start_xmit`, and finally to `ieee80211_monitor_start_xmit`. My current focus is on examining the implementation of `ieee80211_monitor_start_xmit` within `net/mac80211/tx.c` to understand how the `tx_info` structure, and specifically the `rates[0].idx` field, is populated when a packet is processed in monitor mode.
|
| 241/4 |
2026/09/07 07:40 |
tool |
read-file |
0m
Args: map[File:net/mac80211/tx.c FirstLine:2470 LineCount:50]
Results: map[Contents:2470: * flag are not reordered relative to each other.
2471: */
2472: ieee80211_select_queue_80211(sdata, skb, hdr);
2473: skb_set_queue_mapping(skb, ieee80211_ac_from_tid(skb->priority));
2474:
2475: /*
2476: * Process the radiotap header. This will now take into account the
2477: * selected chandef above to accurately set injection rates and
2478: * retransmissions.
2479: */
2480: if (!ieee80211_parse_tx_radiotap(skb, dev))
2481: goto fail_rcu;
2482:
2483: /* remove the injection radiotap header */
2484: skb_pull(skb, len_rthdr);
2485:
2486: ieee80211_xmit(sdata, NULL, skb);
2487: rcu_read_unlock();
2488:
2489: return NETDEV_TX_OK;
2490:
2491: fail_rcu:
2492: rcu_read_unlock();
2493: fail:
2494: dev_kfree_skb(skb);
2495: return NETDEV_TX_OK; /* meaning, we dealt with the skb */
2496: }
2497:
2498: static inline bool ieee80211_is_tdls_setup(struct sk_buff *skb)
2499: {
2500: u16 ethertype = (skb->data[12] << 8) | skb->data[13];
2501:
2502: return ethertype == ETH_P_TDLS &&
2503: skb->len > 14 &&
2504: skb->data[14] == WLAN_TDLS_SNAP_RFTYPE;
2505: }
2506:
2507: int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
2508: struct sk_buff *skb,
2509: struct sta_info **sta_out)
2510: {
2511: struct sta_info *sta;
2512:
2513: switch (sdata->vif.type) {
2514: case NL80211_IFTYPE_AP_VLAN:
2515: sta = rcu_dereference(sdata->u.vlan.sta);
2516: if (sta) {
2517: *sta_out = sta;
2518: return 0;
2519: } else if (sdata->wdev.use_4addr) {
]
|
| 242/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 12226
output: 44
thoughts: 21
Thoughts: **A Deep Dive into `ieee80211_parse_tx_radiotap`**
My immediate thought is to examine `ieee80211_parse_tx_radiotap`. This function, as its name suggests, is clearly responsible for processing Radiotap headers specifically for outgoing (transmit) frames. Given my expertise, I'm anticipating a rigorous parsing mechanism, likely involving bit manipulation and careful checking of flags to correctly interpret the various fields within the Radiotap header. I'll be looking for how it handles different Radiotap present flags, ensuring that each field is only processed if its corresponding bit is set. I expect to see robust error handling, especially for malformed headers or unexpected data lengths, and a clear mapping of Radiotap fields to the internal data structures used by the driver or network stack. The ultimate goal, of course, will be to extract the necessary information to accurately convey transmit parameters to the hardware, whether that's channel information, power levels, or specific antenna selections. I'm particularly interested in any optimizations employed, especially if this function is called frequently within the transmission path.
|
| 243/4 |
2026/09/07 07:40 |
tool |
grepper |
0m
Args: map[Expression:ieee80211_parse_tx_radiotap PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/iface.c=951=static u16 ieee80211_monitor_select_queue(struct net_device *dev,
--
net/mac80211/iface.c-966-
net/mac80211/iface.c:967: if (!ieee80211_parse_tx_radiotap(skb, dev))
net/mac80211/iface.c-968- return 0; /* doesn't matter, frame will be dropped */
--
net/mac80211/tx.c=2086=static bool ieee80211_validate_radiotap_len(struct sk_buff *skb)
--
net/mac80211/tx.c-2105-
net/mac80211/tx.c:2106:bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
net/mac80211/tx.c-2107- struct net_device *dev)
--
net/mac80211/tx.c=2324=netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
--
net/mac80211/tx.c-2479- */
net/mac80211/tx.c:2480: if (!ieee80211_parse_tx_radiotap(skb, dev))
net/mac80211/tx.c-2481- goto fail_rcu;
]
|
| 244/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 12711
output: 42
thoughts: 36
Thoughts: **My Thought Process for Analyzing `ieee80211_parse_tx_radiotap`**
Right, so I'm diving into the `net/mac80211/tx.c` file, specifically focusing on the `ieee80211_parse_tx_radiotap` function. My immediate goal here is to understand precisely how this function is responsible for processing Radiotap headers appended to outgoing frames within the mac80211 subsystem. I need to get a clear picture of what information it's extracting, how it's validating that information, and ultimately, what it's doing with it to prepare the frame for actual transmission.
I'll be looking for the parsing logic itself – how it iterates through the different Radiotap fields, identifies them by their IDs, and then extracts the corresponding data. This likely involves bit manipulation and careful handling of variable-length fields. I'm particularly interested in the specific Radiotap fields that mac80211 cares about for transmission, such as transmit flags, channel information, power levels, and any other metadata that influences the PHY layer behavior.
Furthermore, I want to ensure I grasp the error handling and validation mechanisms. What happens if the Radiotap header is malformed? Are there checks for invalid field values or unexpected sequences? How does the function signal these issues, and what are the consequences for the frame?
Ultimately, I'm trying to connect the dots: how does the Radiotap header, provided by userspace or some other higher layer, get translated into specific parameters and settings that the mac80211 driver will use to configure the hardware for transmission? This function is the critical bridge, so understanding its intricacies is key to understanding the overall transmission path.
|
| 245/4 |
2026/09/07 07:40 |
tool |
read-file |
0m
Args: map[File:net/mac80211/tx.c FirstLine:2106 LineCount:100]
Results: map[Contents:2106: bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
2107: struct net_device *dev)
2108: {
2109: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2110: struct ieee80211_radiotap_iterator iterator;
2111: struct ieee80211_radiotap_header *rthdr =
2112: (struct ieee80211_radiotap_header *) skb->data;
2113: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2114: int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
2115: NULL);
2116: u16 txflags;
2117: u16 rate = 0;
2118: bool rate_found = false;
2119: u8 rate_retries = 0;
2120: u16 rate_flags = 0;
2121: u8 mcs_known, mcs_flags, mcs_bw;
2122: u16 vht_known;
2123: u8 vht_mcs = 0, vht_nss = 0;
2124: int i;
2125:
2126: if (!ieee80211_validate_radiotap_len(skb))
2127: return false;
2128:
2129: info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
2130: IEEE80211_TX_CTL_DONTFRAG;
2131:
2132: /*
2133: * for every radiotap entry that is present
2134: * (ieee80211_radiotap_iterator_next returns -ENOENT when no more
2135: * entries present, or -EINVAL on error)
2136: */
2137:
2138: while (!ret) {
2139: ret = ieee80211_radiotap_iterator_next(&iterator);
2140:
2141: if (ret)
2142: continue;
2143:
2144: /* see if this argument is something we can use */
2145: switch (iterator.this_arg_index) {
2146: /*
2147: * You must take care when dereferencing iterator.this_arg
2148: * for multibyte types... the pointer is not aligned. Use
2149: * get_unaligned((type *)iterator.this_arg) to dereference
2150: * iterator.this_arg for type "type" safely on all arches.
2151: */
2152: case IEEE80211_RADIOTAP_FLAGS:
2153: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
2154: /*
2155: * this indicates that the skb we have been
2156: * handed has the 32-bit FCS CRC at the end...
2157: * we should react to that by snipping it off
2158: * because it will be recomputed and added
2159: * on transmission
2160: */
2161: if (skb->len < (iterator._max_length + FCS_LEN))
2162: return false;
2163:
2164: skb_trim(skb, skb->len - FCS_LEN);
2165: }
2166: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
2167: info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
2168: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
2169: info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
2170: break;
2171:
2172: case IEEE80211_RADIOTAP_TX_FLAGS:
2173: txflags = get_unaligned_le16(iterator.this_arg);
2174: if (txflags & IEEE80211_RADIOTAP_F_TX_NOACK)
2175: info->flags |= IEEE80211_TX_CTL_NO_ACK;
2176: if (txflags & IEEE80211_RADIOTAP_F_TX_NOSEQNO)
2177: info->control.flags |= IEEE80211_TX_CTRL_NO_SEQNO;
2178: if (txflags & IEEE80211_RADIOTAP_F_TX_ORDER)
2179: info->control.flags |=
2180: IEEE80211_TX_CTRL_DONT_REORDER;
2181: break;
2182:
2183: case IEEE80211_RADIOTAP_RATE:
2184: rate = *iterator.this_arg;
2185: rate_flags = 0;
2186: rate_found = true;
2187: break;
2188:
2189: case IEEE80211_RADIOTAP_ANTENNA:
2190: /* this can appear multiple times, keep a bitmap */
2191: /* control.antennas is only a 2-bit bitmap */
2192: if (*iterator.this_arg < 2)
2193: info->control.antennas |= BIT(*iterator.this_arg);
2194: break;
2195:
2196: case IEEE80211_RADIOTAP_DATA_RETRIES:
2197: rate_retries = *iterator.this_arg;
2198: break;
2199:
2200: case IEEE80211_RADIOTAP_MCS:
2201: mcs_known = iterator.this_arg[0];
2202: mcs_flags = iterator.this_arg[1];
2203: if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
2204: break;
2205:
]
|
| 246/4 |
2026/09/07 07:40 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 14572
output: 42
thoughts: 24
Thoughts: **My Deep Dive into `ieee80211_parse_tx_radiotap`**
Alright, I've been digging into `ieee80211_parse_tx_radiotap` and here's what's really striking me. My primary goal here is to understand how the kernel is processing and, more importantly, constructing the Radiotap header for outgoing Wi-Fi frames. This isn't just about surface-level parsing; I need to grasp the intricacies of how it's taking the higher-level Wi-Fi transmission parameters and translating them into the standardized Radiotap format.
What I'm looking for is a clear picture of the data flow. I want to see precisely which fields in the kernel's internal representation of the transmit request are being mapped to which specific Radiotap fields. This means I'm scrutinizing the function’s logic to identify how it determines the present flags and then populates the corresponding data. For instance, how does it decide whether to include the `IEEE80211_RADIOTAP_CHANNEL` field? What information triggers the inclusion of `IEEE80211_RADIOTAP_TX_FLAGS`? And critically, how are the actual values for these fields derived?
I'm particularly interested in the interplay between the generic Radiotap structure and the IEEE 802.11 specific extensions. My expectation is that this function will handle the general Radiotap header construction while also selectively adding 802.11-specific metadata that is crucial for proper interpretation by the receiver or subsequent processing. This could involve things like antenna information, signal strength, modulation schemes, and data rates – the whole gamut of low-level PHY information.
Furthermore, I'm keen to understand the error handling. What happens if the input data is malformed or if certain expected parameters are missing? Does it gracefully handle these situations, or does it result in dropped packets or kernel panics? As an expert, I know that robust error handling is paramount in network drivers.
Ultimately, my thought process is about reverse-engineering the kernel's decision-making process for building these essential headers. It's about tracing the data, understanding the transformations, and verifying that the output conforms to the Radiotap specification, ensuring that my transmissions are correctly understood by the wireless medium. I'm essentially validating the integrity and intelligence behind the kernel's outgoing Wi-Fi frame preparation.
|
| 247/4 |
2026/09/07 07:41 |
tool |
read-file |
0m
Args: map[File:net/mac80211/tx.c FirstLine:2206 LineCount:100]
Results: map[Contents:2206: rate_found = true;
2207: rate = iterator.this_arg[2];
2208: rate_flags = IEEE80211_TX_RC_MCS;
2209:
2210: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
2211: mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
2212: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2213:
2214: mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
2215: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
2216: mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
2217: rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
2218:
2219: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC &&
2220: mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC)
2221: info->flags |= IEEE80211_TX_CTL_LDPC;
2222:
2223: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
2224: u8 stbc = u8_get_bits(mcs_flags,
2225: IEEE80211_RADIOTAP_MCS_STBC_MASK);
2226:
2227: info->flags |=
2228: u32_encode_bits(stbc,
2229: IEEE80211_TX_CTL_STBC);
2230: }
2231: break;
2232:
2233: case IEEE80211_RADIOTAP_VHT:
2234: vht_known = get_unaligned_le16(iterator.this_arg);
2235: rate_found = true;
2236:
2237: rate_flags = IEEE80211_TX_RC_VHT_MCS;
2238: if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
2239: (iterator.this_arg[2] &
2240: IEEE80211_RADIOTAP_VHT_FLAG_SGI))
2241: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2242: if (vht_known &
2243: IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
2244: if (iterator.this_arg[3] == 1)
2245: rate_flags |=
2246: IEEE80211_TX_RC_40_MHZ_WIDTH;
2247: else if (iterator.this_arg[3] == 4)
2248: rate_flags |=
2249: IEEE80211_TX_RC_80_MHZ_WIDTH;
2250: else if (iterator.this_arg[3] == 11)
2251: rate_flags |=
2252: IEEE80211_TX_RC_160_MHZ_WIDTH;
2253: }
2254:
2255: vht_mcs = iterator.this_arg[4] >> 4;
2256: if (vht_mcs > 11)
2257: vht_mcs = 0;
2258: vht_nss = iterator.this_arg[4] & 0xF;
2259: if (!vht_nss || vht_nss > 8)
2260: vht_nss = 1;
2261: break;
2262:
2263: /*
2264: * Please update the file
2265: * Documentation/networking/mac80211-injection.rst
2266: * when parsing new fields here.
2267: */
2268:
2269: default:
2270: break;
2271: }
2272: }
2273:
2274: if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
2275: return false;
2276:
2277: if (rate_found) {
2278: struct ieee80211_supported_band *sband =
2279: local->hw.wiphy->bands[info->band];
2280:
2281: info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
2282:
2283: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
2284: info->control.rates[i].idx = -1;
2285: info->control.rates[i].flags = 0;
2286: info->control.rates[i].count = 0;
2287: }
2288:
2289: if (rate_flags & IEEE80211_TX_RC_MCS) {
2290: /* reset antennas if not enough */
2291: if (IEEE80211_HT_MCS_CHAINS(rate) >
2292: hweight8(info->control.antennas))
2293: info->control.antennas = 0;
2294:
2295: info->control.rates[0].idx = rate;
2296: } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
2297: /* reset antennas if not enough */
2298: if (vht_nss > hweight8(info->control.antennas))
2299: info->control.antennas = 0;
2300:
2301: ieee80211_rate_set_vht(info->control.rates, vht_mcs,
2302: vht_nss);
2303: } else if (sband) {
2304: for (i = 0; i < sband->n_bitrates; i++) {
2305: if (rate * 5 != sband->bitrates[i].bitrate)
]
|
| 248/4 |
2026/09/07 07:41 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 16457
output: 41
thoughts: 24
Thoughts: **My Deep Dive into `ieee80211_parse_tx_radiotap`**
Alright, I've been digging into `ieee80211_parse_tx_radiotap` and here's what's really striking me. My primary goal here is to understand how the kernel is processing and, more importantly, constructing the Radiotap header for outgoing Wi-Fi frames. This isn't just about surface-level parsing; I need to grasp the intricacies of how it's taking the higher-level Wi-Fi transmission parameters and translating them into the standardized Radiotap format.
What I'm looking for is a clear picture of the data flow. I want to see precisely which fields in the kernel's internal representation of the transmit request are being mapped to which specific Radiotap fields. This means I'm scrutinizing the function’s logic to identify how it determines the present flags and then populates the corresponding data. For instance, how does it decide whether to include the `IEEE80211_RADIOTAP_CHANNEL` field? What information triggers the inclusion of `IEEE80211_RADIOTAP_TX_FLAGS`? And critically, how are the actual values for these fields derived?
I'm particularly interested in the interplay between the generic Radiotap structure and the IEEE 802.11 specific extensions. My expectation is that this function will handle the general Radiotap header construction while also selectively adding 802.11-specific metadata that is crucial for proper interpretation by the receiver or subsequent processing. This could involve things like antenna information, signal strength, modulation schemes, and data rates – the whole gamut of low-level PHY information.
Furthermore, I'm keen to understand the error handling. What happens if the input data is malformed or if certain expected parameters are missing? Does it gracefully handle these situations, or does it result in dropped packets or kernel panics? As an expert, I know that robust error handling is paramount in network drivers.
Ultimately, my thought process is about reverse-engineering the kernel's decision-making process for building these essential headers. It's about tracing the data, understanding the transformations, and verifying that the output conforms to the Radiotap specification, ensuring that my transmissions are correctly understood by the wireless medium. I'm essentially validating the integrity and intelligence behind the kernel's outgoing Wi-Fi frame preparation.
|
| 249/4 |
2026/09/07 07:41 |
tool |
read-file |
0m
Args: map[File:net/mac80211/tx.c FirstLine:2306 LineCount:50]
Results: map[Contents:2306: continue;
2307:
2308: info->control.rates[0].idx = i;
2309: break;
2310: }
2311: }
2312:
2313: if (info->control.rates[0].idx < 0)
2314: info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
2315:
2316: info->control.rates[0].flags = rate_flags;
2317: info->control.rates[0].count = min_t(u8, rate_retries + 1,
2318: local->hw.max_rate_tries);
2319: }
2320:
2321: return true;
2322: }
2323:
2324: netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2325: struct net_device *dev)
2326: {
2327: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2328: struct ieee80211_chanctx_conf *chanctx_conf;
2329: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2330: struct ieee80211_hdr *hdr;
2331: struct ieee80211_sub_if_data *tmp_sdata, *sdata;
2332: struct cfg80211_chan_def *chandef;
2333: u16 len_rthdr;
2334: int hdrlen;
2335:
2336: sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2337: if (unlikely(!ieee80211_sdata_running(sdata)))
2338: goto fail;
2339:
2340: memset(info, 0, sizeof(*info));
2341: info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
2342: IEEE80211_TX_CTL_INJECTED;
2343:
2344: /* Sanity-check the length of the radiotap header */
2345: if (!ieee80211_validate_radiotap_len(skb))
2346: goto fail;
2347:
2348: /* we now know there is a radiotap header with a length we can use */
2349: len_rthdr = ieee80211_get_radiotap_len(skb->data);
2350:
2351: /*
2352: * fix up the pointers accounting for the radiotap
2353: * header still being in there. We are being given
2354: * a precooked IEEE80211 header so no need for
2355: * normal processing
]
|
| 250/4 |
2026/09/07 07:41 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 17379
output: 50
thoughts: 998
Thoughts: **My Thought Process Regarding the mac80211_hwsim Rate Injection Issue**
Okay, let me walk through my understanding of this particular code path and the potential issue I've identified.
It seems I've stumbled upon a subtle but critical path in the `mac80211_hwsim` driver that could lead to a `WARN_ON_ONCE` being triggered. My thinking started in the `ieee80211_parse_tx_radiotap` function. I observed that when a radiotap rate is found (`rate_found` is true), the code attempts to populate the `info->control.rates` array. Specifically, it initializes all entries to invalid (`-1` index, zero flags, zero count).
Then, it tries to determine the correct rate index based on `rate_flags`. If it's an MCS or VHT MCS rate, it directly sets `info->control.rates[0].idx`. If it's a legacy rate (i.e., not MCS/VHT), it iterates through the supported band's bitrates to find a match. The key part here is the condition: `rate * 5 != sband->bitrates[i].bitrate`. This means it's expecting the rate value in the radiotap header to be in units of 500 kbps, which is a standard convention for IEEE 802.11 rates.
Now, here's where my concern arises: if the `rate_flags` *don't* indicate MCS or VHT, *and* the radiotap rate value doesn't match any of the supported legacy bitrates in the current band (i.e., the loop completes without finding a match), then `info->control.rates[0].idx` remains at its initialized value of `-1`.
Crucially, after this rate-finding logic, the code checks `if (info->control.rates[0].idx < 0)`. If it's indeed less than zero, it *clears* the `IEEE80211_TX_CTRL_RATE_INJECT` flag from `info->control.flags`. This is a good indicator that the driver understands it couldn't inject a specific rate. However, it *doesn't* reset `info->control.rates[0].idx` back to a valid state; it remains `-1`. The `rate_flags` are also still set, which could be misleading.
My focus then shifted to how this `info` structure is consumed. I looked at `mac80211_hwsim_get_tx_rate`. This function acts as an intermediary. It checks if the `info->control.rates[0].flags` indicate MCS or VHT MCS. If they do, it returns `NULL`, meaning `hwsim` bypasses the standard rate lookup for these. But if it's *not* an MCS/VHT rate, it proceeds to call `ieee80211_get_tx_rate(hw, info)`.
And `ieee80211_get_tx_rate` has a very strict check: `if (WARN_ON_ONCE(c->control.rates[0].idx < 0)) return NULL;`. This is the smoking gun. If we reach this point with `info->control.rates[0].idx` still being `-1` (which happens when the legacy rate didn't match anything in the band and the `IEEE80211_TX_CTRL_RATE_INJECT` flag was cleared), this `WARN_ON_ONCE` will be triggered.
So, to recap my deduced sequence of events to hit this warning:
1. **Packet Origination:** I need to inject a packet, likely through a monitor interface using something like `packet_sendmsg`.
2. **Radiotap Header:** This packet *must* have a radiotap header.
3. **Rate Field:** The radiotap header *must* contain the `IEEE80211_RADIOTAP_RATE` field.
4. **Unmatchable Rate:** The value in this radiotap `rate` field must be such that it *doesn't* correspond to any of the legacy bitrates supported by the current band (meaning `rate * 5` doesn't match any `sband->bitrates[i].bitrate`).
5. **Non-MCS/VHT Rate:** The `rate_flags` associated with this radiotap rate must *not* include `IEEE80211_TX_RC_MCS` or `IEEE80211_TX_RC_VHT_MCS`. This ensures we go down the legacy rate lookup path.
6. **Packet Type (Potentially):** The packet type needs to be one that gets processed by `mac80211_hwsim_tx_frame_no_nl`, which then calls `mac80211_hwsim_get_tx_rate`. I was initially considering specific frame types like Probe Response or Beacon for `mac80211_hwsim_write_tsf`, but further inspection suggests that `mac80211_hwsim_tx_frame_no_nl` is called for *all* transmitted frames by `hwsim`, so the specific frame type might not be the deciding factor for reaching `mac80211_hwsim_get_tx_rate`. The key is just that the frame is transmitted through the `hwsim` driver.
Essentially, I'm aiming to construct a scenario where a user attempts to specify a legacy transmission rate that the simulated hardware simply doesn't support, but without explicitly marking it as an MCS/VHT rate. The driver's logic correctly identifies that it can't inject the rate (by clearing `IEEE80211_TX_CTRL_RATE_INJECT`), but it fails to clean up the `rates[0].idx` field, leading to the downstream assertion.
|
| 251/4 |
2026/09/07 07:41 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:1900 LineCount:20]
Results: map[Contents:1900: }
1901:
1902: static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
1903: struct sk_buff *skb,
1904: struct ieee80211_channel *chan)
1905: {
1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
1907: bool ack = false;
1908: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1909: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1910: struct ieee80211_rx_status rx_status;
1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
1912:
1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
1914:
1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
1916:
1917: memset(&rx_status, 0, sizeof(rx_status));
1918: rx_status.flag |= RX_FLAG_MACTIME_START;
1919: rx_status.freq = chan->center_freq;
]
|
| 252/4 |
2026/09/07 07:41 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 18840
output: 81
thoughts: 1127
Thoughts: **My Thought Process on Reproducing the `mac80211_hwsim` TSF Issue**
It's clear to me that the vulnerability hinges on a specific sequence of events and conditions within the `mac80211_hwsim` driver. My understanding points to `mac80211_hwsim_write_tsf` as the critical function, and I've confirmed it's invoked for every packet transmitted. More importantly, this function *unconditionally* calls `mac80211_hwsim_get_tx_rate(data->hw, info)`. This unconditional call is a key weakness.
Therefore, to trigger the issue, I need to satisfy a precise set of requirements:
1. **`mac80211_hwsim` must be loaded:** This is the foundational requirement, as it provides the simulated hardware and the driver code in question.
2. **A monitor interface needs to be created and active:** I need a way to inject packets as if they were coming from a real wireless device operating in monitor mode.
3. **A packet must be sent via an `AF_PACKET` socket:** The vulnerability is triggered by sending a packet using this specific socket type, bound to the monitor interface.
4. **The packet must include a radiotap header:** Specifically, this radiotap header needs to have the `IEEE80211_RADIOTAP_RATE` bit set within its `it_present` field. This signals to the driver that rate information is provided.
5. **The provided rate value must be invalid:** The crucial part is that the rate value itself needs to be something that doesn't align with the supported rates for the simulated band (`sband->bitrates`). A value of `0` is a prime candidate for an invalid legacy rate.
6. **The packet must be a valid 802.11 frame:** Although `mac80211_hwsim_write_tsf` calls `mac80211_hwsim_get_tx_rate` unconditionally, the overall packet structure still needs to be recognizable as an 802.11 frame (like a Data frame or Beacon) for the process to proceed normally up to the point of rate handling. The frame type itself doesn't directly influence the call to `mac80211_hwsim_get_tx_rate`, but it's necessary for the packet processing pipeline.
Reflecting on my previous attempt to reproduce this, I recall that the initial approach was more of a strategic outline than a fully executed reproducer. The prior work involved a probe program, not a C reproducer based on the direct strategy I've just laid out.
Now, I need to focus on constructing a robust C reproducer. A significant hurdle I'm considering is the correct setup of the monitor interface. Since `mac80211_hwsim` loads and typically creates `wlanX` interfaces, my initial thought was how to configure one of these for monitor mode. The instructions are very strict: I *cannot* use shell commands or external binaries like `system()` or `exec`. This means I must rely on Linux system calls directly.
My options are:
* **Using Netlink (`nl80211`):** This is the proper, programmatic way to interact with the kernel's wireless stack. I can use Netlink to create a monitor interface or, more likely, change the type of an existing `wlanX` interface to `NL80211_IFTYPE_MONITOR`.
* **`ioctl(SIOCSIWMODE)`:** I initially questioned if this older `ioctl` would work with `mac80211`. However, given that `mac80211` relies on `nl80211` for modern configuration, `ioctl` is likely not the intended or supported method for changing interface types to monitor mode in this context.
Therefore, the most viable path forward is using Netlink. Constructing Netlink messages directly in C can be a bit involved. I need to prepare a small Netlink helper library or functions to handle the `NL80211_CMD_SET_INTERFACE` command with the correct attributes to set the interface type to monitor. This will ensure I adhere to the strict reproduction requirements. My next step is to implement this Netlink interaction to get the monitor interface ready before crafting and sending the malicious `AF_PACKET`.
|
| 253/4 |
2026/09/07 07:41 |
tool |
codeexpert |
10m
Args: map[Question:Write a minimal C function using raw netlink sockets to change the interface type of "wlan0" to monitor mode (NL80211_IFTYPE_MONITOR) and set it UP, and set its frequency to 2412 MHz. Assume nl80211 family ID is known.]
Results: map[Answer:A complete, minimal C implementation using raw Netlink sockets (Generic Netlink for nl80211 commands and RTNetlink for interface state) to configure "wlan0" to monitor mode, bring it UP, and set its frequency to 2412 MHz.]
|
| 254/5 |
2026/09/07 07:41 |
agent |
codeexpert |
10m
Model:
Results: map[Answer:A complete, minimal C implementation using raw Netlink sockets (Generic Netlink for nl80211 commands and RTNetlink for interface state) to configure "wlan0" to monitor mode, bring it UP, and set its frequency to 2412 MHz.]
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Use tools extensively while researching the question. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Write a minimal C function using raw netlink sockets to change the interface type of "wlan0" to monitor mode (NL80211_IFTYPE_MONITOR) and set it UP, and set its frequency to 2412 MHz. Assume nl80211 family ID is known.
|
| 255/6 |
2026/09/07 07:41 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 2376
output: 143
thoughts: 489
Thoughts: **My Thought Process on Crafting the Netlink Solution**
Alright, the user wants a minimal C function, using raw netlink sockets, to perform a specific set of operations on the `wlan0` interface: changing its type to monitor mode, setting it UP, and configuring its frequency. They've also helpfully stated that the `nl80211` family ID is known, which is a good starting point.
My first instinct is to break down the request into its core components and map them to `nl80211` commands.
1. **"Change the interface type of 'wlan0' to monitor mode (NL80211_IFTYPE_MONITOR)"**: This immediately points me towards the `NL80211_CMD_SET_INTERFACE` command. I need to verify if this command, indeed, supports changing the interface type directly using `NL80211_ATTR_IFTYPE`. I'm recalling that `NL80211_CMD_SET_INTERFACE` typically takes an `IFINDEX` and the desired `IFTYPE`. I need to confirm that `NL80211_IFTYPE_MONITOR` is a valid target for this command.
There's a slight hesitation here: *can* the interface type be changed on the fly? Or does the interface need to be brought down first? This is a critical detail for the implementation. I'm also wondering if this is purely an `nl80211` operation, or if `rtnetlink` (specifically `RTM_NEWLINK` with `IFF_UP`) might be involved in conjunction with `nl80211` for bringing it UP, or if `nl80211` handles the UP state as well. The interaction between `nl80211` and `rtnetlink` for interface state changes is something I need to be precise about.
2. **"Set UP"**: This could be handled by `rtnetlink`'s `RTM_NEWLINK` command with the `IFF_UP` flag, or it might be part of the `NL80211_CMD_SET_INTERFACE` operation or a separate `NL80211_CMD_SET_LINK` or similar. Given the previous point, I'm leaning towards checking if `NL80211_CMD_SET_INTERFACE` can also manage the interface's operational state.
3. **"Set its frequency to 2412 MHz"**: This sounds like a channel configuration. I'd typically associate this with `NL80211_CMD_SET_CHANNEL`. However, I need to consider the context. If I'm changing the interface *type* to monitor mode, the frequency setting might be a prerequisite for that, or a subsequent step. Also, `NL80211_CMD_SET_WIPHY` might be relevant if it's a global setting, but the request is specific to an interface, so `SET_CHANNEL` seems more appropriate. I'll need to find the right attribute for frequency, likely `NL80211_ATTR_WIPHY_FREQ` or similar, and its associated value.
My next step in this thought process is to dive into the kernel headers, specifically `include/uapi/linux/nl80211.h` and potentially `include/uapi/linux/rtnetlink.h`. I need to confirm the exact command IDs, attribute types, and their allowed values. Searching the kernel source code for examples of how `NL80211_CMD_SET_INTERFACE`, `NL80211_CMD_SET_CHANNEL`, and related attributes are used in practice will be crucial for writing correct and functional netlink messages. I'll be looking for patterns in how these commands are constructed, how the `nlattr` structures are populated, and how the socket communication is managed. This will help me avoid common pitfalls and ensure I'm using the most appropriate netlink API calls for the task.
|
| 256/6 |
2026/09/07 07:41 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_INTERFACE PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-371- * single %NL80211_ATTR_IFINDEX is supported.
include/uapi/linux/nl80211.h:372: * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
include/uapi/linux/nl80211.h-373- * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1442- NL80211_CMD_GET_INTERFACE, /* can dump */
include/uapi/linux/nl80211.h:1443: NL80211_CMD_SET_INTERFACE,
include/uapi/linux/nl80211.h-1444- NL80211_CMD_NEW_INTERFACE,
]
|
| 257/6 |
2026/09/07 07:42 |
tool |
grepper |
0m
Args: map[Expression:NL80211_ATTR_WIPHY_FREQ PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-354- * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
include/uapi/linux/nl80211.h:355: * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
include/uapi/linux/nl80211.h:356: * %NL80211_ATTR_WIPHY_FREQ_OFFSET (and the attributes determining the
include/uapi/linux/nl80211.h-357- * channel width; this is used for setting monitor mode channel),
--
include/uapi/linux/nl80211.h-421- * The channel to use can be set on the interface or be given using the
include/uapi/linux/nl80211.h:422: * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_FREQ_OFFSET, and the
include/uapi/linux/nl80211.h-423- * attributes determining channel width.
--
include/uapi/linux/nl80211.h-605- * the SSID (mainly for association, but is included in authentication
include/uapi/linux/nl80211.h:606: * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ +
include/uapi/linux/nl80211.h:607: * %NL80211_ATTR_WIPHY_FREQ_OFFSET is used to specify the frequency of the
include/uapi/linux/nl80211.h-608- * channel in MHz. %NL80211_ATTR_AUTH_TYPE is used to specify the
--
include/uapi/linux/nl80211.h-666- * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE,
include/uapi/linux/nl80211.h:667: * %NL80211_ATTR_USE_MFP, %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ,
include/uapi/linux/nl80211.h:668: * %NL80211_ATTR_WIPHY_FREQ_OFFSET, %NL80211_ATTR_CONTROL_PORT,
include/uapi/linux/nl80211.h-669- * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
--
include/uapi/linux/nl80211.h-671- * %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
include/uapi/linux/nl80211.h:672: * %NL80211_ATTR_WIPHY_FREQ_HINT.
include/uapi/linux/nl80211.h:673: * If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
include/uapi/linux/nl80211.h-674- * restrictions on BSS selection, i.e., they effectively prevent roaming
include/uapi/linux/nl80211.h:675: * within the ESS. %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT
include/uapi/linux/nl80211.h-676- * can be included to provide a recommendation of the initial BSS while
--
include/uapi/linux/nl80211.h-679- * set of BSSID,frequency parameters is used (i.e., either the enforcing
include/uapi/linux/nl80211.h:680: * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
include/uapi/linux/nl80211.h:681: * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
include/uapi/linux/nl80211.h-682- * Driver shall not modify the IEs specified through %NL80211_ATTR_IE if
--
include/uapi/linux/nl80211.h-725- * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
include/uapi/linux/nl80211.h:726: * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
include/uapi/linux/nl80211.h-727- * frequency for the operation.
--
include/uapi/linux/nl80211.h-770- * user space application). %NL80211_ATTR_FRAME is used to specify the
include/uapi/linux/nl80211.h:771: * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ is used
include/uapi/linux/nl80211.h-772- * to indicate on which channel the frame is to be transmitted or was
--
include/uapi/linux/nl80211.h-815- * reached.
include/uapi/linux/nl80211.h:816: * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-817- * and the attributes determining channel width) the given interface
--
include/uapi/linux/nl80211.h-944- * independently of the userspace SME, send this event indicating
include/uapi/linux/nl80211.h:945: * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
include/uapi/linux/nl80211.h-946- * attributes determining channel width. This indication may also be
--
include/uapi/linux/nl80211.h-953- * initiated on our own). It indicates that
include/uapi/linux/nl80211.h:954: * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-955- * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may
--
include/uapi/linux/nl80211.h-1019- * new channel. Userspace provides the new channel information (using
include/uapi/linux/nl80211.h:1020: * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel
include/uapi/linux/nl80211.h-1021- * width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform
--
include/uapi/linux/nl80211.h-1066- * identified by the %NL80211_ATTR_MAC parameter. A target channel is
include/uapi/linux/nl80211.h:1067: * provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
include/uapi/linux/nl80211.h-1068- * channel width/type. The target operating class is given via
--
include/uapi/linux/nl80211.h-1246- * detected and reported by a neighboring device on the channel
include/uapi/linux/nl80211.h:1247: * indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes
include/uapi/linux/nl80211.h-1248- * determining the width and type.
--
include/uapi/linux/nl80211.h-1361- * it to prepare frames to be sent in the next DW.
include/uapi/linux/nl80211.h:1362: * %NL80211_ATTR_WIPHY_FREQ is used to indicate the frequency of the next
include/uapi/linux/nl80211.h-1363- * DW. SDF transmission should be requested with %NL80211_CMD_FRAME and
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1744- * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
include/uapi/linux/nl80211.h:1745: * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz,
include/uapi/linux/nl80211.h-1746- * defines the channel together with the (deprecated)
--
include/uapi/linux/nl80211.h-1757- * channel, used only for 80+80 MHz bandwidth
include/uapi/linux/nl80211.h:1758: * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-1759- * if HT20 or HT40 are to be used (i.e., HT disabled if not included):
--
include/uapi/linux/nl80211.h-2445- * @NL80211_ATTR_MAC_HINT: MAC address recommendation as initial BSS
include/uapi/linux/nl80211.h:2446: * @NL80211_ATTR_WIPHY_FREQ_HINT: frequency of the recommended initial BSS
include/uapi/linux/nl80211.h-2447- *
--
include/uapi/linux/nl80211.h-2829- * %NL80211_CMD_REGISTER_FRAME command, see the description there.
include/uapi/linux/nl80211.h:2830: * @NL80211_ATTR_WIPHY_FREQ_OFFSET: offset of the associated
include/uapi/linux/nl80211.h:2831: * %NL80211_ATTR_WIPHY_FREQ in positive KHz. Only valid when supplied with
include/uapi/linux/nl80211.h:2832: * an %NL80211_ATTR_WIPHY_FREQ_OFFSET.
include/uapi/linux/nl80211.h-2833- * @NL80211_ATTR_CENTER_FREQ1_OFFSET: Center frequency offset in KHz for the
--
include/uapi/linux/nl80211.h-3072- * attributes of this type, each one represents a channel definition and
include/uapi/linux/nl80211.h:3073: * consists of top-level attributes like %NL80211_ATTR_WIPHY_FREQ.
include/uapi/linux/nl80211.h-3074- * When used with %NL80211_CMD_NAN_SET_LOCAL_SCHED, it specifies
--
include/uapi/linux/nl80211.h=3192=enum nl80211_attrs {
--
include/uapi/linux/nl80211.h-3247- NL80211_ATTR_WIPHY_TXQ_PARAMS,
include/uapi/linux/nl80211.h:3248: NL80211_ATTR_WIPHY_FREQ,
include/uapi/linux/nl80211.h-3249- NL80211_ATTR_WIPHY_CHANNEL_TYPE,
--
include/uapi/linux/nl80211.h-3517- NL80211_ATTR_MAC_HINT,
include/uapi/linux/nl80211.h:3518: NL80211_ATTR_WIPHY_FREQ_HINT,
include/uapi/linux/nl80211.h-3519-
--
include/uapi/linux/nl80211.h-3663- NL80211_ATTR_RECEIVE_MULTICAST,
include/uapi/linux/nl80211.h:3664: NL80211_ATTR_WIPHY_FREQ_OFFSET,
include/uapi/linux/nl80211.h-3665- NL80211_ATTR_CENTER_FREQ1_OFFSET,
--
include/uapi/linux/nl80211.h-3811-#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
include/uapi/linux/nl80211.h:3812:#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-3813-#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE
--
include/uapi/linux/nl80211.h=8058=enum nl80211_peer_measurement_ftm_req_type {
--
include/uapi/linux/nl80211.h-8072- * @NL80211_PMSR_PEER_ATTR_CHAN: channel definition, nested, using top-level
include/uapi/linux/nl80211.h:8073: * attributes like %NL80211_ATTR_WIPHY_FREQ etc.
include/uapi/linux/nl80211.h-8074- * @NL80211_PMSR_PEER_ATTR_REQ: This is a nested attribute indexed by
]
|
| 258/6 |
2026/09/07 07:42 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_CHANNEL PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-360- * %NL80211_ATTR_WIPHY_RTS_THRESHOLD. However, for setting the channel,
include/uapi/linux/nl80211.h:361: * see %NL80211_CMD_SET_CHANNEL instead, the support here is for backward
include/uapi/linux/nl80211.h-362- * compatibility only.
--
include/uapi/linux/nl80211.h-815- * reached.
include/uapi/linux/nl80211.h:816: * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-817- * and the attributes determining channel width) the given interface
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1532-
include/uapi/linux/nl80211.h:1533: NL80211_CMD_SET_CHANNEL,
include/uapi/linux/nl80211.h-1534- NL80211_CMD_SET_WDS_PEER,
]
|
| 259/6 |
2026/09/07 07:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 7500
output: 72
thoughts: 54
Thoughts: **My Thought Process**
My primary objective here is to deeply understand how the Linux kernel's wireless subsystem handles two fundamental configuration commands: `NL80211_CMD_SET_CHANNEL` and `NL80211_CMD_SET_INTERFACE`. As an expert in this domain, I know that these commands are the bedrock of controlling a wireless network interface's operational parameters. My immediate instinct is to dive into the source code, specifically within the `net/wireless` directory, as this is where the `nl80211` netlink interface's core logic resides. I'll be looking for the specific handler functions or dispatch mechanisms that process these `nl80211` command IDs. My expectation is that these handlers will translate the netlink messages into internal kernel operations, likely involving interactions with the specific hardware drivers for Wi-Fi devices. I'm particularly interested in the validation steps performed on the received parameters – for instance, ensuring a requested channel is valid for the regulatory domain and the hardware's capabilities. Similarly, for `NL80211_CMD_SET_INTERFACE`, I'll be scrutinizing how the kernel manages interface creation, deletion, and modification, including aspects like setting the interface mode (e.g., AP, STA, monitor). The ultimate goal is to map these high-level netlink commands to the concrete, low-level actions that manipulate the wireless hardware, and to ensure a robust and secure implementation by examining the error handling and security checks in place.
|
| 260/6 |
2026/09/07 07:42 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_CHANNEL PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=2401=static int nl80211_add_commands_unsplit(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-2440- i++;
net/wireless/nl80211.c:2441: if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL))
net/wireless/nl80211.c-2442- goto nla_put_failure;
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-20153- {
net/wireless/nl80211.c:20154: .cmd = NL80211_CMD_SET_CHANNEL,
net/wireless/nl80211.c-20155- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
]
|
| 261/6 |
2026/09/07 07:42 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_INTERFACE PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=4659=static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags,
--
net/wireless/nl80211.c-4670- cmd != NL80211_CMD_DEL_INTERFACE &&
net/wireless/nl80211.c:4671: cmd != NL80211_CMD_SET_INTERFACE);
net/wireless/nl80211.c-4672-
--
net/wireless/nl80211.c=5049=static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-5118- if (change && !err)
net/wireless/nl80211.c:5119: nl80211_notify_iface(rdev, wdev, NL80211_CMD_SET_INTERFACE);
net/wireless/nl80211.c-5120-
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-19748- {
net/wireless/nl80211.c:19749: .cmd = NL80211_CMD_SET_INTERFACE,
net/wireless/nl80211.c-19750- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
]
|
| 262/6 |
2026/09/07 07:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 8364
output: 41
thoughts: 55
Thoughts: **A Deep Dive into `nl80211_set_interface` and `nl80211_set_channel`**
Alright, so my immediate impulse is to get a granular understanding of how the `nl80211_set_interface` and `nl80211_set_channel` functions operate within the `net/wireless/nl80211.c` file. I need to meticulously examine their implementation to determine precisely what attributes are expected by these functions and, more importantly, how they translate those attributes into concrete actions. My goal is to dissect the logic flow, understand the validation steps for the provided attributes, and trace the subsequent system calls or kernel operations they trigger. Essentially, I'm trying to map out the functional contract of these two core nl80211 operations from the perspective of what information they demand and what effect they have on the wireless subsystem.
|
| 263/6 |
2026/09/07 07:42 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:5049 LineCount:80]
Results: map[Contents:5049: static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
5050: {
5051: struct cfg80211_registered_device *rdev = info->user_ptr[0];
5052: struct vif_params params;
5053: int err;
5054: enum nl80211_iftype otype, ntype;
5055: struct net_device *dev = info->user_ptr[1];
5056: struct wireless_dev *wdev = dev->ieee80211_ptr;
5057: u32 radio_mask = 0;
5058: bool change = false;
5059:
5060: memset(¶ms, 0, sizeof(params));
5061:
5062: otype = ntype = dev->ieee80211_ptr->iftype;
5063:
5064: if (info->attrs[NL80211_ATTR_IFTYPE]) {
5065: ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
5066: if (otype != ntype)
5067: change = true;
5068: }
5069:
5070: if (info->attrs[NL80211_ATTR_MESH_ID]) {
5071: if (ntype != NL80211_IFTYPE_MESH_POINT)
5072: return -EINVAL;
5073: if (otype != NL80211_IFTYPE_MESH_POINT)
5074: return -EINVAL;
5075: if (netif_running(dev))
5076: return -EBUSY;
5077:
5078: wdev->u.mesh.id_up_len =
5079: nla_len(info->attrs[NL80211_ATTR_MESH_ID]);
5080: memcpy(wdev->u.mesh.id,
5081: nla_data(info->attrs[NL80211_ATTR_MESH_ID]),
5082: wdev->u.mesh.id_up_len);
5083: }
5084:
5085: if (info->attrs[NL80211_ATTR_4ADDR]) {
5086: params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]);
5087: change = true;
5088: err = nl80211_valid_4addr(rdev, dev, params.use_4addr, ntype);
5089: if (err)
5090: return err;
5091: } else {
5092: params.use_4addr = -1;
5093: }
5094:
5095: err = nl80211_parse_mon_options(rdev, ntype, info, ¶ms);
5096: if (err < 0)
5097: return err;
5098: if (err > 0)
5099: change = true;
5100:
5101: err = nl80211_parse_vif_radio_mask(info, &radio_mask);
5102: if (err < 0)
5103: return err;
5104: if (err && netif_running(dev))
5105: return -EBUSY;
5106:
5107: if (change)
5108: err = cfg80211_change_iface(rdev, dev, ntype, ¶ms);
5109: else
5110: err = 0;
5111:
5112: if (!err && params.use_4addr != -1)
5113: dev->ieee80211_ptr->use_4addr = params.use_4addr;
5114:
5115: if (radio_mask)
5116: wdev->radio_mask = radio_mask;
5117:
5118: if (change && !err)
5119: nl80211_notify_iface(rdev, wdev, NL80211_CMD_SET_INTERFACE);
5120:
5121: return err;
5122: }
5123:
5124: static int _nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
5125: {
5126: struct cfg80211_registered_device *rdev = info->user_ptr[0];
5127: struct vif_params params;
5128: struct wireless_dev *wdev;
]
|
| 264/6 |
2026/09/07 07:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 9805
output: 36
thoughts: 32
Thoughts: **My Thought Process Regarding `nl80211_set_channel`**
Alright, the immediate next step in my debugging or development process is to dive into the implementation of `nl80211_set_channel` within the `net/wireless/nl80211.c` file. This is the logical progression after identifying a potential issue or a need to understand how channel setting is handled at the netlink/nl80211 interface. I'm assuming I've either encountered a problem with channel selection, am investigating how a specific application or driver interacts with the wireless subsystem, or perhaps I'm looking to contribute a new feature that involves channel manipulation. My goal here is to gain a granular understanding of the code's execution flow, the parameters it expects, the validations it performs, and how it ultimately communicates this channel request down to the actual hardware driver. I'll be looking for things like:
* **Input Validation:** What checks are in place to ensure the requested channel is valid for the configured device, band, and regulatory domain? Are there any potential out-of-bounds or malformed input scenarios I need to consider?
* **State Management:** How does this function interact with the device's current state? Does it handle transitions between different operational modes or states before attempting to set the channel?
* **Driver Interaction:** This is a crucial part. How does `nl80211_set_channel` translate the nl80211 request into the specific ioctls or other mechanisms required by the underlying hardware driver? I'll be tracing the calls to the driver's backend to see the concrete actions being taken.
* **Error Handling:** What are the potential error conditions that can arise during channel setting, and how does the kernel report these back to the user-space application via netlink? I need to understand the various error codes and their implications.
* **Concurrency and Locking:** Given the nature of kernel networking code, I'll be mindful of how this function handles concurrency. Are there locks or other synchronization primitives employed to prevent race conditions when multiple requests or events are occurring simultaneously?
* **Regulatory Compliance:** The `nl80211` interface is deeply intertwined with regulatory domain information. I'll be looking to see how this function consults and enforces those rules to ensure legal operation.
Ultimately, by dissecting `nl80211_set_channel`, I aim to build a comprehensive mental model of the channel-setting process from the nl80211 API down to the driver's execution, which is essential for any advanced wireless networking work.
|
| 265/6 |
2026/09/07 07:42 |
tool |
grepper |
0m
Args: map[Expression:static int nl80211_set_channel PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=4105=static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-4208-
net/wireless/nl80211.c:4209:static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info)
net/wireless/nl80211.c-4210-{
]
|
| 266/6 |
2026/09/07 07:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 10005
output: 41
thoughts: 31
Thoughts: **My Thought Process Regarding `nl80211_set_channel`**
Alright, so my immediate instinct is to dive into the source code for `nl80211_set_channel` over in `net/wireless/nl80211.c`. This is where the rubber meets the road, so to speak, for how we communicate channel setting requests to the wireless subsystem. I need to understand the entire flow, from the initial netlink message that triggers this function all the way down to the kernel's internal actions.
My primary goal here is to trace the lifecycle of a channel setting command. What information is being passed in from userspace? How is that information parsed and validated within `nl80211_set_channel`? I'm particularly interested in the validation steps – are there checks for valid channels, bands, or any specific hardware capabilities? This is crucial for understanding potential failure points and security considerations.
Following that, I need to see what internal kernel functions or structures are invoked. Does it directly interact with the hardware driver interface? Is there an intermediate layer of abstraction? My assumption is that it will eventually call down to a driver-specific method, but I need to confirm the exact path. This involves understanding the relationships between the `nl80211` framework, the generic wireless configuration structures, and the specific hardware drivers.
Furthermore, I'll be looking for any error handling mechanisms. What happens if the channel cannot be set? How are these errors communicated back to the calling application? This is vital for robust system design and effective debugging. I'll be paying attention to return codes and any associated error messages.
Finally, I want to get a sense of the broader context. How does `nl80211_set_channel` fit into the overall wireless management ecosystem? Are there other related netlink commands that might interact with or depend on this function? Understanding its place within the larger system will provide a more complete picture of its functionality and implications. Essentially, I'm building a mental model of the entire channel setting process, from the user's perspective to the hardware's execution.
|
| 267/6 |
2026/09/07 07:42 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:4209 LineCount:40]
Results: map[Contents:4209: static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info)
4210: {
4211: struct cfg80211_registered_device *rdev = info->user_ptr[0];
4212: int link_id = nl80211_link_id_or_invalid(info->attrs);
4213: struct net_device *netdev = info->user_ptr[1];
4214:
4215: return __nl80211_set_channel(rdev, netdev, info, link_id);
4216: }
4217:
4218: static int nl80211_set_wiphy_radio(struct genl_info *info,
4219: struct cfg80211_registered_device *rdev,
4220: int radio_idx)
4221: {
4222: u32 rts_threshold = 0, old_rts, changed = 0;
4223: int result;
4224:
4225: if (!rdev->ops->set_wiphy_params)
4226: return -EOPNOTSUPP;
4227:
4228: if (info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]) {
4229: rts_threshold = nla_get_u32(
4230: info->attrs[NL80211_ATTR_WIPHY_RTS_THRESHOLD]);
4231: changed |= WIPHY_PARAM_RTS_THRESHOLD;
4232: }
4233:
4234: old_rts = rdev->wiphy.radio_cfg[radio_idx].rts_threshold;
4235:
4236: rdev->wiphy.radio_cfg[radio_idx].rts_threshold = rts_threshold;
4237:
4238: result = rdev_set_wiphy_params(rdev, radio_idx, changed);
4239: if (result)
4240: rdev->wiphy.radio_cfg[radio_idx].rts_threshold = old_rts;
4241:
4242: return 0;
4243: }
4244:
4245: static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
4246: {
4247: struct cfg80211_registered_device *rdev = NULL;
4248: struct net_device *netdev = NULL;
]
|
| 268/6 |
2026/09/07 07:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 10800
output: 41
thoughts: 32
Thoughts: **My Thought Process on Examining `__nl80211_set_channel`**
Alright, so the immediate next step in my analysis is to dive into the `__nl80211_set_channel` function, specifically within the `net/wireless/nl80211.c` file. My intention here is to meticulously examine the internal workings of this function. I need to understand precisely how it handles the request to set a wireless channel. This means I'll be looking at the arguments it receives, how it validates those arguments, and more importantly, what actions it takes based on the provided channel information. I expect to see interactions with the lower-level drivers or hardware abstraction layers to actually enact the channel change. My goal is to trace the flow of control, identify any potential error handling mechanisms, and understand the precise state transitions that occur when a channel is set via this function. Essentially, I'm peeling back the layers to get to the core implementation details.
|
| 269/6 |
2026/09/07 07:42 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:4105 LineCount:60]
Results: map[Contents:4105: static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
4106: struct net_device *dev,
4107: struct genl_info *info,
4108: int _link_id)
4109: {
4110: struct cfg80211_chan_def chandef;
4111: int result;
4112: enum nl80211_iftype iftype = NL80211_IFTYPE_MONITOR;
4113: struct wireless_dev *wdev = NULL;
4114: int link_id = _link_id;
4115: bool permit_npca;
4116:
4117: if (dev)
4118: wdev = dev->ieee80211_ptr;
4119: if (!nl80211_can_set_dev_channel(wdev))
4120: return -EOPNOTSUPP;
4121: if (wdev)
4122: iftype = wdev->iftype;
4123:
4124: if (link_id < 0) {
4125: if (wdev && wdev->valid_links)
4126: return -EINVAL;
4127: link_id = 0;
4128: }
4129:
4130: /* allow parsing it - will check on start_ap or below */
4131: permit_npca = iftype == NL80211_IFTYPE_AP ||
4132: iftype == NL80211_IFTYPE_P2P_GO;
4133:
4134: result = _nl80211_parse_chandef(rdev, info->extack, info->attrs,
4135: iftype == NL80211_IFTYPE_MONITOR,
4136: &chandef, permit_npca);
4137: if (result)
4138: return result;
4139:
4140: switch (iftype) {
4141: case NL80211_IFTYPE_AP:
4142: case NL80211_IFTYPE_P2P_GO:
4143: if (!cfg80211_reg_can_beacon_relax(&rdev->wiphy, &chandef,
4144: iftype))
4145: return -EINVAL;
4146: if (wdev->links[link_id].ap.beacon_interval) {
4147: struct ieee80211_channel *cur_chan;
4148:
4149: if (!dev || !rdev->ops->set_ap_chanwidth ||
4150: !(rdev->wiphy.features &
4151: NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE))
4152: return -EBUSY;
4153:
4154: /* Only allow dynamic channel width changes */
4155: cur_chan = wdev->links[link_id].ap.chandef.npca_chan;
4156: if (chandef.npca_chan != cur_chan)
4157: return -EBUSY;
4158: cur_chan = wdev->links[link_id].ap.chandef.chan;
4159: if (chandef.chan != cur_chan)
4160: return -EBUSY;
4161:
4162: /* only allow this for regular channel widths */
4163: switch (wdev->links[link_id].ap.chandef.width) {
4164: case NL80211_CHAN_WIDTH_20_NOHT:
]
|
| 270/6 |
2026/09/07 07:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 11911
output: 36
thoughts: 21
Thoughts: **My Exploration of `_nl80211_parse_chandef`**
My immediate objective is to delve into the workings of the `_nl80211_parse_chandef` function. I'm keen to understand its internal logic and how it handles the parsing of channel definitions within the nl80211 framework. My expectation is that this function plays a crucial role in translating raw channel information, likely received through netlink messages, into a structured and usable format for the kernel's wireless subsystem. I anticipate it will involve processing various channel parameters, such as frequency, channel width, and potentially other flags or attributes, to construct a comprehensive `struct nl80211_chandef` object. My thought process will be to meticulously trace its execution path, examining the conditions and data transformations it performs, to gain a deep appreciation for its functionality and any potential edge cases it might address.
|
| 271/6 |
2026/09/07 07:42 |
tool |
grepper |
0m
Args: map[Expression:_nl80211_parse_chandef PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=3902=static bool nl80211_can_set_dev_channel(struct wireless_dev *wdev)
--
net/wireless/nl80211.c-3925-
net/wireless/nl80211.c:3926:static int _nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
net/wireless/nl80211.c-3927- struct netlink_ext_ack *extack,
--
net/wireless/nl80211.c=4095=int nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-4100-{
net/wireless/nl80211.c:4101: return _nl80211_parse_chandef(rdev, extack, attrs, false, chandef,
net/wireless/nl80211.c-4102- permit_npca);
--
net/wireless/nl80211.c=4105=static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-4133-
net/wireless/nl80211.c:4134: result = _nl80211_parse_chandef(rdev, info->extack, info->attrs,
net/wireless/nl80211.c-4135- iftype == NL80211_IFTYPE_MONITOR,
]
|
| 272/6 |
2026/09/07 07:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 12407
output: 41
thoughts: 33
Thoughts: **My Deep Dive into `_nl80211_parse_chandef`**
Alright, so the immediate impulse is to dive into `_nl80211_parse_chandef` within the `net/wireless/nl80211.c` file. This function, as I understand it, is a critical component for parsing channel definitions coming from user-space applications via the nl80211 netlink interface. My primary goal here is to get a really granular understanding of *how* it takes the raw netlink attributes, which are essentially opaque blobs of data to the kernel's core logic, and transforms them into a structured `struct ieee80211_channel_def` that the rest of the wireless subsystem can actually work with.
I'm looking to map out the entire flow. This means tracing the parsing of each relevant attribute, like the channel center frequency, bandwidth, and any other control information that might be present. I need to be particularly mindful of the error handling – what happens when an attribute is missing, malformed, or out of expected ranges? How does the function signal these issues back up the call stack? Understanding the validation steps is key; what checks are in place to ensure the requested channel configuration is even feasible for the hardware or the current operating context?
Furthermore, I'm keenly interested in the interplay between different attributes. For instance, how does setting a specific bandwidth affect the interpretation of the center frequency, especially in scenarios involving channel bonding or specific regulatory domains? I expect there will be some subtle dependencies and potential ambiguities that `_nl80211_parse_chandef` needs to resolve. The ultimate objective is to fully comprehend the contract this function establishes between user-space and the kernel's wireless drivers, ensuring that the channel definition is robust, unambiguous, and correctly represents the user's intent. I'm not just looking for what it does, but *why* it does it this way, considering the broader design principles of nl80211 and the Linux wireless stack.
|
| 273/6 |
2026/09/07 07:43 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:3926 LineCount:60]
Results: map[Contents:3926: static int _nl80211_parse_chandef(struct cfg80211_registered_device *rdev,
3927: struct netlink_ext_ack *extack,
3928: struct nlattr **attrs, bool monitor,
3929: struct cfg80211_chan_def *chandef,
3930: bool permit_npca)
3931: {
3932: u32 control_freq;
3933:
3934: if (!attrs[NL80211_ATTR_WIPHY_FREQ]) {
3935: NL_SET_ERR_MSG_ATTR(extack, attrs[NL80211_ATTR_WIPHY_FREQ],
3936: "Frequency is missing");
3937: return -EINVAL;
3938: }
3939:
3940: control_freq = MHZ_TO_KHZ(
3941: nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ]));
3942: if (attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET])
3943: control_freq +=
3944: nla_get_u32(attrs[NL80211_ATTR_WIPHY_FREQ_OFFSET]);
3945:
3946: memset(chandef, 0, sizeof(*chandef));
3947: chandef->chan = ieee80211_get_channel_khz(&rdev->wiphy, control_freq);
3948: chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
3949: chandef->center_freq1 = KHZ_TO_MHZ(control_freq);
3950: chandef->freq1_offset = control_freq % 1000;
3951: chandef->center_freq2 = 0;
3952: chandef->s1g_primary_2mhz = false;
3953:
3954: if (!chandef->chan) {
3955: NL_SET_ERR_MSG_ATTR(extack, attrs[NL80211_ATTR_WIPHY_FREQ],
3956: "Unknown channel");
3957: return -EINVAL;
3958: }
3959:
3960: if (cfg80211_chandef_is_s1g(chandef))
3961: chandef->width = NL80211_CHAN_WIDTH_1;
3962:
3963: if (attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
3964: enum nl80211_channel_type chantype;
3965:
3966: chantype = nla_get_u32(attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]);
3967:
3968: switch (chantype) {
3969: case NL80211_CHAN_NO_HT:
3970: case NL80211_CHAN_HT20:
3971: case NL80211_CHAN_HT40PLUS:
3972: case NL80211_CHAN_HT40MINUS:
3973: if (chandef->chan->band == NL80211_BAND_60GHZ ||
3974: chandef->chan->band == NL80211_BAND_S1GHZ)
3975: return -EINVAL;
3976: cfg80211_chandef_create(chandef, chandef->chan,
3977: chantype);
3978: /* user input for center_freq is incorrect */
3979: if (attrs[NL80211_ATTR_CENTER_FREQ1] &&
3980: chandef->center_freq1 != nla_get_u32(attrs[NL80211_ATTR_CENTER_FREQ1])) {
3981: NL_SET_ERR_MSG_ATTR(extack,
3982: attrs[NL80211_ATTR_CENTER_FREQ1],
3983: "bad center frequency 1");
3984: return -EINVAL;
3985: }
]
|
| 274/6 |
2026/09/07 07:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 13665
output: 41
thoughts: 139
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_CHANNEL`**
Right, so I'm looking at `NL80211_CMD_SET_CHANNEL`, and my initial understanding is that this command is relatively straightforward. It seems to only require a couple of key attributes to function: `NL80211_ATTR_IFINDEX` (or its equivalent, `WIPHY`) and, crucially, `NL80211_ATTR_WIPHY_FREQ`. This latter attribute is where I'd specify the actual desired channel, for instance, 2412 MHz for channel 1 in the 2.4 GHz band.
However, as with any low-level wireless operation, I need to be absolutely certain about the operational context. My next immediate thought is to verify the state requirements for the wireless interface when this command is invoked. Specifically, I need to determine if the interface must be in a particular state – is it okay to set the channel when the interface is `UP`, or does it need to be `DOWN`? And equally important, what about its state regarding monitor mode? Can I set the channel while monitor mode is active, or must it be disabled first?
To get a definitive answer, I know I'll need to dive into the source code. The most logical place to check for the actual implementation of this netlink command is within the `net/wireless/nl80211.c` file. I'll be looking for the `__nl80211_set_channel` function, as that's where the kernel logic for handling this command will reside. By examining this function, I can trace the expected state of the interface and confirm the necessary conditions for a successful channel change.
|
| 275/6 |
2026/09/07 07:43 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:4165 LineCount:45]
Results: map[Contents:4165: case NL80211_CHAN_WIDTH_20:
4166: case NL80211_CHAN_WIDTH_40:
4167: case NL80211_CHAN_WIDTH_80:
4168: case NL80211_CHAN_WIDTH_80P80:
4169: case NL80211_CHAN_WIDTH_160:
4170: case NL80211_CHAN_WIDTH_320:
4171: break;
4172: default:
4173: return -EINVAL;
4174: }
4175:
4176: switch (chandef.width) {
4177: case NL80211_CHAN_WIDTH_20_NOHT:
4178: case NL80211_CHAN_WIDTH_20:
4179: case NL80211_CHAN_WIDTH_40:
4180: case NL80211_CHAN_WIDTH_80:
4181: case NL80211_CHAN_WIDTH_80P80:
4182: case NL80211_CHAN_WIDTH_160:
4183: case NL80211_CHAN_WIDTH_320:
4184: break;
4185: default:
4186: return -EINVAL;
4187: }
4188:
4189: result = rdev_set_ap_chanwidth(rdev, dev, link_id,
4190: &chandef);
4191: if (result)
4192: return result;
4193: wdev->links[link_id].ap.chandef = chandef;
4194: } else {
4195: wdev->u.ap.preset_chandef = chandef;
4196: }
4197: return 0;
4198: case NL80211_IFTYPE_MESH_POINT:
4199: return cfg80211_set_mesh_channel(rdev, wdev, &chandef);
4200: case NL80211_IFTYPE_MONITOR:
4201: return cfg80211_set_monitor_channel(rdev, dev, &chandef);
4202: default:
4203: break;
4204: }
4205:
4206: return -EINVAL;
4207: }
4208:
4209: static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info)
]
|
| 276/6 |
2026/09/07 07:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 14582
output: 36
thoughts: 19
Thoughts: **My Thought Process on `cfg80211_set_monitor_channel`**
Ah, so the focus is on `cfg80211_set_monitor_channel`. My immediate instinct, as an expert in this domain, is to delve into its implementation and understand its role within the broader `cfg80211` framework. This function, by its very name, suggests it's directly responsible for configuring the radio interface to operate in monitor mode on a specific channel.
My internal monologue would then likely branch into several key areas of inquiry:
* **Core Functionality:** What *exactly* does `cfg80211_set_monitor_channel` do? At its heart, I expect it to translate a request to set a monitor channel into the necessary hardware-level operations. This would involve interacting with the wireless device driver, which in turn communicates with the network interface card (NIC) hardware. I'm thinking about the low-level commands that need to be sent to the firmware – things like setting the frequency, bandwidth, and potentially other parameters relevant to monitor mode (like channel width, guard intervals, etc.).
* **Parameters and Return Values:** I'd be mentally scrutinizing the function's signature. What are the input parameters? What data structures are involved? I'd expect arguments like the network device (`net_device`), the desired channel information (frequency, bandwidth, channel type), and perhaps some flags or options. Equally important are the return values: what are the possible success codes, and more critically, what are the error conditions? Are we talking about invalid channel parameters, driver issues, hardware limitations, or perhaps permission problems?
* **Context and Callers:** Where is this function called from? This tells me about the higher-level logic that triggers a channel switch for monitor mode. Is it initiated by user-space tools (like `iw` or `wpa_supplicant`) through the `nl80211` netlink interface? Or is it invoked internally by other kernel components? Understanding its callers helps me map its purpose within the overall wireless stack.
* **State Management:** How does this function manage the state of the wireless interface? Setting a monitor channel implies a transition from a potentially active data transmission/reception mode. Does it handle stopping existing operations gracefully? Does it ensure the interface is correctly configured *before* returning success? I'm also considering if there are any associated data structures within `cfg80211` or the driver that need to be updated to reflect the new monitor channel configuration.
* **Error Handling and Robustness:** This is paramount. What happens if the hardware isn't capable of operating on the requested channel or in the specified mode? How does `cfg80211_set_monitor_channel` handle these failures? Does it propagate the error up the call chain effectively, providing meaningful diagnostics? I'm thinking about scenarios like invalid regulatory domain settings or hardware limitations that might prevent the operation.
* **Driver Interaction:** My expertise leads me to believe that `cfg80211_set_monitor_channel` itself likely doesn't perform the direct hardware manipulation. Instead, it acts as a standardized interface to the underlying wireless driver. So, my thought process would quickly pivot to the driver's implementation of the corresponding callback (likely a `set_monitor_channel` callback within `struct nl80211_ops`). I'd be thinking about the driver's responsibility in translating the generic `cfg80211` request into hardware-specific instructions.
* **Potential Issues and Edge Cases:** As with any kernel function, I'd be probing for potential pitfalls. Are there race conditions to consider if multiple threads or processes try to change the monitor channel simultaneously? What about interactions with other `cfg80211` operations like scanning or power management? I'd also be considering the impact of different wireless standards (802.11a/b/g/n/ac/ax) and how they might affect channel configuration.
In essence, when I see `cfg80211_set_monitor_channel`, I'm not just seeing a function name; I'm seeing a critical nexus point in the wireless stack, and my mind immediately begins to deconstruct its responsibilities, its interactions, and its potential failure modes, all within the context of expert knowledge of the Linux wireless subsystem.
|
| 277/6 |
2026/09/07 07:43 |
tool |
grepper |
0m
Args: map[Expression:cfg80211_set_monitor_channel PathPrefix:net/wireless/]
Results: map[Output:net/wireless/chan.c=1812=EXPORT_SYMBOL(cfg80211_reg_check_beaconing);
net/wireless/chan.c-1813-
net/wireless/chan.c:1814:int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
net/wireless/chan.c-1815- struct net_device *dev,
--
net/wireless/core.h=525=static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
--
net/wireless/core.h-534-
net/wireless/core.h:535:int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
net/wireless/core.h-536- struct net_device *dev,
--
net/wireless/nl80211.c=4105=static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-4200- case NL80211_IFTYPE_MONITOR:
net/wireless/nl80211.c:4201: return cfg80211_set_monitor_channel(rdev, dev, &chandef);
net/wireless/nl80211.c-4202- default:
--
net/wireless/wext-compat.c=763=static int cfg80211_wext_siwfreq(struct net_device *dev,
--
net/wireless/wext-compat.c-794- return -EINVAL;
net/wireless/wext-compat.c:795: return cfg80211_set_monitor_channel(rdev, dev, &chandef);
net/wireless/wext-compat.c-796- case NL80211_IFTYPE_MESH_POINT:
]
|
| 278/6 |
2026/09/07 07:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 15142
output: 36
thoughts: 30
Thoughts: **My Thought Process on `cfg80211_set_monitor_channel`**
Alright, so the first thing that pops into my head when I see `cfg80211_set_monitor_channel` is that it's clearly going to be about configuring the channel for a monitor mode interface. Given that it's in `net/wireless/chan.c`, the context is definitely the Linux wireless subsystem, and specifically, the channel management aspect of it.
My immediate mental model is that this function is the user-space driver's way of telling the kernel's wireless stack, "Hey, I want this specific monitor interface to listen on this particular channel, perhaps with a specific frequency or band." It's the bridge between what an application or a tool like `iw` or `aircrack-ng` wants to do and how the kernel's `cfg80211` framework translates that into actual hardware operations.
I'm anticipating that this function will likely involve several key steps. First, there's bound to be some validation. The kernel needs to ensure that the requested channel is valid for the hardware in question, that it's within the supported frequency ranges, and that the interface is actually capable of operating in monitor mode. It wouldn't surprise me if there's a check to see if the interface is already up and running, or if it needs to be put into a specific operational state.
Then, there's the actual setting of the channel. This will almost certainly involve an interaction with the lower-level driver. `cfg80211` acts as an abstraction layer, and it needs to hand off the command to the specific hardware driver. So, I expect to see calls to driver-specific functions or structures that ultimately configure the radio hardware. This might involve setting registers, updating firmware parameters, or triggering hardware events.
I'm also thinking about error handling. What happens if the channel is invalid? What if the hardware can't tune to that frequency? The function needs to return appropriate error codes so that the caller knows what went wrong. This is crucial for debugging and for applications to gracefully handle unsupported configurations.
Furthermore, I'm considering the implications for existing operations. If the interface was already on a channel, does this function seamlessly switch it, or does it require a teardown and re-setup? Is there any state preservation involved? For a monitor interface, this might be less critical than for a connected station, but it's still a point to consider for efficiency.
Finally, I'm expecting to see some interaction with the `nl80211` netlink subsystem. `cfg80211` uses netlink for communication between the kernel and user space. So, `cfg80211_set_monitor_channel` is likely part of a larger netlink request-response cycle, where a user-space application sends a command and the kernel processes it, potentially sending a response back.
In essence, my initial thought is that `cfg80211_set_monitor_channel` is the kernel's central handler for user-space requests to put a monitor interface on a specific radio channel, orchestrating validation, hardware interaction, and error reporting within the `cfg80211` framework.
|
| 279/6 |
2026/09/07 07:43 |
tool |
read-file |
0m
Args: map[File:net/wireless/chan.c FirstLine:1814 LineCount:40]
Results: map[Contents:1814: int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
1815: struct net_device *dev,
1816: struct cfg80211_chan_def *chandef)
1817: {
1818: if (!rdev->ops->set_monitor_channel)
1819: return -EOPNOTSUPP;
1820: if (!cfg80211_has_monitors_only(rdev))
1821: return -EBUSY;
1822:
1823: return rdev_set_monitor_channel(rdev, dev, chandef);
1824: }
1825:
1826: bool cfg80211_any_usable_channels(struct wiphy *wiphy,
1827: unsigned long sband_mask,
1828: u32 prohibited_flags)
1829: {
1830: int idx;
1831:
1832: prohibited_flags |= IEEE80211_CHAN_DISABLED;
1833:
1834: for_each_set_bit(idx, &sband_mask, NUM_NL80211_BANDS) {
1835: struct ieee80211_supported_band *sband = wiphy->bands[idx];
1836: int chanidx;
1837:
1838: if (!sband)
1839: continue;
1840:
1841: for (chanidx = 0; chanidx < sband->n_channels; chanidx++) {
1842: struct ieee80211_channel *chan;
1843:
1844: chan = &sband->channels[chanidx];
1845:
1846: if (chan->flags & prohibited_flags)
1847: continue;
1848:
1849: return true;
1850: }
1851: }
1852:
1853: return false;
]
|
| 280/6 |
2026/09/07 07:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 15788
output: 35
thoughts: 56
Thoughts: **My Thought Process Regarding `cfg80211_change_iface`**
Alright, my immediate thought, as I'm diving into `net/wireless/core.c` and specifically looking at the `cfg80211_change_iface` function, is to determine its operational prerequisites. The crucial question I'm posing to myself is: does this function necessitate that the wireless interface it's operating on be in a down state before it can be called? To answer this, my next logical step is to meticulously examine the implementation details of `cfg80211_change_iface` itself. I need to trace its execution path, scrutinize its internal logic, and look for any explicit checks or dependencies that might enforce this "interface down" requirement. This detailed inspection will be key to understanding its behavior and ensuring its correct usage within the broader networking stack.
|
| 281/6 |
2026/09/07 07:43 |
tool |
grepper |
0m
Args: map[Expression:cfg80211_change_iface PathPrefix:net/wireless/]
Results: map[Output:net/wireless/core.h=466=void cfg80211_upload_connect_keys(struct wireless_dev *wdev);
net/wireless/core.h:467:int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
net/wireless/core.h-468- struct net_device *dev, enum nl80211_iftype ntype,
--
net/wireless/nl80211.c=5049=static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-5107- if (change)
net/wireless/nl80211.c:5108: err = cfg80211_change_iface(rdev, dev, ntype, ¶ms);
net/wireless/nl80211.c-5109- else
--
net/wireless/util.c=1248=void cfg80211_process_rdev_events(struct cfg80211_registered_device *rdev)
--
net/wireless/util.c-1257-
net/wireless/util.c:1258:int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
net/wireless/util.c-1259- struct net_device *dev, enum nl80211_iftype ntype,
--
net/wireless/wext-compat.c=35=int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
--
net/wireless/wext-compat.c-66-
net/wireless/wext-compat.c:67: return cfg80211_change_iface(rdev, dev, type, &vifparams);
net/wireless/wext-compat.c-68-}
]
|
| 282/6 |
2026/09/07 07:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 16389
output: 36
thoughts: 27
Thoughts: **My Journey Through `cfg80211_change_iface`**
Alright, so my first step is to dive into `net/wireless/util.c` and really understand what `cfg80211_change_iface` is all about. I need to get a solid grip on its purpose and the mechanics behind it. What exactly does it *do*? What are the parameters it takes, and what kind of state changes is it designed to manage within the `cfg80211` subsystem? I'm expecting it to be a central point for modifying the operational characteristics of wireless interfaces.
As I parse the code, I'll be looking for the core logic. Is it handling configuration updates? Is it about switching between different operational modes, like AP, station, or monitor? I'll pay close attention to the conditions under which it's called and the different flags or options it can accept. Understanding the various interface types and their specific attributes that can be altered by this function will be crucial. I'm also keenly interested in how it interacts with other parts of the wireless stack – what dependencies does it have, and what other functions does it likely trigger?
My mental model will start forming as I trace the control flow. I'll be asking myself: what happens if a specific configuration change is invalid? Does it return an error code? What are the expected return values, and what do they signify? I need to anticipate potential edge cases and error handling paths. This function, being in a `util.c` file, suggests it might be a helper or a wrapper, so I'll be curious about the underlying, more granular functions it calls and how it abstracts them. I'll be looking for any locking mechanisms or concurrency considerations, as modifying interface state is likely a sensitive operation. Ultimately, I want to build a comprehensive understanding of the lifecycle of an interface configuration change, as managed by this specific function, and how it contributes to the overall robustness and flexibility of the wireless networking stack.
|
| 283/6 |
2026/09/07 07:43 |
tool |
read-file |
0m
Args: map[File:net/wireless/util.c FirstLine:1258 LineCount:40]
Results: map[Contents:1258: int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
1259: struct net_device *dev, enum nl80211_iftype ntype,
1260: struct vif_params *params)
1261: {
1262: int err;
1263: enum nl80211_iftype otype = dev->ieee80211_ptr->iftype;
1264:
1265: lockdep_assert_held(&rdev->wiphy.mtx);
1266:
1267: /* don't support changing VLANs, you just re-create them */
1268: if (otype == NL80211_IFTYPE_AP_VLAN)
1269: return -EOPNOTSUPP;
1270:
1271: /*
1272: * for NAN interfaces cfg80211_leave must be called for leaving,
1273: * but locking here doesn't allow this.
1274: */
1275: if (otype == NL80211_IFTYPE_NAN)
1276: return -EOPNOTSUPP;
1277:
1278: /* cannot change into P2P device or NAN */
1279: if (ntype == NL80211_IFTYPE_P2P_DEVICE ||
1280: ntype == NL80211_IFTYPE_NAN ||
1281: ntype == NL80211_IFTYPE_PD)
1282: return -EOPNOTSUPP;
1283:
1284: if (!rdev->ops->change_virtual_intf ||
1285: !(rdev->wiphy.interface_modes & (1 << ntype)))
1286: return -EOPNOTSUPP;
1287:
1288: if (ntype != otype) {
1289: /* if it's part of a bridge, reject changing type to station/ibss */
1290: if (netif_is_bridge_port(dev) &&
1291: (ntype == NL80211_IFTYPE_ADHOC ||
1292: ntype == NL80211_IFTYPE_STATION ||
1293: ntype == NL80211_IFTYPE_P2P_CLIENT))
1294: return -EBUSY;
1295:
1296: dev->ieee80211_ptr->use_4addr = false;
1297: rdev_set_qos_map(rdev, dev, NULL);
]
|
| 284/6 |
2026/09/07 07:44 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 17181
output: 36
thoughts: 21
Thoughts: **My Thought Process as I Analyze `cfg80211_change_iface`**
Okay, my primary focus right now is to meticulously observe the execution flow within the `cfg80211_change_iface` function. I need to understand precisely what actions are being taken and in what sequence as the system transitions an interface's configuration. I'm anticipating that this function will be a critical juncture for managing the operational state of wireless network devices, and therefore, I'm paying close attention to any state changes, parameter updates, or interactions with other kernel subsystems. My goal is to fully grasp the implications of these changes on the overall wireless networking stack.
|
| 285/6 |
2026/09/07 07:44 |
tool |
read-file |
0m
Args: map[File:net/wireless/util.c FirstLine:1298 LineCount:40]
Results: map[Contents:1298:
1299: cfg80211_leave_locked(rdev, dev->ieee80211_ptr, -1);
1300:
1301: cfg80211_process_rdev_events(rdev);
1302: cfg80211_mlme_purge_registrations(dev->ieee80211_ptr);
1303:
1304: memset(&dev->ieee80211_ptr->u, 0,
1305: sizeof(dev->ieee80211_ptr->u));
1306: memset(&dev->ieee80211_ptr->links, 0,
1307: sizeof(dev->ieee80211_ptr->links));
1308: }
1309:
1310: err = rdev_change_virtual_intf(rdev, dev, ntype, params);
1311:
1312: WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype);
1313:
1314: if (!err && params && params->use_4addr != -1)
1315: dev->ieee80211_ptr->use_4addr = params->use_4addr;
1316:
1317: if (!err) {
1318: dev->priv_flags &= ~IFF_DONT_BRIDGE;
1319: switch (ntype) {
1320: case NL80211_IFTYPE_STATION:
1321: if (dev->ieee80211_ptr->use_4addr)
1322: break;
1323: fallthrough;
1324: case NL80211_IFTYPE_OCB:
1325: case NL80211_IFTYPE_P2P_CLIENT:
1326: case NL80211_IFTYPE_ADHOC:
1327: case NL80211_IFTYPE_NAN_DATA:
1328: dev->priv_flags |= IFF_DONT_BRIDGE;
1329: break;
1330: case NL80211_IFTYPE_P2P_GO:
1331: case NL80211_IFTYPE_AP:
1332: case NL80211_IFTYPE_AP_VLAN:
1333: case NL80211_IFTYPE_MESH_POINT:
1334: /* bridging OK */
1335: break;
1336: case NL80211_IFTYPE_MONITOR:
1337: /* monitor can't bridge anyway */
]
|
| 286/6 |
2026/09/07 07:44 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 17973
output: 34
thoughts: 258
Thoughts: **My Thought Process on Interface Manipulation via Netlink**
Right, so the core of this is about programmatically controlling network interfaces, specifically setting one up, changing its type to monitor mode, and configuring its frequency. The prompt specifically calls for a minimal C function using *raw netlink sockets*, which immediately brings two primary kernel interfaces to mind: `rtnetlink` and `nl80211`.
My initial thought is to identify the netlink commands that would achieve these goals. For bringing an interface "UP," I know that `rtnetlink` is a common avenue, utilizing messages like `RTM_NEWLINK` or `RTM_SETLINK`. These typically involve the `struct ifinfomsg` structure, where flags like `IFF_UP` are set and indicated for modification via `ifi_change`. I also recall that the older `ioctl` interface, specifically `SIOCSIFFLAGS`, can achieve a similar outcome for setting interface flags like "UP."
However, the prompt is quite specific: "raw netlink sockets." This means I need to focus on the netlink protocol directly. The question then arises: can *both* `nl80211` and `rtnetlink` be invoked through raw netlink sockets? My understanding is that `rtnetlink` is indeed one of the families you can communicate with directly via a raw netlink socket, typically using the `NETLINK_ROUTE` socket type.
The prompt also mentions `nl80211` for changing the interface type to monitor mode and setting the frequency. This suggests that `nl80211` might be the *preferred* or *necessary* mechanism for these specific operations, even if `rtnetlink` handles the basic "UP" state. It's crucial to clarify if `nl80211` operations can *also* be sent over a raw netlink socket. My hypothesis is yes, that I would use a `NETLINK_GENERIC` socket and specify the `nl80211` family ID (which the prompt states we can assume is known).
So, the critical question I'm grappling with is the interplay between these two protocols for the task at hand. Can I combine an `rtnetlink` message for `IFF_UP` with `nl80211` messages for type and frequency, all within the same raw netlink socket interaction? Or is it a matter of using separate netlink sockets or message types?
To solidify this, I’d delve into the kernel source code. Specifically, I'd look at how `rtnetlink` handles `RTM_SETLINK` or `RTM_NEWLINK` when it comes to the `IFF_UP` flag. I'd be searching for code paths that process these messages and examine how they interact with the network device layer. This would help me understand if setting the interface UP is a distinct operation or if it's somehow integrated into or implicitly handled by `nl80211` commands that also modify the interface state. The goal is to determine the most direct and correct netlink message sequence to achieve all three requirements: UP, monitor mode, and frequency.
|
| 287/6 |
2026/09/07 07:44 |
tool |
grepper |
0m
Args: map[Expression:RTM_SETLINK PathPrefix:net/core/rtnetlink.c]
Results: map[Output:net/core/rtnetlink.c=7234=static const struct rtnl_msg_handler rtnetlink_rtnl_msg_handlers[] __initconst = {
--
net/core/rtnetlink.c-7243- RTNL_FLAG_DUMP_UNLOCKED},
net/core/rtnetlink.c:7244: {.msgtype = RTM_SETLINK, .doit = rtnl_setlink,
net/core/rtnetlink.c-7245- .flags = RTNL_FLAG_DOIT_PERNET_WIP},
--
net/core/rtnetlink.c-7257- .doit = rtnl_bridge_dellink},
net/core/rtnetlink.c:7258: {.protocol = PF_BRIDGE, .msgtype = RTM_SETLINK,
net/core/rtnetlink.c-7259- .doit = rtnl_bridge_setlink},
]
|
| 288/6 |
2026/09/07 07:44 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 18499
output: 38
thoughts: 23
Thoughts: **My Thought Process on Exploring `rtnl_setlink`**
Ah, `rtnl_setlink` in `net/core/rtnetlink.c`. That's where I'd start digging. My immediate instinct is to understand how the kernel handles requests to modify network interface configurations. This function, by its name, strongly suggests it's the core handler for setting link-layer properties, like the state of an interface (up/down), its MTU, MAC address, or perhaps even more complex attributes.
I'd be looking for a few key things as I dive into the code:
First, **the parsing of attributes**. `rtnl_setlink` will undoubtedly receive a netlink message containing a series of attributes. I need to meticulously trace how these attributes are parsed. What format are they expected in? How does the code validate them? Are there specific attribute types for different operations (e.g., `IFLA_MTU`, `IFLA_OPERSTATE`)? Understanding this parsing logic is fundamental to knowing what operations are supported and how they are communicated.
Second, **the validation and permission checks**. Before any modification, the kernel needs to ensure the requested operation is valid and that the calling process has the necessary privileges. I'd be keen to see how `rtnl_setlink` enforces these checks. Is it using standard security hooks? Does it rely on UID/GID checks? How does it handle potentially dangerous operations that could disrupt network connectivity? This is crucial for understanding the security posture of the network stack.
Third, **the interaction with the device driver layer**. Ultimately, changes to an interface's configuration need to be propagated down to the actual hardware. I'd want to see how `rtnl_setlink` translates the netlink requests into calls that the specific network device driver can understand. Does it use a generic interface? Are there specific `ndo_set_...` operations that it invokes on the driver's `net_device` structure? This is where the abstract request meets the concrete hardware.
Fourth, **error handling and reporting**. What happens when an operation fails? How are errors propagated back to the user-space application that made the request? I'd be looking for how return codes are set and how netlink error messages are constructed. This is vital for debugging and for building robust network management tools.
Finally, **the scope of its functionality**. While the name suggests "setting link" properties, I'd be curious to see if it handles *all* link-related settings or if some specialized operations are delegated to other functions. For instance, does it handle setting up VLANs or bonding directly, or are those handled by higher-level netlink protocols that might *call* `rtnl_setlink` for specific sub-operations?
In essence, my goal is to build a comprehensive mental model of how `rtnl_setlink` acts as the central nexus for managing network interface state, bridging the user-space request with the kernel's internal representation and ultimately the hardware.
|
| 289/6 |
2026/09/07 07:44 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:3170 LineCount:40]
Results: map[Contents:3170: if (err)
3171: return err;
3172:
3173: status |= DO_SETLINK_MODIFIED;
3174: }
3175:
3176: netdev_lock_ops(dev);
3177:
3178: if (tb[IFLA_MAP]) {
3179: struct rtnl_link_ifmap *u_map;
3180: struct ifmap k_map;
3181:
3182: if (!ops->ndo_set_config) {
3183: err = -EOPNOTSUPP;
3184: goto errout;
3185: }
3186:
3187: if (!netif_device_present(dev)) {
3188: err = -ENODEV;
3189: goto errout;
3190: }
3191:
3192: u_map = nla_data(tb[IFLA_MAP]);
3193: k_map.mem_start = (unsigned long) u_map->mem_start;
3194: k_map.mem_end = (unsigned long) u_map->mem_end;
3195: k_map.base_addr = (unsigned short) u_map->base_addr;
3196: k_map.irq = (unsigned char) u_map->irq;
3197: k_map.dma = (unsigned char) u_map->dma;
3198: k_map.port = (unsigned char) u_map->port;
3199:
3200: err = ops->ndo_set_config(dev, &k_map);
3201: if (err < 0)
3202: goto errout;
3203:
3204: status |= DO_SETLINK_NOTIFY;
3205: }
3206:
3207: if (tb[IFLA_ADDRESS]) {
3208: struct sockaddr_storage ss = { };
3209:
]
|
| 290/6 |
2026/09/07 07:44 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 19128
output: 32
thoughts: 39
Thoughts: **My Thought Process Regarding `struct ifinfomsg` and Flag Changes**
Alright, so my initial focus here is to thoroughly understand the `struct ifinfomsg`. I need to know precisely what information it encapsulates, what its fields represent, and what role it plays within the kernel's networking subsystem. My goal is to get a comprehensive grasp of its structure and purpose before diving into how it's utilized.
Following that, I want to trace the execution path that leads to `dev_change_flags` being invoked. Specifically, I'm interested in its appearance within the `rtnl_setlink` function and also within `do_setlink`. I need to identify the conditions or scenarios that trigger these calls and, in doing so, understand how network device flags are being modified at a fundamental level. This exploration will likely involve examining the arguments passed to these functions and the logic that dictates when and how flag changes are processed. My aim is to build a clear picture of the interplay between the `ifinfomsg` structure, the `rtnl_setlink` and `do_setlink` functions, and ultimately, the mechanism for altering network interface flags.
|
| 291/6 |
2026/09/07 07:44 |
tool |
grepper |
0m
Args: map[Expression:ifi_flags PathPrefix:net/core/rtnetlink.c]
Results: map[Output:net/core/rtnetlink.c=1130=static unsigned int rtnl_dev_combine_flags(const struct net_device *dev,
--
net/core/rtnetlink.c-1132-{
net/core/rtnetlink.c:1133: unsigned int flags = ifm->ifi_flags;
net/core/rtnetlink.c-1134-
--
net/core/rtnetlink.c=2110=static int rtnl_fill_ifinfo(struct sk_buff *skb,
--
net/core/rtnetlink.c-2130- ifm->ifi_index = READ_ONCE(dev->ifindex);
net/core/rtnetlink.c:2131: ifm->ifi_flags = netif_get_flags(dev);
net/core/rtnetlink.c-2132- ifm->ifi_change = change;
--
net/core/rtnetlink.c=2500=static int rtnl_valid_dump_ifinfo_req(const struct nlmsghdr *nlh,
--
net/core/rtnetlink.c-2514-
net/core/rtnetlink.c:2515: if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags ||
net/core/rtnetlink.c-2516- ifm->ifi_change) {
--
net/core/rtnetlink.c=3144=static int do_setlink(const struct sk_buff *skb, struct net_device *dev,
--
net/core/rtnetlink.c-3264-
net/core/rtnetlink.c:3265: if (ifm->ifi_flags || ifm->ifi_change) {
net/core/rtnetlink.c-3266- err = netif_change_flags(dev, rtnl_dev_combine_flags(dev, ifm),
--
net/core/rtnetlink.c=3710=int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm,
--
net/core/rtnetlink.c-3718- old_flags = dev->flags;
net/core/rtnetlink.c:3719: if (ifm && (ifm->ifi_flags || ifm->ifi_change)) {
net/core/rtnetlink.c-3720- err = __dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm),
--
net/core/rtnetlink.c=4228=static int rtnl_valid_getlink_req(struct sk_buff *skb,
--
net/core/rtnetlink.c-4245-
net/core/rtnetlink.c:4246: if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags ||
net/core/rtnetlink.c-4247- ifm->ifi_change) {
--
net/core/rtnetlink.c=5390=int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
--
net/core/rtnetlink.c-5414- ifm->ifi_index = dev->ifindex;
net/core/rtnetlink.c:5415: ifm->ifi_flags = netif_get_flags(dev);
net/core/rtnetlink.c-5416- ifm->ifi_change = 0;
--
net/core/rtnetlink.c=5493=static int valid_bridge_getlink_req(const struct nlmsghdr *nlh,
--
net/core/rtnetlink.c-5508-
net/core/rtnetlink.c:5509: if (ifm->__ifi_pad || ifm->ifi_type || ifm->ifi_flags ||
net/core/rtnetlink.c-5510- ifm->ifi_change || ifm->ifi_index) {
]
|
| 292/6 |
2026/09/07 07:44 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 20227
output: 38
thoughts: 743
Thoughts: **My Thought Process on Configuring a Wireless Interface**
Alright, so I'm trying to get a wireless interface, let's say `wlan0`, into monitor mode, set it to a specific channel (2412 MHz), and ensure it's administratively up. My immediate thought is to leverage Netlink for this, given its role in network configuration in Linux.
First, I recall that setting the interface state, specifically making it UP, is a fundamental netdevice operation. This immediately points me towards `NETLINK_ROUTE`, also known as rtnetlink. I remember the function `rtnl_setlink` as the primary interface for this. To use it, I'll need to construct a `struct ifinfomsg`. The key fields here are `ifi_family` (which I'll set to `AF_UNSPEC` to be general), `ifi_index` (which I can get either directly if I have the index or by using `if_nametoindex("wlan0")`), and crucially, `ifi_flags`. To bring the interface UP, I'll set `IFF_UP`. I also need to tell the system *which* flags are being changed, so `ifi_change` will also be set to `IFF_UP`. The Netlink message itself will be of type `RTM_SETLINK` (or `RTM_NEWLINK`), and I'll request a reply with `NLM_F_REQUEST | NLM_F_ACK`. The socket for this will be a raw Netlink socket of type `AF_NETLINK`, protocol `NETLINK_ROUTE`.
Now, the prompt also mentions setting the interface to monitor mode and setting the channel. My knowledge base tells me that these are more specialized operations, particularly those related to wireless extensions. This points me towards `NETLINK_GENERIC` and the `nl80211` subsystem. I need to check if `nl80211` *itself* has a command to bring an interface UP or DOWN. A quick mental check confirms: no, `nl80211` doesn't handle the generic UP/DOWN state; that's handled by `NETLINK_ROUTE` or even legacy `ioctl` calls. However, `nl80211` is definitely the way to go for setting the interface *type* (to `NL80211_IFTYPE_MONITOR`) and setting the frequency (`NL80211_CMD_SET_CHANNEL`).
This leads to a crucial realization: I'll likely need *two* Netlink sockets. One for `NETLINK_ROUTE` to manage the UP/DOWN state, and another for `NETLINK_GENERIC` to interact with `nl80211` for the monitor mode and channel configuration. The prompt even confirms this, asking about using "raw netlink sockets" (plural!), which makes perfect sense for these distinct operations.
So, my overall approach will involve:
1. Opening a `NETLINK_ROUTE` socket for `RTM_SETLINK` operations.
2. Opening a `NETLINK_GENERIC` socket for `nl80211` commands.
3. Constructing the `nl80211` messages to set the interface type to `NL80211_IFTYPE_MONITOR` and the channel to 2412 MHz using `NL80211_CMD_SET_INTERFACE` and `NL80211_CMD_SET_CHANNEL`, respectively.
4. Simultaneously, or sequentially, constructing the `rtnetlink` message using `rtnl_setlink` (or direct `rtnetlink` API) to set `IFF_UP`.
To get this done correctly, I know I'll need to dig into the specific structures and headers. I'll need `<stdio.h>`, `<string.h>`, `<unistd.h>`, `<sys/socket.h>`, `<net/if.h>` (for `if_nametoindex`, `IFF_UP`), and the Netlink-specific headers: `<linux/netlink.h>`, `<linux/rtnetlink.h>`, `<linux/genetlink.h>`, and `<linux/nl80211.h>`. Within these headers, I'll be looking for the definitions of `struct nlmsghdr` (the generic Netlink message header), `struct genlmsghdr` (for generic Netlink commands), `struct nlattr` (Netlink attributes, which carry the actual data for commands), and `struct ifinfomsg` (for `NETLINK_ROUTE` interface messages). I'll need to pay close attention to the attribute nesting and the specific enum values defined in `nl80211.h` for commands and attributes.
|
| 293/6 |
2026/09/07 07:44 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/genetlink.h FirstLine:1 LineCount:50]
Results: map[Contents: 1: /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2: #ifndef _UAPI__LINUX_GENERIC_NETLINK_H
3: #define _UAPI__LINUX_GENERIC_NETLINK_H
4:
5: #include <linux/types.h>
6: #include <linux/netlink.h>
7:
8: #define GENL_NAMSIZ 16 /* length of family name */
9:
10: #define GENL_MIN_ID NLMSG_MIN_TYPE
11: #define GENL_MAX_ID 1023
12:
13: struct genlmsghdr {
14: __u8 cmd;
15: __u8 version;
16: __u16 reserved;
17: };
18:
19: #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
20:
21: #define GENL_ADMIN_PERM 0x01
22: #define GENL_CMD_CAP_DO 0x02
23: #define GENL_CMD_CAP_DUMP 0x04
24: #define GENL_CMD_CAP_HASPOL 0x08
25: #define GENL_UNS_ADMIN_PERM 0x10
26:
27: /*
28: * List of reserved static generic netlink identifiers:
29: */
30: #define GENL_ID_CTRL NLMSG_MIN_TYPE
31: #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
32: #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
33: /* must be last reserved + 1 */
34: #define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3)
35:
36: /**************************************************************************
37: * Controller
38: **************************************************************************/
39:
40: enum {
41: CTRL_CMD_UNSPEC,
42: CTRL_CMD_NEWFAMILY,
43: CTRL_CMD_DELFAMILY,
44: CTRL_CMD_GETFAMILY,
45: CTRL_CMD_NEWOPS,
46: CTRL_CMD_DELOPS,
47: CTRL_CMD_GETOPS,
48: CTRL_CMD_NEWMCAST_GRP,
49: CTRL_CMD_DELMCAST_GRP,
50: CTRL_CMD_GETMCAST_GRP, /* unused */
]
|
| 294/6 |
2026/09/07 07:44 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 21739
output: 38
thoughts: 17
Thoughts: **My Thought Process on Debugging Netlink**
Here I am, wrestling with a Netlink issue, and my mind immediately jumps to the source code. My first instinct is to dive into `include/uapi/linux/netlink.h`. Why? Because this header file is foundational to Netlink communication within the Linux kernel. It defines the core structures, constants, and types that govern how userspace and kernel components interact. When I'm debugging, understanding these fundamental building blocks is paramount. I need to verify the exact definitions of the Netlink message headers, the different protocol families, the attributes used for data exchange, and any flags that control message behavior. It’s the Rosetta Stone for Netlink, and without a solid grasp of its contents, I'm just guessing about the underlying mechanics of the communication. So, yes, `netlink.h` is where I'll start to get a clear, unambiguous picture of what I'm working with.
|
| 295/6 |
2026/09/07 07:45 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:30 LineCount:70]
Results: map[Contents: 30: #define NETLINK_CRYPTO 21 /* Crypto layer */
31: #define NETLINK_SMC 22 /* SMC monitoring */
32:
33: #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
34:
35: #define MAX_LINKS 32
36:
37: struct sockaddr_nl {
38: __kernel_sa_family_t nl_family; /* AF_NETLINK */
39: unsigned short nl_pad; /* zero */
40: __u32 nl_pid; /* port ID */
41: __u32 nl_groups; /* multicast groups mask */
42: };
43:
44: /**
45: * struct nlmsghdr - fixed format metadata header of Netlink messages
46: * @nlmsg_len: Length of message including header
47: * @nlmsg_type: Message content type
48: * @nlmsg_flags: Additional flags
49: * @nlmsg_seq: Sequence number
50: * @nlmsg_pid: Sending process port ID
51: */
52: struct nlmsghdr {
53: __u32 nlmsg_len;
54: __u16 nlmsg_type;
55: __u16 nlmsg_flags;
56: __u32 nlmsg_seq;
57: __u32 nlmsg_pid;
58: };
59:
60: /* Flags values */
61:
62: #define NLM_F_REQUEST 0x01 /* It is request message. */
63: #define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */
64: #define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */
65: #define NLM_F_ECHO 0x08 /* Receive resulting notifications */
66: #define NLM_F_DUMP_INTR 0x10 /* Dump was inconsistent due to sequence change */
67: #define NLM_F_DUMP_FILTERED 0x20 /* Dump was filtered as requested */
68:
69: /* Modifiers to GET request */
70: #define NLM_F_ROOT 0x100 /* specify tree root */
71: #define NLM_F_MATCH 0x200 /* return all matching */
72: #define NLM_F_ATOMIC 0x400 /* atomic GET */
73: #define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
74:
75: /* Modifiers to NEW request */
76: #define NLM_F_REPLACE 0x100 /* Override existing */
77: #define NLM_F_EXCL 0x200 /* Do not touch, if it exists */
78: #define NLM_F_CREATE 0x400 /* Create, if it does not exist */
79: #define NLM_F_APPEND 0x800 /* Add to end of list */
80:
81: /* Modifiers to DELETE request */
82: #define NLM_F_NONREC 0x100 /* Do not delete recursively */
83: #define NLM_F_BULK 0x200 /* Delete multiple objects */
84:
85: /* Flags for ACK message */
86: #define NLM_F_CAPPED 0x100 /* request was capped */
87: #define NLM_F_ACK_TLVS 0x200 /* extended ACK TVLs were included */
88:
89: /*
90: 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL
91: 4.4BSD CHANGE NLM_F_REPLACE
92:
93: True CHANGE NLM_F_CREATE|NLM_F_REPLACE
94: Append NLM_F_CREATE
95: Check NLM_F_EXCL
96: */
97:
98: #define NLMSG_ALIGNTO 4U
99: #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
]
|
| 296/6 |
2026/09/07 07:45 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 23036
output: 39
thoughts: 42
Thoughts: **My Thought Process**
Okay, so I'm working through this problem, and I'm at a point where I need to understand the specifics of how Netlink attributes are structured and how they are defined. My next step is to dive into the source code, specifically the header files where this information is likely to reside. I'm going to be looking for the definition of `struct nlattr`. This is the fundamental structure that encapsulates Netlink attributes, and understanding its fields and layout is crucial for correctly parsing or constructing them.
Concurrently, I'll be examining the `NLA_*` macros. These are the constants and identifiers that are used to specify the type and flags associated with Netlink attributes. They are essential for correctly interpreting the `nla_type` field within the `struct nlattr` and for understanding how different attributes are distinguished and handled.
I'm expecting to find these definitions in either `include/uapi/linux/netlink.h` or `include/linux/netlink.h`. The `uapi` directory typically contains the user-space API definitions, which are often the most relevant when I'm working on user-space applications interacting with the kernel. However, sometimes these definitions can also be found in the more general kernel header files. I'll start with the `uapi` version as it's generally the intended interface, but I'll be prepared to check the other if needed. This investigation is a key step in ensuring I'm correctly handling Netlink messages at a granular level.
|
| 297/6 |
2026/09/07 07:45 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:180 LineCount:60]
Results: map[Contents: 180: };
181:
182: struct nl_mmap_req {
183: unsigned int nm_block_size;
184: unsigned int nm_block_nr;
185: unsigned int nm_frame_size;
186: unsigned int nm_frame_nr;
187: };
188:
189: struct nl_mmap_hdr {
190: unsigned int nm_status;
191: unsigned int nm_len;
192: __u32 nm_group;
193: /* credentials */
194: __u32 nm_pid;
195: __u32 nm_uid;
196: __u32 nm_gid;
197: };
198:
199: #ifndef __KERNEL__
200: enum nl_mmap_status {
201: NL_MMAP_STATUS_UNUSED,
202: NL_MMAP_STATUS_RESERVED,
203: NL_MMAP_STATUS_VALID,
204: NL_MMAP_STATUS_COPY,
205: NL_MMAP_STATUS_SKIP,
206: };
207:
208: #define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
209: #define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
210: #define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))
211: #endif
212:
213: #define NET_MAJOR 36 /* Major 36 is reserved for networking */
214:
215: enum {
216: NETLINK_UNCONNECTED = 0,
217: NETLINK_CONNECTED,
218: };
219:
220: /*
221: * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
222: * +---------------------+- - -+- - - - - - - - - -+- - -+
223: * | Header | Pad | Payload | Pad |
224: * | (struct nlattr) | ing | | ing |
225: * +---------------------+- - -+- - - - - - - - - -+- - -+
226: * <-------------- nlattr->nla_len -------------->
227: */
228:
229: struct nlattr {
230: __u16 nla_len;
231: __u16 nla_type;
232: };
233:
234: /*
235: * nla_type (16 bits)
236: * +---+---+-------------------------------+
237: * | N | O | Attribute Type |
238: * +---+---+-------------------------------+
239: * N := Carries nested attributes
]
|
| 298/6 |
2026/09/07 07:45 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 23992
output: 39
thoughts: 28
Thoughts: **My Exploration of NLA Macros in the Netlink Header**
Ah, I need to get a handle on what exactly these `NLA_*` macros represent within the `include/uapi/linux/netlink.h` file. It's crucial for me, as an expert in this area, to have a clear understanding of the fundamental building blocks we're working with here in Netlink. I'm going to dive into that header file and meticulously examine each of these `NLA_*` definitions. My goal is to grasp their specific purpose and how they function within the broader Netlink protocol, ensuring I'm not missing any nuances that might impact my work.
|
| 299/6 |
2026/09/07 07:45 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:240 LineCount:40]
Results: map[Contents: 240: * O := Payload stored in network byte order
241: *
242: * Note: The N and O flag are mutually exclusive.
243: */
244: #define NLA_F_NESTED (1 << 15)
245: #define NLA_F_NET_BYTEORDER (1 << 14)
246: #define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
247:
248: #define NLA_ALIGNTO 4
249: #define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
250: #define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
251:
252: /* Generic 32 bitflags attribute content sent to the kernel.
253: *
254: * The value is a bitmap that defines the values being set
255: * The selector is a bitmask that defines which value is legit
256: *
257: * Examples:
258: * value = 0x0, and selector = 0x1
259: * implies we are selecting bit 1 and we want to set its value to 0.
260: *
261: * value = 0x2, and selector = 0x2
262: * implies we are selecting bit 2 and we want to set its value to 1.
263: *
264: */
265: struct nla_bitfield32 {
266: __u32 value;
267: __u32 selector;
268: };
269:
270: /*
271: * policy descriptions - it's specific to each family how this is used
272: * Normally, it should be retrieved via a dump inside another attribute
273: * specifying where it applies.
274: */
275:
276: /**
277: * enum netlink_attribute_type - type of an attribute
278: * @NL_ATTR_TYPE_INVALID: unused
279: * @NL_ATTR_TYPE_FLAG: flag attribute (present/not present)
]
|
| 300/6 |
2026/09/07 07:45 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 24708
output: 38
thoughts: 24
Thoughts: **My Thought Process**
My immediate impulse is to delve into the specifics of the `NLMSG_` macros. To do this, I know the definitive source will be the kernel's user-space API header file, specifically `include/uapi/linux/netlink.h`. This is where the fundamental definitions for Netlink messages, including their type identifiers, are laid out. I'm not just looking for a superficial list; I need to understand the nature and purpose of each macro within the `NLMSG_` family to grasp the full spectrum of Netlink message control and data framing. This is a foundational step in understanding how Netlink communication is structured and managed at a low level.
|
| 301/6 |
2026/09/07 07:45 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:98 LineCount:40]
Results: map[Contents: 98: #define NLMSG_ALIGNTO 4U
99: #define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
100: #define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
101: #define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
102: #define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
103: #define NLMSG_DATA(nlh) ((void *)(((char *)nlh) + NLMSG_HDRLEN))
104: #define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
105: (struct nlmsghdr *)(((char *)(nlh)) + \
106: NLMSG_ALIGN((nlh)->nlmsg_len)))
107: #define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
108: (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
109: (nlh)->nlmsg_len <= (len))
110: #define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
111:
112: #define NLMSG_NOOP 0x1 /* Nothing. */
113: #define NLMSG_ERROR 0x2 /* Error */
114: #define NLMSG_DONE 0x3 /* End of a dump */
115: #define NLMSG_OVERRUN 0x4 /* Data lost */
116:
117: #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
118:
119: struct nlmsgerr {
120: int error;
121: struct nlmsghdr msg;
122: /*
123: * followed by the message contents unless NETLINK_CAP_ACK was set
124: * or the ACK indicates success (error == 0)
125: * message length is aligned with NLMSG_ALIGN()
126: */
127: /*
128: * followed by TLVs defined in enum nlmsgerr_attrs
129: * if NETLINK_EXT_ACK was set
130: */
131: };
132:
133: /**
134: * enum nlmsgerr_attrs - nlmsgerr attributes
135: * @NLMSGERR_ATTR_UNUSED: unused
136: * @NLMSGERR_ATTR_MSG: error message string (string)
137: * @NLMSGERR_ATTR_OFFS: offset of the invalid attribute in the original
]
|
| 302/6 |
2026/09/07 07:45 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 25564
output: 38
thoughts: 42
Thoughts: **My Thought Process on Investigating `rtnetlink` Link Operations**
My immediate instinct when dealing with network interface manipulation in the Linux kernel, especially concerning how configuration is reported and modified, is to dive into the relevant header files. For `rtnetlink`, the core data structures and message types are crucial. Therefore, my first step is to examine `include/uapi/linux/rtnetlink.h`.
Within this header, I'm specifically looking for `struct ifinfomsg`. This structure is the fundamental payload for link-level information messages. It defines the common attributes associated with network interfaces, such as their index, interface flags, MTU, and so on. Understanding its layout and the fields it contains is paramount to interpreting any `rtnetlink` traffic related to links.
Concurrently, I need to understand the *actions* that can be performed on these link structures. This leads me to search for the relevant message types: `RTM_SETLINK` and `RTM_NEWLINK`.
* **`RTM_NEWLINK`**: This message type signifies the creation of a new network link or, more commonly, the modification of an existing one. It's the primary mechanism for reporting changes in link state or parameters, and also for instructing the kernel to *set* certain link properties. When I see `RTM_NEWLINK`, I anticipate it will be accompanied by an `ifinfomsg` structure and a series of Netlink attributes (`struct nlattr`) that specify *what* is being changed. This could be anything from bringing an interface up or down, changing its MTU, setting its name, or configuring VLANs.
* **`RTM_SETLINK`**: While `RTM_NEWLINK` is used for both reporting and setting, `RTM_SETLINK` explicitly denotes an operation to *set* link parameters. This is a more direct request to modify the state of a link. It will also use `struct ifinfomsg` and Netlink attributes to convey the desired changes. The distinction between `RTM_NEWLINK` (when used for setting) and `RTM_SETLINK` might be subtle and depend on the specific context and the kernel version, but both are clearly signaling a modification operation.
So, my thought process is to establish the foundational data structure (`struct ifinfomsg`) that represents a network link's information and then identify the message types (`RTM_NEWLINK`, `RTM_SETLINK`) that are used to send or receive this information, particularly for the purpose of making changes. This exploration is the starting point for understanding how userspace tools interact with the kernel's networking stack via the `rtnetlink` socket for link management.
|
| 303/6 |
2026/09/07 07:45 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/rtnetlink.h FirstLine:1 LineCount:40]
Results: map[Contents: 1: /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2: #ifndef _UAPI__LINUX_RTNETLINK_H
3: #define _UAPI__LINUX_RTNETLINK_H
4:
5: #include <linux/types.h>
6: #include <linux/netlink.h>
7: #include <linux/if_link.h>
8: #include <linux/if_addr.h>
9: #include <linux/neighbour.h>
10:
11: /* rtnetlink families. Values up to 127 are reserved for real address
12: * families, values above 128 may be used arbitrarily.
13: */
14: #define RTNL_FAMILY_IPMR 128
15: #define RTNL_FAMILY_IP6MR 129
16: #define RTNL_FAMILY_MAX 129
17:
18: /****
19: * Routing/neighbour discovery messages.
20: ****/
21:
22: /* Types of messages */
23:
24: enum {
25: RTM_BASE = 16,
26: #define RTM_BASE RTM_BASE
27:
28: RTM_NEWLINK = 16,
29: #define RTM_NEWLINK RTM_NEWLINK
30: RTM_DELLINK,
31: #define RTM_DELLINK RTM_DELLINK
32: RTM_GETLINK,
33: #define RTM_GETLINK RTM_GETLINK
34: RTM_SETLINK,
35: #define RTM_SETLINK RTM_SETLINK
36:
37: RTM_NEWADDR = 20,
38: #define RTM_NEWADDR RTM_NEWADDR
39: RTM_DELADDR,
40: #define RTM_DELADDR RTM_DELADDR
]
|
| 304/6 |
2026/09/07 07:45 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26207
output: 32
thoughts: 26
Thoughts: **A Deep Dive into `struct ifinfomsg` and its Implications**
My current line of inquiry centers on understanding the intricacies of network interface information as managed by the Linux kernel. To that end, I'm delving into the `struct ifinfomsg` definition, which I find located in `include/uapi/linux/rtnetlink.h`. This particular structure is crucial because it forms the backbone of how the kernel communicates detailed information about network interfaces to userspace, particularly through the `rtnetlink` socket interface. My expectation is that by dissecting this structure, I'll gain a clearer picture of the various attributes and states associated with network interfaces that are exposed to applications. This, in turn, will inform my understanding of how network management tools and processes interact with the kernel to configure and monitor network devices. I anticipate that this exploration will reveal not only the immediate data fields but also the underlying mechanisms for how this information is populated and updated, which is vital for any expert working with network diagnostics or development.
|
| 305/6 |
2026/09/07 07:45 |
tool |
grepper |
0m
Args: map[Expression:struct ifinfomsg PathPrefix:include/uapi/linux/]
Results: map[Output:include/uapi/linux/if_link.h=390=enum {
--
include/uapi/linux/if_link.h-400-#ifndef __KERNEL__
include/uapi/linux/if_link.h:401:#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
include/uapi/linux/if_link.h:402:#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
include/uapi/linux/if_link.h-403-#endif
--
include/uapi/linux/rtnetlink.h=583=struct rtgenmsg {
--
include/uapi/linux/rtnetlink.h-590-
include/uapi/linux/rtnetlink.h:591:/* struct ifinfomsg
include/uapi/linux/rtnetlink.h-592- * passes link level specific information, not dependent
--
include/uapi/linux/rtnetlink.h-595-
include/uapi/linux/rtnetlink.h:596:struct ifinfomsg {
include/uapi/linux/rtnetlink.h-597- unsigned char ifi_family;
]
|
| 306/6 |
2026/09/07 07:45 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26587
output: 40
thoughts: 26
Thoughts: **A Deep Dive into `ifinfomsg` and its Context within Netlink**
My current train of thought is centered on understanding the `struct ifinfomsg` structure, and to do that, I need to pull up its definition. The immediate place I'd look is in the `include/uapi/linux/rtnetlink.h` header file. This is where the User API definitions for Netlink messages related to networking are typically housed. My objective here is to get a precise, unadulterated view of the structure as it's exposed to userspace, ensuring I'm working with the definitive ABI.
My immediate priority is to examine the fields within `ifinfomsg`. I'll be looking at:
* **What data is directly contained within the structure?** This will likely involve basic interface identifiers like the interface index (`ifi_index`), interface flags (`ifi_flags`), and potentially MTU (`ifi_mtu`).
* **How does `ifinfomsg` relate to the broader Netlink protocol?** I know that `ifinfomsg` is part of a Netlink message, and Netlink messages have a common header (`struct nlmsg` or similar) that precedes the payload. So, I'm expecting `ifinfomsg` to be the *payload* of a Netlink message, likely one sent or received via the `NETLINK_ROUTE` protocol family.
* **What are the typical use cases for `ifinfomsg`?** I'm anticipating that this structure is fundamental to querying and manipulating network interface information. This would involve operations like listing active interfaces, retrieving their status, configuration details (like addresses, though those might be in separate attributes), and possibly modifying certain aspects.
* **What are the associated Netlink attributes?** `ifinfomsg` itself might be relatively lean. The real meat of interface information is often passed in Netlink attributes (TLVs) that follow the core message structure. I'll need to be aware of common attribute types that are typically associated with `RTM_NEWLINK` or `RTM_GETLINK` operations, such as interface names, MAC addresses, IP addresses, etc.
* **What are the potential versioning implications?** Since this is a User API header (`uapi`), I'm mindful that changes to this structure between kernel versions *could* break userspace applications if not managed carefully. Understanding the evolution of `ifinfomsg` and its related attributes is important for robust network programming.
In essence, my immediate thought process is to establish a concrete understanding of `ifinfomsg`'s definition and its role as the core data component within Netlink messages used for network interface management. This is the foundational step before I can truly analyze or build upon how interfaces are managed in the Linux networking stack via Netlink.
|
| 307/6 |
2026/09/07 07:45 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/rtnetlink.h FirstLine:590 LineCount:20]
Results: map[Contents: 590:
591: /* struct ifinfomsg
592: * passes link level specific information, not dependent
593: * on network protocol.
594: */
595:
596: struct ifinfomsg {
597: unsigned char ifi_family;
598: unsigned char __ifi_pad;
599: unsigned short ifi_type; /* ARPHRD_* */
600: int ifi_index; /* Link index */
601: unsigned ifi_flags; /* IFF_* flags */
602: unsigned ifi_change; /* IFF_* change mask */
603: };
604:
605: /********************************************************************
606: * prefix information
607: ****/
608:
609: struct prefixmsg {
]
|
| 308/6 |
2026/09/07 07:45 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26904
output: 30
thoughts: 165
Thoughts: **My Thought Process on Interface Type Modification**
My primary objective here is to transition the `wlan0` interface into monitor mode. Initially, I conceptualized a straightforward change of the interface type to `NL80211_IFTYPE_MONITOR`. However, a crucial consideration immediately surfaced: the state of the interface. Does the Linux kernel's `cfg80211_change_iface` function permit a modification of the interface type while it's actively operational (UP) or only when it's in a dormant state (DOWN)?
This question necessitates a deeper dive into the kernel's internal workings. I need to meticulously examine the `cfg80211_change_iface` function itself and, critically, how specific hardware drivers, particularly those within the mac80211/fullmac framework, handle such transformations. The core of my investigation will be to ascertain whether the `cfg80211_change_iface` call is designed to accommodate type changes for an UP interface. To achieve this, I plan to scrutinize the source code, specifically files like `net/wireless/util.c` and the relevant driver implementations responsible for managing virtual interfaces, often denoted by functions like `change_virtual_intf`. This detailed code review will ultimately inform the correct sequence of operations for successfully placing `wlan0` into monitor mode.
|
| 309/6 |
2026/09/07 07:46 |
tool |
grepper |
0m
Args: map[Expression:change_virtual_intf PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=2401=static int nl80211_add_commands_unsplit(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-2411- CMD(add_virtual_intf, NEW_INTERFACE);
net/wireless/nl80211.c:2412: CMD(change_virtual_intf, SET_INTERFACE);
net/wireless/nl80211.c-2413- CMD(add_key, NEW_KEY);
--
net/wireless/rdev-ops.h=67=static inline int
net/wireless/rdev-ops.h:68:rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
net/wireless/rdev-ops.h-69- struct net_device *dev, enum nl80211_iftype type,
--
net/wireless/rdev-ops.h-72- int ret;
net/wireless/rdev-ops.h:73: trace_rdev_change_virtual_intf(&rdev->wiphy, dev, type);
net/wireless/rdev-ops.h:74: ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, params);
net/wireless/rdev-ops.h-75- trace_rdev_return_int(&rdev->wiphy, ret);
--
net/wireless/trace.h=535=DEFINE_EVENT(wiphy_wdev_evt, rdev_del_virtual_intf,
--
net/wireless/trace.h-539-
net/wireless/trace.h:540:TRACE_EVENT(rdev_change_virtual_intf,
net/wireless/trace.h-541- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
--
net/wireless/util.c=1258=int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
--
net/wireless/util.c-1283-
net/wireless/util.c:1284: if (!rdev->ops->change_virtual_intf ||
net/wireless/util.c-1285- !(rdev->wiphy.interface_modes & (1 << ntype)))
--
net/wireless/util.c-1309-
net/wireless/util.c:1310: err = rdev_change_virtual_intf(rdev, dev, ntype, params);
net/wireless/util.c-1311-
]
|
| 310/6 |
2026/09/07 07:46 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 27773
output: 35
thoughts: 73
Thoughts: **My Thought Process Regarding Interface Change in mac80211**
My immediate focus is on understanding how the `iw` tool, or more fundamentally, the `mac80211` subsystem, manages changes to network interfaces. Given that `mac80211` is the core driver for many wireless devices, it's the logical place to investigate the underlying mechanisms. I'm particularly interested in the code responsible for dynamically altering or creating virtual interfaces. To pinpoint this, I'll be looking for functions that handle such operations. My initial suspicion is that `net/mac80211/iface.c` or perhaps `net/mac80211/cfg.c` would be the most probable locations for this logic, specifically looking for a function named something like `change_virtual_intf`. This function would likely be the entry point for requests to modify or reconfigure existing virtual interfaces or to create new ones, encapsulating the necessary state changes and interactions with the hardware.
|
| 311/6 |
2026/09/07 07:46 |
tool |
grepper |
0m
Args: map[Expression:change_virtual_intf PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/cfg.c=5976=const struct cfg80211_ops mac80211_config_ops = {
--
net/mac80211/cfg.c-5978- .del_virtual_intf = ieee80211_del_iface,
net/mac80211/cfg.c:5979: .change_virtual_intf = ieee80211_change_iface,
net/mac80211/cfg.c-5980- .start_p2p_device = ieee80211_start_p2p_device,
]
|
| 312/6 |
2026/09/07 07:46 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 28047
output: 41
thoughts: 40
Thoughts: **My Thought Process Regarding `ieee80211_change_iface`**
Right, so, the first thing that comes to my mind when considering a change to an interface, specifically within the context of IEEE 802.11 wireless networking as handled by the `mac80211` subsystem in the Linux kernel, is to immediately pivot to the relevant function responsible for managing such changes. Based on my experience and the typical structure of kernel drivers, I'd expect to find this logic concentrated in a function named something like `ieee80211_change_iface`. My initial search would therefore be directed towards the source files that house the core `mac80211` interface management logic. Given the nature of interface configuration and state changes, `net/mac80211/iface.c` seems like the most probable location for this function. Alternatively, since interface configuration often involves settings and parameters, I'd also keep an open mind that it might reside within a file specifically dedicated to configuration handling, hence my secondary consideration of `cfg.c` within the same `net/mac80211/` directory. My goal here is to pinpoint the exact entry point where the system processes requests to alter the operational parameters of an existing wireless interface.
|
| 313/6 |
2026/09/07 07:46 |
tool |
grepper |
0m
Args: map[Expression:ieee80211_change_iface PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/cfg.c=252=static int ieee80211_del_iface(struct wiphy *wiphy, struct wireless_dev *wdev)
--
net/mac80211/cfg.c-258-
net/mac80211/cfg.c:259:static int ieee80211_change_iface(struct wiphy *wiphy,
net/mac80211/cfg.c-260- struct net_device *dev,
--
net/mac80211/cfg.c=5976=const struct cfg80211_ops mac80211_config_ops = {
--
net/mac80211/cfg.c-5978- .del_virtual_intf = ieee80211_del_iface,
net/mac80211/cfg.c:5979: .change_virtual_intf = ieee80211_change_iface,
net/mac80211/cfg.c-5980- .start_p2p_device = ieee80211_start_p2p_device,
]
|
| 314/6 |
2026/09/07 07:46 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 28431
output: 40
thoughts: 18
Thoughts: **My Deep Dive into `ieee80211_change_iface`**
Alright, so I'm looking at this `ieee80211_change_iface` function, and my immediate thought is, "What's *really* happening under the hood when the network interface configuration changes?" I need to understand the core mechanisms at play here. My expertise tells me that this isn't just a simple toggle; it's likely a complex dance of state transitions, resource management, and potential interactions with higher-level networking stacks.
I'm hypothesizing that this function is the central pivot point for modifying an existing wireless interface's operational parameters. This could involve anything from changing its operational mode (station, AP, monitor, etc.) to adjusting fundamental radio settings like channel, power, or aggregation. The name itself, `change_iface`, suggests it's designed to be a granular control point for an already established interface, rather than the initial setup or teardown.
My expectation is that the function will meticulously validate any proposed changes. I'm anticipating checks for compatibility with the underlying hardware capabilities, regulatory domain constraints, and possibly even the current state of the interface itself. A bad configuration could lead to instability, performance degradation, or outright failure, so robust validation is paramount.
Furthermore, I'm looking for evidence of how this function handles resource allocation and deallocation. When parameters change, it might necessitate re-initializing certain hardware components, reconfiguring DMA buffers, or updating internal data structures. This could involve acquiring new resources or releasing old ones. I'm particularly interested in any potential race conditions or locking mechanisms that might be in place to ensure thread-safe access to these shared resources.
I'm also considering the implications for the rest of the networking stack. Changes to the interface's configuration will undoubtedly have ripple effects. For instance, switching modes might require updating the Netlink interface, informing userspace applications about the new capabilities, or even re-initializing network protocols that are bound to this specific interface. I'll be looking for how this function communicates these changes to other parts of the system.
Finally, I'm keenly interested in the error handling. What happens when a change cannot be applied? Does it gracefully revert to the previous state, or does it signal an error that the caller must manage? Understanding the failure modes is just as critical as understanding the success paths for robust system design. My goal is to trace the flow of execution and identify the key state machines and data structures that are manipulated by `ieee80211_change_iface` to achieve its purpose.
|
| 315/6 |
2026/09/07 07:46 |
tool |
read-file |
0m
Args: map[File:net/mac80211/cfg.c FirstLine:258 LineCount:40]
Results: map[Contents: 258:
259: static int ieee80211_change_iface(struct wiphy *wiphy,
260: struct net_device *dev,
261: enum nl80211_iftype type,
262: struct vif_params *params)
263: {
264: struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
265: struct ieee80211_local *local = sdata->local;
266: struct sta_info *sta;
267: int ret;
268:
269: lockdep_assert_wiphy(local->hw.wiphy);
270:
271: ret = ieee80211_if_change_type(sdata, type);
272: if (ret)
273: return ret;
274:
275: if (type == NL80211_IFTYPE_AP_VLAN && params->use_4addr == 0) {
276: RCU_INIT_POINTER(sdata->u.vlan.sta, NULL);
277: ieee80211_check_fast_rx_iface(sdata);
278: } else if (type == NL80211_IFTYPE_STATION && params->use_4addr >= 0) {
279: struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
280:
281: if (params->use_4addr == ifmgd->use_4addr)
282: return 0;
283:
284: sdata->u.mgd.use_4addr = params->use_4addr;
285: if (!ifmgd->associated)
286: return 0;
287:
288: sta = sta_info_get(sdata, sdata->deflink.u.mgd.bssid);
289: if (sta)
290: drv_sta_set_4addr(local, sdata, &sta->sta,
291: params->use_4addr);
292:
293: if (params->use_4addr)
294: ieee80211_send_4addr_nullfunc(local, sdata);
295: }
296:
297: if (sdata->vif.type == NL80211_IFTYPE_MONITOR) {
]
|
| 316/6 |
2026/09/07 07:46 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 29215
output: 42
thoughts: 22
Thoughts: **My Thought Process on `ieee80211_if_change_type`**
Alright, so the first thing that comes to my mind when I see `ieie80211_if_change_type` is that this is clearly a core function for managing the operational mode of a wireless interface within the 802.11 subsystem. My immediate inclination is to dive into its implementation to understand precisely *how* it orchestrates these transitions.
My initial hypothesis is that this function will be responsible for a number of critical tasks. Foremost among them, I expect it to handle the actual re-configuration of the network interface controller (NIC) hardware. This could involve setting new parameters like the operational mode (e.g., AP mode, station mode, monitor mode), adjusting radio parameters if the type change necessitates it (though I'd expect some of that to be handled by separate, lower-level drivers), and potentially re-initializing certain hardware states.
Beyond the hardware interaction, I'm also looking for how this function integrates with the broader network stack. Changing the interface type is a significant event, and it's highly probable that `ieee80211_if_change_type` will need to trigger updates in other parts of the kernel. This could include notifying higher-level network management daemons, reconfiguring associated network devices (like bridges or virtual interfaces), and most importantly, managing the lifecycle of the network device itself. For instance, if we're moving from an operational mode to a shutdown or uninitialized state, I'd expect resource cleanup to be a major concern.
I'm also considering the potential for race conditions and concurrency issues. Wireless drivers are notoriously complex, and managing state changes across different operational modes while other parts of the system might be trying to access or modify the interface presents a significant challenge. Therefore, I'll be paying close attention to any locking mechanisms, atomic operations, or other synchronization primitives employed within this function and its callees.
Furthermore, the "type" in `if_change_type` is key. I'm anticipating that this function will act as a dispatcher, potentially looking at an enumeration or a specific value to determine which specific operational mode is being requested. This suggests that the function might not perform all the mode-specific logic itself, but rather delegate to other, more specialized functions based on the input `type`. This would be a good design choice for modularity.
Finally, I'm thinking about error handling. What happens if a requested type change is invalid, or if the hardware fails to reconfigure? I expect `ieee80211_if_change_type` to return appropriate error codes and to handle rollback scenarios gracefully, ensuring the system remains in a stable state. I'll be scanning for return value checks and any cleanup logic that might be invoked in the event of an error.
|
| 317/6 |
2026/09/07 07:46 |
tool |
grepper |
0m
Args: map[Expression:ieee80211_if_change_type PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/cfg.c=259=static int ieee80211_change_iface(struct wiphy *wiphy,
--
net/mac80211/cfg.c-270-
net/mac80211/cfg.c:271: ret = ieee80211_if_change_type(sdata, type);
net/mac80211/cfg.c-272- if (ret)
--
net/mac80211/ieee80211_i.h=2184=int ieee80211_if_add(struct ieee80211_local *local, const char *name,
--
net/mac80211/ieee80211_i.h-2187- struct vif_params *params);
net/mac80211/ieee80211_i.h:2188:int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
net/mac80211/ieee80211_i.h-2189- enum nl80211_iftype type);
--
net/mac80211/iface.c=1980=static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/iface.c-2071-
net/mac80211/iface.c:2072:int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
net/mac80211/iface.c-2073- enum nl80211_iftype type)
]
|
| 318/6 |
2026/09/07 07:46 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 29763
output: 42
thoughts: 35
Thoughts: **A Deep Dive into `ieee80211_if_change_type`**
Okay, so I'm here, ready to really understand what's going on with `ieee80211_if_change_type` in `net/mac80211/iface.c`. This function seems pivotal, the point where the driver's view of an interface's operational mode can be altered. As an expert, I'm not just looking for a superficial description; I need to grasp the implications, the internal workings, and how it interacts with the broader 802.11 subsystem.
My primary goal is to trace the execution flow. What are the conditions under which this function is called? What are the key parameters it receives, and what do they signify in terms of the desired interface type change? I'm particularly interested in the state transitions that occur. If an interface is currently operating in one mode (say, AP mode), what are the necessary steps to transition it to another (like STA or mesh)? This will involve looking for checks, validation, and potentially resource allocation or deallocation.
I'll be meticulously examining how the driver's internal state is updated. This isn't just about setting a flag; it's about reconfiguring hardware, potentially changing firmware behavior, and ensuring that all relevant internal data structures are consistent. I'll be paying close attention to any locking mechanisms or concurrency controls, as interface state changes can be a sensitive operation.
Furthermore, I want to understand the error handling. What can go wrong during a type change, and how does the function gracefully manage these failures? Are there specific error codes or return values that indicate the reason for a failed transition? This is crucial for robust driver development and debugging.
Ultimately, I'm looking to build a comprehensive mental model of `ieee80211_if_change_type`. I want to be able to predict its behavior, understand its dependencies, and identify potential areas for optimization or improvement. It’s about seeing the function not just as lines of code, but as a critical component orchestrating the dynamic behavior of wireless interfaces within the kernel.
|
| 319/6 |
2026/09/07 07:47 |
tool |
read-file |
0m
Args: map[File:net/mac80211/iface.c FirstLine:2072 LineCount:40]
Results: map[Contents:2072: int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
2073: enum nl80211_iftype type)
2074: {
2075: int ret;
2076:
2077: ASSERT_RTNL();
2078:
2079: if (type == ieee80211_vif_type_p2p(&sdata->vif))
2080: return 0;
2081:
2082: if (ieee80211_sdata_running(sdata)) {
2083: ret = ieee80211_runtime_change_iftype(sdata, type);
2084: if (ret)
2085: return ret;
2086: } else {
2087: /* Purge and reset type-dependent state. */
2088: ieee80211_teardown_sdata(sdata);
2089: ieee80211_setup_sdata(sdata, type);
2090: }
2091:
2092: /* reset some values that shouldn't be kept across type changes */
2093: if (type == NL80211_IFTYPE_STATION)
2094: sdata->u.mgd.use_4addr = false;
2095:
2096: return 0;
2097: }
2098:
2099: static void ieee80211_assign_perm_addr(struct ieee80211_local *local,
2100: u8 *perm_addr, enum nl80211_iftype type)
2101: {
2102: struct ieee80211_sub_if_data *sdata;
2103: u64 mask, start, addr, val, inc;
2104: u8 *m;
2105: u8 tmp_addr[ETH_ALEN];
2106: int i;
2107:
2108: lockdep_assert_wiphy(local->hw.wiphy);
2109:
2110: /* default ... something at least */
2111: memcpy(perm_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
]
|
| 320/6 |
2026/09/07 07:47 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30497
output: 34
thoughts: 765
Thoughts: **My Thought Process on the Interface Type and Configuration Task**
Alright, let's break down this request for a minimal C function to manipulate a wireless interface. The core objective is to change "wlan0" to monitor mode, bring it up, and set its frequency. I'm assuming I have the `nl80211` family ID handy.
My first instinct is to leverage `nl80211` commands for wireless-specific operations. For changing the interface type to monitor mode, `NL80211_CMD_SET_INTERFACE` immediately comes to mind. The key attributes I'll need to populate for this command are:
* `NL80211_ATTR_IFINDEX`: This will require mapping the interface name "wlan0" to its corresponding index, likely using `if_nametoindex()`.
* `NL80211_ATTR_IFTYPE`: This attribute will be set to `NL80211_IFTYPE_MONITOR` to achieve the desired mode.
Next, the requirement to set the interface UP. This is a more general network interface operation, and I know that `rtnetlink` is the mechanism for this. Specifically, I'll be looking at the `RTM_SETLINK` (or `RTM_NEWLINK`) message type within the `NETLINK_ROUTE` family. The payload will be a `struct ifinfomsg`.
* `ifi_family` can be `AF_UNSPEC`.
* `ifi_index` will be the same interface index obtained earlier.
* Crucially, `ifi_flags` and `ifi_change` will both be set to `IFF_UP` to signify that I intend to bring the interface up. I'll probably use `NLM_F_REQUEST | NLM_F_ACK` for these netlink requests, ensuring I get a response confirming the operation.
Finally, the frequency setting. For this, I'll again turn to `nl80211`, as it handles wireless channel configurations. The command for this is `NL80211_CMD_SET_CHANNEL`. The necessary attributes here are:
* `NL80211_ATTR_IFINDEX`: Again, the index of "wlan0".
* `NL80211_ATTR_WIPHY_FREQ`: This will be set to `2412` for the desired 2412 MHz frequency.
Now, a crucial point of consideration arises: the order of operations. Specifically, can I set the frequency on a monitor mode interface *before* or *after* bringing it up? I'll need to peek into the kernel's `cfg80211` implementation for this.
Looking at `__nl80211_set_channel` within the kernel's `net/wireless/nl80211.c`, I see it handles different interface types. For `NL80211_IFTYPE_MONITOR`, it calls `cfg80211_set_monitor_channel`. This function then checks if the device's operations (`rdev->ops->set_monitor_channel`) are supported and if the device only has monitors (`cfg80211_has_monitors_only(rdev)`). If these checks pass, it ultimately calls `rdev_set_monitor_channel`.
My immediate thought here is to check the `mac80211` driver (if that's the underlying implementation being used) to see how `set_monitor_channel` is actually handled. The concern is whether this specific driver operation is sensitive to the interface's UP/DOWN state when setting the channel. Without that specific driver knowledge, I'm making an educated guess that setting the channel *after* setting the interface type to monitor and *before* bringing it fully UP might be the safest bet, or perhaps it works regardless. The prompt asks for a *minimal* function, so I'll aim for a logical sequence, but this is a point where further investigation into the driver specifics would be essential for robustness. However, for a *minimal* function, I'll proceed with the sequence: set interface type, then bring it up, then set the channel. If that fails, I'd re-evaluate.
|
| 321/6 |
2026/09/07 07:47 |
tool |
grepper |
0m
Args: map[Expression:set_monitor_channel PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/cfg.c=1034=static int ieee80211_get_station(struct wiphy *wiphy,
--
net/mac80211/cfg.c-1059-
net/mac80211/cfg.c:1060:static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
net/mac80211/cfg.c-1061- struct net_device *dev,
--
net/mac80211/cfg.c=5976=const struct cfg80211_ops mac80211_config_ops = {
--
net/mac80211/cfg.c-6014- .set_txq_params = ieee80211_set_txq_params,
net/mac80211/cfg.c:6015: .set_monitor_channel = ieee80211_set_monitor_channel,
net/mac80211/cfg.c-6016- .suspend = ieee80211_suspend,
]
|
| 322/6 |
2026/09/07 07:47 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 31586
output: 41
thoughts: 34
Thoughts: **My Thought Process Regarding `ieee80211_set_monitor_channel`**
Okay, my current focus is on understanding how the system handles setting the channel for monitor mode, specifically within the `mac80211` driver. I've identified `ieee80211_set_monitor_channel` in `net/mac80211/cfg.c` as the key function to investigate. My intention here is to delve into the implementation details of this function to grasp the underlying mechanisms and logic that govern this operation. I anticipate this will involve tracing its execution path, examining how it interacts with other parts of the driver and potentially the hardware abstraction layer, and understanding any constraints or specific requirements for setting a monitor channel compared to a normal operational channel. Essentially, I'm starting at this specific entry point to reverse-engineer the process from a functional perspective.
|
| 323/6 |
2026/09/07 07:47 |
tool |
read-file |
0m
Args: map[File:net/mac80211/cfg.c FirstLine:1060 LineCount:25]
Results: map[Contents:1060: static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
1061: struct net_device *dev,
1062: struct cfg80211_chan_def *chandef)
1063: {
1064: struct ieee80211_local *local = wiphy_priv(wiphy);
1065: struct ieee80211_sub_if_data *sdata;
1066: struct ieee80211_chan_req chanreq = { .oper = *chandef };
1067: int ret;
1068:
1069: lockdep_assert_wiphy(local->hw.wiphy);
1070:
1071: sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1072: if (!ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) {
1073: if (cfg80211_chandef_identical(&local->monitor_chanreq.oper,
1074: &chanreq.oper))
1075: return 0;
1076:
1077: sdata = wiphy_dereference(wiphy, local->monitor_sdata);
1078: if (!sdata)
1079: goto done;
1080: }
1081:
1082: if (rcu_access_pointer(sdata->deflink.conf->chanctx_conf) &&
1083: cfg80211_chandef_identical(&sdata->vif.bss_conf.chanreq.oper,
1084: &chanreq.oper))
]
|
| 324/6 |
2026/09/07 07:47 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 32127
output: 34
thoughts: 190
Thoughts: **My Thought Process on `sdata = wiphy_dereference(wiphy, local->monitor_sdata); if (!sdata) goto done;`**
Okay, I'm looking at this snippet here: `sdata = wiphy_dereference(wiphy, local->monitor_sdata); if (!sdata) goto done;`. My immediate thought is about the state of `local->monitor_sdata`. I know that when a monitor interface is brought *up*, `local->monitor_sdata` should indeed be set. If it's not currently running, it's designed to record the `chandef` (channel definition) and then set `local->monitor_sdata` when the interface eventually comes up. This implies that setting `local->monitor_sdata` either *before* or *after* the interface is brought up should be acceptable behavior. The typical pattern I've seen, and what's suggested here, is to set it *after* the interface is UP. This aligns with common operational sequences, like the example shown: `iw dev wlan0 set type monitor; ip link set wlan0 up; iw dev wlan0 set freq 2412`.
My next step is to understand how `iw`, the user-space utility, actually constructs these `nl80211` messages. I need to delve into its internals to see how it handles interface configuration and state changes. To do this, I'll likely be examining the `iw` tool itself, or perhaps looking for any relevant tools or examples within the kernel tree, particularly in directories like `tools/testing` or `samples`.
Finally, to get a comprehensive understanding of how `NL80211_CMD_SET_INTERFACE` is utilized and handled across the kernel, I'll perform a broad search for it throughout the entire kernel source tree. This will help me identify all the places where this command is invoked and how different components react to it.
|
| 325/6 |
2026/09/07 07:47 |
tool |
grepper |
0m
Error:
Args: map[Expression:NL80211_CMD_SET_INTERFACE PathPrefix:tools/]
Results:
|
| 326/6 |
2026/09/07 07:47 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 32349
output: 27
thoughts: 22
Thoughts: **My Thought Process: Probing the Kernel for `NL80211_` Interfaces**
My initial impulse, given the context of exploring wireless networking within the Linux kernel, is to perform a targeted search for anything related to `NL80211_`. This constant, `NL80211_`, is the primary namespace for netlink events and commands within the kernel's wireless subsystem, so I expect that any tools or tests directly interacting with or exercising this functionality will likely be prefixed or heavily involve this identifier. Therefore, a broad search across the kernel source tree for this string seems like the most efficient first step to uncover the relevant components. I'm not just looking for explicit "tools" in the user-space sense, but also any internal kernel testing frameworks or utilities that leverage `NL80211_` to validate the wireless driver interface. This would give me a comprehensive view of how this critical API is being utilized and verified within the kernel's own development ecosystem.
|
| 327/6 |
2026/09/07 07:47 |
tool |
grepper |
0m
Args: map[Expression:NETLINK_GENERIC PathPrefix:tools/]
Results: map[Output:tools/accounting/delaytop.c=397=static int create_nl_socket(void)
--
tools/accounting/delaytop.c-401-
tools/accounting/delaytop.c:402: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/accounting/delaytop.c-403- if (fd < 0)
--
tools/accounting/getdelays.c=467=int main(int argc, char *argv[])
--
tools/accounting/getdelays.c-588-
tools/accounting/getdelays.c:589: nl_sd = create_nl_socket(NETLINK_GENERIC);
tools/accounting/getdelays.c-590- if (nl_sd < 0)
--
tools/accounting/procacct.c=290=int main(int argc, char *argv[])
--
tools/accounting/procacct.c-353-
tools/accounting/procacct.c:354: nl_sd = create_nl_socket(NETLINK_GENERIC);
tools/accounting/procacct.c-355- if (nl_sd < 0)
--
tools/include/uapi/linux/netlink.h-24-#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
tools/include/uapi/linux/netlink.h:25:#define NETLINK_GENERIC 16
tools/include/uapi/linux/netlink.h-26-/* leave room for NETLINK_DM (DM Events) */
--
tools/include/uapi/linux/taskstats.h=275=enum {
--
tools/include/uapi/linux/taskstats.h-285-
tools/include/uapi/linux/taskstats.h:286:/* NETLINK_GENERIC related info */
tools/include/uapi/linux/taskstats.h-287-
--
tools/lib/bpf/netlink.c=268=static int libbpf_netlink_resolve_genl_family_id(const char *name,
--
tools/lib/bpf/netlink.c-283-
tools/lib/bpf/netlink.c:284: return libbpf_netlink_send_recv(&req, NETLINK_GENERIC,
tools/lib/bpf/netlink.c-285- parse_genl_family_id, NULL, id);
--
tools/lib/bpf/netlink.c=433=int bpf_xdp_query(int ifindex, int xdp_flags, struct bpf_xdp_query_opts *opts)
--
tools/lib/bpf/netlink.c-495-
tools/lib/bpf/netlink.c:496: err = libbpf_netlink_send_recv(&req, NETLINK_GENERIC,
tools/lib/bpf/netlink.c-497- parse_xdp_features, NULL, &md);
--
tools/net/ynl/lib/ynl.c=736=ynl_sock_create(const struct ynl_family *yf, struct ynl_error *yse)
--
tools/net/ynl/lib/ynl.c-753-
tools/net/ynl/lib/ynl.c:754: sock_type = yf->is_classic ? yf->classic_id : NETLINK_GENERIC;
tools/net/ynl/lib/ynl.c-755-
--
tools/net/ynl/pyynl/lib/ynl.py=40=class Netlink:
--
tools/net/ynl/pyynl/lib/ynl.py-74- # Genetlink defines
tools/net/ynl/pyynl/lib/ynl.py:75: NETLINK_GENERIC = 16
tools/net/ynl/pyynl/lib/ynl.py-76-
--
tools/net/ynl/pyynl/lib/ynl.py=461=def _genl_load_families():
--
tools/net/ynl/pyynl/lib/ynl.py-463-
tools/net/ynl/pyynl/lib/ynl.py:464: with socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, Netlink.NETLINK_GENERIC) as sock:
tools/net/ynl/pyynl/lib/ynl.py-465- sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_CAP_ACK, 1)
--
tools/net/ynl/pyynl/lib/ynl.py=509=def _genl_policy_dump(family_id, op):
--
tools/net/ynl/pyynl/lib/ynl.py-512-
tools/net/ynl/pyynl/lib/ynl.py:513: with socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, Netlink.NETLINK_GENERIC) as sock:
tools/net/ynl/pyynl/lib/ynl.py-514- sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_CAP_ACK, 1)
--
tools/net/ynl/pyynl/lib/ynl.py=606=class GenlProtocol(NetlinkProtocol):
--
tools/net/ynl/pyynl/lib/ynl.py-609- def __init__(self, family_name):
tools/net/ynl/pyynl/lib/ynl.py:610: super().__init__(family_name, Netlink.NETLINK_GENERIC)
tools/net/ynl/pyynl/lib/ynl.py-611-
--
tools/testing/selftests/acct/netlink_helper.c=13=int netlink_open(void)
--
tools/testing/selftests/acct/netlink_helper.c-21-
tools/testing/selftests/acct/netlink_helper.c:22: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/acct/netlink_helper.c-23- if (fd < 0)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=104=static bool get_smc_nl_family_id(void)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-111-
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:112: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-113- if (!ASSERT_OK_FD(fd, "nl_family socket"))
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=153=static bool smc_ueid(int op)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-164- memcpy(test_ueid, SMC_BPFTEST_UEID, strlen(SMC_BPFTEST_UEID));
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:165: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-166- if (!ASSERT_OK_FD(fd, "ueid socket"))
--
tools/testing/selftests/nci/nci_dev.c=90=static int create_nl_socket(void)
--
tools/testing/selftests/nci/nci_dev.c-94-
tools/testing/selftests/nci/nci_dev.c:95: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/nci/nci_dev.c-96- if (fd < 0)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1534=int main(int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1542-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1543: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1544- if (fd == -1)
--
tools/testing/selftests/net/netlink-dumps.c=199=TEST(test_sanity)
--
tools/testing/selftests/net/netlink-dumps.c-204-
tools/testing/selftests/net/netlink-dumps.c:205: netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/netlink-dumps.c-206- ASSERT_GE(netlink_sock, 0);
--
tools/testing/selftests/net/netlink-dumps.c=220=TEST(close_in_progress)
--
tools/testing/selftests/net/netlink-dumps.c-224-
tools/testing/selftests/net/netlink-dumps.c:225: netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/netlink-dumps.c-226- ASSERT_GE(netlink_sock, 0);
--
tools/testing/selftests/net/netlink-dumps.c=234=TEST(close_with_ref)
--
tools/testing/selftests/net/netlink-dumps.c-240-
tools/testing/selftests/net/netlink-dumps.c:241: netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/netlink-dumps.c-242- ASSERT_GE(netlink_sock, 0);
]
|
| 328/6 |
2026/09/07 07:47 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 35053
output: 48
thoughts: 42
Thoughts: **Understanding Netlink Message Construction for Power Management Selftests**
My immediate goal is to understand how generic Netlink messages are constructed and transmitted within the context of power management selftests. To achieve this, I've decided to start by diving into the source code of `pm_nl_ctl.c`. My intention is to meticulously read through this file, paying close attention to the mechanisms employed for building these messages and the subsequent steps involved in sending them. I'm particularly interested in the specific functions, data structures, and protocols used to create these Netlink messages that are essential for testing power management functionalities.
|
| 329/6 |
2026/09/07 07:48 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/mptcp/pm_nl_ctl.c FirstLine:40 LineCount:50]
Results: map[Contents: 40: fprintf(stderr, "\tflush\n");
41: fprintf(stderr, "\tdump\n");
42: fprintf(stderr, "\tlimits [<rcv addr max> <subflow max>]\n");
43: fprintf(stderr, "\tevents\n");
44: fprintf(stderr, "\tlisten <local-ip> <local-port>\n");
45: exit(0);
46: }
47:
48: static int init_genl_req(char *data, int family, int cmd, int version)
49: {
50: struct nlmsghdr *nh = (void *)data;
51: struct genlmsghdr *gh;
52: int off = 0;
53:
54: nh->nlmsg_type = family;
55: nh->nlmsg_flags = NLM_F_REQUEST;
56: nh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
57: off += NLMSG_ALIGN(sizeof(*nh));
58:
59: gh = (void *)(data + off);
60: gh->cmd = cmd;
61: gh->version = version;
62: off += NLMSG_ALIGN(sizeof(*gh));
63: return off;
64: }
65:
66: static int nl_error(struct nlmsghdr *nh)
67: {
68: struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
69: int len = nh->nlmsg_len - sizeof(*nh);
70: uint32_t off;
71:
72: if (len < sizeof(struct nlmsgerr)) {
73: error(1, 0, "netlink error message truncated %d min %ld", len,
74: sizeof(struct nlmsgerr));
75: return -1;
76: }
77:
78: if (err->error) {
79: /* check messages from kernel */
80: struct rtattr *attrs = (struct rtattr *)NLMSG_DATA(nh);
81:
82: fprintf(stderr, "netlink error %d (%s)\n",
83: err->error, strerror(-err->error));
84:
85: while (RTA_OK(attrs, len)) {
86: if (attrs->rta_type == NLMSGERR_ATTR_MSG)
87: fprintf(stderr, "netlink ext ack msg: %s\n",
88: (char *)RTA_DATA(attrs));
89: if (attrs->rta_type == NLMSGERR_ATTR_OFFS) {
]
|
| 330/6 |
2026/09/07 07:48 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 35884
output: 48
thoughts: 50
Thoughts: **My Thought Process on Generic Netlink Attribute Handling**
Right, so the immediate task at hand is to understand precisely how attributes are appended to generic Netlink messages within the `pm_nl_ctl.c` file, or potentially in related files if the logic isn't entirely self-contained. My strategy here is to dive directly into the source code and examine a specific, relevant section. I've decided to focus my attention on lines 90 through 150 of `pm_nl_ctl.c`. My expectation is that within this block of code, I'll find the core mechanisms for defining, populating, and attaching these attributes to the outgoing Netlink messages. This will involve looking for functions that deal with attribute creation, serialization, and linking them to the message buffer. I'm particularly interested in the data structures used to represent attributes and how they are marshaled into the binary format required by Netlink. Understanding this section will be key to grasping the overall attribute management strategy for power management Netlink operations.
|
| 331/6 |
2026/09/07 07:48 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/mptcp/pm_nl_ctl.c FirstLine:90 LineCount:60]
Results: map[Contents: 90: memcpy(&off, RTA_DATA(attrs), 4);
91: fprintf(stderr, "netlink err off %d\n",
92: (int)off);
93: }
94: attrs = RTA_NEXT(attrs, len);
95: }
96: return -1;
97: }
98:
99: return 0;
100: }
101:
102: static int capture_events(int fd, int event_group)
103: {
104: u_int8_t buffer[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
105: NLMSG_ALIGN(sizeof(struct genlmsghdr)) + 1024];
106: struct genlmsghdr *ghdr;
107: struct rtattr *attrs;
108: struct nlmsghdr *nh;
109: int ret = 0;
110: int res_len;
111: int msg_len;
112: fd_set rfds;
113:
114: if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
115: &event_group, sizeof(event_group)) < 0)
116: error(1, errno, "could not join the " MPTCP_PM_EV_GRP_NAME " mcast group");
117:
118: do {
119: bool server_side = false;
120:
121: FD_ZERO(&rfds);
122: FD_SET(fd, &rfds);
123: res_len = NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
124: NLMSG_ALIGN(sizeof(struct genlmsghdr)) + 1024;
125:
126: ret = select(FD_SETSIZE, &rfds, NULL, NULL, NULL);
127:
128: if (ret < 0)
129: error(1, ret, "error in select() on NL socket");
130:
131: res_len = recv(fd, buffer, res_len, 0);
132: if (res_len < 0)
133: error(1, res_len, "error on recv() from NL socket");
134:
135: nh = (struct nlmsghdr *)buffer;
136:
137: for (; NLMSG_OK(nh, res_len); nh = NLMSG_NEXT(nh, res_len)) {
138: if (nh->nlmsg_type == NLMSG_ERROR)
139: error(1, NLMSG_ERROR, "received invalid NL message");
140:
141: ghdr = (struct genlmsghdr *)NLMSG_DATA(nh);
142:
143: if (ghdr->cmd == 0)
144: continue;
145:
146: fprintf(stderr, "type:%d", ghdr->cmd);
147:
148: msg_len = nh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
149:
]
|
| 332/6 |
2026/09/07 07:48 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 36898
output: 44
thoughts: 30
Thoughts: **My Thought Process on Attribute Appending**
My immediate impulse is to understand the mechanism by which attributes are appended. To get a clear picture, I'm going to focus my investigation on the `pm_nl_ctl.c` file. My primary goal is to identify and examine any helper functions within this file that are specifically designed for adding attributes. This approach should provide me with the granular details of the attribute appending process.
|
| 333/6 |
2026/09/07 07:48 |
tool |
grepper |
0m
Args: map[Expression:rta_type PathPrefix:tools/testing/selftests/net/mptcp/pm_nl_ctl.c]
Results: map[Output:tools/testing/selftests/net/mptcp/pm_nl_ctl.c=66=static int nl_error(struct nlmsghdr *nh)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-85- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:86: if (attrs->rta_type == NLMSGERR_ATTR_MSG)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-87- fprintf(stderr, "netlink ext ack msg: %s\n",
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-88- (char *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:89: if (attrs->rta_type == NLMSGERR_ATTR_OFFS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-90- memcpy(&off, RTA_DATA(attrs), 4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=102=static int capture_events(int fd, int event_group)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-151- while (RTA_OK(attrs, msg_len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:152: if (attrs->rta_type == MPTCP_ATTR_TOKEN)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-153- fprintf(stderr, ",token:%u", *(__u32 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:154: else if (attrs->rta_type == MPTCP_ATTR_FAMILY)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-155- fprintf(stderr, ",family:%u", *(__u16 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:156: else if (attrs->rta_type == MPTCP_ATTR_LOC_ID)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-157- fprintf(stderr, ",loc_id:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:158: else if (attrs->rta_type == MPTCP_ATTR_REM_ID)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-159- fprintf(stderr, ",rem_id:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:160: else if (attrs->rta_type == MPTCP_ATTR_SADDR4) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-161- u_int32_t saddr4 = ntohl(*(__u32 *)RTA_DATA(attrs));
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-165- (saddr4 & 0xFF));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:166: } else if (attrs->rta_type == MPTCP_ATTR_SADDR6) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-167- char buf[INET6_ADDRSTRLEN];
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-171- fprintf(stderr, ",saddr6:%s", buf);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:172: } else if (attrs->rta_type == MPTCP_ATTR_DADDR4) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-173- u_int32_t daddr4 = ntohl(*(__u32 *)RTA_DATA(attrs));
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-177- (daddr4 & 0xFF));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:178: } else if (attrs->rta_type == MPTCP_ATTR_DADDR6) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-179- char buf[INET6_ADDRSTRLEN];
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-183- fprintf(stderr, ",daddr6:%s", buf);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:184: } else if (attrs->rta_type == MPTCP_ATTR_SPORT)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-185- fprintf(stderr, ",sport:%u",
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-186- ntohs(*(__u16 *)RTA_DATA(attrs)));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:187: else if (attrs->rta_type == MPTCP_ATTR_DPORT)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-188- fprintf(stderr, ",dport:%u",
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-189- ntohs(*(__u16 *)RTA_DATA(attrs)));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:190: else if (attrs->rta_type == MPTCP_ATTR_BACKUP)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-191- fprintf(stderr, ",backup:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:192: else if (attrs->rta_type == MPTCP_ATTR_ERROR)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-193- fprintf(stderr, ",error:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:194: else if (attrs->rta_type == MPTCP_ATTR_SERVER_SIDE)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-195- server_side = !!*(__u8 *)RTA_DATA(attrs);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:196: else if (attrs->rta_type == MPTCP_ATTR_FLAGS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-197- __u16 flags = *(__u16 *)RTA_DATA(attrs);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=253=static int genl_parse_getfamily(struct nlmsghdr *nlh, int *pm_family,
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-282- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:283: if (attrs->rta_type == CTRL_ATTR_FAMILY_ID) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-284- *pm_family = *(__u16 *)RTA_DATA(attrs);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-285- got_family = 1;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:286: } else if (attrs->rta_type == CTRL_ATTR_MCAST_GROUPS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-287- grps = RTA_DATA(attrs);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-295- while (RTA_OK(grp, grp_len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:296: if (grp->rta_type == CTRL_ATTR_MCAST_GRP_ID)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-297- *events_mcast_grp = *(__u32 *)RTA_DATA(grp);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:298: else if (grp->rta_type == CTRL_ATTR_MCAST_GRP_NAME &&
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-299- !strcmp(RTA_DATA(grp), MPTCP_PM_EV_GRP_NAME))
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=322=static int resolve_mptcp_pm_netlink(int fd, int *pm_family, int *events_mcast_grp)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-337- namelen = strlen(MPTCP_PM_NAME) + 1;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:338: rta->rta_type = CTRL_ATTR_FAMILY_NAME;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-339- rta->rta_len = RTA_LENGTH(namelen);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=347=int dsf(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-408- addr = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:409: addr->rta_type = NLA_F_NESTED |
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-410- ((arg == 0) ? MPTCP_PM_ATTR_ADDR : MPTCP_PM_ATTR_ADDR_REMOTE);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-417- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:418: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-419- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-421- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:422: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-423- rta->rta_len = RTA_LENGTH(16);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-429- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:430: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-431- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-437- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:438: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-439- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-448- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:449: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-450- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=459=int csf(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-523- addr = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:524: addr->rta_type = NLA_F_NESTED |
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-525- ((arg == 0) ? MPTCP_PM_ATTR_ADDR : MPTCP_PM_ATTR_ADDR_REMOTE);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-532- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:533: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-534- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-536- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:537: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-538- rta->rta_len = RTA_LENGTH(16);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-544- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:545: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-546- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-553- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:554: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-555- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-563- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:564: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-565- rta->rta_len = RTA_LENGTH(1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-571- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:572: rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-573- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-582- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:583: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-584- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=593=int remove_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-619- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:620: rta->rta_type = MPTCP_PM_ATTR_LOC_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-621- rta->rta_len = RTA_LENGTH(1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-629- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:630: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-631- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=642=int announce_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-667- addr = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:668: addr->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-669- addr->rta_len = RTA_LENGTH(0);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-676- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:677: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-678- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-680- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:681: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-682- rta->rta_len = RTA_LENGTH(16);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-688- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:689: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-690- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-701- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:702: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-703- rta->rta_len = RTA_LENGTH(1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-717- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:718: rta->rta_type = MPTCP_PM_ADDR_ATTR_IF_IDX;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-719- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-730- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:731: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-732- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-746- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:747: rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-748- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-758- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:759: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-760- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=769=int add_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-792- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:793: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-794- nest->rta_len = RTA_LENGTH(0);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-800- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:801: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-802- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-804- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:805: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-806- rta->rta_len = RTA_LENGTH(16);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-812- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:813: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-814- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-851- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:852: rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-853- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-861- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:862: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-863- rta->rta_len = RTA_LENGTH(1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-876- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:877: rta->rta_type = MPTCP_PM_ADDR_ATTR_IF_IDX;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-878- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-890- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:891: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-892- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=904=int del_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-931- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:932: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-933- nest->rta_len = RTA_LENGTH(0);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-937- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:938: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-939- rta->rta_len = RTA_LENGTH(1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-947- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:948: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-949- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-951- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:952: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-953- rta->rta_len = RTA_LENGTH(16);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-960- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:961: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-962- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=972=static void print_addr(struct rtattr *attrs, int len)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-980- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:981: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_FAMILY)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-982- memcpy(&family, RTA_DATA(attrs), 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:983: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_PORT)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-984- memcpy(&port, RTA_DATA(attrs), 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:985: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ADDR4) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-986- if (family != AF_INET)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-993- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:994: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ADDR6) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-995- if (family != AF_INET6)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1002- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1003: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ID) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1004- memcpy(&id, RTA_DATA(attrs), 1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1006- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1007: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_FLAGS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1008- memcpy(&flags, RTA_DATA(attrs), 4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1064- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1065: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_IF_IDX) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1066- char name[IF_NAMESIZE], *ret;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1082=static void print_addrs(struct nlmsghdr *nh, int pm_family, int total_len)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1099- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1100: if (attrs->rta_type ==
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1101- (MPTCP_PM_ATTR_ADDR | NLA_F_NESTED))
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1109=int get_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1135- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1136: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1137- nest->rta_len = RTA_LENGTH(0);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1141- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1142: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1143- rta->rta_len = RTA_LENGTH(1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1150- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1151: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1152- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1161=int dump_addrs(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1189- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1190: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1191- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1217=static void print_limits(struct nlmsghdr *nh, int pm_family, int total_len)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1235- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1236: int type = attrs->rta_type;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1237-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1252=int get_set_limits(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1278-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1279: rta->rta_type = MPTCP_PM_ATTR_RCV_ADD_ADDRS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1280- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1284- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1285: rta->rta_type = MPTCP_PM_ATTR_SUBFLOWS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1286- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1348=int set_flags(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1375- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1376: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1377- nest->rta_len = RTA_LENGTH(0);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1386- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1387: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1388- rta->rta_len = RTA_LENGTH(1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1395- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1396: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1397- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1399- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1400: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1401- rta->rta_len = RTA_LENGTH(16);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1408- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1409: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1410- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1444- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1445: rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1446- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1459- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1460: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1461- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1482- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1483: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1484- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1492- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1493: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR_REMOTE;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1494- nest->rta_len = RTA_LENGTH(0);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1500- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1501: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1502- rta->rta_len = RTA_LENGTH(4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1504- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1505: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1506- rta->rta_len = RTA_LENGTH(16);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1513- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1514: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1515- rta->rta_len = RTA_LENGTH(2);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1520- rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1521: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1522- rta->rta_len = RTA_LENGTH(2);
]
|
| 334/6 |
2026/09/07 07:48 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 48604
output: 38
thoughts: 1451
Thoughts: **A Deep Dive into Netlink Attribute Construction and Message Layout**
My current train of thought is centered on the intricacies of constructing Netlink messages, specifically how attributes are appended and the underlying layout of both Generic Netlink and Netlink Route (rtnetlink) messages. I'm essentially dissecting the mechanics of building these kernel-userspace communication packets.
It all begins with the `struct nlattr` (or `struct rtattr`), which is the fundamental building block for any Netlink attribute. I'm keenly aware that to append an attribute, I need to account for its header (`NLA_HDRLEN`) and proper alignment (`NLA_ALIGN`). The structure itself, `struct nlattr`, is straightforward: a 16-bit length (`nla_len`) and a 16-bit type (`nla_type`).
When I need to add a specific attribute, say a `uint32_t`, I'm looking at a function like `nla_put_u32`. The core idea here is to calculate the position where the new attribute will reside, typically at the end of the current Netlink message header (`nlh`). I then populate the `nla_type` and `nla_len` fields. Crucially, `nla_len` needs to include the `NLA_HDRLEN` plus the actual data length. The data itself is then copied into the attribute's data payload. Finally, and this is a critical step, the total message length (`nlh->nlmsg_len`) must be updated, taking into account the aligned size of the newly added attribute. This ensures the message buffer is correctly sized for subsequent attributes or for transmission.
This leads me to a more fundamental question: how do `struct nlmsghdr`, `nlmsg_len`, and the specific protocol headers (like `GENL_HDRLEN` for Generic Netlink) interact with these attributes? I'm verifying the overall message layout.
For Generic Netlink, I recall the structure: it starts with the standard `struct nlmsghdr`. The `nlh->nlmsg_len` is initialized using `NLMSG_LENGTH(GENL_HDRLEN)`, which is essentially `NLMSG_HDRLEN` plus `GENL_HDRLEN`. The `nlmsghdr` fields like `nlmsg_type`, `nlmsg_flags`, `nlmsg_seq`, and `nlmsg_pid` are set according to the specific command and request. Immediately following the `nlmsghdr` is the `struct genlmsghdr`, which contains the command (`cmd`) and version information. The actual Netlink attributes then begin *after* this generic Netlink header. The offset to these attributes is determined by `NLMSG_DATA(nlh) + GENL_HDRLEN`.
When appending an attribute to a Generic Netlink message, the logic is consistent with the general attribute appending process. The `struct nlattr` is placed at the end of the current message data. Its `nla_type` and `nla_len` are set, with `nla_len` being `NLA_HDRLEN` plus the data length. The data is copied, and then `nlh->nlmsg_len` is updated to reflect the addition of this attribute, again using alignment.
A point of clarification I'm revisiting is the exact definition of `NLA_HDRLEN`. I know it's derived from `NLA_ALIGNTO` (typically 4 bytes in Linux) and the `sizeof(struct nlattr)`. Since `sizeof(struct nlattr)` is 4 bytes, and `NLA_ALIGN(4)` is also 4, `NLA_HDRLEN` is indeed 4. `NLA_DATA(nla)` simply points to the memory *after* this 4-byte header. The total size of an attribute, including its header and data, is then `nla->nla_len`, and `NLA_ALIGN(nla->nla_len)` gives its padded, buffer-friendly size. This padded size is what gets added to `nlh->nlmsg_len`.
I'm also examining the Netlink Route (rtnetlink) message layout, which has its own specific header. For example, when dealing with link operations (like setting an interface), the message starts with `struct nlmsghdr`, and then immediately follows `struct ifinfomsg`. The `nlh->nlmsg_len` is initialized with `NLMSG_LENGTH(sizeof(struct ifinfomsg))`. The `nlmsghdr` fields are set as usual, and then `struct ifinfomsg` is populated with details like `ifi_family`, `ifi_index`, `ifi_flags`, and `ifi_change`. Attributes, in this case, follow the `struct ifinfomsg`.
To ensure complete accuracy, I'm cross-referencing my understanding with the source code. Specifically, I'm looking into functions like `do_setlink` within `net/core/rtnetlink.c` to confirm the precise usage of fields like `ifi_flags` and `ifi_change` and how they relate to attribute construction in rtnetlink messages. This direct inspection of the kernel code is crucial for ironing out any subtle nuances.
|
| 335/6 |
2026/09/07 07:48 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:3250 LineCount:40]
Results: map[Contents:3250: }
3251:
3252: if (tb[IFLA_IFALIAS]) {
3253: err = netif_set_alias(dev, nla_data(tb[IFLA_IFALIAS]),
3254: nla_len(tb[IFLA_IFALIAS]));
3255: if (err < 0)
3256: goto errout;
3257: status |= DO_SETLINK_NOTIFY;
3258: }
3259:
3260: if (tb[IFLA_BROADCAST]) {
3261: nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len);
3262: call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
3263: }
3264:
3265: if (ifm->ifi_flags || ifm->ifi_change) {
3266: err = netif_change_flags(dev, rtnl_dev_combine_flags(dev, ifm),
3267: extack);
3268: if (err < 0)
3269: goto errout;
3270: }
3271:
3272: if (tb[IFLA_MASTER]) {
3273: err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]), extack);
3274: if (err)
3275: goto errout;
3276: status |= DO_SETLINK_MODIFIED;
3277: }
3278:
3279: if (tb[IFLA_CARRIER]) {
3280: err = netif_change_carrier(dev, nla_get_u8(tb[IFLA_CARRIER]));
3281: if (err)
3282: goto errout;
3283: status |= DO_SETLINK_MODIFIED;
3284: }
3285:
3286: if (tb[IFLA_TXQLEN]) {
3287: unsigned int value = nla_get_u32(tb[IFLA_TXQLEN]);
3288:
3289: err = netif_change_tx_queue_len(dev, value);
]
|
| 336/6 |
2026/09/07 07:48 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 50718
output: 38
thoughts: 22
Thoughts: **My Thought Process on `rtnl_dev_combine_flags(dev, ifm)`**
Right, so the first thing I'm doing here, as I look at this code, is a deep dive into the `rtnl_dev_combine_flags(dev, ifm)` function. My primary objective is to understand precisely what this function accomplishes when it takes a network device structure (`dev`) and an `ifreq` structure (`ifm`) as input. I need to unravel its behavior to its core. I'm anticipating that this function is involved in reconciling or merging flag information related to a network interface. The name itself, "combine_flags," strongly suggests this. I'll be scrutinizing the code to see *how* it combines them. Is it a simple bitwise OR? Does it prioritize flags from one source over another? Are there specific conditions under which flags are added, removed, or modified? I'm also curious about the interplay between `dev` and `ifm`. `dev` likely represents the current state of the device, perhaps as maintained by the kernel's internal data structures. `ifm`, on the other hand, is often used for interacting with the kernel's netlink interface, typically for user-space requests or reports about network interfaces. So, I'm hypothesizing that `rtnl_dev_combine_flags` is a mechanism to take flag information that might be present in both these contexts and create a unified, consistent representation, or perhaps to update the device's state based on information provided in `ifm`. I'll be looking for specific flag bits and how they are manipulated. Are we talking about standard interface flags like `IFF_UP`, `IFF_RUNNING`, `IFF_BROADCAST`, or are there more specialized flags being handled here? The context of Netlink (`rtnl`) also suggests that this might be related to how the kernel presents interface information to user-space applications, or how user-space applications can request changes to interface flags. I'll be paying close attention to any error handling or return values, as these will tell me about the success or failure of the flag combination process. Ultimately, I want to understand the exact semantic meaning and operational impact of calling this function.
|
| 337/6 |
2026/09/07 07:48 |
tool |
read-file |
0m
Args: map[File:net/core/rtnetlink.c FirstLine:1130 LineCount:20]
Results: map[Contents:1130: static unsigned int rtnl_dev_combine_flags(const struct net_device *dev,
1131: const struct ifinfomsg *ifm)
1132: {
1133: unsigned int flags = ifm->ifi_flags;
1134:
1135: /* bugwards compatibility: ifi_change == 0 is treated as ~0 */
1136: if (ifm->ifi_change)
1137: flags = (flags & ifm->ifi_change) |
1138: (rtnl_dev_get_flags(dev) & ~ifm->ifi_change);
1139:
1140: return flags;
1141: }
1142:
1143: static void copy_rtnl_link_stats(struct rtnl_link_stats *a,
1144: const struct rtnl_link_stats64 *b)
1145: {
1146: a->rx_packets = b->rx_packets;
1147: a->tx_packets = b->tx_packets;
1148: a->rx_bytes = b->rx_bytes;
1149: a->tx_bytes = b->tx_bytes;
]
|
| 338/6 |
2026/09/07 07:48 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 51106
output: 42
thoughts: 241
Thoughts: **My Thought Process Regarding `rtnl_dev_combine_flags` and Interface State**
My initial focus was on understanding the behavior of `rtnl_dev_combine_flags`. I observed that when `ifm->ifi_flags` and `ifm->ifi_change` were both set to `IFF_UP`, the resulting `flags` calculation would effectively force the `IFF_UP` flag in the underlying device's flags (`dev->flags`). This, in turn, I deduced, would trigger a `do_setlink` operation upon receiving an `RTM_SETLINK` or `RTM_NEWLINK` message with the corresponding `ifindex`.
However, this line of thought immediately raised a critical question in my mind: can an interface, specifically `wlan0` in this context, be transitioned to monitor mode while it is already in the `UP` state? This is a practical concern that needs verification.
To address this, my attention shifted to the mac80211 subsystem, as it's the relevant component for wireless interface operations. I decided the next logical step was to investigate the `ieee80211_runtime_change_iftype` function within `net/mac80211/iface.c`. My goal was to ascertain whether this function imposes a requirement for the interface to be in a `DOWN` state before allowing a change in its interface type, such as switching to monitor mode. This would directly answer my preceding question about the feasibility of changing interface types while the interface is `UP`.
|
| 339/6 |
2026/09/07 07:49 |
tool |
read-file |
0m
Args: map[File:net/mac80211/iface.c FirstLine:1980 LineCount:45]
Results: map[Contents:1980: static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
1981: enum nl80211_iftype type)
1982: {
1983: struct ieee80211_local *local = sdata->local;
1984: int ret, err;
1985: enum nl80211_iftype internal_type = type;
1986: bool p2p = false;
1987:
1988: ASSERT_RTNL();
1989:
1990: if (!local->ops->change_interface)
1991: return -EBUSY;
1992:
1993: /* for now, don't support changing while links exist */
1994: if (ieee80211_vif_is_mld(&sdata->vif))
1995: return -EBUSY;
1996:
1997: switch (sdata->vif.type) {
1998: case NL80211_IFTYPE_AP:
1999: if (!list_empty(&sdata->u.ap.vlans))
2000: return -EBUSY;
2001: break;
2002: case NL80211_IFTYPE_STATION:
2003: case NL80211_IFTYPE_ADHOC:
2004: case NL80211_IFTYPE_OCB:
2005: /*
2006: * Could maybe also all others here?
2007: * Just not sure how that interacts
2008: * with the RX/config path e.g. for
2009: * mesh.
2010: */
2011: break;
2012: default:
2013: return -EBUSY;
2014: }
2015:
2016: switch (type) {
2017: case NL80211_IFTYPE_AP:
2018: case NL80211_IFTYPE_STATION:
2019: case NL80211_IFTYPE_ADHOC:
2020: case NL80211_IFTYPE_OCB:
2021: /*
2022: * Could probably support everything
2023: * but here.
2024: */
]
|
| 340/6 |
2026/09/07 07:49 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 52064
output: 31
thoughts: 1979
Thoughts: **My Thought Process on Creating the C Function for Interface Type and Configuration**
Okay, I need to craft a minimal C function that leverages raw netlink sockets to achieve three specific goals for an interface named "wlan0": change its type to monitor mode, bring it up, and set its frequency to 2412 MHz. The prompt explicitly states we can assume the `nl80211` family ID is known.
My first instinct is to break this down into the core netlink operations required.
1. **Changing the Interface Type to Monitor Mode:** This immediately points to the `nl80211` subsystem. I recall that the command to manipulate interface types is `NL80211_CMD_SET_INTERFACE`. This command will need to carry the interface index (`NL80211_ATTR_IFINDEX`) and the desired interface type, which is `NL80211_IFTYPE_MONITOR`.
I then think about the kernel's implementation. I'm looking at `net/mac80211/iface.c` and specifically `runtime_change_iftype`. I notice a potential snag here: the `switch (type)` statement in this function only lists `AP`, `STATION`, `ADHOC`, and `OCB`. It *doesn't* explicitly list `MONITOR`. If the interface is already in use for something else, or if there's some internal state that prevents the change directly, it might return `-EBUSY`. This is a crucial detail to keep in mind.
However, the prompt also mentions that `ip link set dev wlan0 down` is typically done *before* setting the monitor type. This suggests that if the interface is DOWN, the process might be simpler. Looking at the code again, if the interface is DOWN (`!ieee80211_sdata_running(sdata)`), the kernel's `runtime_change_iftype` (or a similar underlying handler) will tear down the old data structure and set up a new one for the requested type (`ieee80211_teardown_sdata(sdata); ieee80211_setup_sdata(sdata, type);`). This confirms that transitioning from a DOWN state is a viable and potentially smoother path.
The question then arises: should my function explicitly bring the interface DOWN first using rtnetlink, or does the prompt's wording imply a direct sequence of three actions starting from the current state? The prompt says: "change the interface type... and set it UP, and set its frequency..." This *could* be interpreted as performing these three actions sequentially without an explicit DOWN operation. If the interface is already down, the DOWN operation would be redundant. If it's up but in a different mode, the `SET_INTERFACE` command *should* handle the transition if the kernel logic supports it, especially if the `runtime_change_iftype` logic correctly handles the transition when the interface is not actively running. Given the prompt's explicit request for three specific actions, I'll stick to those three.
2. **Setting the Interface UP:** This is a standard network configuration task that falls under the purview of rtnetlink. The command for modifying link properties is `RTM_SETLINK` (or `RTM_NEWLINK` with the `ifi_flags` set). I'll need to construct an `struct ifinfomsg` and set the `ifi_index` to the interface's index, and crucially, set `ifi_flags` to `IFF_UP` and `ifi_change` to `IFF_UP` to indicate that only the UP flag is being modified.
3. **Setting the Frequency:** This again falls under `nl80211`. The command to set the operating channel is `NL80211_CMD_SET_CHANNEL`. This command requires the interface index (`NL80211_ATTR_IFINDEX`) and the desired frequency, which is provided via `NL80211_ATTR_WIPHY_FREQ` set to `2412`.
I quickly verify this in the kernel headers and source. `NL80211_CMD_SET_CHANNEL` is indeed the correct command, and it takes `NL80211_ATTR_WIPHY_FREQ`. Looking at `net/wireless/nl80211.c` and the `__nl80211_set_channel` function, it parses the frequency, gets the corresponding channel object, and then uses `cfg80211_set_monitor_channel` (or similar logic for other interface types). Importantly, it seems that just providing the frequency attribute is sufficient for basic channel setting, and it defaults to 20MHz width if not otherwise specified, which is fine for this minimal function.
Now, a critical architectural question: **socket usage**. I know that rtnetlink and generic netlink (which `nl80211` uses) are distinct netlink protocols. `NETLINK_ROUTE` has protocol 0, and `NETLINK_GENERIC` has protocol 16. Therefore, I cannot use a single `socket(AF_NETLINK, SOCK_RAW, ...)` call for both. I will need two separate sockets: one for rtnetlink (`NETLINK_ROUTE`) and one for generic netlink (`NETLINK_GENERIC`).
The prompt mentions "raw netlink sockets," which means I'll be directly constructing netlink messages using standard C structures and sending them via `send()` or `sendto()` on these sockets. I don't need to worry about libraries like `libnl` or `libmnl` here.
One final check regarding sending messages: do I need to `bind()` the sockets explicitly before sending? For netlink, when using `sendto()` with `nl_family = AF_NETLINK` and `nl_pid = 0` (or implicitly 0 if not set), the kernel automatically assigns a unique port ID to the socket. So, explicit binding isn't strictly necessary for sending requests, especially in this context where the kernel will act as the receiver.
So, the plan is:
1. Open a `NETLINK_GENERIC` socket.
2. Construct and send an `NL80211_CMD_SET_INTERFACE` message for `NL80211_IFTYPE_MONITOR`.
3. Open a `NETLINK_ROUTE` socket.
4. Construct and send an `RTM_SETLINK` message to set `IFF_UP`.
5. Go back to the `NETLINK_GENERIC` socket.
6. Construct and send an `NL80211_CMD_SET_CHANNEL` message with `NL80211_ATTR_WIPHY_FREQ` set to 2412.
This sequence directly addresses the three requirements laid out in the prompt. I've considered potential kernel-side issues, confirmed the correct netlink commands and attributes, and addressed the fundamental architectural requirement of using separate sockets for different netlink protocols.
|
| 341/6 |
2026/09/07 07:49 |
tool |
grepper |
0m
Args: map[Expression:netlink_autobind PathPrefix:net/netlink/]
Results: map[Output:net/netlink/af_netlink.c=718=static int netlink_release(struct socket *sock)
--
net/netlink/af_netlink.c-800-
net/netlink/af_netlink.c:801:static int netlink_autobind(struct socket *sock)
net/netlink/af_netlink.c-802-{
--
net/netlink/af_netlink.c=970=static int netlink_bind(struct socket *sock, struct sockaddr_unsized *addr,
--
net/netlink/af_netlink.c-1031- netlink_insert(sk, nladdr->nl_pid) :
net/netlink/af_netlink.c:1032: netlink_autobind(sock);
net/netlink/af_netlink.c-1033- if (err) {
--
net/netlink/af_netlink.c=1058=static int netlink_connect(struct socket *sock, struct sockaddr_unsized *addr,
--
net/netlink/af_netlink.c-1091- if (!READ_ONCE(nlk->bound))
net/netlink/af_netlink.c:1092: err = netlink_autobind(sock);
net/netlink/af_netlink.c-1093-
--
net/netlink/af_netlink.c=1818=static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
--
net/netlink/af_netlink.c-1862- if (!READ_ONCE(nlk->bound)) {
net/netlink/af_netlink.c:1863: err = netlink_autobind(sock);
net/netlink/af_netlink.c-1864- if (err)
]
|
| 342/6 |
2026/09/07 07:49 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 54546
output: 37
thoughts: 1588
Thoughts: **My Thought Process on Crafting the `set_wlan0_monitor` Function**
Okay, let's break down how I'd approach writing this minimal C function to configure the Wi-Fi interface. The core task is to change "wlan0" to monitor mode, bring it up, and set its frequency. I need to do this using raw netlink sockets, which means I'm operating at a fairly low level.
First, I need to recall how netlink messages are structured and sent. I remember that `netlink_sendmsg` has a handy feature: if the socket isn't explicitly bound, it will automatically call `netlink_autobind(sock)`. This is great because it simplifies the connection setup. Also, if I'm sending a message to the kernel and `msg->msg_name` has `nl_pid = 0`, that's the standard way to target the kernel.
The request mentions changing the interface type and setting it up. For interface-related operations, I know there are two primary netlink families to consider: Generic Netlink (often used for protocols like `nl80211`) and rtnetlink (for core network interface management).
Let's consider the interface name: "wlan0". The prompt explicitly states this name. While it's good practice to make functions more flexible by accepting parameters, the prompt implies a specific scenario. However, I'm thinking that it *would* be cleaner to allow the interface name and the `nl80211_family_id` to be passed as parameters. Something like `void set_wlan0_monitor(int nl80211_family_id)` or `void set_wlan0_monitor(const char *ifname, int nl80211_family_id)` seems more robust. I'll lean towards the latter for better reusability, but for this specific prompt, hardcoding "wlan0" might be acceptable if the goal is absolute minimalism for *this exact* task. The prompt *does* say "Assume nl80211 family ID is known," which hints that it might be a known value passed in.
Now, the critical part: error handling and confirmation. When I send a message to the kernel, I want to know if it succeeded. The prompt hints at ACK receiving. If I set the `NLM_F_ACK` flag in `nlmsg_flags`, the kernel is supposed to send back a `struct nlmsgerr`. If `err->error` is 0, it's a success. If it's negative, it corresponds to `-errno`. The alternative is *not* setting `NLM_F_ACK`, in which case `send()` returns, but I don't get any explicit confirmation or error code from the kernel back in userspace. For a "minimal C function," I need to decide if explicitly reading the ACK is part of the minimalism, or if a helper function that *internally* handles sending and checking the ACK would be cleaner. Given the "minimal" requirement and the focus on the core operation, I'll assume the function should *attempt* to get the ACK for proper operation, as just sending and ignoring is risky.
Let's map the required actions to netlink commands and attributes.
**1. Changing Interface Type to Monitor Mode:**
This falls under `nl80211` commands. The command is likely `NL80211_CMD_SET_INTERFACE`. The attributes I'll need are:
* `NL80211_ATTR_IFINDEX`: To identify which interface we're modifying. I'll need to get the `ifindex` for "wlan0". The standard POSIX function `if_nametoindex("wlan0")` from `<net/if.h>` is perfect for this.
* `NL80211_ATTR_IFTYPE`: To specify the new type, which is `NL80211_IFTYPE_MONITOR`.
**2. Setting the Interface UP:**
This is a standard network interface operation and is handled by rtnetlink. The message type would be `RTM_SETLINK` (or `RTM_NEWLINK`). The core structure here is `struct ifinfomsg`.
* `ifi_index`: This will be the `ifindex` I obtained earlier.
* `ifi_flags`: I need to set the `IFF_UP` flag.
* `ifi_change`: To indicate that the flags have changed, I'll likely set this to `IFF_UP` or `0xFFFFFFFF`.
**3. Setting the Frequency:**
This again uses `nl80211`. The command is likely `NL80211_CMD_SET_CHANNEL`. The attributes needed are:
* `NL80211_ATTR_IFINDEX`: Same `ifindex` as before.
* `NL80211_ATTR_WIPHY_FREQ`: To set the frequency to 2412 MHz.
So, I'll need to construct at least two Generic Netlink messages (one for `SET_INTERFACE` and one for `SET_CHANNEL`) and one rtnetlink message (for `SETLINK`). This implies sending multiple messages, or perhaps chaining them if the kernel supports it, but generally, distinct operations mean distinct netlink requests.
Now, I need to be precise about the byte layout for each message.
**Generic Netlink Message Construction (for `NL80211_CMD_SET_INTERFACE` and `NL80211_CMD_SET_CHANNEL`)**
* **`struct nlmsghdr`**:
* `nlmsg_len`: This is crucial. It's the total length of the message, including the `nlmsghdr` itself. It's calculated as `NLMSG_LENGTH(payload_len)`.
* `nlmsg_type`: This will be the `nl80211_family_id`.
* `nlmsg_flags`: `NLM_F_REQUEST | NLM_F_ACK` (for confirmation).
* `nlmsg_seq`: A sequence number, usually incremented for each request.
* `nlmsg_pid`: The process ID of the sender. I can let `netlink_autobind` handle this, or set it to `getpid()`.
* **`struct genlmsghdr`**: This follows the `nlmsghdr`.
* `cmd`: The specific `nl80211` command (e.g., `NL80211_CMD_SET_INTERFACE`).
* `version`: Typically 0.
* `reserved`: Padding, 0.
* **Netlink Attributes (NLA)**: These are encoded as `struct nlattr`.
* For `NL80211_CMD_SET_INTERFACE`:
* `NL80211_ATTR_IFINDEX`: This attribute will contain the `ifindex` as a `uint32_t`. The total size will be `NLA_HDRLEN + sizeof(uint32_t)`.
* `NL80211_ATTR_IFTYPE`: This attribute will contain `NL80211_IFTYPE_MONITOR` as a `uint32_t`. Total size: `NLA_HDRLEN + sizeof(uint32_t)`.
* For `NL80211_CMD_SET_CHANNEL`:
* `NL80211_ATTR_IFINDEX`: Again, the `ifindex`.
* `NL80211_ATTR_WIPHY_FREQ`: This attribute will contain `2412` as a `uint32_t`. Total size: `NLA_HDRLEN + sizeof(uint32_t)`.
**rtnetlink Message Construction (for `RTM_SETLINK`)**
* **`struct nlmsghdr`**: Similar to the generic netlink header, but `nlmsg_type` will be `RTM_SETLINK`.
* `nlmsg_len`: `NLMSG_LENGTH(sizeof(struct ifinfomsg))`.
* `nlmsg_type`: `RTM_SETLINK`.
* `nlmsg_flags`: `NLM_F_REQUEST | NLM_F_ACK`.
* `nlmsg_seq`: Sequence number.
* `nlmsg_pid`: Sender PID.
* **`struct ifinfomsg`**: This is the payload for rtnetlink link operations.
* `ifi_family`: `AF_UNSPEC` is common for link operations.
* `__ifi_pad`: Padding.
* `ifi_type`: Not strictly needed for setting flags, usually 0.
* `ifi_index`: The `ifindex` of the interface.
* `ifi_flags`: `IFF_UP`.
* `ifi_change`: `IFF_UP` or `0xFFFFFFFF` to indicate which flags are being changed.
I'm also thinking about the specific function signature. To keep it "minimal" and focused on the prompt, I'll likely stick to `void set_wlan0_monitor(int nl80211_family_id)`. This assumes "wlan0" is hardcoded.
The process would be:
1. Create a raw netlink socket.
2. Get the `ifindex` for "wlan0".
3. Construct and send the `NL80211_CMD_SET_INTERFACE` message.
4. Receive and check the ACK for the interface type change.
5. Construct and send the `RTM_SETLINK` message to set the interface UP.
6. Receive and check the ACK for the interface UP.
7. Construct and send the `NL80211_CMD_SET_CHANNEL` message.
8. Receive and check the ACK for the channel set.
9. Close the socket.
This detailed breakdown of message structures and the required steps gives me a clear roadmap for writing the function. I'm ensuring I account for all necessary components, from socket creation to message formatting and acknowledgment.
|
| 343/6 |
2026/09/07 07:49 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:net/core/rtnetlink.c Name:ifinfomsg]
Results: map[Fields:[map[Name:ifi_family OffsetBits:0 SizeBits:8] map[Name:__ifi_pad OffsetBits:8 SizeBits:8] map[Name:ifi_type OffsetBits:16 SizeBits:16] map[Name:ifi_index OffsetBits:32 SizeBits:32] map[Name:ifi_flags OffsetBits:64 SizeBits:32] map[Name:ifi_change OffsetBits:96 SizeBits:32]]]
|
| 344/6 |
2026/09/07 07:49 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 56240
output: 41
thoughts: 63
Thoughts: **A Deep Dive into `struct ifinfomsg` and its Size Calculation**
My current line of inquiry is focused on understanding the precise memory footprint of `struct ifinfomsg`. I've just performed a calculation, and my initial finding is that `sizeof(struct ifinfomsg)` appears to be 16 bytes. My breakdown for this conclusion is as follows: I've accounted for the constituent fields, summing their sizes to arrive at 128 bits, which naturally translates to 16 bytes. Specifically, I've added up 8 bytes for one element, another 8 bytes for a second, then 16, 32, 32, and finally another 32 bytes.
Following this, my next logical step is to meticulously examine the layout of `struct genlmsghdr`. This is crucial for confirming the overall structure's integrity and ensuring that my understanding of data alignment and padding is accurate, especially as I'm working with these low-level structures.
|
| 345/6 |
2026/09/07 07:50 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:net/wireless/nl80211.c Name:genlmsghdr]
Results: map[Fields:[map[Name:cmd OffsetBits:0 SizeBits:8] map[Name:version OffsetBits:8 SizeBits:8] map[Name:reserved OffsetBits:16 SizeBits:16]]]
|
| 346/6 |
2026/09/07 07:50 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 56370
output: 38
thoughts: 27
Thoughts: **My Thought Process**
Okay, so I'm thinking about the underlying data structures involved here. I just confirmed that `sizeof(struct genlmsghdr)` evaluates to 4 bytes. This is a foundational piece of information, giving me a concrete size for that particular header. Now, my immediate next step is to delve into the layout of `struct nlattr`. I need to understand its constituent members and how they're arranged in memory, as this will likely impact how I interpret or manipulate data associated with generic netlink attributes.
|
| 347/6 |
2026/09/07 07:50 |
tool |
codesearch-struct-layout |
0m
Args: map[ContextFile:net/wireless/nl80211.c Name:nlattr]
Results: map[Fields:[map[Name:nla_len OffsetBits:0 SizeBits:16] map[Name:nla_type OffsetBits:16 SizeBits:16]]]
|
| 348/6 |
2026/09/07 07:50 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 56460
output: 47
thoughts: 120
Thoughts: **My Thought Process Regarding Netlink Attribute Alignment**
Ah, right, let's dive into this. So, the initial thought is about the size of `struct nlattr`. I know, or at least I'm recalling, that this structure itself, the basic header for any Netlink attribute, is 4 bytes. That's fundamental.
Now, when we're dealing with a `u32` attribute specifically, the picture changes slightly. A `u32` attribute isn't *just* the value. It has its own header, which is typically the `struct nlattr` I just mentioned (4 bytes), and then the actual data payload, which in this case is the `u32` itself, also taking up 4 bytes. So, the total size of a `u32` attribute before any alignment considerations is 4 bytes for the header plus 4 bytes for the value, totaling 8 bytes.
This is where the `NLA_ALIGNTO` macro comes into play, and I'm thinking about how it works. `NLA_ALIGNTO` is generally defined as 4 in the context of Netlink. The `NLA_ALIGN(x)` macro then takes a size `x` and rounds it up to the nearest multiple of `NLA_ALIGNTO`. In this particular scenario, my calculated size is 8 bytes. Since 8 is already a perfect multiple of 4 (which is `NLA_ALIGNTO`), applying the `NLA_ALIGN` macro to 8 results in... well, it's still 8. There's no need for further padding or adjustment; it's already aligned. So, `NLA_ALIGN(8)` correctly evaluates to 8. This means that for a `u32` attribute, its total size in memory, including its header and value, is 8 bytes, and it's already properly aligned according to Netlink's rules.
Following this, I'm making a mental note to verify a couple of things to ensure I'm not misremembering or missing context. I need to confirm the specific values and definitions for `NL80211_IFTYPE_MONITOR` – which is a standard Wi-Fi interface type for monitor mode – and then, critically, I need to look at the `NL80211_ATTR_*` definitions. These are the constants that represent the actual attributes used in the `nl80211` Netlink family. I'll be heading to `include/uapi/linux/nl80211.h` for this. My intention there is to check their definitions to see how they are structured and what data types they are intended to hold, which will solidify my understanding of how these attributes are laid out and, consequently, how their sizes are determined and aligned. It's all about ensuring the underlying data structures are being correctly interpreted and accounted for.
|
| 349/6 |
2026/09/07 07:50 |
tool |
grepper |
0m
Args: map[Expression:NL80211_IFTYPE_MONITOR PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h=3192=enum nl80211_attrs {
--
include/uapi/linux/nl80211.h-3870- * @NL80211_IFTYPE_WDS: wireless distribution interface
include/uapi/linux/nl80211.h:3871: * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
include/uapi/linux/nl80211.h-3872- * @NL80211_IFTYPE_MESH_POINT: mesh point
--
include/uapi/linux/nl80211.h=3893=enum nl80211_iftype {
--
include/uapi/linux/nl80211.h-3899- NL80211_IFTYPE_WDS,
include/uapi/linux/nl80211.h:3900: NL80211_IFTYPE_MONITOR,
include/uapi/linux/nl80211.h-3901- NL80211_IFTYPE_MESH_POINT,
]
|
| 350/6 |
2026/09/07 07:50 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 56925
output: 45
thoughts: 66
Thoughts: **My Thought Process on Understanding NL80211 Attributes**
My immediate inclination is to dive into the specifics of the `nl80211` netlink family, as it's the primary interface for configuring wireless devices in Linux. I know that these netlink attributes are the building blocks for commands and events exchanged between user-space applications and the kernel's wireless subsystem.
Specifically, I want to examine `NL80211_ATTR_IFINDEX`, `NL80211_ATTR_IFTYPE`, and `NL80211_ATTR_WIPHY_FREQ`. My reasoning is that these three attributes are fundamental to describing the context and capabilities of a wireless interface.
* **`NL80211_ATTR_IFINDEX`**: This one is straightforward. I expect it to represent the unique index of a network interface. This is crucial for any operation that needs to target a specific wireless device, whether it's for configuration, status retrieval, or an event related to that interface. Without an interface index, I wouldn't know *which* device I'm dealing with.
* **`NL80211_ATTR_IFTYPE`**: This attribute is key to understanding the role of the interface. Is it an access point (`NL80211_IFTYPE_AP`), a client station (`NL80211_IFTYPE_STATION`), an interface for mesh networking (`NL80211_IFTYPE_MESH_POINT`), or perhaps something else like a monitor mode interface (`NL80211_IFTYPE_MONITOR`)? The type dictates the available operations and behaviors, and therefore, it's essential to know this upfront when processing `nl80211` messages.
* **`NL80211_ATTR_WIPHY_FREQ`**: This attribute is about the radio frequency. Wireless communication happens on specific frequencies. For operations that involve setting up or interacting with a radio link, such as joining a network or configuring a channel, knowing the frequency is paramount. This attribute likely specifies the center frequency for a particular operation or channel.
By inspecting these attributes within `include/uapi/linux/nl80211.h`, I anticipate gaining clarity on how the kernel represents and communicates these core pieces of information. This will allow me to correctly interpret netlink messages and formulate appropriate commands to interact with the wireless stack. It's the first step in understanding the structure and data formats used by `nl80211`, which is foundational for any advanced wireless development or debugging on Linux.
|
| 351/6 |
2026/09/07 07:50 |
tool |
grepper |
0m
Args: map[Expression:NL80211_ATTR_IF PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-353- * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
include/uapi/linux/nl80211.h:354: * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
include/uapi/linux/nl80211.h-355- * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
--
include/uapi/linux/nl80211.h-370- * either a dump request for all interfaces or a specific get with a
include/uapi/linux/nl80211.h:371: * single %NL80211_ATTR_IFINDEX is supported.
include/uapi/linux/nl80211.h-372- * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
include/uapi/linux/nl80211.h:373: * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
include/uapi/linux/nl80211.h-374- * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
include/uapi/linux/nl80211.h:375: * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX,
include/uapi/linux/nl80211.h:376: * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also
include/uapi/linux/nl80211.h-377- * be sent from userspace to request creation of a new virtual interface,
include/uapi/linux/nl80211.h:378: * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and
include/uapi/linux/nl80211.h:379: * %NL80211_ATTR_IFNAME.
include/uapi/linux/nl80211.h-380- * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
include/uapi/linux/nl80211.h:381: * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from
include/uapi/linux/nl80211.h-382- * userspace to request deletion of a virtual interface, then requires
include/uapi/linux/nl80211.h:383: * attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are
include/uapi/linux/nl80211.h-384- * enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS,
--
include/uapi/linux/nl80211.h-428- * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
include/uapi/linux/nl80211.h:429: * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-430- * @NL80211_CMD_SET_STATION: Set station attributes for station identified by
include/uapi/linux/nl80211.h:431: * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-432- * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the
include/uapi/linux/nl80211.h:433: * interface identified by %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-434- * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
include/uapi/linux/nl80211.h-435- * or, if no MAC address given, all stations, on the interface identified
include/uapi/linux/nl80211.h:436: * by %NL80211_ATTR_IFINDEX. For MLD station, MLD address is used in
include/uapi/linux/nl80211.h-437- * %NL80211_ATTR_MAC. %NL80211_ATTR_MGMT_SUBTYPE and
--
include/uapi/linux/nl80211.h-445- * destination %NL80211_ATTR_MAC on the interface identified by
include/uapi/linux/nl80211.h:446: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-447- * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
include/uapi/linux/nl80211.h-448- * destination %NL80211_ATTR_MAC on the interface identified by
include/uapi/linux/nl80211.h:449: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-450- * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by
--
include/uapi/linux/nl80211.h-454- * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
include/uapi/linux/nl80211.h:455: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-456- *
--
include/uapi/linux/nl80211.h-484- * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the
include/uapi/linux/nl80211.h:485: * interface identified by %NL80211_ATTR_IFINDEX
include/uapi/linux/nl80211.h-486- *
include/uapi/linux/nl80211.h-487- * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the
include/uapi/linux/nl80211.h:488: * interface identified by %NL80211_ATTR_IFINDEX
include/uapi/linux/nl80211.h-489- *
include/uapi/linux/nl80211.h-490- * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
include/uapi/linux/nl80211.h:491: * interface is identified with %NL80211_ATTR_IFINDEX and the management
include/uapi/linux/nl80211.h-492- * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be
--
include/uapi/linux/nl80211.h-601- * authentication process.
include/uapi/linux/nl80211.h:602: * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the
include/uapi/linux/nl80211.h-603- * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
--
include/uapi/linux/nl80211.h-724- * a response while being associated to an AP on another channel.
include/uapi/linux/nl80211.h:725: * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
include/uapi/linux/nl80211.h-726- * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
--
include/uapi/linux/nl80211.h-740- * completed prior to expiration of the originally requested duration.
include/uapi/linux/nl80211.h:741: * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the
include/uapi/linux/nl80211.h-742- * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to
--
include/uapi/linux/nl80211.h-747- * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX
include/uapi/linux/nl80211.h:748: * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface
include/uapi/linux/nl80211.h-749- * and @NL80211_ATTR_TX_RATES the set of allowed rates.
--
include/uapi/linux/nl80211.h-817- * and the attributes determining channel width) the given interface
include/uapi/linux/nl80211.h:818: * (identified by %NL80211_ATTR_IFINDEX) shall operate on.
include/uapi/linux/nl80211.h-819- * In case multiple channels are supported by the device, the mechanism
--
include/uapi/linux/nl80211.h-944- * independently of the userspace SME, send this event indicating
include/uapi/linux/nl80211.h:945: * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
include/uapi/linux/nl80211.h-946- * attributes determining channel width. This indication may also be
--
include/uapi/linux/nl80211.h-953- * initiated on our own). It indicates that
include/uapi/linux/nl80211.h:954: * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-955- * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may
--
include/uapi/linux/nl80211.h-1057- * destination %NL80211_ATTR_MAC on the interface identified by
include/uapi/linux/nl80211.h:1058: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-1059- *
--
include/uapi/linux/nl80211.h-1200- * User space should use %NL80211_ATTR_MLD_ADDR as peer's MLD address and
include/uapi/linux/nl80211.h:1201: * interface address identified by %NL80211_ATTR_IFINDEX as self MLD
include/uapi/linux/nl80211.h-1202- * address. User space and host driver to use MLD addresses in RA, TA and
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1780- *
include/uapi/linux/nl80211.h:1781: * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
include/uapi/linux/nl80211.h:1782: * @NL80211_ATTR_IFNAME: network interface name
include/uapi/linux/nl80211.h:1783: * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype
include/uapi/linux/nl80211.h-1784- *
--
include/uapi/linux/nl80211.h-2576- *
include/uapi/linux/nl80211.h:2577: * @NL80211_ATTR_IFTYPE_EXT_CAPA: Nested attribute of the following attributes:
include/uapi/linux/nl80211.h:2578: * %NL80211_ATTR_IFTYPE, %NL80211_ATTR_EXT_CAPA,
include/uapi/linux/nl80211.h-2579- * %NL80211_ATTR_EXT_CAPA_MASK, to specify the extended capabilities and
--
include/uapi/linux/nl80211.h-2789- *
include/uapi/linux/nl80211.h:2790: * @NL80211_ATTR_IFTYPE_AKM_SUITES: nested array attribute, with each entry
include/uapi/linux/nl80211.h-2791- * using attributes from &enum nl80211_iftype_akm_attributes. This
--
include/uapi/linux/nl80211.h=3192=enum nl80211_attrs {
--
include/uapi/linux/nl80211.h-3198-
include/uapi/linux/nl80211.h:3199: NL80211_ATTR_IFINDEX,
include/uapi/linux/nl80211.h:3200: NL80211_ATTR_IFNAME,
include/uapi/linux/nl80211.h:3201: NL80211_ATTR_IFTYPE,
include/uapi/linux/nl80211.h-3202-
--
include/uapi/linux/nl80211.h-3569-
include/uapi/linux/nl80211.h:3570: NL80211_ATTR_IFTYPE_EXT_CAPA,
include/uapi/linux/nl80211.h-3571-
--
include/uapi/linux/nl80211.h-3653-
include/uapi/linux/nl80211.h:3654: NL80211_ATTR_IFTYPE_AKM_SUITES,
include/uapi/linux/nl80211.h-3655-
--
include/uapi/linux/nl80211.h-3797-#define NL80211_ATTR_MESH_PARAMS NL80211_ATTR_MESH_CONFIG
include/uapi/linux/nl80211.h:3798:#define NL80211_ATTR_IFACE_SOCKET_OWNER NL80211_ATTR_SOCKET_OWNER
include/uapi/linux/nl80211.h-3799-#define NL80211_ATTR_SAE_DATA NL80211_ATTR_AUTH_DATA
--
include/uapi/linux/nl80211.h-3888- *
include/uapi/linux/nl80211.h:3889: * These values are used with the %NL80211_ATTR_IFTYPE
include/uapi/linux/nl80211.h-3890- * to set the type of an interface.
--
include/uapi/linux/nl80211.h=7418=enum nl80211_dfs_state {
--
include/uapi/linux/nl80211.h-7428- * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the
include/uapi/linux/nl80211.h:7429: * wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or
include/uapi/linux/nl80211.h-7430- * %NL80211_ATTR_WDEV.
]
|
| 352/6 |
2026/09/07 07:50 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 61483
output: 44
thoughts: 135
Thoughts: **My Thought Process on Analyzing `nl80211` Commands and Attributes**
Okay, so to really get a handle on how these `nl80211` commands are structured and what they're capable of, I need to dive into the definitions themselves. My first instinct is to examine the specific enum values that seem central to setting up and configuring network interfaces and channels. I'm particularly interested in `NL80211_CMD_SET_INTERFACE` and `NL80211_CMD_SET_CHANNEL` because those directly speak to manipulating the network hardware.
Hand-in-hand with those commands, I need to understand the data they operate on. That's where attributes come in, so I'll be scrutinizing `NL80211_ATTR_IFINDEX` and `NL80211_ATTR_IFTYPE`. `IFINDEX` is crucial for identifying *which* interface we're talking about, and `IFTYPE` will tell me *what kind* of interface is being configured or expected. The `NL80211_ATTR_WIPHY_FREQ` attribute is also a key piece of the puzzle, especially when I'm dealing with channel setting, as it clearly defines the frequency we're aiming for.
To get this information, I'll be reading through the definitions for `enum nl80211_commands`, `enum nl80211_attrs`, and `enum nl80211_iftype`. By looking at these enums, I expect to see the actual numerical values assigned to these identifiers, which is fundamental for understanding how they're represented in the netlink messages. Furthermore, I'll pay close attention to `NL80211_IFTYPE_MONITOR`. This specific interface type is of particular interest to me because it implies a passive sniffing capability, which is often a critical component in wireless diagnostics and analysis. Understanding how this type is defined and how it interacts with the other commands and attributes will be a significant part of my overall comprehension.
|
| 353/6 |
2026/09/07 07:50 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/nl80211.h FirstLine:1433 LineCount:20]
Results: map[Contents:1433: enum nl80211_commands {
1434: /* don't change the order or add anything between, this is ABI! */
1435: NL80211_CMD_UNSPEC,
1436:
1437: NL80211_CMD_GET_WIPHY, /* can dump */
1438: NL80211_CMD_SET_WIPHY,
1439: NL80211_CMD_NEW_WIPHY,
1440: NL80211_CMD_DEL_WIPHY,
1441:
1442: NL80211_CMD_GET_INTERFACE, /* can dump */
1443: NL80211_CMD_SET_INTERFACE,
1444: NL80211_CMD_NEW_INTERFACE,
1445: NL80211_CMD_DEL_INTERFACE,
1446:
1447: NL80211_CMD_GET_KEY,
1448: NL80211_CMD_SET_KEY,
1449: NL80211_CMD_NEW_KEY,
1450: NL80211_CMD_DEL_KEY,
1451:
1452: NL80211_CMD_GET_BEACON,
]
|
| 354/6 |
2026/09/07 07:50 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 62026
output: 44
thoughts: 24
Thoughts: **My Thought Process for Investigating `NL80211_CMD_SET_CHANNEL` and Related Enums**
Alright, so I'm delving into the `nl80211` subsystem, and my immediate focus is on how channels are managed. Specifically, I want to understand the mechanics behind setting a channel, which naturally leads me to investigate the `NL80211_CMD_SET_CHANNEL` command.
My first instinct is to explore this command in detail. What are its parameters? What information does it expect to receive, and what kind of feedback can I expect to get back? Is it a simple request to change the operating channel, or does it involve more complex configurations like channel width, power levels, or specific regulatory domain settings? I'm anticipating that this command will be the cornerstone for manipulating the wireless interface's operational frequency.
Beyond the primary command itself, I know that `nl80211` relies heavily on enumerations (enums) to define various states, options, and parameters. Therefore, my next step, intrinsically linked to understanding `NL80211_CMD_SET_CHANNEL`, is to examine related enums. I'm thinking about:
* **Channel Types/Modes:** Are there different enums that specify whether the channel is for 2.4GHz, 5GHz, 6GHz, or perhaps DFS (Dynamic Frequency Selection) channels? Understanding these distinctions is crucial for ensuring I'm setting the channel correctly for the intended band and avoiding potential regulatory issues.
* **Channel Widths:** Modern Wi-Fi utilizes wider channels (20MHz, 40MHz, 80MHz, 160MHz, even 320MHz). I need to find the enums that govern these settings, as `NL80211_CMD_SET_CHANNEL` likely has associated parameters or related commands that control the channel width.
* **Regulatory Domain Information:** While `NL80211_CMD_SET_CHANNEL` might be the direct command, the underlying regulatory domain constraints will heavily influence which channels are permissible and at what power levels. I'll be looking for enums related to country codes, power limits, and channel availability masks.
* **Command Status/Error Codes:** When I send `NL80211_CMD_SET_CHANNEL`, it's vital to understand how the kernel communicates success or failure. I'm expecting to find enums that define common error conditions, such as invalid channel numbers, unsupported channel widths, or regulatory violations.
Essentially, my thought process is to start with the most direct action I want to perform – setting a channel – and then systematically expand my investigation to encompass all the supporting enums and related commands that provide the necessary context and functionality for that action. This layered approach ensures a comprehensive understanding of how channel management is implemented within `nl80211`.
|
| 355/6 |
2026/09/07 07:50 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/nl80211.h FirstLine:1525 LineCount:15]
Results: map[Contents:1525: NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS,
1526:
1527: NL80211_CMD_SET_POWER_SAVE,
1528: NL80211_CMD_GET_POWER_SAVE,
1529:
1530: NL80211_CMD_SET_CQM,
1531: NL80211_CMD_NOTIFY_CQM,
1532:
1533: NL80211_CMD_SET_CHANNEL,
1534: NL80211_CMD_SET_WDS_PEER,
1535:
1536: NL80211_CMD_FRAME_WAIT_CANCEL,
1537:
1538: NL80211_CMD_JOIN_MESH,
1539: NL80211_CMD_LEAVE_MESH,
]
|
| 356/6 |
2026/09/07 07:50 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 62357
output: 44
thoughts: 16
Thoughts: **My Thought Process Regarding `enum nl80211_iftype`**
Alright, the immediate impulse here is to dive into the specifics of the `nl80211_iftype` enumeration. I need to understand the different interface types it defines within the context of `nl80211`, which is the netlink interface for configuring Linux wireless devices. This enum is foundational to how the kernel communicates different wireless operating modes to userspace applications.
My first question is: what are the core roles or functionalities represented by each enumerator? I'm thinking about the fundamental distinctions between, say, an access point, a client station, a mesh point, or perhaps more specialized roles like monitor mode or P2P. I need to ensure I grasp the full spectrum of possibilities and what each type signifies in terms of hardware behavior and network interaction.
Beyond just listing them, I want to understand the implications of selecting a particular `iftype`. For an expert like myself, this isn't just about knowing the names; it's about knowing the constraints and capabilities associated with each. For instance, if I set an interface to `NL80211_IFTYPE_AP`, what are the expected operational parameters? What drivers will support this? What kind of management frames should I anticipate? Conversely, if I'm dealing with `NL80211_IFTYPE_STATION`, I'd be focused on association, scanning, and data transmission to an existing AP.
I also need to consider the lifecycle and transition of these types. Can an interface dynamically change its `iftype`? If so, under what conditions and with what potential side effects? Are there any `iftype` combinations that are mutually exclusive or that might require a device reset or reinitialization? This understanding is crucial for robust network management and debugging.
Furthermore, I should be thinking about how this enum integrates with other `nl80211` commands and attributes. How does the `iftype` influence the available configuration options for a given interface? For example, certain regulatory domain settings or channel selection mechanisms might be inherently tied to the intended operational mode.
Finally, I'll be mentally cross-referencing this with my existing knowledge of wireless standards (802.11 a/b/g/n/ac/ax, etc.) and how `nl80211_iftype` maps to those. Does a specific `iftype` implicitly suggest a certain generation of Wi-Fi or a particular operational domain within the 802.11 framework? This level of detail is what distinguishes a surface-level understanding from a truly deep one.
So, in essence, my thought process is a systematic deconstruction and contextualization of `nl80211_iftype`, moving from a simple list of definitions to a comprehensive understanding of their practical implications, interdependencies, and operational relevance within the Linux wireless stack.
|
| 357/6 |
2026/09/07 07:50 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/nl80211.h FirstLine:3890 LineCount:20]
Results: map[Contents:3890: * to set the type of an interface.
3891: *
3892: */
3893: enum nl80211_iftype {
3894: NL80211_IFTYPE_UNSPECIFIED,
3895: NL80211_IFTYPE_ADHOC,
3896: NL80211_IFTYPE_STATION,
3897: NL80211_IFTYPE_AP,
3898: NL80211_IFTYPE_AP_VLAN,
3899: NL80211_IFTYPE_WDS,
3900: NL80211_IFTYPE_MONITOR,
3901: NL80211_IFTYPE_MESH_POINT,
3902: NL80211_IFTYPE_P2P_CLIENT,
3903: NL80211_IFTYPE_P2P_GO,
3904: NL80211_IFTYPE_P2P_DEVICE,
3905: NL80211_IFTYPE_OCB,
3906: NL80211_IFTYPE_NAN,
3907: NL80211_IFTYPE_NAN_DATA,
3908: NL80211_IFTYPE_PD,
3909:
]
|
| 358/6 |
2026/09/07 07:50 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 62782
output: 44
thoughts: 33
Thoughts: **My Thought Process on `nl80211_attrs`**
Alright, so my immediate impulse, when encountering a query or a problem related to the nl80211 subsystem, is to dive straight into the source. Specifically, I need to get a handle on the fundamental building blocks – the attributes that define the structure and meaning of messages exchanged via netlink. That's why my first port of call is always `include/uapi/linux/nl80211.h`.
Within that header, my focus will be squarely on the `enum nl80211_attrs`. This enumeration is absolutely critical because it defines the various attributes that can be present within nl80211 netlink messages. Think of it as the definitive dictionary for understanding the data being passed around. Each member of this enum corresponds to a specific piece of information – an identifier for a Wi-Fi device, a configuration parameter, a status code, and so on.
By examining `nl80211_attrs`, I'm essentially looking to:
* **Identify the core components:** What are the fundamental pieces of data that nl80211 uses? This includes things like `NL80211_ATTR_WDEV` (for the wireless device), `NL80211_ATTR_IFINDEX` (for the interface index), and any number of other attributes related to BSS information, regulatory domains, specific commands, and so forth.
* **Understand the schema:** This enum, along with the associated structures and how these attributes are packed into netlink messages (often using a TLV-like structure), defines the de facto schema for nl80211 communication. Knowing the attributes is the first step to understanding the *structure* of the information being conveyed.
* **Map concepts to data:** For any given wireless networking concept I'm dealing with – be it scanning, station management, interface configuration, or driver information – I need to know which attribute(s) in `nl80211_attrs` represent that concept in the netlink payload. This is essential for both parsing incoming messages and constructing outgoing ones.
* **Anticipate variations:** I'm also aware that this enum is likely to evolve with kernel versions. So, while I'm checking it now, I also keep in the back of my mind that newer kernel features might introduce new attributes, or that older attributes might be deprecated. This makes it a dynamic but fundamental reference point.
In short, looking at `enum nl80211_attrs` is my way of grounding my understanding in the concrete, definitional elements of the nl80211 protocol. It's where the "what" of the data is defined, and from there, I can build up to the "how" and "why" of its usage.
|
| 359/6 |
2026/09/07 07:51 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/nl80211.h FirstLine:3192 LineCount:20]
Results: map[Contents:3192: enum nl80211_attrs {
3193: /* don't change the order or add anything between, this is ABI! */
3194: NL80211_ATTR_UNSPEC,
3195:
3196: NL80211_ATTR_WIPHY,
3197: NL80211_ATTR_WIPHY_NAME,
3198:
3199: NL80211_ATTR_IFINDEX,
3200: NL80211_ATTR_IFNAME,
3201: NL80211_ATTR_IFTYPE,
3202:
3203: NL80211_ATTR_MAC,
3204:
3205: NL80211_ATTR_KEY_DATA,
3206: NL80211_ATTR_KEY_IDX,
3207: NL80211_ATTR_KEY_CIPHER,
3208: NL80211_ATTR_KEY_SEQ,
3209: NL80211_ATTR_KEY_DEFAULT,
3210:
3211: NL80211_ATTR_BEACON_INTERVAL,
]
|
| 360/6 |
2026/09/07 07:51 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 63190
output: 44
thoughts: 22
Thoughts: **My Thought Process**
I need to examine the `NL80211_ATTR_WIPHY_FREQ` attribute, specifically its index. This is a crucial step in understanding how the wireless device's frequency information is structured and accessed within the nl80211 framework. My goal is to determine its position or identifier within the overall netlink message, which will be essential for correctly parsing and interpreting the data related to the device's supported frequencies.
|
| 361/6 |
2026/09/07 07:51 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/nl80211.h FirstLine:3245 LineCount:10]
Results: map[Contents:3245: NL80211_ATTR_BSS_BASIC_RATES,
3246:
3247: NL80211_ATTR_WIPHY_TXQ_PARAMS,
3248: NL80211_ATTR_WIPHY_FREQ,
3249: NL80211_ATTR_WIPHY_CHANNEL_TYPE,
3250:
3251: NL80211_ATTR_KEY_DEFAULT_MGMT,
3252:
3253: NL80211_ATTR_MGMT_SUBTYPE,
3254: NL80211_ATTR_IE,
]
|
| 362/6 |
2026/09/07 07:51 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 63430
output: 30
thoughts: 2250
Thoughts: **My Thought Process on Netlink Message Construction and Handling**
Alright, let's break down this netlink interaction. I'm trying to figure out the most efficient and robust way to send commands to the kernel via netlink, specifically for wireless interface configuration.
First, I need to identify the specific netlink commands and attributes I'll be using. I've noted down the numerical values:
* `NL80211_CMD_SET_INTERFACE` is command 7.
* `NL80211_CMD_SET_CHANNEL` is command 64.
* `NL80211_IFTYPE_MONITOR` is interface type 6.
* `NL80211_ATTR_IFINDEX` is attribute 3.
* `NL80211_ATTR_IFTYPE` is attribute 5.
* `NL80211_ATTR_WIPHY_FREQ` is attribute 38.
With these constants in hand, my next thought is about how to construct these messages in C. I want something clean, robust, and minimal. This leads me to consider defining C structs that directly mirror the expected netlink message layout.
I looked at a potential generic netlink request structure:
```c
struct genl_req {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256]; // For attributes
};
```
Then, a more specific one for known attributes:
```c
struct nl_req {
struct nlmsghdr n;
struct genlmsghdr g;
struct {
struct nlattr hdr;
uint32_t val;
} attr1;
struct {
struct nlattr hdr;
uint32_t val;
} attr2;
};
```
This immediately brings up a crucial question: is defining an exact C struct for the entire netlink message a valid and standard approach in netlink programming? I need to verify this.
Let's think about the memory layout. If I were to use that `nl_req` struct, how would it lay out?
* `struct nlmsghdr`: 16 bytes.
* `struct genlmsghdr`: 4 bytes.
* The first attribute struct (`attr1`) would be an `nlattr` header (likely 4 bytes) followed by a `uint32_t` value (4 bytes), making it 8 bytes total, with 4-byte alignment.
* The second attribute struct (`attr2`) would be the same: 8 bytes, 4-byte alignment.
So, the total size would be 16 (nlmsghdr) + 4 (genlmsghdr) + 8 (attr1) + 8 (attr2) = 36 bytes. Importantly, all these components seem to align nicely on 4-byte boundaries, suggesting no unexpected padding issues within this specific structure.
The `nlmsghdr` itself would need to be populated correctly:
* `nlmsg_len` should be `sizeof(req)`.
* `nlmsg_type` would be the family ID (in this case, `nl80211_family_id`).
* `nlmsg_flags` would typically be `NLM_F_REQUEST | NLM_F_ACK` if I want a response, or just `NLM_F_REQUEST`.
* `nlmsg_seq` would be an incrementing sequence number.
* `nlmsg_pid` would be the process ID (often 0 for kernel interactions).
Now, I also considered the `rtnetlink` world. For modifying link properties, a structure like this might be used:
```c
struct rtnl_req {
struct nlmsghdr n;
struct ifinfomsg ifi;
};
```
The size here would be 16 bytes (`nlmsghdr`) + 16 bytes (`ifinfomsg`) = 32 bytes. Again, no obvious padding issues.
For `rtnetlink`, I'd set:
* `req.n.nlmsg_len = sizeof(req);`
* `req.n.nlmsg_type = RTM_SETLINK;`
* `req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;`
* And then populate `ifi_family`, `ifi_index` (which I can get using `if_nametoindex()`), `ifi_flags`, and `ifi_change`.
A critical point here: should I use `RTM_SETLINK` or `RTM_NEWLINK`? My understanding from looking at the kernel's `rtnetlink.c` is that `RTM_SETLINK` is the appropriate message type for modifying flags on an *existing* interface, which is exactly what `ip link set dev wlan0 up` does. It calls `rtnl_setlink`, which then calls `netif_change_flags`, precisely what I want.
This naturally leads me to the handling of acknowledgements (ACKs). Is it strictly necessary to check responses? My strong inclination is yes, for robustness. If `NLM_F_ACK` is set in the request flags, the kernel will send back a message with `nlmsg_type = NLMSG_ERROR`.
* If `err->error` within that message is `0`, the operation succeeded.
* If `err->error` is a negative errno code (e.g., `-EBUSY`, `-EINVAL`), it failed.
This means I need a mechanism to send the request and then receive and interpret this ACK. I can envision a small helper function for this. It would involve a `sendto` call, followed by a `recv`, and then parsing the received `nlmsghdr` to check for `NLMSG_ERROR` and its `error` field.
Here's a sketch of what that ACK-checking helper function might look like:
```c
static int nl_send_and_recv_ack(int fd, struct nlmsghdr *n)
{
struct sockaddr_nl sa = { .nl_family = AF_NETLINK };
if (sendto(fd, n, n->nlmsg_len, 0, (struct sockaddr *)&sa, sizeof(sa)) < 0)
return -1; // Indicate send error
char buf[512]; // A reasonable buffer size
ssize_t len = recv(fd, buf, sizeof(buf), 0);
if (len < 0)
return -1; // Indicate receive error
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (len < sizeof(*nlh) || nlh->nlmsg_len < sizeof(*nlh))
return -1; // Malformed header
if (nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (len < NLMSG_LENGTH(sizeof(*err)))
return -1; // Malformed error message
return err->error; // Returns 0 on success, negative errno on failure
}
return 0; // Unexpected message type, treat as success for now? (Or error out)
}
```
This helper seems quite clean. It encapsulates the sending, receiving, and ACK interpretation logic, making the main code much tidier. The core idea is that the kernel's netlink subsystem handles the `NLM_F_ACK` mechanism by sending an `NLMSG_ERROR` message, and my helper just needs to parse that standard response. I'd need to confirm the exact kernel behavior for `NLMSG_ERROR` by looking for `netlink_ack` within the kernel source, but this approach aligns with common netlink patterns.
|
| 363/6 |
2026/09/07 07:51 |
tool |
grepper |
0m
Args: map[Expression:void netlink_ack PathPrefix:net/netlink/]
Results: map[Output:net/netlink/af_netlink.c=2467=EXPORT_SYMBOL(__netlink_dump_start);
net/netlink/af_netlink.c-2468-
net/netlink/af_netlink.c:2469:void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
net/netlink/af_netlink.c-2470- const struct netlink_ext_ack *extack)
]
|
| 364/6 |
2026/09/07 07:51 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 65830
output: 40
thoughts: 24
Thoughts: **My Deep Dive into `netlink_ack`**
Alright, so my immediate thought is to dissect `netlink_ack` within the `net/netlink/af_netlink.c` file. I'm really trying to get to the heart of its functionality and understand precisely how it operates within the Netlink subsystem. My goal here is to grasp its role in the communication flow, particularly how it handles acknowledgments for Netlink messages. I'll be looking for the underlying mechanisms it employs, the data structures it interacts with, and the potential implications of its implementation on system performance and reliability. Ultimately, I want to build a comprehensive mental model of this function's purpose and its place in the broader Netlink ecosystem, ensuring I have a robust understanding as an expert in this domain.
|
| 365/6 |
2026/09/07 07:51 |
tool |
read-file |
0m
Args: map[File:net/netlink/af_netlink.c FirstLine:2469 LineCount:40]
Results: map[Contents:2469: void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
2470: const struct netlink_ext_ack *extack)
2471: {
2472: struct sk_buff *skb;
2473: struct nlmsghdr *rep;
2474: struct nlmsgerr *errmsg;
2475: size_t payload = sizeof(*errmsg);
2476: struct netlink_sock *nlk = nlk_sk(NETLINK_CB(in_skb).sk);
2477: unsigned int flags = 0;
2478: size_t tlvlen;
2479:
2480: /* Error messages get the original request appended, unless the user
2481: * requests to cap the error message, and get extra error data if
2482: * requested.
2483: */
2484: if (err && !test_bit(NETLINK_F_CAP_ACK, &nlk->flags))
2485: payload += nlmsg_len(nlh);
2486: else
2487: flags |= NLM_F_CAPPED;
2488:
2489: tlvlen = netlink_ack_tlv_len(nlk, err, extack);
2490: if (tlvlen)
2491: flags |= NLM_F_ACK_TLVS;
2492:
2493: skb = nlmsg_new(payload + tlvlen, GFP_KERNEL);
2494: if (!skb)
2495: goto err_skb;
2496:
2497: rep = nlmsg_put(skb, NETLINK_CB(in_skb).portid, nlh->nlmsg_seq,
2498: NLMSG_ERROR, sizeof(*errmsg), flags);
2499: if (!rep)
2500: goto err_bad_put;
2501: errmsg = nlmsg_data(rep);
2502: errmsg->error = err;
2503: errmsg->msg = *nlh;
2504:
2505: if (!(flags & NLM_F_CAPPED)) {
2506: if (!nlmsg_append(skb, nlmsg_len(nlh)))
2507: goto err_bad_put;
2508:
]
|
| 366/6 |
2026/09/07 07:52 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 66548
output: 73
thoughts: 6999
Thoughts: **My Thought Process on Achieving the Desired Netlink Operations**
I've been reviewing the requirements for modifying a network interface, specifically "wlan0," to operate in monitor mode, ensure it's up, and set its frequency. This involves a series of precise, low-level operations using Netlink sockets. I'm breaking down my thinking process into understanding the mechanics of Netlink, the specific nl80211 commands, and how to orchestrate them in a robust C function.
First, I'm considering the acknowledgment mechanism in Netlink. The `nlmsg_put` function, when used with `NLMSG_ERROR` and `NLM_F_ACK`, is key. I observe that on success with `NLM_F_ACK`, the `rep->nlmsg_type` will indeed be `NLMSG_ERROR`, and crucially, `errmsg->error` will be 0. Conversely, failures will be indicated by a negative `errno` value in `errmsg->error`. I've confirmed that the payload size, `sizeof(struct nlmsgerr)`, is sufficiently handled by typical buffer sizes like 512 bytes.
A critical practical aspect I'm examining is the state of the interface *before* changing its type. The question is whether the interface *must* be down before switching to monitor mode. My analysis of the `mac80211` driver, specifically `ieee80211_runtime_change_iftype`, reveals that if the interface type is set to `NL80211_IFTYPE_MONITOR` while the interface is UP, it will result in an `-EBUSY` error. This confirms that the interface *should* be brought down first. The prompt, by listing "change the interface type... and set it UP, and set its frequency," implies a sequence where we might need to manage the UP/DOWN state. Bringing the interface down first via rtnetlink, even if it's already down, is a safe and idempotent operation that resolves the `-EBUSY` issue.
Next, I'm focusing on the core Netlink messages required:
1. **Setting the Interface Type to Monitor Mode:** This is handled by a generic Netlink message, specifically `NL80211_CMD_SET_INTERFACE`, using the `NETLINK_GENERIC` socket. It requires specifying the interface index and the `NL80211_IFTYPE_MONITOR` type.
2. **Setting the Interface to UP:** This is a traditional rtnetlink operation, `RTM_SETLINK`, sent over the `NETLINK_ROUTE` socket. We'll set the `IFF_UP` flag.
3. **Setting the Channel Frequency:** This is another generic Netlink message, `NL80211_CMD_SET_CHANNEL`, also over `NETLINK_GENERIC`, specifying the interface index and the desired frequency (2412 MHz).
I'm thinking about how to structure the code for clarity and minimal dependencies. This means avoiding external libraries like libnl and working directly with raw sockets and the necessary kernel headers. I'm verifying all required headers: `<stdio.h>`, `<stdlib.h>`, `<string.h>`, `<unistd.h>`, `<sys/socket.h>`, `<net/if.h>`, `<linux/netlink.h>`, `<linux/rtnetlink.h>`, `<linux/genetlink.h>`, and `<linux/nl80211.h>`. I'm double-checking that constants like `NLA_HDRLEN` and `NLA_ALIGN` are indeed defined in the standard Netlink headers.
To facilitate message construction, I'm designing helper functions. For sending generic Netlink commands with two `uint32_t` attributes, a function like `send_genl_cmd_2u32` seems ideal. This function will encapsulate the creation of `struct nlmsghdr`, `struct genlmsghdr`, and the necessary `struct nlattr`s for attributes like `NL80211_ATTR_IFINDEX`, `NL80211_ATTR_IFTYPE`, and `NL80211_ATTR_WIPHY_FREQ`. Similarly, a `set_link_up` function for rtnetlink operations will handle setting the interface's UP/DOWN state.
I'm carefully examining the structure of these Netlink messages. For instance, when sending `NL80211_CMD_SET_INTERFACE`, the `nlmsg_len` needs to be correctly calculated based on the header sizes and the attributes. My calculation confirms that for two `uint32_t` attributes, a total message length of around 36 bytes is expected after alignment. The `nl_send_and_recv_ack` helper function is crucial here; it sends the message, receives the reply, and crucially, parses the `NLMSG_ERROR` type to return the success (0) or failure (negative errno) code.
The overall execution flow I'm envisioning is:
1. Resolve the interface name "wlan0" to its index using `if_nametoindex`.
2. Open two raw Netlink sockets: one for `NETLINK_GENERIC` and one for `NETLINK_ROUTE`.
3. **Safely bring the interface DOWN:** Use `RTM_SETLINK` with `IFF_UP` set to 0. This is a preparatory step to avoid the `-EBUSY` error.
4. **Change the interface type to monitor mode:** Send `NL80211_CMD_SET_INTERFACE` over `NETLINK_GENERIC`.
5. **Bring the interface UP:** Send `RTM_SETLINK` with `IFF_UP` set to 1 over `NETLINK_ROUTE`.
6. **Set the frequency:** Send `NL80211_CMD_SET_CHANNEL` with the desired frequency over `NETLINK_GENERIC`.
7. Handle potential errors at each step, ensuring sockets are closed and a meaningful return code is provided.
I'm also considering the `nl80211_family_id` which is assumed to be known, so it will be passed as a parameter to the main function. The use of a simple `goto out;` structure helps in cleaning up resources (closing sockets) regardless of where an error occurs.
Finally, I've re-verified all the constants and structure definitions (`struct nlmsghdr`, `struct genlmsghdr`, `struct ifinfomsg`, `struct nlattr`, `struct nlmsgerr`) against the Linux kernel headers to ensure they are standard and correctly interpreted by the C code. This meticulous verification ensures the code is portable and relies only on the standard Linux user-space API.
|
| 367/6 |
2026/09/07 07:52 |
tool |
set-results |
0m
Args: map[Answer:A complete, minimal C implementation using raw Netlink sockets (Generic Netlink for nl80211 commands and RTNetlink for interface state) to configure "wlan0" to monitor mode, bring it UP, and set its frequency to 2412 MHz.]
Results: map[Answer:A complete, minimal C implementation using raw Netlink sockets (Generic Netlink for nl80211 commands and RTNetlink for interface state) to configure "wlan0" to monitor mode, bring it UP, and set its frequency to 2412 MHz.]
|
| 368/4 |
2026/09/07 07:52 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 20106
output: 72
thoughts: 23
Thoughts: **A Moment of Code-Lapse**
My initial thought was one of mild surprise, bordering on mild annoyance: "Wait, the codeexpert didn't give me the code." It seems I was expecting a direct delivery of the requested code, a pre-packaged solution. This expectation, I now realize, was perhaps a bit naive, or at least underspecified in my initial prompt. The realization dawned that the onus was still on me to generate the code, either through my own expertise or by refining my request to elicit the desired output. This leads to a two-pronged strategy: either I apply my existing knowledge to construct the code myself, or I need to re-evaluate how I'm communicating my needs to the expert, to ensure they can provide what I'm looking for.
|
| 369/4 |
2026/09/07 07:52 |
tool |
codeexpert |
3m
Args: map[Question:Provide the C code snippet using raw netlink sockets to change the interface type of "wlan0" to monitor mode (NL80211_IFTYPE_MONITOR) using nl80211. Assume nl80211 family ID is known.]
Results: map[Answer:Below is the complete C code snippet to switch the interface type of "wlan0" to monitor mode (`NL80211_IFTYPE_MONITOR`) using raw netlink sockets and Generic Netlink (`nl80211`):
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
/* Request message structure containing Netlink and nl80211 headers and attributes */
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
/* 1. Resolve network interface index */
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
/* 2. Open raw netlink socket for Generic Netlink */
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
/* 3. Bind socket to local address */
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
local.nl_pid = 0; /* Let kernel assign port ID */
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
/* 4. Construct nl80211 request */
memset(&req, 0, sizeof(req));
/* Netlink header */
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
/* Generic Netlink header */
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
/* NL80211_ATTR_IFINDEX attribute */
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
/* NL80211_ATTR_IFTYPE attribute */
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
/* 5. Send netlink message to kernel */
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
/* 6. Receive ACK / Error response */
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
/* Negative error code in ACK indicates failure (e.g. -EBUSY) */
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
/* Assume nl80211 family ID is known (e.g., resolved beforehand or dynamically) */
uint16_t nl80211_id = 0; /* Replace with your known nl80211 family ID */
if (set_interface_monitor_mode(nl80211_id, "wlan0") == 0) {
printf("Successfully set wlan0 to monitor mode.\n");
}
return 0;
}
```]
|
| 370/5 |
2026/09/07 07:52 |
agent |
codeexpert |
3m
Model:
Results: map[Answer:Below is the complete C code snippet to switch the interface type of "wlan0" to monitor mode (`NL80211_IFTYPE_MONITOR`) using raw netlink sockets and Generic Netlink (`nl80211`):
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
/* Request message structure containing Netlink and nl80211 headers and attributes */
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
/* 1. Resolve network interface index */
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
/* 2. Open raw netlink socket for Generic Netlink */
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
/* 3. Bind socket to local address */
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
local.nl_pid = 0; /* Let kernel assign port ID */
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
/* 4. Construct nl80211 request */
memset(&req, 0, sizeof(req));
/* Netlink header */
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
/* Generic Netlink header */
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
/* NL80211_ATTR_IFINDEX attribute */
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
/* NL80211_ATTR_IFTYPE attribute */
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
/* 5. Send netlink message to kernel */
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
/* 6. Receive ACK / Error response */
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
/* Negative error code in ACK indicates failure (e.g. -EBUSY) */
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
/* Assume nl80211 family ID is known (e.g., resolved beforehand or dynamically) */
uint16_t nl80211_id = 0; /* Replace with your known nl80211 family ID */
if (set_interface_monitor_mode(nl80211_id, "wlan0") == 0) {
printf("Successfully set wlan0 to monitor mode.\n");
}
return 0;
}
```]
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Use tools extensively while researching the question. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Provide the C code snippet using raw netlink sockets to change the interface type of "wlan0" to monitor mode (NL80211_IFTYPE_MONITOR) using nl80211. Assume nl80211 family ID is known.
|
| 371/6 |
2026/09/07 07:52 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 2367
output: 47
thoughts: 186
Thoughts: **My Thought Process on Generating the Netlink Code for Monitor Mode**
Right, so the request is to craft C code, specifically using raw netlink sockets and the `nl80211` framework, to transition a wireless interface, identified as "wlan0", into monitor mode. The prompt also states that the `nl80211` family ID is already established. This is a classic task involving direct kernel interaction for network device configuration.
My immediate inclination is to consult the definitive source: the kernel headers, particularly `include/uapi/linux/nl80211.h`. This is where all the enumerations, command IDs, and attribute definitions reside, forming the contract between userspace applications and the `nl80211` kernel module.
I'll be looking for the specific command that allows modification of interface properties. My intuition points towards something along the lines of `NL80211_CMD_SET_INTERFACE`. This command is the logical candidate for altering an interface's fundamental characteristics, such as its operational mode.
Within this command, I need to identify the attributes that specify *what* is being changed and *how*. For changing the interface type, I'll be searching for an attribute like `NL80211_ATTR_IFTYPE`. This attribute will likely hold the enumeration value representing the desired mode.
The prompt explicitly mentions "monitor mode," which translates to the `NL80211_IFTYPE_MONITOR` enumeration. So, my code will need to construct a netlink message targeting `NL80211_CMD_SET_INTERFACE` and populate it with an `NL80211_ATTR_IFTYPE` attribute set to `NL80211_IFTYPE_MONITOR`.
Furthermore, the command needs to know *which* interface to modify. The prompt specifies "wlan0". While the netlink command might not directly take an interface name string, it will invariably require the interface's index. Therefore, I'll also be looking for an attribute like `NL80211_ATTR_IFINDEX`. This means my process will likely involve a preliminary step (or an assumption that this is handled) to resolve the string name "wlan0" into its corresponding integer interface index.
To facilitate this search and verification, I'll leverage a tool like `grepper` (or a similar command-line text searching utility) on the kernel source tree, specifically targeting the `include/uapi/linux/nl80211.h` file. This allows me to quickly pinpoint the exact definitions and their associated values.
So, the overall strategy is:
1. **Identify the Netlink Command:** Locate `NL80211_CMD_SET_INTERFACE`.
2. **Identify Key Attributes:** Find `NL80211_ATTR_IFTYPE` and `NL80211_ATTR_IFINDEX`.
3. **Determine Enumeration Values:** Confirm `NL80211_IFTYPE_MONITOR`.
4. **Construct the Netlink Message:**
* Set the command to `NL80211_CMD_SET_INTERFACE`.
* Add an attribute for the interface index (obtained from "wlan0").
* Add an attribute for the interface type, setting its value to `NL80211_IFTYPE_MONITOR`.
5. **Handle Socket Operations:** Set up a raw netlink socket, bind it, and send the constructed message to the `nl80211` family. I'll also need to be prepared to receive and parse any acknowledgments or error messages from the kernel.
This systematic approach, starting with the request and moving through the necessary kernel interface definitions, ensures that the generated code is accurate and directly addresses the user's requirement for programmatic interface type modification.
|
| 372/6 |
2026/09/07 07:52 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_INTERFACE PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-371- * single %NL80211_ATTR_IFINDEX is supported.
include/uapi/linux/nl80211.h:372: * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
include/uapi/linux/nl80211.h-373- * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1442- NL80211_CMD_GET_INTERFACE, /* can dump */
include/uapi/linux/nl80211.h:1443: NL80211_CMD_SET_INTERFACE,
include/uapi/linux/nl80211.h-1444- NL80211_CMD_NEW_INTERFACE,
]
|
| 373/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 2877
output: 47
thoughts: 57
Thoughts: **My Thought Process**
Right, so my immediate instinct when dealing with this particular kernel interface, especially concerning wireless networking attributes, is to dive straight into the source. My mental map immediately points me to `include/uapi/linux/nl80211.h`. I know this is the canonical place for Netlink definitions related to nl80211, which is the standard user-space interface for configuring wireless devices in Linux.
I'm specifically interested in how the `IFTYPE` attribute is defined and, more crucially, how the `MONITOR` interface type is represented within that structure. My expectation is that I'll find an enumeration or a set of defines under `NL80211_ATTR_IFTYPE` that will list all possible interface types. I'm betting that `NL80211_IFTYPE_MONITOR` will be one of these specific enumerants.
Therefore, I'm going to navigate my way to approximately line 370 in that header file, as my internal indexing suggests that's a likely vicinity for attribute definitions of this nature. I'll be looking for the definition of `NL80211_ATTR_IFTYPE` and then scanning downwards or around it for `NL80211_IFTYPE_MONITOR` to confirm its presence and its numerical value, which is important for understanding how it's serialized and communicated via Netlink messages. This is a fundamental step in understanding the structure of nl80211 messages and how to interact with the kernel for monitor mode configuration.
|
| 374/6 |
2026/09/07 07:53 |
tool |
grepper |
0m
Args: map[Expression:NL80211_IFTYPE_MONITOR PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h=3192=enum nl80211_attrs {
--
include/uapi/linux/nl80211.h-3870- * @NL80211_IFTYPE_WDS: wireless distribution interface
include/uapi/linux/nl80211.h:3871: * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
include/uapi/linux/nl80211.h-3872- * @NL80211_IFTYPE_MESH_POINT: mesh point
--
include/uapi/linux/nl80211.h=3893=enum nl80211_iftype {
--
include/uapi/linux/nl80211.h-3899- NL80211_IFTYPE_WDS,
include/uapi/linux/nl80211.h:3900: NL80211_IFTYPE_MONITOR,
include/uapi/linux/nl80211.h-3901- NL80211_IFTYPE_MESH_POINT,
]
|
| 375/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 3279
output: 36
thoughts: 42
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_INTERFACE`**
Okay, so my primary objective here is to dive into the nitty-gritty of how the `NL80211_CMD_SET_INTERFACE` command is processed within the Linux kernel's wireless subsystem, specifically focusing on the `net/wireless/nl80211.c` file. My immediate inclination is to trace the execution path for this particular command. I'm particularly interested in understanding the attribute parsing mechanism. When a `NL80211_CMD_SET_INTERFACE` message arrives, it's going to be carrying a set of attributes that describe the desired interface configuration. My goal is to identify *how* the kernel extracts and interprets these attributes. This means I need to locate the relevant function or functions that receive the netlink message, identify the attribute parsing logic (likely involving functions like `nla_parse` or similar), and then understand how those parsed attributes are then used to actually modify the interface's state or configuration. I'm assuming there will be a switch statement or a series of `if` conditions based on the command ID to dispatch the handling, and within that, the attribute parsing will be the critical step for me to understand the specifics of what can be configured and how.
|
| 376/6 |
2026/09/07 07:53 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_INTERFACE PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=4659=static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags,
--
net/wireless/nl80211.c-4670- cmd != NL80211_CMD_DEL_INTERFACE &&
net/wireless/nl80211.c:4671: cmd != NL80211_CMD_SET_INTERFACE);
net/wireless/nl80211.c-4672-
--
net/wireless/nl80211.c=5049=static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-5118- if (change && !err)
net/wireless/nl80211.c:5119: nl80211_notify_iface(rdev, wdev, NL80211_CMD_SET_INTERFACE);
net/wireless/nl80211.c-5120-
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-19748- {
net/wireless/nl80211.c:19749: .cmd = NL80211_CMD_SET_INTERFACE,
net/wireless/nl80211.c-19750- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
]
|
| 377/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 3798
output: 41
thoughts: 39
Thoughts: **My Thought Process Regarding `nl80211_set_interface`**
Alright, so the first thing I'm doing is diving into the kernel source, specifically `net/wireless/nl80211.c`, and I'm homing in on the `nl80211_set_interface` function, aiming for around line 5049. This is where the core logic for configuring wireless interfaces via nl80211 resides, and understanding its internal workings is crucial for my analysis. I need to see how this particular netlink command is parsed, validated, and subsequently translated into actual driver operations. My expectation is that this function will be responsible for handling a variety of interface configuration requests, such as setting operating modes (AP, STA, etc.), changing MAC addresses, or perhaps reconfiguring existing interface parameters. I'm particularly interested in the error handling mechanisms and how invalid requests are rejected.
|
| 378/6 |
2026/09/07 07:53 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:5049 LineCount:40]
Results: map[Contents:5049: static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
5050: {
5051: struct cfg80211_registered_device *rdev = info->user_ptr[0];
5052: struct vif_params params;
5053: int err;
5054: enum nl80211_iftype otype, ntype;
5055: struct net_device *dev = info->user_ptr[1];
5056: struct wireless_dev *wdev = dev->ieee80211_ptr;
5057: u32 radio_mask = 0;
5058: bool change = false;
5059:
5060: memset(¶ms, 0, sizeof(params));
5061:
5062: otype = ntype = dev->ieee80211_ptr->iftype;
5063:
5064: if (info->attrs[NL80211_ATTR_IFTYPE]) {
5065: ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
5066: if (otype != ntype)
5067: change = true;
5068: }
5069:
5070: if (info->attrs[NL80211_ATTR_MESH_ID]) {
5071: if (ntype != NL80211_IFTYPE_MESH_POINT)
5072: return -EINVAL;
5073: if (otype != NL80211_IFTYPE_MESH_POINT)
5074: return -EINVAL;
5075: if (netif_running(dev))
5076: return -EBUSY;
5077:
5078: wdev->u.mesh.id_up_len =
5079: nla_len(info->attrs[NL80211_ATTR_MESH_ID]);
5080: memcpy(wdev->u.mesh.id,
5081: nla_data(info->attrs[NL80211_ATTR_MESH_ID]),
5082: wdev->u.mesh.id_up_len);
5083: }
5084:
5085: if (info->attrs[NL80211_ATTR_4ADDR]) {
5086: params.use_4addr = !!nla_get_u8(info->attrs[NL80211_ATTR_4ADDR]);
5087: change = true;
5088: err = nl80211_valid_4addr(rdev, dev, params.use_4addr, ntype);
]
|
| 379/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 4623
output: 42
thoughts: 120
Thoughts: **My Thought Process Regarding `nl80211_set_interface` Initialization**
My primary focus right now is understanding how the `nl80211_set_interface` function is being initialized and what it expects in terms of input, particularly regarding interface identification. I know that `nl80211_set_interface` fundamentally requires either a direct `NL80211_ATTR_IFINDEX` attribute within the netlink message, or it needs to resolve the interface index through a `genl_info` user pointer. The latter case, where the user pointer is used, *still* necessitates that `NL80211_ATTR_IFINDEX` be present in the netlink message itself when referring to a specific device (`dev`).
This leads me to my next investigative step: I need to meticulously examine how `info->user_ptr[1]` is populated. To do this effectively, I'll be diving into the code paths that precede the actual execution of `nl80211_set_interface`. Specifically, I intend to look into `nl80211_small_ops` and any `pre_doit` handlers associated with `nl80211_set_interface`. By tracing the data flow into `info->user_ptr[1]`, I'll be able to confirm whether the `NL80211_ATTR_IFINDEX` is being correctly set or if there's a potential point of failure in how the interface is being contextually identified for this operation.
|
| 380/6 |
2026/09/07 07:53 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:19748 LineCount:20]
Results: map[Contents:19748: {
19749: .cmd = NL80211_CMD_SET_INTERFACE,
19750: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
19751: .doit = nl80211_set_interface,
19752: .flags = GENL_UNS_ADMIN_PERM,
19753: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV |
19754: NL80211_FLAG_NEED_RTNL),
19755: },
19756: {
19757: .cmd = NL80211_CMD_NEW_INTERFACE,
19758: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
19759: .doit = nl80211_new_interface,
19760: .flags = GENL_UNS_ADMIN_PERM,
19761: .internal_flags =
19762: IFLAGS(NL80211_FLAG_NEED_WIPHY |
19763: NL80211_FLAG_NEED_RTNL |
19764: /* we take the wiphy mutex later ourselves */
19765: NL80211_FLAG_NO_WIPHY_MTX),
19766: },
19767: {
]
|
| 381/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 5191
output: 45
thoughts: 35
Thoughts: **My Thought Process on `NL80211_FLAG_NEED_NETDEV` and `nl80211_pre_doit`**
Alright, so my current focus is on understanding the mechanics of how the `NL80211_FLAG_NEED_NETDEV` flag operates within the `nl80211_pre_doit` function. I need to dissect its role in the broader context of netlink operations related to wireless devices.
My primary objective here is to trace the execution flow when this specific flag is encountered. I want to confirm that `nl80211_pre_doit` correctly identifies when a netdev is a prerequisite for a particular nl80211 command. This likely involves checking if the `nl80211_pre_doit` function is appropriately validating the presence and validity of a network device structure based on this flag.
I'm anticipating that `NL80211_FLAG_NEED_NETDEV` acts as a signal, indicating to the nl80211 subsystem that the subsequent operation is intrinsically tied to a specific network interface. This implies that the system must be able to map the nl80211 command to a concrete `struct net_device` at an early stage, before the actual command logic is executed.
So, I'll be looking for the code path within `nl80211_pre_doit` that specifically checks for `NL80211_FLAG_NEED_NETDEV`. Once that check is positive, I expect to see logic that retrieves or validates the associated network device. This could involve looking up the device based on information provided in the netlink message, perhaps through an index or by a name embedded in the message's attributes.
Furthermore, I'm interested in what happens if this flag is set, but no valid netdev can be found or associated with the request. I'd expect an error to be returned at this pre-execution stage, preventing the invalid operation from proceeding. This early error detection is crucial for robustness and preventing downstream issues.
Essentially, I'm trying to confirm that `nl80211_pre_doit` serves as an intelligent gatekeeper, ensuring that the fundamental requirements for wireless operations, like the existence of a network device, are met *before* delving into the specifics of the command itself. The `NL80211_FLAG_NEED_NETDEV` flag seems to be the key mechanism for enforcing this dependency.
|
| 382/6 |
2026/09/07 07:53 |
tool |
grepper |
0m
Args: map[Expression:NL80211_FLAG_NEED_NETDEV PathPrefix:net/wireless/nl80211.c]
Results: map[Output:net/wireless/nl80211.c=19348=nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-19367-#define NL80211_FLAG_NEED_WIPHY 0x01
net/wireless/nl80211.c:19368:#define NL80211_FLAG_NEED_NETDEV 0x02
net/wireless/nl80211.c-19369-#define NL80211_FLAG_NEED_RTNL 0x04
net/wireless/nl80211.c-19370-#define NL80211_FLAG_CHECK_NETDEV_UP 0x08
net/wireless/nl80211.c:19371:#define NL80211_FLAG_NEED_NETDEV_UP (NL80211_FLAG_NEED_NETDEV |\
net/wireless/nl80211.c-19372- NL80211_FLAG_CHECK_NETDEV_UP)
--
net/wireless/nl80211.c-19388- SELECTOR(__sel, NETDEV, \
net/wireless/nl80211.c:19389: NL80211_FLAG_NEED_NETDEV) \
net/wireless/nl80211.c-19390- SELECTOR(__sel, NETDEV_LINK, \
net/wireless/nl80211.c:19391: NL80211_FLAG_NEED_NETDEV | \
net/wireless/nl80211.c-19392- NL80211_FLAG_MLO_VALID_LINK_ID) \
net/wireless/nl80211.c-19393- SELECTOR(__sel, NETDEV_NO_MLO, \
net/wireless/nl80211.c:19394: NL80211_FLAG_NEED_NETDEV | \
net/wireless/nl80211.c-19395- NL80211_FLAG_MLO_UNSUPPORTED) \
--
net/wireless/nl80211.c-19406- SELECTOR(__sel, NETDEV_RTNL, \
net/wireless/nl80211.c:19407: NL80211_FLAG_NEED_NETDEV | \
net/wireless/nl80211.c-19408- NL80211_FLAG_NEED_RTNL) \
net/wireless/nl80211.c-19409- SELECTOR(__sel, NETDEV_UP, \
net/wireless/nl80211.c:19410: NL80211_FLAG_NEED_NETDEV_UP) \
net/wireless/nl80211.c-19411- SELECTOR(__sel, NETDEV_UP_LINK, \
net/wireless/nl80211.c:19412: NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c-19413- NL80211_FLAG_MLO_VALID_LINK_ID) \
net/wireless/nl80211.c-19414- SELECTOR(__sel, NETDEV_UP_NO_MLO, \
net/wireless/nl80211.c:19415: NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c-19416- NL80211_FLAG_MLO_UNSUPPORTED) \
net/wireless/nl80211.c-19417- SELECTOR(__sel, NETDEV_UP_NO_MLO_CLEAR, \
net/wireless/nl80211.c:19418: NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c-19419- NL80211_FLAG_CLEAR_SKB | \
--
net/wireless/nl80211.c-19421- SELECTOR(__sel, NETDEV_UP_NOTMX, \
net/wireless/nl80211.c:19422: NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c-19423- NL80211_FLAG_NO_WIPHY_MTX) \
net/wireless/nl80211.c-19424- SELECTOR(__sel, NETDEV_UP_NOTMX_MLO, \
net/wireless/nl80211.c:19425: NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c-19426- NL80211_FLAG_NO_WIPHY_MTX | \
--
net/wireless/nl80211.c-19428- SELECTOR(__sel, NETDEV_UP_CLEAR, \
net/wireless/nl80211.c:19429: NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c-19430- NL80211_FLAG_CLEAR_SKB) \
--
net/wireless/nl80211.c=19462=static int nl80211_pre_doit(const struct genl_split_ops *ops,
--
net/wireless/nl80211.c-19484- info->user_ptr[0] = rdev;
net/wireless/nl80211.c:19485: } else if (internal_flags & NL80211_FLAG_NEED_NETDEV ||
net/wireless/nl80211.c-19486- internal_flags & NL80211_FLAG_NEED_WDEV) {
--
net/wireless/nl80211.c-19497-
net/wireless/nl80211.c:19498: if (internal_flags & NL80211_FLAG_NEED_NETDEV) {
net/wireless/nl80211.c-19499- if (!dev) {
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-19752- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19753: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV |
net/wireless/nl80211.c-19754- NL80211_FLAG_NEED_RTNL),
--
net/wireless/nl80211.c-19810- .doit = nl80211_set_beacon,
net/wireless/nl80211.c:19811: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-19812- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-19818- .doit = nl80211_start_ap,
net/wireless/nl80211.c:19819: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-19820- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-19826- .doit = nl80211_stop_ap,
net/wireless/nl80211.c:19827: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-19828- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-19860- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19861: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19862- },
--
net/wireless/nl80211.c-19868- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19869: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19870- },
--
net/wireless/nl80211.c-19875- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19876: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19877- },
--
net/wireless/nl80211.c-19882- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19883: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19884- },
--
net/wireless/nl80211.c-19889- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19890: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19891- },
--
net/wireless/nl80211.c-19896- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19897: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-19898- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-19931- /* can be retrieved by unprivileged users */
net/wireless/nl80211.c:19932: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19933- },
--
net/wireless/nl80211.c-19938- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19939: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19940- },
--
net/wireless/nl80211.c-19964- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19965: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19966- },
--
net/wireless/nl80211.c-19971- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19972: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19973- },
--
net/wireless/nl80211.c-19978- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19979: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-19980- NL80211_FLAG_CLEAR_SKB),
--
net/wireless/nl80211.c-19986- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19987: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-19988- NL80211_FLAG_CLEAR_SKB),
--
net/wireless/nl80211.c-19994- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:19995: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-19996- },
--
net/wireless/nl80211.c-20001- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20002: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20003- },
--
net/wireless/nl80211.c-20008- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20009: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20010- },
--
net/wireless/nl80211.c-20015- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20016: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20017- },
--
net/wireless/nl80211.c-20032- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20033: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20034- NL80211_FLAG_CLEAR_SKB),
--
net/wireless/nl80211.c-20040- .flags = GENL_ADMIN_PERM,
net/wireless/nl80211.c:20041: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20042- NL80211_FLAG_CLEAR_SKB),
--
net/wireless/nl80211.c-20048- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20049: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20050- },
--
net/wireless/nl80211.c-20069- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20070: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20071- NL80211_FLAG_CLEAR_SKB),
--
net/wireless/nl80211.c-20077- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20078: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20079- },
--
net/wireless/nl80211.c-20084- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20085: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20086- },
--
net/wireless/nl80211.c-20107- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20108: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV |
net/wireless/nl80211.c-20109- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20136- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20137: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
net/wireless/nl80211.c-20138- },
--
net/wireless/nl80211.c-20143- /* can be retrieved by unprivileged users */
net/wireless/nl80211.c:20144: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
net/wireless/nl80211.c-20145- },
--
net/wireless/nl80211.c-20150- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20151: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
net/wireless/nl80211.c-20152- },
--
net/wireless/nl80211.c-20157- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20158: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV |
net/wireless/nl80211.c-20159- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20165- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20166: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20167- },
--
net/wireless/nl80211.c-20172- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20173: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20174- },
--
net/wireless/nl80211.c-20179- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20180: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20181- },
--
net/wireless/nl80211.c-20186- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20187: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20188- },
--
net/wireless/nl80211.c-20209- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20210: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20211- NL80211_FLAG_CLEAR_SKB),
--
net/wireless/nl80211.c-20217- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20218: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20219- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20225- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20226: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20227- },
--
net/wireless/nl80211.c-20232- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20233: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
net/wireless/nl80211.c-20234- },
--
net/wireless/nl80211.c-20239- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20240: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20241- },
--
net/wireless/nl80211.c-20253- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20254: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
net/wireless/nl80211.c-20255- },
--
net/wireless/nl80211.c-20328- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20329: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
net/wireless/nl80211.c-20330- },
--
net/wireless/nl80211.c-20335- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20336: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV |
net/wireless/nl80211.c-20337- NL80211_FLAG_MLO_UNSUPPORTED),
--
net/wireless/nl80211.c-20343- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20344: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20345- NL80211_FLAG_NO_WIPHY_MTX |
--
net/wireless/nl80211.c-20357- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20358: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20359- },
--
net/wireless/nl80211.c-20391- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20392: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20393- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20408- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20409: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20410- },
--
net/wireless/nl80211.c-20415- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20416: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20417- NL80211_FLAG_MLO_UNSUPPORTED),
--
net/wireless/nl80211.c-20423- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20424: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20425- },
--
net/wireless/nl80211.c-20430- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20431: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20432- },
--
net/wireless/nl80211.c-20437- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20438: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20439- },
--
net/wireless/nl80211.c-20444- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20445: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
net/wireless/nl80211.c-20446- },
--
net/wireless/nl80211.c-20451- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20452: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20453- NL80211_FLAG_CLEAR_SKB),
--
net/wireless/nl80211.c-20459- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20460: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20461- },
--
net/wireless/nl80211.c-20466- .flags = GENL_ADMIN_PERM,
net/wireless/nl80211.c:20467: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20468- },
--
net/wireless/nl80211.c-20473- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20474: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20475- },
--
net/wireless/nl80211.c-20479- .doit = nl80211_get_ftm_responder_stats,
net/wireless/nl80211.c:20480: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV |
net/wireless/nl80211.c-20481- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20494- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20495: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20496- },
--
net/wireless/nl80211.c-20500- .flags = GENL_ADMIN_PERM,
net/wireless/nl80211.c:20501: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20502- },
--
net/wireless/nl80211.c-20506- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20507: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20508- },
--
net/wireless/nl80211.c-20512- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20513: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV |
net/wireless/nl80211.c-20514- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20528- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20529: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20530- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20536- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20537: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20538- },
--
net/wireless/nl80211.c-20542- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20543: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20544- },
--
net/wireless/nl80211.c-20548- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20549: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20550- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20555- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20556: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20557- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20562- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20563: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20564- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20569- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20570: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c-20571- NL80211_FLAG_MLO_VALID_LINK_ID),
--
net/wireless/nl80211.c-20576- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20577: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20578- },
--
net/wireless/nl80211.c-20582- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20583: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20584- },
--
net/wireless/nl80211.c-20588- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20589: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20590- },
--
net/wireless/nl80211.c-20594- .flags = GENL_UNS_ADMIN_PERM,
net/wireless/nl80211.c:20595: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
net/wireless/nl80211.c-20596- },
]
|
| 383/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 14884
output: 42
thoughts: 41
Thoughts: **A Deep Dive into `nl80211_pre_doit` and Interface Identification**
My current line of inquiry is focused on dissecting the `nl80211_pre_doit` function, specifically to understand the mechanism by which the `NL80211_FLAG_NEED_NETDEV` flag contributes to the precise identification of a network interface. I'm meticulously examining this segment of code to trace the flow of execution and pinpoint how this flag directs the system to the correct netdevice, ensuring that subsequent operations are applied to the intended wireless interface. This is a crucial step in my overall understanding of the nl80211 framework and its interaction with the Linux networking stack.
|
| 384/6 |
2026/09/07 07:53 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:19480 LineCount:40]
Results: map[Contents:19480: if (IS_ERR(rdev)) {
19481: err = PTR_ERR(rdev);
19482: goto out_unlock;
19483: }
19484: info->user_ptr[0] = rdev;
19485: } else if (internal_flags & NL80211_FLAG_NEED_NETDEV ||
19486: internal_flags & NL80211_FLAG_NEED_WDEV) {
19487: wdev = __cfg80211_wdev_from_attrs(NULL, genl_info_net(info),
19488: info->attrs);
19489: if (IS_ERR(wdev)) {
19490: err = PTR_ERR(wdev);
19491: goto out_unlock;
19492: }
19493:
19494: dev = wdev->netdev;
19495: dev_hold(dev);
19496: rdev = wiphy_to_rdev(wdev->wiphy);
19497:
19498: if (internal_flags & NL80211_FLAG_NEED_NETDEV) {
19499: if (!dev) {
19500: err = -EINVAL;
19501: goto out_unlock;
19502: }
19503:
19504: info->user_ptr[1] = dev;
19505: } else {
19506: info->user_ptr[1] = wdev;
19507: }
19508:
19509: if (internal_flags & NL80211_FLAG_CHECK_NETDEV_UP &&
19510: !wdev_running(wdev)) {
19511: err = -ENETDOWN;
19512: goto out_unlock;
19513: }
19514:
19515: info->user_ptr[0] = rdev;
19516: }
19517:
19518: if (internal_flags & NL80211_FLAG_MLO_VALID_LINK_ID) {
19519: struct nlattr *link_id = info->attrs[NL80211_ATTR_MLO_LINK_ID];
]
|
| 385/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 15630
output: 38
thoughts: 20
Thoughts: **My Thought Process on `__cfg80211_wdev_from_attrs`**
Alright, so I'm diving into the kernel code, specifically looking at `__cfg80211_wdev_from_attrs`. My immediate instinct is to understand its purpose and how it fits into the broader picture of wireless device management within the cfg80211 subsystem.
My first question is: what exactly does this function *do*? The name itself gives me a strong hint – `wdev_from_attrs`. This suggests it's about taking some form of attributes and deriving or retrieving a `struct wdev` from them. `struct wdev` is the core representation of a wireless device in cfg80211, so this function likely plays a crucial role in associating incoming configuration or operational data with the correct wireless device context.
What kind of "attributes" are we talking about here? I'm assuming it's likely some kind of key or identifier that uniquely points to a specific `wdev`. This could be a device index, a hardware address, or perhaps some other internal kernel identifier. The "from_attrs" part implies it's not just a direct pointer lookup, but rather a process of resolution.
Given that this is a "private" helper function (indicated by the double underscore `__`), it's probably not intended for direct use by external modules or applications. Instead, it's an internal utility used by other cfg80211 functions. This means its complexity and the way it interacts with other internal data structures are likely tailored for efficiency and correctness within the kernel's wireless stack.
I'm curious about the flow:
1. **Input:** What are the specific arguments passed into `__cfg80211_wdev_from_attrs`? This will be key to understanding *how* it resolves the `wdev`.
2. **Internal Logic:** How does it traverse its internal data structures (e.g., lists, hash tables, arrays) to find the `wdev` corresponding to the provided attributes? Is there error handling involved if the attributes are invalid or don't match any existing `wdev`?
3. **Output:** What does it return? Ideally, it will return a pointer to the `struct wdev`. What happens in error cases? Does it return `NULL`, or perhaps a negative error code?
Understanding this function is likely important for debugging issues related to wireless device initialization, configuration changes, or even operational states where the system needs to correctly identify and interact with a specific wireless interface. It's a foundational piece for ensuring that the right commands and data reach the correct hardware.
|
| 386/6 |
2026/09/07 07:53 |
tool |
grepper |
0m
Args: map[Expression:__cfg80211_wdev_from_attrs PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=67=static struct wireless_dev *
net/wireless/nl80211.c:68:__cfg80211_wdev_from_attrs(struct cfg80211_registered_device *rdev,
net/wireless/nl80211.c-69- struct net *netns, struct nlattr **attrs)
--
net/wireless/nl80211.c=1252=static int nl80211_prepare_wdev_dump(struct netlink_callback *cb,
--
net/wireless/nl80211.c-1278- rtnl_lock();
net/wireless/nl80211.c:1279: *wdev = __cfg80211_wdev_from_attrs(NULL, sock_net(cb->skb->sk),
net/wireless/nl80211.c-1280- attrbuf);
--
net/wireless/nl80211.c-1305- * The first invocation validated the wdev's netns against
net/wireless/nl80211.c:1306: * the caller via __cfg80211_wdev_from_attrs(). The wiphy
net/wireless/nl80211.c-1307- * may have moved netns between dumpit invocations (via
--
net/wireless/nl80211.c=13848=static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-13855-
net/wireless/nl80211.c:13856: wdev = __cfg80211_wdev_from_attrs(rdev, genl_info_net(info),
net/wireless/nl80211.c-13857- info->attrs);
--
net/wireless/nl80211.c=17878=static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-17881- struct wireless_dev *wdev =
net/wireless/nl80211.c:17882: __cfg80211_wdev_from_attrs(rdev, genl_info_net(info),
net/wireless/nl80211.c-17883- info->attrs);
--
net/wireless/nl80211.c=17954=static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
--
net/wireless/nl80211.c-18015-
net/wireless/nl80211.c:18016: *wdev = __cfg80211_wdev_from_attrs(NULL, sock_net(skb->sk), attrbuf);
net/wireless/nl80211.c-18017- if (IS_ERR(*wdev))
--
net/wireless/nl80211.c=19462=static int nl80211_pre_doit(const struct genl_split_ops *ops,
--
net/wireless/nl80211.c-19486- internal_flags & NL80211_FLAG_NEED_WDEV) {
net/wireless/nl80211.c:19487: wdev = __cfg80211_wdev_from_attrs(NULL, genl_info_net(info),
net/wireless/nl80211.c-19488- info->attrs);
]
|
| 387/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 16667
output: 39
thoughts: 27
Thoughts: **My Thought Process on `net/wireless/nl80211.c` Lines 67-100**
Alright, so I'm looking at lines 67 through 100 in `net/wireless/nl80211.c`. My immediate goal here is to understand the *purpose* and *mechanism* of this specific code block. Given my expertise, I'm not just reading it; I'm dissecting it to see how it fits into the broader nl80211 framework and what implications it has for wireless device interaction.
First, I'm scanning the code to identify the function or routine it belongs to. Is this part of a command handler? A data processing path? A setup or teardown sequence? I need to establish its context within the nl80211 subsystem.
Then, I'm focusing on the function calls and data structures being manipulated. What are the key variables being declared or accessed? Are there any calls to other kernel functions, particularly within the netdev subsystem or specific driver interfaces? This will tell me what external dependencies or interactions are happening.
I'm paying close attention to any nl80211-specific attribute parsing or generation. The nl80211 framework is all about these attributes to communicate configuration and status between userspace and the kernel. So, what kind of information is being exchanged here? Is it configuration parameters, event notifications, or status updates? What are the specific attribute types and values being handled? This is crucial for understanding the *what* of the communication.
Furthermore, I'm evaluating the control flow. Are there conditional branches (if/else statements)? Loops? Error handling? This tells me *how* the logic is executed and what different scenarios the code is designed to handle. I'm specifically looking for any error checks and how they are propagated – does it return an error code? Does it log a message?
The lines might also involve interaction with the `cfg80211` core. I'll be looking for calls to `cfg80211` functions that register capabilities, set parameters, or retrieve information from the underlying wireless hardware. This is where the nl80211 event or command actually gets translated into an action at the driver or hardware level.
Finally, I'm considering the *implications* of this code. What does it enable or prevent? What kind of user-space tools or applications would interact with this specific code path? Does it relate to a common wireless operation like scanning, connecting, or setting power management? By understanding the details, I can infer the higher-level functionality and its role in the overall wireless stack.
Essentially, I'm building a mental model of this code segment: its inputs, its processing, its outputs, and its place in the larger system. It's about understanding the *intent* behind these specific lines and how they contribute to the robust operation of wireless networking in Linux.
|
| 388/6 |
2026/09/07 07:53 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:67 LineCount:40]
Results: map[Contents: 67: static struct wireless_dev *
68: __cfg80211_wdev_from_attrs(struct cfg80211_registered_device *rdev,
69: struct net *netns, struct nlattr **attrs)
70: {
71: struct wireless_dev *result = NULL;
72: bool have_ifidx = attrs[NL80211_ATTR_IFINDEX];
73: bool have_wdev_id = attrs[NL80211_ATTR_WDEV];
74: u64 wdev_id = 0;
75: int wiphy_idx = -1;
76: int ifidx = -1;
77:
78: if (!have_ifidx && !have_wdev_id)
79: return ERR_PTR(-EINVAL);
80:
81: if (have_ifidx)
82: ifidx = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
83: if (have_wdev_id) {
84: wdev_id = nla_get_u64(attrs[NL80211_ATTR_WDEV]);
85: wiphy_idx = wdev_id >> 32;
86: }
87:
88: if (rdev) {
89: struct wireless_dev *wdev;
90:
91: lockdep_assert_held(&rdev->wiphy.mtx);
92:
93: list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
94: if (have_ifidx && wdev->netdev &&
95: wdev->netdev->ifindex == ifidx) {
96: result = wdev;
97: break;
98: }
99: if (have_wdev_id && wdev->identifier == (u32)wdev_id) {
100: result = wdev;
101: break;
102: }
103: }
104:
105: return result ?: ERR_PTR(-ENODEV);
106: }
]
|
| 389/6 |
2026/09/07 07:53 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 17351
output: 34
thoughts: 363
Thoughts: **Understanding the `NL80211_CMD_SET_INTERFACE` Command**
My objective is to understand the requirements for sending an `NL80211_CMD_SET_INTERFACE` command via Netlink. My thought process is to break down the command into its constituent parts and verify the underlying structures.
Firstly, I know that this command operates within the Generic Netlink framework. Therefore, I expect a Generic Netlink message. The specific command I need to invoke is `NL80211_CMD_SET_INTERFACE`. I also need the `nl80211` family ID, which the prompt conveniently provides as known.
Next, I need to identify the necessary attributes for this command. Based on my understanding, `NL80211_CMD_SET_INTERFACE` requires two primary attributes:
* `NL80211_ATTR_IFINDEX`: This attribute specifies the interface index. I know it's a `uint32_t` and can be obtained using a function like `if_nametoindex("wlan0")` for a specific wireless interface.
* `NL80211_ATTR_IFTYPE`: This attribute defines the type of interface I want to set. For my current goal, I need to set it to `NL80211_IFTYPE_MONITOR`, also as a `uint32_t`.
To ensure I'm constructing the message correctly, I need to examine the exact structures of the Generic Netlink and Netlink headers. I'll start with the standard Netlink header, which is defined in `<linux/netlink.h>`. The `struct nlmsghdr` contains fields like:
* `nlmsg_len`: The total length of the message.
* `nlmsg_type`: This will be the family ID for Generic Netlink messages.
* `nlmsg_flags`: This is crucial for indicating the type of request, such as `NLM_F_REQUEST` (to send a request) and potentially `NLM_F_ACK` (to request an acknowledgment).
* `nlmsg_seq`: A sequence number for correlating requests and replies.
* `nlmsg_pid`: The process ID of the sender.
Following the Netlink header, I'll look at the Generic Netlink header, defined in `<linux/genetlink.h>`. The `struct genlmsghdr` contains:
* `cmd`: This is where I'll place `NL80211_CMD_SET_INTERFACE`.
* `version`: This specifies the protocol version. For `nl80211`, the version is typically 0 or 1. I need to confirm the exact version expected by `nl80211` in the kernel to ensure compatibility. This is a crucial detail to verify to avoid communication failures.
Therefore, my thought process is to meticulously assemble these components: the Netlink header, the Generic Netlink header with the correct command and version, and finally, the specified attributes (`NL80211_ATTR_IFINDEX` and `NL80211_ATTR_IFTYPE`) populated with the correct values and types. The verification of the `nl80211` version is the final critical step before actual implementation.
|
| 390/6 |
2026/09/07 07:54 |
tool |
grepper |
0m
Args: map[Expression:\.version PathPrefix:net/wireless/nl80211.c]
Results: map[Output:net/wireless/nl80211.c=20611=static struct genl_family nl80211_fam __ro_after_init = {
--
net/wireless/nl80211.c-20613- .hdrsize = 0, /* no private header */
net/wireless/nl80211.c:20614: .version = 1, /* no particular meaning now */
net/wireless/nl80211.c-20615- .maxattr = NL80211_ATTR_MAX,
]
|
| 391/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 17892
output: 34
thoughts: 213
Thoughts: **My Exploration of Netlink Attribute Structure and Formatting**
My immediate goal is to get a solid grasp on the internal structure and formatting of netlink attributes, specifically focusing on `struct nlattr` and `struct rtattr`. I'm pulling up the definition of `struct nlattr` from `<linux/netlink.h>`, and what stands out is its primary components: `nla_len`, a 16-bit unsigned integer indicating the total length of the attribute including its header, and `nla_type`, another 16-bit unsigned integer specifying the attribute's type. I've noted that the actual attribute data immediately follows this header structure. From this, I can deduce that the `nla_len` field is calculated as the size of the `struct nlattr` header itself plus the length of the actual data payload (`data_len`). A crucial detail I've observed is the requirement for attributes within a netlink message to adhere to a specific alignment: `NLA_ALIGN(len)`, which translates to 4-byte alignment achieved by the expression `(len + 3) & ~3`. This ensures efficient processing and proper data handling across different architectures.
Following this line of inquiry, I'm now looking into the various helper macros that are defined around these structures. I intend to grep through `include/uapi/linux/netlink.h` to find definitions for macros like `NLA_HDRLEN`, `NLA_ALIGN`, `NLMSG_ALIGN`, `NLMSG_LENGTH`, and `NLMSG_DATA`. My aim is to understand how these macros abstract away the low-level details of attribute and message construction, making it easier to work with netlink communication. Understanding these macros will be key to programmatically building and parsing netlink messages, ensuring I'm handling lengths, data offsets, and alignment correctly.
|
| 392/6 |
2026/09/07 07:54 |
tool |
grepper |
0m
Args: map[Expression:NLMSG_ PathPrefix:include/uapi/linux/netlink.h]
Results: map[Output:include/uapi/linux/netlink.h=52=struct nlmsghdr {
--
include/uapi/linux/netlink.h-62-#define NLM_F_REQUEST 0x01 /* It is request message. */
include/uapi/linux/netlink.h:63:#define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */
include/uapi/linux/netlink.h-64-#define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */
--
include/uapi/linux/netlink.h-97-
include/uapi/linux/netlink.h:98:#define NLMSG_ALIGNTO 4U
include/uapi/linux/netlink.h:99:#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
include/uapi/linux/netlink.h:100:#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
include/uapi/linux/netlink.h:101:#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)
include/uapi/linux/netlink.h:102:#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
include/uapi/linux/netlink.h:103:#define NLMSG_DATA(nlh) ((void *)(((char *)nlh) + NLMSG_HDRLEN))
include/uapi/linux/netlink.h:104:#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
include/uapi/linux/netlink.h-105- (struct nlmsghdr *)(((char *)(nlh)) + \
include/uapi/linux/netlink.h:106: NLMSG_ALIGN((nlh)->nlmsg_len)))
include/uapi/linux/netlink.h:107:#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
include/uapi/linux/netlink.h-108- (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
include/uapi/linux/netlink.h-109- (nlh)->nlmsg_len <= (len))
include/uapi/linux/netlink.h:110:#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
include/uapi/linux/netlink.h-111-
include/uapi/linux/netlink.h:112:#define NLMSG_NOOP 0x1 /* Nothing. */
include/uapi/linux/netlink.h:113:#define NLMSG_ERROR 0x2 /* Error */
include/uapi/linux/netlink.h:114:#define NLMSG_DONE 0x3 /* End of a dump */
include/uapi/linux/netlink.h:115:#define NLMSG_OVERRUN 0x4 /* Data lost */
include/uapi/linux/netlink.h-116-
include/uapi/linux/netlink.h:117:#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
include/uapi/linux/netlink.h-118-
include/uapi/linux/netlink.h=119=struct nlmsgerr {
--
include/uapi/linux/netlink.h-124- * or the ACK indicates success (error == 0)
include/uapi/linux/netlink.h:125: * message length is aligned with NLMSG_ALIGN()
include/uapi/linux/netlink.h-126- */
--
include/uapi/linux/netlink.h=200=enum nl_mmap_status {
--
include/uapi/linux/netlink.h-207-
include/uapi/linux/netlink.h:208:#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO
include/uapi/linux/netlink.h-209-#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)
]
|
| 393/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 19246
output: 27
thoughts: 36
Thoughts: **A Deep Dive into Netlink Macro Investigations**
My current line of thinking is that I need to thoroughly investigate the `NLA_` macros. To do this effectively, I'll be examining them in two key locations: `include/uapi/linux/netlink.h` and `include/net/netlink.h`. This dual approach is crucial because I anticipate finding different, or at least contextually distinct, definitions and uses of these macros across the user-API and the kernel-internal header files. My goal is to gain a comprehensive understanding of their role, implementation, and potential implications within the Netlink subsystem.
|
| 394/6 |
2026/09/07 07:54 |
tool |
grepper |
0m
Args: map[Expression:#define NLA_ PathPrefix:include/]
Results: map[Output:include/net/netlink.h=177=enum {
--
include/net/netlink.h-202-
include/net/netlink.h:203:#define NLA_TYPE_MAX (__NLA_TYPE_MAX - 1)
include/net/netlink.h-204-
--
include/net/netlink.h=346=struct nla_policy {
--
include/net/netlink.h-388-
include/net/netlink.h:389:#define NLA_POLICY_ETH_ADDR NLA_POLICY_EXACT_LEN(ETH_ALEN)
include/net/netlink.h:390:#define NLA_POLICY_ETH_ADDR_COMPAT NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN)
include/net/netlink.h-391-
--
include/net/netlink.h-395- { .type = NLA_NESTED_ARRAY, .nested_policy = policy, .len = maxattr }
include/net/netlink.h:396:#define NLA_POLICY_NESTED(policy) \
include/net/netlink.h-397- _NLA_POLICY_NESTED(ARRAY_SIZE(policy) - 1, policy)
include/net/netlink.h:398:#define NLA_POLICY_NESTED_ARRAY(policy) \
include/net/netlink.h-399- _NLA_POLICY_NESTED_ARRAY(ARRAY_SIZE(policy) - 1, policy)
include/net/netlink.h:400:#define NLA_POLICY_BITFIELD32(valid) \
include/net/netlink.h-401- { .type = NLA_BITFIELD32, .bitfield32_valid = valid }
--
include/net/netlink.h-411-#define __NLA_ENSURE(condition) BUILD_BUG_ON_ZERO(!(condition))
include/net/netlink.h:412:#define NLA_ENSURE_UINT_TYPE(tp) \
include/net/netlink.h-413- (__NLA_ENSURE(__NLA_IS_UINT_TYPE(tp)) + tp)
include/net/netlink.h:414:#define NLA_ENSURE_UINT_OR_BINARY_TYPE(tp) \
include/net/netlink.h-415- (__NLA_ENSURE(__NLA_IS_UINT_TYPE(tp) || \
--
include/net/netlink.h-417- tp == NLA_BINARY) + tp)
include/net/netlink.h:418:#define NLA_ENSURE_SINT_TYPE(tp) \
include/net/netlink.h-419- (__NLA_ENSURE(__NLA_IS_SINT_TYPE(tp)) + tp)
include/net/netlink.h:420:#define NLA_ENSURE_INT_OR_BINARY_TYPE(tp) \
include/net/netlink.h-421- (__NLA_ENSURE(__NLA_IS_UINT_TYPE(tp) || \
--
include/net/netlink.h-424- tp == NLA_BINARY) + tp)
include/net/netlink.h:425:#define NLA_ENSURE_NO_VALIDATION_PTR(tp) \
include/net/netlink.h-426- (__NLA_ENSURE(tp != NLA_BITFIELD32 && \
--
include/net/netlink.h-430-
include/net/netlink.h:431:#define NLA_POLICY_RANGE(tp, _min, _max) { \
include/net/netlink.h-432- .type = NLA_ENSURE_INT_OR_BINARY_TYPE(tp), \
--
include/net/netlink.h-437-
include/net/netlink.h:438:#define NLA_POLICY_FULL_RANGE(tp, _range) { \
include/net/netlink.h-439- .type = NLA_ENSURE_UINT_OR_BINARY_TYPE(tp), \
--
include/net/netlink.h-443-
include/net/netlink.h:444:#define NLA_POLICY_FULL_RANGE_SIGNED(tp, _range) { \
include/net/netlink.h-445- .type = NLA_ENSURE_SINT_TYPE(tp), \
--
include/net/netlink.h-449-
include/net/netlink.h:450:#define NLA_POLICY_MIN(tp, _min) { \
include/net/netlink.h-451- .type = NLA_ENSURE_INT_OR_BINARY_TYPE(tp), \
--
include/net/netlink.h-455-
include/net/netlink.h:456:#define NLA_POLICY_MAX(tp, _max) { \
include/net/netlink.h-457- .type = NLA_ENSURE_INT_OR_BINARY_TYPE(tp), \
--
include/net/netlink.h-461-
include/net/netlink.h:462:#define NLA_POLICY_MASK(tp, _mask) { \
include/net/netlink.h-463- .type = NLA_ENSURE_UINT_TYPE(tp), \
--
include/net/netlink.h-467-
include/net/netlink.h:468:#define NLA_POLICY_VALIDATE_FN(tp, fn, ...) { \
include/net/netlink.h-469- .type = NLA_ENSURE_NO_VALIDATION_PTR(tp), \
--
include/net/netlink.h-474-
include/net/netlink.h:475:#define NLA_POLICY_EXACT_LEN(_len) NLA_POLICY_RANGE(NLA_BINARY, _len, _len)
include/net/netlink.h:476:#define NLA_POLICY_EXACT_LEN_WARN(_len) { \
include/net/netlink.h-477- .type = NLA_BINARY, \
--
include/net/netlink.h-481-}
include/net/netlink.h:482:#define NLA_POLICY_MIN_LEN(_len) NLA_POLICY_MIN(NLA_BINARY, _len)
include/net/netlink.h:483:#define NLA_POLICY_MAX_LEN(_len) NLA_POLICY_MAX(NLA_BINARY, _len)
include/net/netlink.h-484-
--
include/uapi/linux/netlink.h=229=struct nlattr {
--
include/uapi/linux/netlink.h-243- */
include/uapi/linux/netlink.h:244:#define NLA_F_NESTED (1 << 15)
include/uapi/linux/netlink.h:245:#define NLA_F_NET_BYTEORDER (1 << 14)
include/uapi/linux/netlink.h:246:#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
include/uapi/linux/netlink.h-247-
include/uapi/linux/netlink.h:248:#define NLA_ALIGNTO 4
include/uapi/linux/netlink.h:249:#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
include/uapi/linux/netlink.h:250:#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
include/uapi/linux/netlink.h-251-
]
|
| 395/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 21294
output: 38
thoughts: 27
Thoughts: **My Thought Process**
Okay, so I'm trying to understand something related to Netlink, specifically a generalized Netlink message. My first instinct, given that I'm trying to debug or understand a specific message structure, is to go straight to the source code. My mental model of the system tells me that the definitive definitions for these kernel-level structures, especially those exposed to userspace, will be found within the kernel source tree.
Specifically, I'm looking for the definition of `struct genlmsghdr`. I know that header files are where these definitions live, and given the "gen" prefix, it strongly suggests "generic" or "generalized" Netlink. The `uapi` directory in the kernel source is crucial here. It signifies "user API," meaning these are the headers intended for userspace applications to interact with the kernel. This is important because kernel internal headers might change without notice, but `uapi` headers are generally more stable to maintain compatibility. The `.h` extension confirms it's a header file.
Therefore, the very next step in my thought process is to navigate to `include/uapi/linux/genetlink.h` to examine the definition of `struct genlmsghdr`. This is where I expect to find the exact layout, member types, and offsets of this header, which will be critical for interpreting the raw bytes of a Netlink message related to generic Netlink. It's the foundational step for understanding the message's structure and how to parse it correctly.
|
| 396/6 |
2026/09/07 07:54 |
tool |
grepper |
0m
Args: map[Expression:struct genlmsghdr PathPrefix:include/uapi/linux/genetlink.h]
Results: map[Output:include/uapi/linux/genetlink.h-12-
include/uapi/linux/genetlink.h:13:struct genlmsghdr {
include/uapi/linux/genetlink.h-14- __u8 cmd;
--
include/uapi/linux/genetlink.h-18-
include/uapi/linux/genetlink.h:19:#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
include/uapi/linux/genetlink.h-20-
]
|
| 397/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 21494
output: 38
thoughts: 24
Thoughts: **My Thought Process on Approaching the `genetlink.h` File**
Alright, so the core of my current thinking is focused on understanding the intricacies of Netlink, specifically the `genetlink` interface. My immediate next step is to dive into the source code itself. I need to get my bearings within the `include/uapi/linux/genetlink.h` file, and I'm specifically targeting around line 12. This isn't just a casual glance; I'm looking for the foundational definitions, the constants, the structures that define the very essence of how generic Netlink communication is structured. My expectation is that this section will lay out the fundamental identifiers, perhaps the primary family definitions or key control flags that govern the behavior of the generic Netlink subsystem. This is where the abstract concepts begin to solidify into concrete code, and understanding this early part of the header file is crucial for me to build a comprehensive mental model of how generic Netlink operates.
|
| 398/6 |
2026/09/07 07:54 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/genetlink.h FirstLine:1 LineCount:40]
Results: map[Contents: 1: /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2: #ifndef _UAPI__LINUX_GENERIC_NETLINK_H
3: #define _UAPI__LINUX_GENERIC_NETLINK_H
4:
5: #include <linux/types.h>
6: #include <linux/netlink.h>
7:
8: #define GENL_NAMSIZ 16 /* length of family name */
9:
10: #define GENL_MIN_ID NLMSG_MIN_TYPE
11: #define GENL_MAX_ID 1023
12:
13: struct genlmsghdr {
14: __u8 cmd;
15: __u8 version;
16: __u16 reserved;
17: };
18:
19: #define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
20:
21: #define GENL_ADMIN_PERM 0x01
22: #define GENL_CMD_CAP_DO 0x02
23: #define GENL_CMD_CAP_DUMP 0x04
24: #define GENL_CMD_CAP_HASPOL 0x08
25: #define GENL_UNS_ADMIN_PERM 0x10
26:
27: /*
28: * List of reserved static generic netlink identifiers:
29: */
30: #define GENL_ID_CTRL NLMSG_MIN_TYPE
31: #define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
32: #define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
33: /* must be last reserved + 1 */
34: #define GENL_START_ALLOC (NLMSG_MIN_TYPE + 3)
35:
36: /**************************************************************************
37: * Controller
38: **************************************************************************/
39:
40: enum {
]
|
| 399/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 22145
output: 35
thoughts: 24
Thoughts: **A Deep Dive into `sockaddr_nl` and its Implications**
My current line of inquiry has led me to meticulously examine the `sockaddr_nl` structure, specifically within the `include/uapi/linux/netlink.h` header file. This isn't a casual perusal; I'm undertaking a comprehensive analysis, driven by the need to fully grasp its nuances and how they directly impact my work, which, as you know, is deeply rooted in the intricacies of this domain.
My immediate focus is on the precise definition and layout of `sockaddr_nl`. I need to understand each field, its purpose, and its potential interactions with other system components. This includes, but is not limited to, the `nl_family` field, which dictates the address family (specifically `AF_NETLINK` in this context), and the `nl_pad` and `nl_pid` fields. The `nl_pid` is particularly crucial, as it represents the Netlink process identifier and plays a pivotal role in message routing and identification within the Netlink subsystem.
Furthermore, I'm investigating how this structure is used in practice. This involves tracing its instantiation and usage across various kernel modules and user-space applications that interact with Netlink. I'm paying close attention to how the kernel interprets and populates this structure during Netlink socket operations, such as binding, connecting, and sending/receiving messages. My objective is to identify any subtle behaviors or undocumented aspects that might not be immediately apparent from a static code review.
My analysis is also geared towards understanding the implications of `sockaddr_nl` on system performance and security. Are there any potential pitfalls in how this structure is handled that could lead to vulnerabilities or performance bottlenecks? For instance, understanding the size and alignment of the structure, and how it's serialized and deserialized, is paramount for efficient data transfer and for preventing any unexpected behavior.
Ultimately, my goal is to build a robust and comprehensive understanding of `sockaddr_nl` that allows me to leverage Netlink effectively and confidently in my projects. This deep dive is a necessary step in ensuring that my implementations are not only functional but also optimized and secure, reflecting the high standards I maintain in my field.
|
| 400/6 |
2026/09/07 07:54 |
tool |
grepper |
0m
Args: map[Expression:sockaddr_nl PathPrefix:include/uapi/linux/netlink.h]
Results: map[Output:include/uapi/linux/netlink.h-36-
include/uapi/linux/netlink.h:37:struct sockaddr_nl {
include/uapi/linux/netlink.h-38- __kernel_sa_family_t nl_family; /* AF_NETLINK */
]
|
| 401/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 22275
output: 38
thoughts: 27
Thoughts: **My Thought Process on `struct sockaddr_nl`**
Alright, the immediate next step in my exploration of Netlink internals is to dive into the full definition of `struct sockaddr_nl` as it appears in `include/uapi/linux/netlink.h`. I'm assuming this header file contains the definitive, user-space accessible view of the structure. I need to understand all its members, their types, and their intended purpose to fully grasp how a Netlink socket address is represented. This will be crucial for constructing valid Netlink messages, especially when dealing with peer addresses, port identifiers, and group memberships. Knowing the exact layout and meaning of each field will prevent any misunderstandings and ensure correct implementation when I'm setting up or binding Netlink sockets, or when I'm interpreting received messages.
|
| 402/6 |
2026/09/07 07:54 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/netlink.h FirstLine:35 LineCount:30]
Results: map[Contents: 35: #define MAX_LINKS 32
36:
37: struct sockaddr_nl {
38: __kernel_sa_family_t nl_family; /* AF_NETLINK */
39: unsigned short nl_pad; /* zero */
40: __u32 nl_pid; /* port ID */
41: __u32 nl_groups; /* multicast groups mask */
42: };
43:
44: /**
45: * struct nlmsghdr - fixed format metadata header of Netlink messages
46: * @nlmsg_len: Length of message including header
47: * @nlmsg_type: Message content type
48: * @nlmsg_flags: Additional flags
49: * @nlmsg_seq: Sequence number
50: * @nlmsg_pid: Sending process port ID
51: */
52: struct nlmsghdr {
53: __u32 nlmsg_len;
54: __u16 nlmsg_type;
55: __u16 nlmsg_flags;
56: __u32 nlmsg_seq;
57: __u32 nlmsg_pid;
58: };
59:
60: /* Flags values */
61:
62: #define NLM_F_REQUEST 0x01 /* It is request message. */
63: #define NLM_F_MULTI 0x02 /* Multipart message, terminated by NLMSG_DONE */
64: #define NLM_F_ACK 0x04 /* Reply with ack, with zero or error code */
]
|
| 403/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 22804
output: 46
thoughts: 76
Thoughts: **My Thought Process on Investigating `NL80211_ATTR_IFINDEX`**
Okay, so my primary objective here is to understand the specifics of the `NL80211_ATTR_IFINDEX` attribute within the nl80211 framework. As an expert in this domain, I know that pinpointing the exact definition and usage of such attributes is crucial for effective development and debugging.
My immediate next step is to delve into the source code. Specifically, I need to locate the definition of `NL80211_ATTR_IFINDEX`. I'm confident that this attribute will be declared within the `include/uapi/linux/nl80211.h` header file, as this is the standard location for user-space API definitions related to nl80211.
Once I'm in that file, my focus will be on finding `NL80211_ATTR_IFINDEX`. I anticipate it will be an enumeration member within the `nl80211_attrs` enum. This enum serves as a comprehensive catalog of all possible attributes that can be passed in nl80211 netlink messages, so finding it there will confirm its existence and its assigned numerical identifier. This identifier is key for proper message construction and parsing.
In essence, I'm performing a targeted code lookup to establish the concrete representation and context of this particular attribute, which will allow me to proceed with whatever task requires this knowledge, be it crafting a netlink command, interpreting a received message, or understanding a specific Wi-Fi driver's behavior.
|
| 404/6 |
2026/09/07 07:54 |
tool |
grepper |
0m
Args: map[Expression:NL80211_ATTR_IFINDEX PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-353- * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
include/uapi/linux/nl80211.h:354: * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
include/uapi/linux/nl80211.h-355- * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
--
include/uapi/linux/nl80211.h-370- * either a dump request for all interfaces or a specific get with a
include/uapi/linux/nl80211.h:371: * single %NL80211_ATTR_IFINDEX is supported.
include/uapi/linux/nl80211.h-372- * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
include/uapi/linux/nl80211.h:373: * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
include/uapi/linux/nl80211.h-374- * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
include/uapi/linux/nl80211.h:375: * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX,
include/uapi/linux/nl80211.h-376- * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also
--
include/uapi/linux/nl80211.h-380- * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
include/uapi/linux/nl80211.h:381: * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from
include/uapi/linux/nl80211.h-382- * userspace to request deletion of a virtual interface, then requires
include/uapi/linux/nl80211.h:383: * attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are
include/uapi/linux/nl80211.h-384- * enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS,
--
include/uapi/linux/nl80211.h-428- * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
include/uapi/linux/nl80211.h:429: * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-430- * @NL80211_CMD_SET_STATION: Set station attributes for station identified by
include/uapi/linux/nl80211.h:431: * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-432- * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the
include/uapi/linux/nl80211.h:433: * interface identified by %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-434- * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
include/uapi/linux/nl80211.h-435- * or, if no MAC address given, all stations, on the interface identified
include/uapi/linux/nl80211.h:436: * by %NL80211_ATTR_IFINDEX. For MLD station, MLD address is used in
include/uapi/linux/nl80211.h-437- * %NL80211_ATTR_MAC. %NL80211_ATTR_MGMT_SUBTYPE and
--
include/uapi/linux/nl80211.h-445- * destination %NL80211_ATTR_MAC on the interface identified by
include/uapi/linux/nl80211.h:446: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-447- * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
include/uapi/linux/nl80211.h-448- * destination %NL80211_ATTR_MAC on the interface identified by
include/uapi/linux/nl80211.h:449: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-450- * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by
--
include/uapi/linux/nl80211.h-454- * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
include/uapi/linux/nl80211.h:455: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-456- *
--
include/uapi/linux/nl80211.h-484- * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the
include/uapi/linux/nl80211.h:485: * interface identified by %NL80211_ATTR_IFINDEX
include/uapi/linux/nl80211.h-486- *
include/uapi/linux/nl80211.h-487- * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the
include/uapi/linux/nl80211.h:488: * interface identified by %NL80211_ATTR_IFINDEX
include/uapi/linux/nl80211.h-489- *
include/uapi/linux/nl80211.h-490- * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
include/uapi/linux/nl80211.h:491: * interface is identified with %NL80211_ATTR_IFINDEX and the management
include/uapi/linux/nl80211.h-492- * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be
--
include/uapi/linux/nl80211.h-601- * authentication process.
include/uapi/linux/nl80211.h:602: * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the
include/uapi/linux/nl80211.h-603- * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
--
include/uapi/linux/nl80211.h-724- * a response while being associated to an AP on another channel.
include/uapi/linux/nl80211.h:725: * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
include/uapi/linux/nl80211.h-726- * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
--
include/uapi/linux/nl80211.h-740- * completed prior to expiration of the originally requested duration.
include/uapi/linux/nl80211.h:741: * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the
include/uapi/linux/nl80211.h-742- * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to
--
include/uapi/linux/nl80211.h-747- * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX
include/uapi/linux/nl80211.h:748: * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface
include/uapi/linux/nl80211.h-749- * and @NL80211_ATTR_TX_RATES the set of allowed rates.
--
include/uapi/linux/nl80211.h-817- * and the attributes determining channel width) the given interface
include/uapi/linux/nl80211.h:818: * (identified by %NL80211_ATTR_IFINDEX) shall operate on.
include/uapi/linux/nl80211.h-819- * In case multiple channels are supported by the device, the mechanism
--
include/uapi/linux/nl80211.h-944- * independently of the userspace SME, send this event indicating
include/uapi/linux/nl80211.h:945: * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
include/uapi/linux/nl80211.h-946- * attributes determining channel width. This indication may also be
--
include/uapi/linux/nl80211.h-953- * initiated on our own). It indicates that
include/uapi/linux/nl80211.h:954: * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-955- * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may
--
include/uapi/linux/nl80211.h-1057- * destination %NL80211_ATTR_MAC on the interface identified by
include/uapi/linux/nl80211.h:1058: * %NL80211_ATTR_IFINDEX.
include/uapi/linux/nl80211.h-1059- *
--
include/uapi/linux/nl80211.h-1200- * User space should use %NL80211_ATTR_MLD_ADDR as peer's MLD address and
include/uapi/linux/nl80211.h:1201: * interface address identified by %NL80211_ATTR_IFINDEX as self MLD
include/uapi/linux/nl80211.h-1202- * address. User space and host driver to use MLD addresses in RA, TA and
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1780- *
include/uapi/linux/nl80211.h:1781: * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
include/uapi/linux/nl80211.h-1782- * @NL80211_ATTR_IFNAME: network interface name
--
include/uapi/linux/nl80211.h=3192=enum nl80211_attrs {
--
include/uapi/linux/nl80211.h-3198-
include/uapi/linux/nl80211.h:3199: NL80211_ATTR_IFINDEX,
include/uapi/linux/nl80211.h-3200- NL80211_ATTR_IFNAME,
--
include/uapi/linux/nl80211.h=7418=enum nl80211_dfs_state {
--
include/uapi/linux/nl80211.h-7428- * %NL80211_ATTR_SPLIT_WIPHY_DUMP. Also supported is filtering the
include/uapi/linux/nl80211.h:7429: * wiphy dump by %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFINDEX or
include/uapi/linux/nl80211.h-7430- * %NL80211_ATTR_WDEV.
]
|
| 405/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26405
output: 44
thoughts: 40
Thoughts: **My Thought Process on Navigating the `nl80211_attrs` Enum**
Okay, so my first instinct when diving into a new area of the kernel, especially something as fundamental as wireless networking configuration via netlink, is to orient myself within the core data structures. I know that `nl80211` is the primary Netlink protocol family for this, and within that, the attributes (`attrs`) are crucial for defining the various parameters and commands.
My immediate thought is to locate the definition of these attributes. I recall that header files are typically where these definitions reside, and `include/uapi/linux/nl80211.h` sounds like the most probable place for user-space API definitions related to `nl80211`. The mention of "around line 3192" is a specific hint, suggesting that the `enum nl80211_attrs` is likely to be found in that vicinity.
So, my mental checklist goes:
1. **Identify the key component:** The user is asking about `enum nl80211_attrs`.
2. **Determine the likely location:** User-space kernel API definitions are in `.h` files under `include/uapi/`.
3. **Pinpoint the specific file:** The context points strongly to `linux/nl80211.h`.
4. **Leverage contextual clues:** The "around line 3192" is a strong indicator of where to look within that file.
My objective in looking at this enum is to understand the *structure* and *scope* of the attributes that can be used when communicating with the `nl80211` subsystem. This enum will tell me all the possible pieces of information that can be sent or received, from basic interface details to more complex things like BSS configuration, regulatory domain settings, or even specific command parameters. It's essentially the lexicon for how we describe and configure wireless devices through netlink. By understanding this enum, I'll be able to grasp the granular details of any `nl80211` message.
|
| 406/6 |
2026/09/07 07:54 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/nl80211.h FirstLine:3192 LineCount:25]
Results: map[Contents:3192: enum nl80211_attrs {
3193: /* don't change the order or add anything between, this is ABI! */
3194: NL80211_ATTR_UNSPEC,
3195:
3196: NL80211_ATTR_WIPHY,
3197: NL80211_ATTR_WIPHY_NAME,
3198:
3199: NL80211_ATTR_IFINDEX,
3200: NL80211_ATTR_IFNAME,
3201: NL80211_ATTR_IFTYPE,
3202:
3203: NL80211_ATTR_MAC,
3204:
3205: NL80211_ATTR_KEY_DATA,
3206: NL80211_ATTR_KEY_IDX,
3207: NL80211_ATTR_KEY_CIPHER,
3208: NL80211_ATTR_KEY_SEQ,
3209: NL80211_ATTR_KEY_DEFAULT,
3210:
3211: NL80211_ATTR_BEACON_INTERVAL,
3212: NL80211_ATTR_DTIM_PERIOD,
3213: NL80211_ATTR_BEACON_HEAD,
3214: NL80211_ATTR_BEACON_TAIL,
3215:
3216: NL80211_ATTR_STA_AID,
]
|
| 407/6 |
2026/09/07 07:54 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26911
output: 26
thoughts: 795
Thoughts: **My Thought Process on Generic Netlink Communication**
So, I've been diving into the specifics of how raw Netlink sockets interact with the Generic Netlink framework. My goal is to get a clear picture of the entire communication flow, from setting up the connection to composing and sending a message.
First off, initiating the connection involves creating a raw Netlink socket. I know I'll need `socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC)`. This gives me a file descriptor, `fd`, that's the handle for all subsequent Netlink operations.
Next, there's the matter of binding. While it's not strictly mandatory if I'm only sending requests and don't care about receiving unicast responses, it's still standard practice and good form. I'd use `bind(fd, (struct sockaddr *)&sa, sizeof(sa))` where `sa` is a `struct sockaddr_nl`. A key detail here is setting `sa.nl_family = AF_NETLINK` and `sa.nl_pid = getpid()`. Alternatively, and this is quite convenient, I can set `sa.nl_pid = 0`. In that case, the kernel automatically assigns a port ID, simplifying things on my end.
When it comes to sending a message to a specific Netlink destination, I need to prepare a `struct sockaddr_nl` for the destination address as well. Again, `da.nl_family` will be `AF_NETLINK`.
The core of the communication is the Netlink message itself. I need a buffer that's sufficiently large to hold a `struct nlmsghdr`, a `struct genlmsghdr`, and all the necessary attributes. For instance, if I'm dealing with wireless interfaces, I'll likely need attributes like `NL80211_ATTR_IFINDEX` and `NL80211_ATTR_IFTYPE`, each requiring its header and data.
Let's break down the `struct nlmsghdr`:
* `nlh->nlmsg_len`: This is crucial. It needs to be set to the total length of the message, which includes the `struct genlmsghdr` and any appended attributes. I can calculate this or use macros like `NLMSG_LENGTH`.
* `nlh->nlmsg_type`: For Generic Netlink, this will be the family ID of the Netlink family I'm communicating with (e.g., `nl80211_family_id`).
* `nlh->nlmsg_flags`: I'll typically use `NLM_F_REQUEST` to indicate this is a request message. Adding `NLM_F_ACK` is also very useful because it tells the kernel to send back an acknowledgment or error message, which is essential for robust error handling.
* `nlh->nlmsg_seq`: A sequence number for tracking requests and responses.
* `nlh->nlmsg_pid`: This should match the PID I bound to, or be 0 if the kernel assigned it.
Then comes the `struct genlmsghdr`, which sits within the `nlmsghdr`'s data payload:
* `gnlh->cmd`: This specifies the specific Generic Netlink command I want to execute, such as `NL80211_CMD_SET_INTERFACE`.
* `gnlh->version`: This indicates the version of the Generic Netlink protocol I'm using.
* `gnlh->reserved`: This field is reserved and should be set to 0.
Attributes are appended to the message. I can manually construct these using `struct nlattr`, which has `nla_type` and `nla_len` fields. However, I'm contemplating whether to use helper functions for this or manipulate the buffer directly. I recall seeing helper functions that manage buffer space and align the attributes correctly. The `add_attr` function I'm sketching out involves calculating the required length, checking against the buffer's maximum capacity, and then populating the `nlattr` structure and updating the `nlmsg_len`. I need to make sure I'm using the correct macros like `NLA_LENGTH` and `NLA_DATA` and understand how they are defined and where they come from – whether they're in kernel headers or standard libc ones. This is important for ensuring portability and correct implementation.
|
| 408/6 |
2026/09/07 07:55 |
tool |
grepper |
0m
Error:
Args: map[Expression:NLA_LENGTH PathPrefix:include/]
Results:
|
| 409/6 |
2026/09/07 07:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 27730
output: 26
thoughts: 42
Thoughts: **My Thought Process on Investigating Netlink Initialization**
Okay, so my primary objective here is to understand how Netlink itself is initialized within the kernel, specifically focusing on the data structures and mechanisms that enable its core functionality. I'm thinking about how the system brings up Netlink services and makes them available.
To get a handle on this, I'm going to conduct a targeted search. I'm looking for symbols that are likely to be associated with Netlink's internal data management or its core API. The prefixes `NLA_` and `nla_data` immediately jump out at me as potential candidates. `NLA_` is a common convention for Netlink Attribute related identifiers, and `nla_data` strongly suggests a pointer or a way to access the actual payload of a Netlink message.
My initial hypothesis is that these symbols, if they exist in certain header files, will lead me to the definitions of key Netlink data structures, perhaps something like `struct nlattr` or related structures, and potentially the functions responsible for allocating, manipulating, or parsing these attributes.
The header files I'm choosing to examine are `include/net/netlink.h` and `include/uapi/linux/netlink.h`.
* `include/net/netlink.h`: This file is likely to contain internal kernel implementation details of Netlink. I'm expecting to find data structures, helper functions, and possibly initialization routines that are used within the kernel's networking stack. This is where I anticipate finding the "meat" of how Netlink is managed internally.
* `include/uapi/linux/netlink.h`: This header file is part of the User-space API (UAPI). While it defines structures and constants that user-space applications will use, it also often reflects the underlying kernel structure. Searching here might reveal how the kernel exposes certain aspects of Netlink's data handling to the user space, and how those map back to internal kernel concepts. It's a good cross-reference.
By searching for these specific tokens within these specific files, I aim to quickly pinpoint the relevant code sections. From there, I can then trace the definitions of any structs or functions found, and hopefully understand the foundational data structures and the initialization pathways for Netlink. My goal is to move from these specific symbols to a broader understanding of Netlink's internal workings, particularly how it prepares itself to handle communication.
|
| 410/6 |
2026/09/07 07:55 |
tool |
grepper |
0m
Args: map[Expression:nla_data PathPrefix:include/]
Results: map[Output:include/net/netlink.h-87- * <- nla_len(nla) -> ^
include/net/netlink.h:88: * nla_data(nla)----^ |
include/net/netlink.h-89- * nla_next(nla)-----------------------------'
--
include/net/netlink.h-130- * Attribute Payload Access:
include/net/netlink.h:131: * nla_data(nla) head of attribute payload
include/net/netlink.h-132- * nla_len(nla) length of attribute payload
--
include/net/netlink.h=1276=static inline int nla_type(const struct nlattr *nla)
--
include/net/netlink.h-1281-/**
include/net/netlink.h:1282: * nla_data - head of payload
include/net/netlink.h-1283- * @nla: netlink attribute
include/net/netlink.h-1284- */
include/net/netlink.h:1285:static inline void *nla_data(const struct nlattr *nla)
include/net/netlink.h-1286-{
--
include/net/netlink.h=1335=nla_find_nested(const struct nlattr *nla, int attrtype)
include/net/netlink.h-1336-{
include/net/netlink.h:1337: return nla_find(nla_data(nla), nla_len(nla), attrtype);
include/net/netlink.h-1338-}
--
include/net/netlink.h=1350=static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
--
include/net/netlink.h-1359-
include/net/netlink.h:1360: return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
include/net/netlink.h-1361- NL_VALIDATE_STRICT, extack);
--
include/net/netlink.h=1374=static inline int nla_parse_nested_deprecated(struct nlattr *tb[], int maxtype,
--
include/net/netlink.h-1378-{
include/net/netlink.h:1379: return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
include/net/netlink.h-1380- NL_VALIDATE_LIBERAL, extack);
--
include/net/netlink.h=1732=static inline u32 nla_get_u32(const struct nlattr *nla)
include/net/netlink.h-1733-{
include/net/netlink.h:1734: return *(u32 *) nla_data(nla);
include/net/netlink.h-1735-}
--
include/net/netlink.h=1755=static inline __be32 nla_get_be32(const struct nlattr *nla)
include/net/netlink.h-1756-{
include/net/netlink.h:1757: return *(__be32 *) nla_data(nla);
include/net/netlink.h-1758-}
--
include/net/netlink.h=1779=static inline __le32 nla_get_le32(const struct nlattr *nla)
include/net/netlink.h-1780-{
include/net/netlink.h:1781: return *(__le32 *) nla_data(nla);
include/net/netlink.h-1782-}
--
include/net/netlink.h=1803=static inline u16 nla_get_u16(const struct nlattr *nla)
include/net/netlink.h-1804-{
include/net/netlink.h:1805: return *(u16 *) nla_data(nla);
include/net/netlink.h-1806-}
--
include/net/netlink.h=1826=static inline __be16 nla_get_be16(const struct nlattr *nla)
include/net/netlink.h-1827-{
include/net/netlink.h:1828: return *(__be16 *) nla_data(nla);
include/net/netlink.h-1829-}
--
include/net/netlink.h=1850=static inline __le16 nla_get_le16(const struct nlattr *nla)
include/net/netlink.h-1851-{
include/net/netlink.h:1852: return *(__le16 *) nla_data(nla);
include/net/netlink.h-1853-}
--
include/net/netlink.h=1874=static inline u8 nla_get_u8(const struct nlattr *nla)
include/net/netlink.h-1875-{
include/net/netlink.h:1876: return *(u8 *) nla_data(nla);
include/net/netlink.h-1877-}
--
include/net/netlink.h=1977=static inline __le64 nla_get_le64(const struct nlattr *nla)
include/net/netlink.h-1978-{
include/net/netlink.h:1979: return *(__le64 *) nla_data(nla);
include/net/netlink.h-1980-}
--
include/net/netlink.h=2001=static inline s32 nla_get_s32(const struct nlattr *nla)
include/net/netlink.h-2002-{
include/net/netlink.h:2003: return *(s32 *) nla_data(nla);
include/net/netlink.h-2004-}
--
include/net/netlink.h=2024=static inline s16 nla_get_s16(const struct nlattr *nla)
include/net/netlink.h-2025-{
include/net/netlink.h:2026: return *(s16 *) nla_data(nla);
include/net/netlink.h-2027-}
--
include/net/netlink.h=2047=static inline s8 nla_get_s8(const struct nlattr *nla)
include/net/netlink.h-2048-{
include/net/netlink.h:2049: return *(s8 *) nla_data(nla);
include/net/netlink.h-2050-}
--
include/net/netlink.h=2159=static inline __be32 nla_get_in_addr(const struct nlattr *nla)
include/net/netlink.h-2160-{
include/net/netlink.h:2161: return *(__be32 *) nla_data(nla);
include/net/netlink.h-2162-}
--
include/net/netlink.h=2208=static inline void *nla_memdup_noprof(const struct nlattr *src, gfp_t gfp)
include/net/netlink.h-2209-{
include/net/netlink.h:2210: return kmemdup_noprof(nla_data(src), nla_len(src), gfp);
include/net/netlink.h-2211-}
--
include/net/netlink.h=2330=static inline int __nla_validate_nested(const struct nlattr *start, int maxtype,
--
include/net/netlink.h-2334-{
include/net/netlink.h:2335: return __nla_validate(nla_data(start), nla_len(start), maxtype, policy,
include/net/netlink.h-2336- validate, extack);
--
include/net/netlink.h=2349=nla_validate_nested_deprecated(const struct nlattr *start, int maxtype,
--
include/net/netlink.h-2360- *
include/net/netlink.h:2361: * Return: true if padding is needed to align the next attribute (nla_data()) to
include/net/netlink.h-2362- * a 64-bit aligned area.
--
include/net/netlink.h=2364=static inline bool nla_need_padding_for_64bit(struct sk_buff *skb)
--
include/net/netlink.h-2368- * if the skb->data _is_ aligned. A NOP attribute, plus
include/net/netlink.h:2369: * nlattr header for next attribute, will make nla_data()
include/net/netlink.h-2370- * 8-byte aligned.
--
include/net/netlink.h-2378-/**
include/net/netlink.h:2379: * nla_align_64bit - 64-bit align the nla_data() of next attribute
include/net/netlink.h-2380- * @skb: socket buffer the message is stored in
--
include/net/netlink.h-2383- * Conditionally emit a padding netlink attribute in order to make
include/net/netlink.h:2384: * the next attribute we emit have a 64-bit aligned nla_data() area.
include/net/netlink.h-2385- * This will only be done in architectures which do not have
--
include/net/netlink.h=2403=static inline int nla_total_size_64bit(int payload)
--
include/net/netlink.h-2442-#define nla_for_each_nested(pos, nla, rem) \
include/net/netlink.h:2443: nla_for_each_attr(pos, nla_data(nla), nla_len(nla), rem)
include/net/netlink.h-2444-
--
include/net/xfrm.h=2241=static inline int xfrm_mark_get(struct nlattr **attrs, struct xfrm_mark *m)
--
include/net/xfrm.h-2243- if (attrs[XFRMA_MARK])
include/net/xfrm.h:2244: memcpy(m, nla_data(attrs[XFRMA_MARK]), sizeof(struct xfrm_mark));
include/net/xfrm.h-2245- else
]
|
| 411/6 |
2026/09/07 07:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30598
output: 37
thoughts: 24
Thoughts: **My Thought Process on `nla_data`**
My immediate concern is to understand the definition and purpose of `nla_data`. To do this effectively, I need to examine its declaration within the `include/net/netlink.h` header file. This is a crucial first step because header files are where the core definitions, structures, and function prototypes that underpin a particular subsystem are typically located. By delving into `netlink.h`, I expect to find the precise C code that defines `nla_data`, which will likely reveal its type (e.g., a pointer to a data structure, a macro), its arguments (if it's a function or macro), and its return value. This foundational understanding is essential before I can proceed with any further analysis or utilization of `nla_data` within the Netlink context.
|
| 412/6 |
2026/09/07 07:55 |
tool |
read-file |
0m
Args: map[File:include/net/netlink.h FirstLine:1280 LineCount:20]
Results: map[Contents:1280:
1281: /**
1282: * nla_data - head of payload
1283: * @nla: netlink attribute
1284: */
1285: static inline void *nla_data(const struct nlattr *nla)
1286: {
1287: return (char *) nla + NLA_HDRLEN;
1288: }
1289:
1290: /**
1291: * nla_len - length of payload
1292: * @nla: netlink attribute
1293: */
1294: static inline u16 nla_len(const struct nlattr *nla)
1295: {
1296: return nla->nla_len - NLA_HDRLEN;
1297: }
1298:
1299: /**
]
|
| 413/6 |
2026/09/07 07:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30902
output: 27
thoughts: 37
Thoughts: **My Thought Process**
Alright, so my immediate instinct here is to investigate the existing kernel infrastructure. I want to see if there's already precedent for constructing generic Netlink messages directly, bypassing external libraries like libnl. My primary focus will be on the `tools/` and `samples/` directories within the kernel source tree. These locations are typically where you'd find utilities and examples that demonstrate core kernel functionality, and if someone has already tackled this, it's highly probable they'd have done it there. My hypothesis is that if this is a common or supported pattern, there will be concrete examples demonstrating its use with raw sockets, and I need to find those to understand the implementation details and any potential pitfalls.
|
| 414/6 |
2026/09/07 07:55 |
tool |
grepper |
0m
Args: map[Expression:NETLINK_GENERIC PathPrefix:tools/]
Results: map[Output:tools/accounting/delaytop.c=397=static int create_nl_socket(void)
--
tools/accounting/delaytop.c-401-
tools/accounting/delaytop.c:402: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/accounting/delaytop.c-403- if (fd < 0)
--
tools/accounting/getdelays.c=467=int main(int argc, char *argv[])
--
tools/accounting/getdelays.c-588-
tools/accounting/getdelays.c:589: nl_sd = create_nl_socket(NETLINK_GENERIC);
tools/accounting/getdelays.c-590- if (nl_sd < 0)
--
tools/accounting/procacct.c=290=int main(int argc, char *argv[])
--
tools/accounting/procacct.c-353-
tools/accounting/procacct.c:354: nl_sd = create_nl_socket(NETLINK_GENERIC);
tools/accounting/procacct.c-355- if (nl_sd < 0)
--
tools/include/uapi/linux/netlink.h-24-#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
tools/include/uapi/linux/netlink.h:25:#define NETLINK_GENERIC 16
tools/include/uapi/linux/netlink.h-26-/* leave room for NETLINK_DM (DM Events) */
--
tools/include/uapi/linux/taskstats.h=275=enum {
--
tools/include/uapi/linux/taskstats.h-285-
tools/include/uapi/linux/taskstats.h:286:/* NETLINK_GENERIC related info */
tools/include/uapi/linux/taskstats.h-287-
--
tools/lib/bpf/netlink.c=268=static int libbpf_netlink_resolve_genl_family_id(const char *name,
--
tools/lib/bpf/netlink.c-283-
tools/lib/bpf/netlink.c:284: return libbpf_netlink_send_recv(&req, NETLINK_GENERIC,
tools/lib/bpf/netlink.c-285- parse_genl_family_id, NULL, id);
--
tools/lib/bpf/netlink.c=433=int bpf_xdp_query(int ifindex, int xdp_flags, struct bpf_xdp_query_opts *opts)
--
tools/lib/bpf/netlink.c-495-
tools/lib/bpf/netlink.c:496: err = libbpf_netlink_send_recv(&req, NETLINK_GENERIC,
tools/lib/bpf/netlink.c-497- parse_xdp_features, NULL, &md);
--
tools/net/ynl/lib/ynl.c=736=ynl_sock_create(const struct ynl_family *yf, struct ynl_error *yse)
--
tools/net/ynl/lib/ynl.c-753-
tools/net/ynl/lib/ynl.c:754: sock_type = yf->is_classic ? yf->classic_id : NETLINK_GENERIC;
tools/net/ynl/lib/ynl.c-755-
--
tools/net/ynl/pyynl/lib/ynl.py=40=class Netlink:
--
tools/net/ynl/pyynl/lib/ynl.py-74- # Genetlink defines
tools/net/ynl/pyynl/lib/ynl.py:75: NETLINK_GENERIC = 16
tools/net/ynl/pyynl/lib/ynl.py-76-
--
tools/net/ynl/pyynl/lib/ynl.py=461=def _genl_load_families():
--
tools/net/ynl/pyynl/lib/ynl.py-463-
tools/net/ynl/pyynl/lib/ynl.py:464: with socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, Netlink.NETLINK_GENERIC) as sock:
tools/net/ynl/pyynl/lib/ynl.py-465- sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_CAP_ACK, 1)
--
tools/net/ynl/pyynl/lib/ynl.py=509=def _genl_policy_dump(family_id, op):
--
tools/net/ynl/pyynl/lib/ynl.py-512-
tools/net/ynl/pyynl/lib/ynl.py:513: with socket.socket(socket.AF_NETLINK, socket.SOCK_RAW, Netlink.NETLINK_GENERIC) as sock:
tools/net/ynl/pyynl/lib/ynl.py-514- sock.setsockopt(Netlink.SOL_NETLINK, Netlink.NETLINK_CAP_ACK, 1)
--
tools/net/ynl/pyynl/lib/ynl.py=606=class GenlProtocol(NetlinkProtocol):
--
tools/net/ynl/pyynl/lib/ynl.py-609- def __init__(self, family_name):
tools/net/ynl/pyynl/lib/ynl.py:610: super().__init__(family_name, Netlink.NETLINK_GENERIC)
tools/net/ynl/pyynl/lib/ynl.py-611-
--
tools/testing/selftests/acct/netlink_helper.c=13=int netlink_open(void)
--
tools/testing/selftests/acct/netlink_helper.c-21-
tools/testing/selftests/acct/netlink_helper.c:22: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/acct/netlink_helper.c-23- if (fd < 0)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=104=static bool get_smc_nl_family_id(void)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-111-
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:112: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-113- if (!ASSERT_OK_FD(fd, "nl_family socket"))
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=153=static bool smc_ueid(int op)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-164- memcpy(test_ueid, SMC_BPFTEST_UEID, strlen(SMC_BPFTEST_UEID));
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:165: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-166- if (!ASSERT_OK_FD(fd, "ueid socket"))
--
tools/testing/selftests/nci/nci_dev.c=90=static int create_nl_socket(void)
--
tools/testing/selftests/nci/nci_dev.c-94-
tools/testing/selftests/nci/nci_dev.c:95: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/nci/nci_dev.c-96- if (fd < 0)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1534=int main(int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1542-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1543: fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1544- if (fd == -1)
--
tools/testing/selftests/net/netlink-dumps.c=199=TEST(test_sanity)
--
tools/testing/selftests/net/netlink-dumps.c-204-
tools/testing/selftests/net/netlink-dumps.c:205: netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/netlink-dumps.c-206- ASSERT_GE(netlink_sock, 0);
--
tools/testing/selftests/net/netlink-dumps.c=220=TEST(close_in_progress)
--
tools/testing/selftests/net/netlink-dumps.c-224-
tools/testing/selftests/net/netlink-dumps.c:225: netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/netlink-dumps.c-226- ASSERT_GE(netlink_sock, 0);
--
tools/testing/selftests/net/netlink-dumps.c=234=TEST(close_with_ref)
--
tools/testing/selftests/net/netlink-dumps.c-240-
tools/testing/selftests/net/netlink-dumps.c:241: netlink_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
tools/testing/selftests/net/netlink-dumps.c-242- ASSERT_GE(netlink_sock, 0);
]
|
| 415/6 |
2026/09/07 07:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 33621
output: 47
thoughts: 56
Thoughts: **My Thought Process on Netlink Message and Attribute Handling**
Okay, my immediate inclination is to dive into the specifics of how raw generic Netlink messages and their associated attributes are structured and processed. To get a clear, concrete understanding, I'm going to focus my investigation on two key files: `tools/testing/selftests/net/mptcp/pm_nl_ctl.c` and `tools/lib/bpf/netlink.c`. My hypothesis is that by dissecting the code within these files, I'll be able to observe firsthand the underlying mechanisms for formatting these messages and subsequently parsing and acting upon the attributes they carry. This direct examination should provide me with the granular detail needed to fully grasp the implementation of Netlink communication in these contexts.
|
| 416/6 |
2026/09/07 07:55 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/mptcp/pm_nl_ctl.c FirstLine:1 LineCount:80]
Results: map[Contents: 1: // SPDX-License-Identifier: GPL-2.0
2:
3: #include <errno.h>
4: #include <error.h>
5: #include <stdbool.h>
6: #include <stdio.h>
7: #include <stdlib.h>
8: #include <string.h>
9: #include <unistd.h>
10: #include <limits.h>
11:
12: #include <sys/socket.h>
13: #include <sys/types.h>
14:
15: #include <arpa/inet.h>
16: #include <net/if.h>
17:
18: #include <linux/rtnetlink.h>
19: #include <linux/genetlink.h>
20:
21: #include "linux/mptcp.h"
22:
23: #ifndef IPPROTO_MPTCP
24: #define IPPROTO_MPTCP 262
25: #endif
26:
27: #define MPTCP_PM_ADDR_FLAG_UNKNOWN _BITUL(7)
28:
29: static void syntax(char *argv[])
30: {
31: fprintf(stderr, "%s add|ann|rem|csf|dsf|get|set|del|flush|dump|events|listen|accept [<args>]\n", argv[0]);
32: fprintf(stderr, "\tadd [flags signal|subflow|backup|fullmesh] [id <nr>] [dev <name>] <ip>\n");
33: fprintf(stderr, "\tann <local-ip> id <local-id> token <token> [port <local-port>] [dev <name>]\n");
34: fprintf(stderr, "\trem id <local-id> token <token>\n");
35: fprintf(stderr, "\tcsf lip <local-ip> lid <local-id> rip <remote-ip> rport <remote-port> token <token>\n");
36: fprintf(stderr, "\tdsf lip <local-ip> lport <local-port> rip <remote-ip> rport <remote-port> token <token>\n");
37: fprintf(stderr, "\tdel <id> [<ip>]\n");
38: fprintf(stderr, "\tget <id>\n");
39: fprintf(stderr, "\tset [<ip>] [id <nr>] flags [no]backup|[no]fullmesh [port <nr>] [token <token>] [rip <ip>] [rport <port>]\n");
40: fprintf(stderr, "\tflush\n");
41: fprintf(stderr, "\tdump\n");
42: fprintf(stderr, "\tlimits [<rcv addr max> <subflow max>]\n");
43: fprintf(stderr, "\tevents\n");
44: fprintf(stderr, "\tlisten <local-ip> <local-port>\n");
45: exit(0);
46: }
47:
48: static int init_genl_req(char *data, int family, int cmd, int version)
49: {
50: struct nlmsghdr *nh = (void *)data;
51: struct genlmsghdr *gh;
52: int off = 0;
53:
54: nh->nlmsg_type = family;
55: nh->nlmsg_flags = NLM_F_REQUEST;
56: nh->nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
57: off += NLMSG_ALIGN(sizeof(*nh));
58:
59: gh = (void *)(data + off);
60: gh->cmd = cmd;
61: gh->version = version;
62: off += NLMSG_ALIGN(sizeof(*gh));
63: return off;
64: }
65:
66: static int nl_error(struct nlmsghdr *nh)
67: {
68: struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
69: int len = nh->nlmsg_len - sizeof(*nh);
70: uint32_t off;
71:
72: if (len < sizeof(struct nlmsgerr)) {
73: error(1, 0, "netlink error message truncated %d min %ld", len,
74: sizeof(struct nlmsgerr));
75: return -1;
76: }
77:
78: if (err->error) {
79: /* check messages from kernel */
80: struct rtattr *attrs = (struct rtattr *)NLMSG_DATA(nh);
]
|
| 417/6 |
2026/09/07 07:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 35014
output: 48
thoughts: 33
Thoughts: **My Exploration of Attribute Construction in `pm_nl_ctl.c`**
I'm diving into the `tools/testing/selftests/net/mptcp/pm_nl_ctl.c` file, specifically focusing on how attributes are constructed. My goal is to gain a deeper understanding of this process, as I suspect it's a critical piece of the MPTCP Netlink control mechanism. I want to trace the flow of data and see exactly how these attributes are being defined, populated, and ultimately transmitted. This will likely involve examining data structures, function calls related to attribute building, and how they map to the MPTCP protocol's control messages. I'm expecting to find some intricate details here that are key to MPTCP's functionality and how it's managed through Netlink.
|
| 418/6 |
2026/09/07 07:55 |
tool |
read-file |
0m
Args: map[File:tools/testing/selftests/net/mptcp/pm_nl_ctl.c FirstLine:81 LineCount:60]
Results: map[Contents: 81:
82: fprintf(stderr, "netlink error %d (%s)\n",
83: err->error, strerror(-err->error));
84:
85: while (RTA_OK(attrs, len)) {
86: if (attrs->rta_type == NLMSGERR_ATTR_MSG)
87: fprintf(stderr, "netlink ext ack msg: %s\n",
88: (char *)RTA_DATA(attrs));
89: if (attrs->rta_type == NLMSGERR_ATTR_OFFS) {
90: memcpy(&off, RTA_DATA(attrs), 4);
91: fprintf(stderr, "netlink err off %d\n",
92: (int)off);
93: }
94: attrs = RTA_NEXT(attrs, len);
95: }
96: return -1;
97: }
98:
99: return 0;
100: }
101:
102: static int capture_events(int fd, int event_group)
103: {
104: u_int8_t buffer[NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
105: NLMSG_ALIGN(sizeof(struct genlmsghdr)) + 1024];
106: struct genlmsghdr *ghdr;
107: struct rtattr *attrs;
108: struct nlmsghdr *nh;
109: int ret = 0;
110: int res_len;
111: int msg_len;
112: fd_set rfds;
113:
114: if (setsockopt(fd, SOL_NETLINK, NETLINK_ADD_MEMBERSHIP,
115: &event_group, sizeof(event_group)) < 0)
116: error(1, errno, "could not join the " MPTCP_PM_EV_GRP_NAME " mcast group");
117:
118: do {
119: bool server_side = false;
120:
121: FD_ZERO(&rfds);
122: FD_SET(fd, &rfds);
123: res_len = NLMSG_ALIGN(sizeof(struct nlmsghdr)) +
124: NLMSG_ALIGN(sizeof(struct genlmsghdr)) + 1024;
125:
126: ret = select(FD_SETSIZE, &rfds, NULL, NULL, NULL);
127:
128: if (ret < 0)
129: error(1, ret, "error in select() on NL socket");
130:
131: res_len = recv(fd, buffer, res_len, 0);
132: if (res_len < 0)
133: error(1, res_len, "error on recv() from NL socket");
134:
135: nh = (struct nlmsghdr *)buffer;
136:
137: for (; NLMSG_OK(nh, res_len); nh = NLMSG_NEXT(nh, res_len)) {
138: if (nh->nlmsg_type == NLMSG_ERROR)
139: error(1, NLMSG_ERROR, "received invalid NL message");
140:
]
|
| 419/6 |
2026/09/07 07:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 36033
output: 42
thoughts: 19
Thoughts: **My Exploration of Attribute Addition in `pm_nl_ctl.c`**
I've been diving into the `pm_nl_ctl.c` source file, specifically to understand how attributes are appended to network-related requests. My objective is to trace the execution flow and pinpoint the exact mechanisms responsible for this attribute enrichment. I want to get a granular view of this process, moving from the high-level request initiation down to the nitty-gritty of attribute manipulation. Ultimately, I'm looking for a clear picture of how data, in the form of attributes, is structured and attached before a request is finalized and sent out.
|
| 420/6 |
2026/09/07 07:55 |
tool |
grepper |
0m
Args: map[Expression:rta PathPrefix:tools/testing/selftests/net/mptcp/pm_nl_ctl.c]
Results: map[Output:
Full output is too long, showing 500 out of 654 lines.
Use more precise expression if possible.
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=66=static int nl_error(struct nlmsghdr *nh)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-79- /* check messages from kernel */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:80: struct rtattr *attrs = (struct rtattr *)NLMSG_DATA(nh);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-81-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-85- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:86: if (attrs->rta_type == NLMSGERR_ATTR_MSG)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-87- fprintf(stderr, "netlink ext ack msg: %s\n",
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-88- (char *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:89: if (attrs->rta_type == NLMSGERR_ATTR_OFFS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-90- memcpy(&off, RTA_DATA(attrs), 4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=102=static int capture_events(int fd, int event_group)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-106- struct genlmsghdr *ghdr;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:107: struct rtattr *attrs;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-108- struct nlmsghdr *nh;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-149-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:150: attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-151- while (RTA_OK(attrs, msg_len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:152: if (attrs->rta_type == MPTCP_ATTR_TOKEN)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-153- fprintf(stderr, ",token:%u", *(__u32 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:154: else if (attrs->rta_type == MPTCP_ATTR_FAMILY)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-155- fprintf(stderr, ",family:%u", *(__u16 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:156: else if (attrs->rta_type == MPTCP_ATTR_LOC_ID)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-157- fprintf(stderr, ",loc_id:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:158: else if (attrs->rta_type == MPTCP_ATTR_REM_ID)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-159- fprintf(stderr, ",rem_id:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:160: else if (attrs->rta_type == MPTCP_ATTR_SADDR4) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-161- u_int32_t saddr4 = ntohl(*(__u32 *)RTA_DATA(attrs));
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-165- (saddr4 & 0xFF));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:166: } else if (attrs->rta_type == MPTCP_ATTR_SADDR6) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-167- char buf[INET6_ADDRSTRLEN];
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-171- fprintf(stderr, ",saddr6:%s", buf);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:172: } else if (attrs->rta_type == MPTCP_ATTR_DADDR4) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-173- u_int32_t daddr4 = ntohl(*(__u32 *)RTA_DATA(attrs));
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-177- (daddr4 & 0xFF));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:178: } else if (attrs->rta_type == MPTCP_ATTR_DADDR6) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-179- char buf[INET6_ADDRSTRLEN];
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-183- fprintf(stderr, ",daddr6:%s", buf);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:184: } else if (attrs->rta_type == MPTCP_ATTR_SPORT)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-185- fprintf(stderr, ",sport:%u",
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-186- ntohs(*(__u16 *)RTA_DATA(attrs)));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:187: else if (attrs->rta_type == MPTCP_ATTR_DPORT)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-188- fprintf(stderr, ",dport:%u",
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-189- ntohs(*(__u16 *)RTA_DATA(attrs)));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:190: else if (attrs->rta_type == MPTCP_ATTR_BACKUP)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-191- fprintf(stderr, ",backup:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:192: else if (attrs->rta_type == MPTCP_ATTR_ERROR)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-193- fprintf(stderr, ",error:%u", *(__u8 *)RTA_DATA(attrs));
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:194: else if (attrs->rta_type == MPTCP_ATTR_SERVER_SIDE)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-195- server_side = !!*(__u8 *)RTA_DATA(attrs);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:196: else if (attrs->rta_type == MPTCP_ATTR_FLAGS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-197- __u16 flags = *(__u16 *)RTA_DATA(attrs);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=253=static int genl_parse_getfamily(struct nlmsghdr *nlh, int *pm_family,
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-257- int len = nlh->nlmsg_len;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:258: struct rtattr *attrs;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:259: struct rtattr *grps;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:260: struct rtattr *grp;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-261- int got_events_grp;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-277-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:278: attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-279- got_family = 0;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-282- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:283: if (attrs->rta_type == CTRL_ATTR_FAMILY_ID) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-284- *pm_family = *(__u16 *)RTA_DATA(attrs);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-285- got_family = 1;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:286: } else if (attrs->rta_type == CTRL_ATTR_MCAST_GROUPS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-287- grps = RTA_DATA(attrs);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-295- while (RTA_OK(grp, grp_len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:296: if (grp->rta_type == CTRL_ATTR_MCAST_GRP_ID)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-297- *events_mcast_grp = *(__u32 *)RTA_DATA(grp);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:298: else if (grp->rta_type == CTRL_ATTR_MCAST_GRP_NAME &&
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-299- !strcmp(RTA_DATA(grp), MPTCP_PM_EV_GRP_NAME))
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=322=static int resolve_mptcp_pm_netlink(int fd, int *pm_family, int *events_mcast_grp)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-327- struct nlmsghdr *nh;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:328: struct rtattr *rta;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-329- int namelen;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-335-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:336: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-337- namelen = strlen(MPTCP_PM_NAME) + 1;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:338: rta->rta_type = CTRL_ATTR_FAMILY_NAME;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:339: rta->rta_len = RTA_LENGTH(namelen);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:340: memcpy(RTA_DATA(rta), MPTCP_PM_NAME, namelen);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:341: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-342-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=347=int dsf(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-351- 1024];
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:352: struct rtattr *rta, *addr;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-353- u_int16_t family, port;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-408- addr = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:409: addr->rta_type = NLA_F_NESTED |
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-410- ((arg == 0) ? MPTCP_PM_ATTR_ADDR : MPTCP_PM_ATTR_ADDR_REMOTE);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:411: addr->rta_len = RTA_LENGTH(0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:412: off += NLMSG_ALIGN(addr->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-413-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-414- /* addr data */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:415: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:416: if (inet_pton(AF_INET, params[arg], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-417- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:418: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:419: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:420: } else if (inet_pton(AF_INET6, params[arg], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-421- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:422: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:423: rta->rta_len = RTA_LENGTH(16);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-424- } else
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-425- error(1, errno, "can't parse ip %s", params[arg]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:426: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-427-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-428- /* family */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:429: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:430: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:431: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:432: memcpy(RTA_DATA(rta), &family, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:433: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-434-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-436- port = atoi(params[arg + 1]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:437: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:438: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:439: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:440: memcpy(RTA_DATA(rta), &port, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:441: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-442-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:443: addr->rta_len = off - addr_start;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-444- }
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-447- token = strtoul(params[4], NULL, 10);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:448: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:449: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:450: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:451: memcpy(RTA_DATA(rta), &token, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:452: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-453-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=459=int csf(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-466- struct nlmsghdr *nh;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:467: struct rtattr *addr;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:468: struct rtattr *rta;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-469- u_int16_t family;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-523- addr = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:524: addr->rta_type = NLA_F_NESTED |
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-525- ((arg == 0) ? MPTCP_PM_ATTR_ADDR : MPTCP_PM_ATTR_ADDR_REMOTE);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:526: addr->rta_len = RTA_LENGTH(0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:527: off += NLMSG_ALIGN(addr->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-528-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-529- /* addr data */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:530: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:531: if (inet_pton(AF_INET, params[arg], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-532- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:533: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:534: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:535: } else if (inet_pton(AF_INET6, params[arg], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-536- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:537: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:538: rta->rta_len = RTA_LENGTH(16);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-539- } else
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-540- error(1, errno, "can't parse ip %s", params[arg]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:541: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-542-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-543- /* family */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:544: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:545: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:546: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:547: memcpy(RTA_DATA(rta), &family, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:548: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-549-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-552- port = atoi(params[arg + 1]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:553: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:554: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:555: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:556: memcpy(RTA_DATA(rta), &port, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:557: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-558- }
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-562- id = atoi(params[arg + 1]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:563: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:564: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:565: rta->rta_len = RTA_LENGTH(1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:566: memcpy(RTA_DATA(rta), &id, 1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:567: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-568- }
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-570- /* addr flags */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:571: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:572: rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:573: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:574: memcpy(RTA_DATA(rta), &flags, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:575: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-576-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:577: addr->rta_len = off - addr_start;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-578- }
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-581- token = strtoul(params[4], NULL, 10);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:582: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:583: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:584: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:585: memcpy(RTA_DATA(rta), &token, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:586: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-587-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=593=int remove_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-598- struct nlmsghdr *nh;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:599: struct rtattr *rta;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-600- u_int32_t token;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-618- id = atoi(argv[arg]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:619: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:620: rta->rta_type = MPTCP_PM_ATTR_LOC_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:621: rta->rta_len = RTA_LENGTH(1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:622: memcpy(RTA_DATA(rta), &id, 1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:623: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-624- } else if (!strcmp(argv[arg], "token")) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-628- token = strtoul(argv[arg], NULL, 10);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:629: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:630: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:631: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:632: memcpy(RTA_DATA(rta), &token, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:633: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-634- } else
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=642=int announce_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-648- u_int32_t token = UINT_MAX;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:649: struct rtattr *rta, *addr;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-650- u_int32_t id = UINT_MAX;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-667- addr = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:668: addr->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:669: addr->rta_len = RTA_LENGTH(0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:670: off += NLMSG_ALIGN(addr->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-671-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-673- /* record addr type */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:674: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:675: if (inet_pton(AF_INET, argv[2], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-676- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:677: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:678: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:679: } else if (inet_pton(AF_INET6, argv[2], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-680- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:681: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:682: rta->rta_len = RTA_LENGTH(16);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-683- } else
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-684- error(1, errno, "can't parse ip %s", argv[2]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:685: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-686-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-687- /* addr family */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:688: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:689: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:690: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:691: memcpy(RTA_DATA(rta), &family, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:692: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-693-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-700- id = atoi(argv[arg]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:701: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:702: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:703: rta->rta_len = RTA_LENGTH(1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:704: memcpy(RTA_DATA(rta), &id, 1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:705: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-706- } else if (!strcmp(argv[arg], "dev")) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-716-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:717: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:718: rta->rta_type = MPTCP_PM_ADDR_ATTR_IF_IDX;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:719: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:720: memcpy(RTA_DATA(rta), &ifindex, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:721: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-722- } else if (!strcmp(argv[arg], "port")) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-729- port = atoi(argv[arg]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:730: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:731: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:732: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:733: memcpy(RTA_DATA(rta), &port, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:734: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-735- } else if (!strcmp(argv[arg], "token")) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-745- /* addr flags */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:746: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:747: rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:748: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:749: memcpy(RTA_DATA(rta), &flags, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:750: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-751-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:752: addr->rta_len = off - addr_start;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-753-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-757- /* token */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:758: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:759: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:760: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:761: memcpy(RTA_DATA(rta), &token, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:762: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-763-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=769=int add_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-773- 1024];
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:774: struct rtattr *rta, *nest;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-775- struct nlmsghdr *nh;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-792- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:793: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:794: nest->rta_len = RTA_LENGTH(0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:795: off += NLMSG_ALIGN(nest->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-796-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-797- /* addr data */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:798: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:799: if (inet_pton(AF_INET, argv[2], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-800- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:801: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:802: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:803: } else if (inet_pton(AF_INET6, argv[2], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-804- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:805: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:806: rta->rta_len = RTA_LENGTH(16);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-807- } else
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-808- error(1, errno, "can't parse ip %s", argv[2]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:809: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-810-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-811- /* family */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:812: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:813: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:814: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:815: memcpy(RTA_DATA(rta), &family, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:816: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-817-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-850-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:851: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:852: rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:853: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:854: memcpy(RTA_DATA(rta), &flags, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:855: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-856- } else if (!strcmp(argv[arg], "id")) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-860- id = atoi(argv[arg]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:861: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:862: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:863: rta->rta_len = RTA_LENGTH(1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:864: memcpy(RTA_DATA(rta), &id, 1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:865: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-866- } else if (!strcmp(argv[arg], "dev")) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-875-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:876: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:877: rta->rta_type = MPTCP_PM_ADDR_ATTR_IF_IDX;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:878: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:879: memcpy(RTA_DATA(rta), &ifindex, 4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:880: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-881- } else if (!strcmp(argv[arg], "port")) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-889- port = atoi(argv[arg]);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:890: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:891: rta->rta_type = MPTCP_PM_ADDR_ATTR_PORT;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:892: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:893: memcpy(RTA_DATA(rta), &port, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:894: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-895- } else
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-897- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:898: nest->rta_len = off - nest_start;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-899-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=904=int del_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-908- 1024];
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:909: struct rtattr *rta, *nest;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-910- struct nlmsghdr *nh;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-931- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:932: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:933: nest->rta_len = RTA_LENGTH(0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:934: off += NLMSG_ALIGN(nest->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-935-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-936- /* build a dummy addr with only the ID set */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:937: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:938: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:939: rta->rta_len = RTA_LENGTH(1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:940: memcpy(RTA_DATA(rta), &id, 1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:941: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-942-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-944- /* addr data */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:945: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:946: if (inet_pton(AF_INET, argv[3], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-947- family = AF_INET;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:948: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR4;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:949: rta->rta_len = RTA_LENGTH(4);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:950: } else if (inet_pton(AF_INET6, argv[3], RTA_DATA(rta))) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-951- family = AF_INET6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:952: rta->rta_type = MPTCP_PM_ADDR_ATTR_ADDR6;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:953: rta->rta_len = RTA_LENGTH(16);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-954- } else {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-956- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:957: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-958-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-959- /* family */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:960: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:961: rta->rta_type = MPTCP_PM_ADDR_ATTR_FAMILY;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:962: rta->rta_len = RTA_LENGTH(2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:963: memcpy(RTA_DATA(rta), &family, 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:964: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-965- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:966: nest->rta_len = off - nest_start;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-967-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-971-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:972:static void print_addr(struct rtattr *attrs, int len)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-973-{
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-980- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:981: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_FAMILY)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-982- memcpy(&family, RTA_DATA(attrs), 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:983: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_PORT)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-984- memcpy(&port, RTA_DATA(attrs), 2);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:985: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ADDR4) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-986- if (family != AF_INET)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-993- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:994: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ADDR6) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-995- if (family != AF_INET6)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1002- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1003: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_ID) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1004- memcpy(&id, RTA_DATA(attrs), 1);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1006- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1007: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_FLAGS) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1008- memcpy(&flags, RTA_DATA(attrs), 4);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1064- }
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1065: if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_IF_IDX) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1066- char name[IF_NAMESIZE], *ret;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1082=static void print_addrs(struct nlmsghdr *nh, int pm_family, int total_len)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1083-{
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1084: struct rtattr *attrs;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1085-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1096- len -= NLMSG_LENGTH(GENL_HDRLEN);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1097: attrs = (struct rtattr *) ((char *) NLMSG_DATA(nh) +
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1098- GENL_HDRLEN);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1099- while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1100: if (attrs->rta_type ==
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1101- (MPTCP_PM_ATTR_ADDR | NLA_F_NESTED))
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1102- print_addr((void *)RTA_DATA(attrs),
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1103: attrs->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1104- attrs = RTA_NEXT(attrs, len);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1109=int get_addr(int fd, int pm_family, int argc, char *argv[])
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1113- 1024];
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1114: struct rtattr *rta, *nest;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1115- struct nlmsghdr *nh;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1135- nest = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1136: nest->rta_type = NLA_F_NESTED | MPTCP_PM_ATTR_ADDR;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1137: nest->rta_len = RTA_LENGTH(0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1138: off += NLMSG_ALIGN(nest->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1139-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1140- /* build a dummy addr with only the ID set */
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1141: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1142: rta->rta_type = MPTCP_PM_ADDR_ATTR_ID;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1143: rta->rta_len = RTA_LENGTH(1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1144: memcpy(RTA_DATA(rta), &id, 1);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1145: off += NLMSG_ALIGN(rta->rta_len);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1146: nest->rta_len = off - nest_start;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1147-
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1149- if (token) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1150: rta = (void *)(data + off);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1151: rta->rta_type = MPTCP_PM_ATTR_TOKEN;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1152: rta->rta_len = RTA_LENGTH(4);
]
|
| 421/6 |
2026/09/07 07:55 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 53547
output: 43
thoughts: 1258
Thoughts: **My Thought Process on Constructing a Netlink Message for nl80211**
Alright, so I'm trying to get a handle on how to construct Netlink messages, specifically for `nl80211`, to achieve a particular goal: setting an interface, like `wlan0`, into monitor mode. My first instinct is to compare the underlying attribute structures. I'm looking at `rtattr` and `nlattr`. It's immediately apparent that `struct nlattr` and `struct rtattr` share the same fundamental layout: a 16-bit length field (`rta_len`/`nla_len`) and a 16-bit type field (`rta_type`/`nla_type`). This similarity suggests a common underlying mechanism for attribute encoding.
For generic Netlink, and specifically `nl80211`, `struct nlattr` is the standard. I've pulled up the definition from `<linux/netlink.h>`:
```c
struct nlattr {
__u16 nla_len;
__u16 nla_type;
};
```
And I know that `NLA_HDRLEN` is derived from this, specifically `((int) NLA_ALIGN(sizeof(struct nlattr)))`, which boils down to 4 bytes. The alignment logic, `NLA_ALIGN(len) = (((len) + 4 - 1) & ~(4 - 1))`, tells me attributes are padded to a multiple of 4 bytes. This is crucial for correct message construction.
Now, let's get down to the specific task: setting `wlan0` to monitor mode using `NL80211_CMD_SET_INTERFACE` and `NL80211_IFTYPE_MONITOR`. To do this, I need to include the necessary headers:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
```
These are pretty standard for any Netlink interaction.
Next, I'm thinking about how to structure the actual message. I could use a predefined `struct msg_req` like this:
```c
struct msg_req {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256]; // A general buffer for attributes
};
```
Or, for a more precise approach, I can define a `struct` that directly maps to the expected fields and attributes. This seems more manageable for a specific command:
```c
struct {
struct nlmsghdr nl;
struct genlmsghdr genl;
struct { // Attribute for interface index
struct nlattr attr;
uint32_t val;
} ifindex;
struct { // Attribute for interface type
struct nlattr attr;
uint32_t val;
} iftype;
} req;
```
This second approach is more appealing because it clearly separates the Netlink header, the generic Netlink header, and then the specific attributes.
Now, a critical check: alignment. I need to ensure that `struct nlattr` followed by `uint32_t` is correctly aligned. `sizeof(struct nlattr)` is indeed 4 bytes (`__u16 nla_len` + `__u16 nla_type`). `sizeof(uint32_t)` is also 4 bytes. So, a `struct nlattr` followed by a `uint32_t` results in a total of 8 bytes, which is perfectly aligned to 4-byte boundaries (`NLA_ALIGNTO`).
For the attribute values themselves:
* For `NL80211_ATTR_IFINDEX`, the `nla_len` needs to be `sizeof(struct nlattr) + sizeof(uint32_t)`, which is `4 + 4 = 8`.
* Similarly, for `NL80211_ATTR_IFTYPE`, the `nla_len` will also be 8.
Now, let's consider the overall message length calculation.
* `NLMSG_HDRLEN` (for `struct nlmsghdr`) is 16 bytes.
* `GENL_HDRLEN` (for `struct genlmsghdr`) is 4 bytes.
* The `ifindex` attribute structure (`struct nlattr` + `uint32_t`) is 8 bytes.
* The `iftype` attribute structure (`struct nlattr` + `uint32_t`) is also 8 bytes.
Therefore, the total message length, using `NLMSG_LENGTH(sizeof(struct genlmsghdr) + sizeof(req.ifindex) + sizeof(req.iftype))`, would be `16 + 4 + 8 + 8 = 36` bytes. I've quickly double-checked the structure sizes and offsets in my head: `nlmsghdr` is 16 bytes, `genlmsghdr` is 4 bytes, and each attribute block is 8 bytes. This seems consistent.
Finally, before I commit to this structure, I need to confirm the expected data types for these attributes within `nl80211`. I'm going to check how the policy validation handles `NL80211_ATTR_IFINDEX` and `NL80211_ATTR_IFTYPE` in the kernel's `net/wireless/nl80211.c` to ensure I'm passing a `uint32_t` as expected. This validation step is crucial to avoid unexpected errors or rejections from the kernel module.
|
| 422/6 |
2026/09/07 07:56 |
tool |
grepper |
0m
Args: map[Expression:\[NL80211_ATTR_IF PathPrefix:net/wireless/nl80211.c]
Results: map[Output:net/wireless/nl80211.c=68=__cfg80211_wdev_from_attrs(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-71- struct wireless_dev *result = NULL;
net/wireless/nl80211.c:72: bool have_ifidx = attrs[NL80211_ATTR_IFINDEX];
net/wireless/nl80211.c-73- bool have_wdev_id = attrs[NL80211_ATTR_WDEV];
--
net/wireless/nl80211.c-81- if (have_ifidx)
net/wireless/nl80211.c:82: ifidx = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
net/wireless/nl80211.c-83- if (have_wdev_id) {
--
net/wireless/nl80211.c=141=__cfg80211_rdev_from_attrs(struct net *netns, struct nlattr **attrs)
--
net/wireless/nl80211.c-148- if (!attrs[NL80211_ATTR_WIPHY] &&
net/wireless/nl80211.c:149: !attrs[NL80211_ATTR_IFINDEX] &&
net/wireless/nl80211.c-150- !attrs[NL80211_ATTR_WDEV])
--
net/wireless/nl80211.c-180-
net/wireless/nl80211.c:181: if (attrs[NL80211_ATTR_IFINDEX]) {
net/wireless/nl80211.c:182: int ifindex = nla_get_u32(attrs[NL80211_ATTR_IFINDEX]);
net/wireless/nl80211.c-183-
--
net/wireless/nl80211.c=700=static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
--
net/wireless/nl80211.c-727-
net/wireless/nl80211.c:728: [NL80211_ATTR_IFTYPE] = NLA_POLICY_MAX(NLA_U32, NL80211_IFTYPE_MAX),
net/wireless/nl80211.c:729: [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
net/wireless/nl80211.c:730: [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
net/wireless/nl80211.c-731-
--
net/wireless/nl80211.c=3722=static int nl80211_dump_wiphy_parse(struct sk_buff *skb,
--
net/wireless/nl80211.c-3746- state->filter_wiphy = nla_get_u64(tb[NL80211_ATTR_WDEV]) >> 32;
net/wireless/nl80211.c:3747: if (tb[NL80211_ATTR_IFINDEX]) {
net/wireless/nl80211.c-3748- struct net_device *netdev;
net/wireless/nl80211.c-3749- struct cfg80211_registered_device *rdev;
net/wireless/nl80211.c:3750: int ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
net/wireless/nl80211.c-3751-
--
net/wireless/nl80211.c=4245=static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-4269-
net/wireless/nl80211.c:4270: if (info->attrs[NL80211_ATTR_IFINDEX]) {
net/wireless/nl80211.c:4271: int ifindex = nla_get_u32(info->attrs[NL80211_ATTR_IFINDEX]);
net/wireless/nl80211.c-4272-
--
net/wireless/nl80211.c=5049=static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-5063-
net/wireless/nl80211.c:5064: if (info->attrs[NL80211_ATTR_IFTYPE]) {
net/wireless/nl80211.c:5065: ntype = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
net/wireless/nl80211.c-5066- if (otype != ntype)
--
net/wireless/nl80211.c=5124=static int _nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-5135-
net/wireless/nl80211.c:5136: if (!info->attrs[NL80211_ATTR_IFNAME])
net/wireless/nl80211.c-5137- return -EINVAL;
net/wireless/nl80211.c-5138-
net/wireless/nl80211.c:5139: if (info->attrs[NL80211_ATTR_IFTYPE])
net/wireless/nl80211.c:5140: type = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]);
net/wireless/nl80211.c-5141-
--
net/wireless/nl80211.c-5177- wdev = rdev_add_virtual_intf(rdev,
net/wireless/nl80211.c:5178: nla_data(info->attrs[NL80211_ATTR_IFNAME]),
net/wireless/nl80211.c-5179- NET_NAME_USER, type, ¶ms);
]
|
| 423/6 |
2026/09/07 07:56 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 56618
output: 1403
thoughts: 2752
Thoughts: Here are my thoughts on how to construct that C code snippet for changing an interface to monitor mode using raw netlink sockets and nl80211.
**Detailed Thought Process for `nl80211` Interface Mode Change**
My primary goal here is to craft a robust and clear C function that leverages raw netlink sockets to achieve the specific task of changing an interface, say "wlan0", to `NL80211_IFTYPE_MONITOR`. I'm assuming I have the `nl80211` family ID already.
First, I need to establish the fundamental building blocks: the netlink socket itself. This involves creating a socket with the `AF_NETLINK` family, `SOCK_RAW` type, and the `NETLINK_GENERIC` protocol. I also need to bind this socket to a local address, typically with `sa.nl_family = AF_NETLINK;`.
The core of the operation lies in constructing the netlink message. The `nl80211` policy dictates that `NL80211_ATTR_IFTYPE` and `NL80211_ATTR_IFINDEX` are both `NLA_U32` (which maps to `uint32_t`). This tells me the data types I'll be packing into the message.
For the specific command `NL80211_CMD_SET_INTERFACE`, I can use the `NLM_F_REQUEST | NLM_F_ACK` flags. This is crucial because the `NLM_F_ACK` flag ensures the kernel will send back an `NLMSG_ERROR` message. This response is my confirmation mechanism: a zero error code signifies success, while a negative `errno` indicates a failure. This is a standard and reliable way to handle responses in netlink.
To construct the message, I need to consider the structure. A direct approach would be to define a `struct` that incorporates the `nlmsghdr`, `genlmsghdr`, and the necessary attributes (`NL80211_ATTR_IFINDEX` and `NL80211_ATTR_IFTYPE`). I've considered a slightly more structured approach than just a raw buffer, where each attribute is explicitly defined, making the code more readable and less prone to off-by-one errors when calculating lengths and offsets.
Specifically, I'll need to:
1. **Populate the `nlmsghdr`**: This includes setting `nlmsg_type` to the `nl80211_family_id`, `nlmsg_flags` to `NLM_F_REQUEST | NLM_F_ACK`, `nlmsg_seq` and `nlmsg_pid` (often `getpid()` for the latter, though 0 is also used). `nlmsg_len` will be calculated later to encompass the entire message.
2. **Populate the `genlmsghdr`**: The command will be `NL80211_CMD_SET_INTERFACE`. The `version` field is usually set to 1 (though 0 is sometimes accepted), and `reserved` to 0.
3. **Add the `NL80211_ATTR_IFINDEX`**: This attribute will contain the index of the interface we want to modify. The `if_nametoindex()` function from `<net/if.h>` is the standard way to get this index from an interface name like "wlan0". I'll need to set the `nlattr` header (`nla_len` and `nla_type`) and then the `uint32_t` value.
4. **Add the `NL80211_ATTR_IFTYPE`**: This attribute will specify the desired interface type, `NL80211_IFTYPE_MONITOR`. Again, I'll set the `nlattr` header and the `uint32_t` value.
Calculating `nlmsg_len` correctly is important. It needs to be `NLMSG_LENGTH(GENL_HDRLEN + attribute_sizes)`. `GENL_HDRLEN` accounts for the `genlmsghdr` after alignment, and then I sum up the sizes of all the attributes I'm including.
For sending the message, `sendto()` is the appropriate function, targeting the kernel's netlink address.
After sending, the critical step is to receive and parse the response. I'll read the data into a buffer. Then, I'll check if the received `nlmsghdr` indicates an `NLMSG_ERROR`. If it does, I'll cast the message data to `struct nlmsgerr` and check the `error` field. A value of 0 means success; any other value indicates an error, which I should report.
I also considered a helper function approach for adding attributes (like `nla_put_u32`), which is common in netlink libraries, but for a self-contained snippet, defining the structure directly and filling it in is clear enough.
Finally, I've paid attention to the practicalities:
* **Header Files**: I've identified all the necessary headers: `<stdio.h>`, `<stdlib.h>`, `<string.h>`, `<unistd.h>`, `<sys/socket.h>`, `<net/if.h>`, `<linux/netlink.h>`, `<linux/genetlink.h>`, and `<linux/nl80211.h>`.
* **Error Handling**: Robust error checking is included at each step: socket creation, binding, sending, and receiving.
* **Alignment**: I've mentally walked through the struct layout to ensure there are no alignment issues that could cause problems on different architectures. For the chosen structure, the alignment of `uint32_t` and `nlattr` members on 4-byte boundaries is well-handled by standard C compilers.
* **Practical Considerations**: I've noted that for some drivers, it might be necessary to bring the interface down (`ifconfig wlan0 down`) *before* changing its type to `MONITOR` to avoid `EBUSY` errors, and then bring it back up. This is a good practice to mention for real-world applicability.
This detailed breakdown ensures all netlink protocol nuances and C-level implementation details are considered for a correct and functional solution.
|
| 424/6 |
2026/09/07 07:56 |
tool |
set-results |
0m
Args: map[Answer:Below is the complete C code snippet to switch the interface type of "wlan0" to monitor mode (`NL80211_IFTYPE_MONITOR`) using raw netlink sockets and Generic Netlink (`nl80211`):
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
/* Request message structure containing Netlink and nl80211 headers and attributes */
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
/* 1. Resolve network interface index */
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
/* 2. Open raw netlink socket for Generic Netlink */
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
/* 3. Bind socket to local address */
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
local.nl_pid = 0; /* Let kernel assign port ID */
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
/* 4. Construct nl80211 request */
memset(&req, 0, sizeof(req));
/* Netlink header */
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
/* Generic Netlink header */
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
/* NL80211_ATTR_IFINDEX attribute */
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
/* NL80211_ATTR_IFTYPE attribute */
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
/* 5. Send netlink message to kernel */
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
/* 6. Receive ACK / Error response */
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
/* Negative error code in ACK indicates failure (e.g. -EBUSY) */
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
/* Assume nl80211 family ID is known (e.g., resolved beforehand or dynamically) */
uint16_t nl80211_id = 0; /* Replace with your known nl80211 family ID */
if (set_interface_monitor_mode(nl80211_id, "wlan0") == 0) {
printf("Successfully set wlan0 to monitor mode.\n");
}
return 0;
}
```]
Results: map[Answer:Below is the complete C code snippet to switch the interface type of "wlan0" to monitor mode (`NL80211_IFTYPE_MONITOR`) using raw netlink sockets and Generic Netlink (`nl80211`):
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
/* Request message structure containing Netlink and nl80211 headers and attributes */
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
/* 1. Resolve network interface index */
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
/* 2. Open raw netlink socket for Generic Netlink */
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
/* 3. Bind socket to local address */
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
local.nl_pid = 0; /* Let kernel assign port ID */
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
/* 4. Construct nl80211 request */
memset(&req, 0, sizeof(req));
/* Netlink header */
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
/* Generic Netlink header */
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
/* NL80211_ATTR_IFINDEX attribute */
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
/* NL80211_ATTR_IFTYPE attribute */
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
/* 5. Send netlink message to kernel */
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
/* 6. Receive ACK / Error response */
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
/* Negative error code in ACK indicates failure (e.g. -EBUSY) */
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
/* Assume nl80211 family ID is known (e.g., resolved beforehand or dynamically) */
uint16_t nl80211_id = 0; /* Replace with your known nl80211 family ID */
if (set_interface_monitor_mode(nl80211_id, "wlan0") == 0) {
printf("Successfully set wlan0 to monitor mode.\n");
}
return 0;
}
```]
|
| 425/4 |
2026/09/07 07:56 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 21589
output: 49
thoughts: 229
Thoughts: **My Thought Process on Interface and Frequency Configuration**
Alright, so the immediate next step is to get this interface operational and tune it to the desired frequency. My initial thought is to bring the interface "up." I recall that the standard way to achieve this, at a lower level, is through an `ioctl` call, specifically `SIOCSIFFLAGS`. That seems straightforward enough for the interface activation part.
Now, regarding the frequency, I'm sifting through my knowledge of `nl80211` commands. My first impulse is to consider `NL80211_CMD_SET_WIPHY`. But then I pause – does that command *set* the frequency, or is it more about configuring the wireless device's capabilities in general? I have a fleeting thought that perhaps `NL80211_CMD_SET_CHANNEL` is the more direct route for setting the operational frequency.
However, the question lingers: could `NL80211_CMD_SET_WIPHY` *also* be involved in frequency selection? This ambiguity requires clarification. I need to be absolutely certain. The most reliable way to resolve this is to consult the definitive source, `nl80211.h`, to see precisely what each of these commands is designed to accomplish regarding frequency and channel configuration. That's my next move to ensure I'm using the correct mechanism.
|
| 426/4 |
2026/09/07 07:56 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_WIPHY PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-352- * to get a list of all present wiphys.
include/uapi/linux/nl80211.h:353: * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
include/uapi/linux/nl80211.h-354- * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
--
include/uapi/linux/nl80211.h-717- *
include/uapi/linux/nl80211.h:718: * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
include/uapi/linux/nl80211.h-719- * associated with this wiphy must be down and will follow.
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1437- NL80211_CMD_GET_WIPHY, /* can dump */
include/uapi/linux/nl80211.h:1438: NL80211_CMD_SET_WIPHY,
include/uapi/linux/nl80211.h-1439- NL80211_CMD_NEW_WIPHY,
--
include/uapi/linux/nl80211.h-1505-
include/uapi/linux/nl80211.h:1506: NL80211_CMD_SET_WIPHY_NETNS,
include/uapi/linux/nl80211.h-1507-
]
|
| 427/4 |
2026/09/07 07:56 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 22367
output: 47
thoughts: 18
Thoughts: **My Thought Process**
Right, so my immediate instinct here is to dive into the specifics of the `NL80211_CMD_SET_CHANNEL` command. I need to understand exactly what this command does, what parameters it takes, what the expected return values are, and any potential side effects or dependencies. This is the crucial first step in troubleshooting or developing any functionality related to channel configuration within the nl80211 framework. I'm assuming this is a foundational piece of the puzzle, and a thorough grasp of its behavior will inform the rest of my investigation.
|
| 428/4 |
2026/09/07 07:56 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_CHANNEL PathPrefix:include/uapi/linux/nl80211.h]
Results: map[Output:include/uapi/linux/nl80211.h-360- * %NL80211_ATTR_WIPHY_RTS_THRESHOLD. However, for setting the channel,
include/uapi/linux/nl80211.h:361: * see %NL80211_CMD_SET_CHANNEL instead, the support here is for backward
include/uapi/linux/nl80211.h-362- * compatibility only.
--
include/uapi/linux/nl80211.h-815- * reached.
include/uapi/linux/nl80211.h:816: * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
include/uapi/linux/nl80211.h-817- * and the attributes determining channel width) the given interface
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1532-
include/uapi/linux/nl80211.h:1533: NL80211_CMD_SET_CHANNEL,
include/uapi/linux/nl80211.h-1534- NL80211_CMD_SET_WDS_PEER,
]
|
| 429/4 |
2026/09/07 07:56 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 22799
output: 50
thoughts: 951
Thoughts: **My Thought Process on Debugging a `mac80211_hwsim` Crash**
Okay, let's break down what's happening here. I'm trying to understand a crash related to `mac80211_hwsim`, specifically when sending a crafted packet.
My initial thought is about channel configuration. The log mentions `NL80211_CMD_SET_CHANNEL`. I'm wondering if, when I create a monitor interface, I *have* to explicitly set the channel. Usually, `mac80211_hwsim` defaults to channel 2412 MHz, so maybe I can just proceed without setting it and see what happens. I'll try bringing up the interface and sending a packet directly.
Then, I notice a Netlink warning: "80 bytes leftover after parsing attributes in process syz.4.6946". This seems like a potential red herring. It might just be `syzkaller` sending some malformed Netlink data that `nl80211` is complaining about, but it might not be the direct cause of the actual crash. The crash itself is clearly triggered by `packet_sendmsg`.
So, to get to the bottom of this, I need a reproducible test case. I'll write a C program to automate the steps:
1. First, I need to get the Netlink family ID for `nl80211`.
2. Next, I'll switch my `wlan0` interface to monitor mode.
3. Then, I'll bring the interface up (`UP`).
4. I'll open an `AF_PACKET` socket and bind it to `wlan0`. This is how I'll inject my custom packet.
5. Finally, I'll send the specific "malicious" radiotap frame that I suspect is causing the issue.
Now, I need to construct this radiotap frame. I'm defining a byte array for it.
```c
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
```
This radiotap header has `it_present` set to indicate the `RATE` field, and I've set the `rate` field to 0, which I believe is an invalid legacy rate, likely to trigger the bug condition `rate * 5 != sband->bitrates[i].bitrate` as described in the bug report (`c->control.rates[0].idx < 0`).
However, as I'm looking at the `mac80211_hwsim` code, specifically the `mac80211_hwsim_write_tsf` function, I'm seeing something crucial. It appears that `mac80211_hwsim_write_tsf` is called for both Probe Response and Beacon frames. The code snippet shows:
```c
if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
ieee80211_is_probe_resp(hdr->frame_control)) {
mgmt->u.probe_resp.timestamp = ...
} else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
ieee80211_is_beacon(mgmt->frame_control)) {
mgmt->u.beacon.timestamp = ...
}
```
But *before* any of this frame type checking happens, `mac80211_hwsim_write_tsf` unconditionally calls `mac80211_hwsim_get_tx_rate(data->hw, info)`.
```c
txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
if (txrate)
bitrate = txrate->bitrate;
```
This is a significant realization! It means that the bug I'm investigating, related to the `rate * 5 != sband->bitrates[i].bitrate` condition and ultimately leading to `c->control.rates[0].idx < 0`, isn't dependent on the *type* of 802.11 frame being sent (like a Probe Response or Beacon). The problematic `mac80211_hwsim_get_tx_rate` function is called regardless of the frame type.
So, my crafted data frame, even though it's a Data frame and not a management frame that would typically trigger `write_tsf`, will still end up calling `get_tx_rate` within `write_tsf`, and that's where the crash will likely be initiated. My initial assumption about the specific frame type might have been too narrow; it's the transmission of a packet that ultimately leads to this internal `get_tx_rate` call with an invalid rate that's the problem.
I need to verify this by running my C program and observing if the crash occurs consistently, which I now strongly suspect it will, regardless of the specific 802.11 frame control bits I set, as long as the radiotap header contains an invalid rate.
|
| 430/4 |
2026/09/07 07:57 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:1615 LineCount:10]
Results: map[Contents:1615: spin_lock_bh(&data->tsf_offset_lock);
1616:
1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
1618: if (txrate)
1619: bitrate = txrate->bitrate;
1620:
1621: if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
1622: ieee80211_is_probe_resp(hdr->frame_control)) {
1623: mgmt->u.probe_resp.timestamp =
1624: cpu_to_le64(sim_time + data->tsf_offset +
]
|
| 431/4 |
2026/09/07 07:57 |
llm |
repro-generator |
1m
Model:
Tokens:
input: 23996
output: 4172
thoughts: 10732
Thoughts: **My Thought Process: Setting up the Environment and Triggering the Bug**
Okay, so the core idea here is to exploit a bug in the `mac80211_hwsim` kernel module. The bug is related to how it handles packet injection when certain radiotap fields, specifically the transmission rate, are not set correctly. I need to set up a virtual wireless interface in monitor mode and then send a crafted packet to it.
First, I'm thinking about the unconditional nature of the packet injection. The problem description mentions that the bug is triggered "unconditionally" once the interface is in monitor mode. This means any frame type should, in principle, work, as long as I can get it to the driver.
My plan is to write a full C program to automate this. I'll need to interact with the kernel's wireless subsystem, which means using Netlink, specifically `nl80211`.
The first crucial step is to get an interface into monitor mode. I know I'll need `nl80211` for this. The typical sequence for setting an interface to monitor mode involves:
1. Bringing the interface DOWN.
2. Setting its type to MONITOR.
3. Bringing it back UP.
4. Then, I can send the packet.
I'll need a way to bring interfaces up and down. A small helper function using `ioctl` with `SIOCGIFFLAGS` and `SIOCSIFFLAGS` on a `SOCK_DGRAM` socket seems appropriate. I'll define `set_iface_flags` for this.
For the `nl80211` part, I'll need to:
* Find the `nl80211` family ID. This requires a Netlink socket and sending a `CTRL_CMD_GETFAMILY` request to the `GENL_ID_CTRL` family. I'll create a `get_genl_family_id` function for this.
* Set the interface to monitor mode. This involves sending an `NL80211_CMD_SET_INTERFACE` message with the appropriate `NL80211_ATTR_IFINDEX` and `NL80211_ATTR_IFTYPE` (set to `NL80211_IFTYPE_MONITOR`). I'll encapsulate this in `set_interface_monitor_mode`.
Now, about the environment: I'm told this is a test VM where `mac80211_hwsim` is loaded. This is perfect because `mac80211_hwsim` simulates hardware and creates virtual wireless interfaces, typically `wlan0` and `wlan1`. So, I can assume `wlan0` will be available. I'll start by targeting `wlan0`.
My initial thought on the interface name was just `wlan0`. However, I should consider that it might not be available, or perhaps another interface name might be in use. A safer approach would be to try `wlan0` first and then fall back to `wlan1` if `wlan0` isn't found.
The sequence in `main` will look like this:
1. Get the `nl80211` family ID.
2. Set `wlan0` DOWN.
3. Set `wlan0` to monitor mode.
4. Set `wlan0` UP.
5. Open a packet socket (`AF_PACKET`, `SOCK_RAW`) bound to `wlan0` to send frames.
6. Construct and send the "malicious" frame.
This "malicious" frame is key. The bug description points to an issue with the radiotap header's rate field. Specifically, setting the `rate` field to `0x00` is what I need. The radiotap header has a length field (`it_len`) and a present fields mask (`it_present`). I'll need to set `it_present` to indicate the rate is present (bit 2). The rate itself will be `0x00`.
A standard 802.11 data frame header will follow, with placeholder MAC addresses. I'll send this packet multiple times, with a small delay between sends, to ensure the problematic path is hit.
Now, let me dive into the specifics of why `rate = 0` causes an issue. I'm recalling that the `mac80211` driver expects a valid rate index from the supported bands. When `rate = 0` is provided, it doesn't match any standard bitrates (which are usually multiples of 500 Kbit/s, e.g., 10 for 1 Mbps). This means `info->control.rates[0].idx` will remain `-1` after parsing.
Then, the `ieee80211_get_tx_rate` function is called. Crucially, this function checks `c->control.rates[0].idx < 0`. If it is, it returns `NULL`, triggering a warning. This is where the bug lies: the packet is *sent* to the driver (`drv_tx`) even though the rate is invalid, because `ieee80211_parse_tx_radiotap` returns `true` even with an invalid rate, and `IEEE80211_TX_CTL_INJECTED` flag is set, bypassing some standard checks and going straight to `drv_tx`. The driver then attempts to use this invalid rate, leading to the kernel warning and potentially a crash or unexpected behavior.
One more detail: I remembered seeing a check for `chandef->chan` in `ieee80211_monitor_start_xmit`. If the interface is in monitor mode but no channel is set, `chandef->chan` will be `NULL`, and the packet transmission will fail *before* even reaching the driver's `drv_tx` function. Since `mac80211_hwsim` might not automatically set a channel for a monitor interface, I need to explicitly set one. I'll use `NL80211_CMD_SET_CHANNEL` for this, targeting a common frequency like 2412 MHz. I'll add a `set_interface_freq` function for this.
So, the final sequence for setting up the interface will be:
1. Get `nl80211` ID.
2. Set `wlanX` DOWN.
3. Set `wlanX` to MONITOR mode.
4. Set `wlanX` to a specific frequency (e.g., 2412 MHz).
5. Set `wlanX` UP.
6. Open packet socket and bind.
7. Send the malformed packet.
This detailed thought process covers identifying the bug, planning the exploitation steps, handling system interactions (Netlink, ioctl), constructing the malicious payload, and anticipating potential environmental pitfalls like missing interfaces or unset channels.
|
| 432/4 |
2026/09/07 07:58 |
tool |
set-results |
0m
Args: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set freq: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
const char *ifname = "wlan0";
if (if_nametoindex(ifname) == 0) {
ifname = "wlan1";
if (if_nametoindex(ifname) == 0) {
fprintf(stderr, "No wlan interface found\n");
return 1;
}
}
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s DOWN\n", ifname);
return 1;
}
printf("[+] Set %s DOWN\n", ifname);
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
fprintf(stderr, "Failed to set %s to MONITOR mode\n", ifname);
return 1;
}
printf("[+] Set %s to MONITOR mode\n", ifname);
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s UP\n", ifname);
return 1;
}
printf("[+] Set %s UP\n", ifname);
// 4. Set frequency to 2412 MHz
if (set_interface_freq(nl80211_id, ifname, 2412) < 0) {
fprintf(stderr, "Failed to set frequency for %s\n", ifname);
// Continue anyway, it might have a default frequency
} else {
printf("[+] Set frequency to 2412 MHz\n");
}
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
printf("[+] Bound packet socket to %s\n", ifname);
// 6. Send malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
printf("[+] Sent malicious frames\n");
close(psock);
return 0;
}
]
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set freq: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
const char *ifname = "wlan0";
if (if_nametoindex(ifname) == 0) {
ifname = "wlan1";
if (if_nametoindex(ifname) == 0) {
fprintf(stderr, "No wlan interface found\n");
return 1;
}
}
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s DOWN\n", ifname);
return 1;
}
printf("[+] Set %s DOWN\n", ifname);
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
fprintf(stderr, "Failed to set %s to MONITOR mode\n", ifname);
return 1;
}
printf("[+] Set %s to MONITOR mode\n", ifname);
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s UP\n", ifname);
return 1;
}
printf("[+] Set %s UP\n", ifname);
// 4. Set frequency to 2412 MHz
if (set_interface_freq(nl80211_id, ifname, 2412) < 0) {
fprintf(stderr, "Failed to set frequency for %s\n", ifname);
// Continue anyway, it might have a default frequency
} else {
printf("[+] Set frequency to 2412 MHz\n");
}
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
printf("[+] Bound packet socket to %s\n", ifname);
// 6. Send malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
printf("[+] Sent malicious frames\n");
close(psock);
return 0;
}
]
|
| 433/3 |
2026/09/07 07:58 |
loop |
|
0m
|
| 434/4 |
2026/09/07 07:58 |
iteration |
0 |
0m
|
| 435/5 |
2026/09/07 07:58 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set freq: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
const char *ifname = "wlan0";
if (if_nametoindex(ifname) == 0) {
ifname = "wlan1";
if (if_nametoindex(ifname) == 0) {
fprintf(stderr, "No wlan interface found\n");
return 1;
}
}
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s DOWN\n", ifname);
return 1;
}
printf("[+] Set %s DOWN\n", ifname);
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
fprintf(stderr, "Failed to set %s to MONITOR mode\n", ifname);
return 1;
}
printf("[+] Set %s to MONITOR mode\n", ifname);
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s UP\n", ifname);
return 1;
}
printf("[+] Set %s UP\n", ifname);
// 4. Set frequency to 2412 MHz
if (set_interface_freq(nl80211_id, ifname, 2412) < 0) {
fprintf(stderr, "Failed to set frequency for %s\n", ifname);
// Continue anyway, it might have a default frequency
} else {
printf("[+] Set frequency to 2412 MHz\n");
}
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
printf("[+] Bound packet socket to %s\n", ifname);
// 6. Send malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
printf("[+] Sent malicious frames\n");
close(psock);
return 0;
}
]
|
| 436/5 |
2026/09/07 07:58 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set freq: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
const char *ifname = "wlan0";
if (if_nametoindex(ifname) == 0) {
ifname = "wlan1";
if (if_nametoindex(ifname) == 0) {
fprintf(stderr, "No wlan interface found\n");
return 1;
}
}
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s DOWN\n", ifname);
return 1;
}
printf("[+] Set %s DOWN\n", ifname);
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
fprintf(stderr, "Failed to set %s to MONITOR mode\n", ifname);
return 1;
}
printf("[+] Set %s to MONITOR mode\n", ifname);
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s UP\n", ifname);
return 1;
}
printf("[+] Set %s UP\n", ifname);
// 4. Set frequency to 2412 MHz
if (set_interface_freq(nl80211_id, ifname, 2412) < 0) {
fprintf(stderr, "Failed to set frequency for %s\n", ifname);
// Continue anyway, it might have a default frequency
} else {
printf("[+] Set frequency to 2412 MHz\n");
}
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
printf("[+] Bound packet socket to %s\n", ifname);
// 6. Send malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
printf("[+] Sent malicious frames\n");
close(psock);
return 0;
}
]
|
| 437/5 |
2026/09/07 07:58 |
action |
If |
0m
Args:
|
| 438/3 |
2026/09/07 07:58 |
action |
run-c-repro |
2m
Results: map[CandidateBugTitle: CandidateCrashReport: CandidateReproduced:false ConsoleOutput:[ 63.331937][ T33] audit: type=1400 audit(1788767995.171:200): avc: denied { transition } for pid=5819 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339522][ T33] audit: type=1400 audit(1788767995.171:201): avc: denied { noatsecure } for pid=5819 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339540][ T33] audit: type=1400 audit(1788767995.171:202): avc: denied { rlimitinh } for pid=5819 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339553][ T33] audit: type=1400 audit(1788767995.171:203): avc: denied { siginh } for pid=5819 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:50003' (ED25519) to the list of known hosts.
[ 65.595027][ T33] audit: type=1400 audit(1788767997.441:204): avc: denied { bind } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[ 65.604720][ T33] audit: type=1400 audit(1788767997.451:205): avc: denied { create } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.611713][ T33] audit: type=1400 audit(1788767997.451:206): avc: denied { bind } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.619282][ T33] audit: type=1400 audit(1788767997.451:207): avc: denied { write } for pid=5832 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.626998][ T33] audit: type=1400 audit(1788767997.471:208): avc: denied { write } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.647228][ T33] audit: type=1400 audit(1788767997.491:209): avc: denied { write } for pid=5835 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[+] Set wlan0 DOWN
[+] Set wlan0 to MONITOR mode
[+] Set wlan0 UP
[+] Set frequency to 2412 MHz
[+] Bound packet socket to wlan0
[+] Sent malicious frames
[ 66.425197][ T1380] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.425255][ T1380] ieee802154 phy1 wpan1: encryption failed: -22
[ 68.355948][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.356010][ T33] audit: type=1400 audit(1788768000.201:220): avc: denied { write } for pid=5867 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 68.395962][ T33] audit: type=1400 audit(1788768000.241:221): avc: denied { write } for pid=5870 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
OtherCrashReports:<nil> StraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor2318556748
<...>
[ 61.154660][ T34] kauditd_printk_skb: 10 callbacks suppressed
[ 61.154720][ T34] audit: type=1400 audit(1788768074.193:200): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154753][ T34] audit: type=1400 audit(1788768074.193:201): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154784][ T34] audit: type=1400 audit(1788768074.193:202): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154813][ T34] audit: type=1400 audit(1788768074.193:203): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 64.528336][ T34] audit: type=1400 audit(1788768077.563:204): avc: denied { write } for pid=5837 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.573396][ T34] audit: type=1400 audit(1788768077.613:205): avc: denied { write } for pid=5840 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.797297][ T34] audit: type=1400 audit(1788768077.833:206): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.849267][ T34] audit: type=1400 audit(1788768077.883:207): avc: denied { write } for pid=5851 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:40463' (ED25519) to the list of known hosts.
[ 64.969913][ T34] audit: type=1400 audit(1788768078.003:208): avc: denied { write } for pid=5855 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.014870][ T34] audit: type=1400 audit(1788768078.053:209): avc: denied { write } for pid=5860 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor2318556748", ["/syz-executor2318556748"], 0x7fff439de8d0 /* 11 vars */) = 0
brk(NULL) = 0x55555d907000
brk(0x55555d907d80) = 0x55555d907d80
arch_prctl(ARCH_SET_FS, 0x55555d907400) = 0
set_tid_address(0x55555d9076d0) = 5864
set_robust_list(0x55555d9076e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor2318556748", 4096) = 23
getrandom("\x22\xbb\xd0\x62\x5a\xff\x8b\x08", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55555d907d80
brk(0x55555d928d80) = 0x55555d928d80
brk(0x55555d929000) = 0x55555d929000
mprotect(0x7f3a78ce5000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
sendto(3, [{nlmsg_len=32, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=1, nlmsg_pid=0}, "\x03\x01\x00\x00\x0c\x00\x02\x00\x6e\x6c\x38\x30\x32\x31\x31\x00"], 32, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 32
recvfrom(3, [{nlmsg_len=2636, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=1, nlmsg_pid=5864}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x26], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 367], [{nla_len=2424, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x8}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x9}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xa}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xb}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xc}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BEACON], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xd}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xe}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xf}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x10}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x11}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x12}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x13}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x14}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x15}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x16}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x17}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x18}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x19}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REQ_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RELOAD_REGDB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TRIGGER_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ABORT_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x20}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x21}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x22}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x23}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_AUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x24}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x25}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEAUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x26}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x27}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x28}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x29}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_CONNECT_PARAMS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISCONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY_NETNS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SURVEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x2e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x30}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FLUSH_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x31}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x32}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x33}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_TX_BITRATE_MASK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x34}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x35}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x36}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME_WAIT_CANCEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x37}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x38}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x39}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CQM], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x40}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x41}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REKEY_OFFLOAD], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x42}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_MGMT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x43}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_OPER], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x44}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UNEXPECTED_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x45}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_PROBE_CLIENT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x46}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_BEACONS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x47}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_NOACK_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x48}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x49}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANGE_NAN_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa6 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x50}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa7 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x51}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MCAST_RATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x52}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MAC_ACL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x53}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RADAR_DETECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x54}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_PROTOCOL_FEATURES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x55}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_FT_IES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x56}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_START], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x57}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_STOP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x58}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x59}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_VENDOR], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_QOS_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x60}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x61}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MULTICAST_TO_UNICAST], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x62}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x63}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x64}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_EXTERNAL_AUTH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], ...]], [{nla_len=148, nla_type=CTRL_ATTR_MCAST_GROUPS}, [[{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x17], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]], [{nla_len=24, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x18], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x73\x63\x61\x6e\x00"...]]], [{nla_len=28, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x19], [{nla_len=15, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x72\x65\x67\x75\x6c\x61\x74\x6f\x72\x79\x00"...]]], [{nla_len=24, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1a], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6d\x6c\x6d\x65\x00"...]]], [{nla_len=24, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1b], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x76\x65\x6e\x64\x6f\x72\x00"...]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1c], [{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6e\x61\x6e\x00"...]]]]]]], 4096, 0, NULL, NULL) = 2636
close(3) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = 0
ioctl(3, SIOCSIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
close(3) = 0
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x6, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x5}, "\x06\x00\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
recvfrom(3, [{nlmsg_len=36, nlmsg_type=NLMSG_ERROR, nlmsg_flags=NLM_F_CAPPED, nlmsg_seq=1, nlmsg_pid=5864}, {error=0, msg={nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}}], 4096, 0, NULL, NULL) = 36
close(3) = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
ioctl(3, SIOCSIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = 0
close(3) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x41, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x26}, "\x6c\x09\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
recvfrom(3, [{nlmsg_len=36, nlmsg_type=NLMSG_ERROR, nlmsg_flags=NLM_F_CAPPED, nlmsg_seq=1, nlmsg_pid=5864}, {error=0, msg={nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}}], 4096, 0, NULL, NULL) = 36
close(3) = 0
socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)) = 3
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4
ioctl(4, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(4) = 0
bind(3, {sa_family=AF_PACKET, sll_protocol=htons(ETH_P_ALL), sll_ifindex=if_nametoindex("wlan0"), sll_hatype=ARPHRD_NETROM, sll_pkttype=PACKET_HOST, sll_halen=0}, 20) = 0
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
close(3) = 0
[+] Set wlan0 DOWN
[+] Set wlan0 to MONITOR mode
[+] Set wlan0 UP
[+] Set frequency to 2412 MHz
[+] Bound packet socket to wlan0
[+] Sent malicious frames
write(1, "[+] Set wlan0 DOWN\n[+] Set wlan0 to MONITOR mode\n[+] Set wlan0 UP\n[+] Set frequency to 2412 MHz\n[+] "..., 155) = 155
exit_group(0) = ?
+++ exited with 0 +++
[ 66.394674][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.394741][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 66.633030][ T34] kauditd_printk_skb: 18 callbacks suppressed
[ 66.633086][ T34] audit: type=1400 audit(1788768079.663:228): avc: denied { write } for pid=5905 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.665769][ T34] audit: type=1400 audit(1788768079.703:229): avc: denied { write } for pid=5908 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
TestError:]
|
| 439/3 |
2026/09/07 08:01 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 63.331937][ T33] audit: type=1400 audit(1788767995.171:200): avc: denied { transition } for pid=5819 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339522][ T33] audit: type=1400 audit(1788767995.171:201): avc: denied { noatsecure } for pid=5819 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339540][ T33] audit: type=1400 audit(1788767995.171:202): avc: denied { rlimitinh } for pid=5819 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339553][ T33] audit: type=1400 audit(1788767995.171:203): avc: denied { siginh } for pid=5819 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:50003' (ED25519) to the list of known hosts.
[ 65.595027][ T33] audit: type=1400 audit(1788767997.441:204): avc: denied { bind } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[ 65.604720][ T33] audit: type=1400 audit(1788767997.451:205): avc: denied { create } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.611713][ T33] audit: type=1400 audit(1788767997.451:206): avc: denied { bind } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.619282][ T33] audit: type=1400 audit(1788767997.451:207): avc: denied { write } for pid=5832 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.626998][ T33] audit: type=1400 audit(1788767997.471:208): avc: denied { write } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.647228][ T33] audit: type=1400 audit(1788767997.491:209): avc: denied { write } for pid=5835 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[+] Set wlan0 DOWN
[+] Set wlan0 to MONITOR mode
[+] Set wlan0 UP
[+] Set frequency to 2412 MHz
[+] Bound packet socket to wlan0
[+] Sent malicious frames
[ 66.425197][ T1380] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.425255][ T1380] ieee802154 phy1 wpan1: encryption failed: -22
[ 68.355948][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.356010][ T33] audit: type=1400 audit(1788768000.201:220): avc: denied { write } for pid=5867 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 68.395962][ T33] audit: type=1400 audit(1788768000.241:221): avc: denied { write } for pid=5870 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
TruncatedCrashReport: TruncatedStraceOutput:/strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor2318556748
<...>
[ 61.154660][ T34] kauditd_printk_skb: 10 callbacks suppressed
[ 61.154720][ T34] audit: type=1400 audit(1788768074.193:200): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154753][ T34] audit: type=1400 audit(1788768074.193:201): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154784][ T34] audit: type=1400 audit(1788768074.193:202): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154813][ T34] audit: type=1400 audit(1788768074.193:203): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 64.528336][ T34] audit: type=1400 audit(1788768077.563:204): avc: denied { write } for pid=5837 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.573396][ T34] audit: type=1400 audit(1788768077.613:205): avc: denied { write } for pid=5840 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.797297][ T34] audit: type=1400 audit(1788768077.833:206): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.849267][ T34] audit: type=1400 audit(1788768077.883:207): avc: denied { write } for pid=5851 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:40463' (ED25519) to the list of known hosts.
[ 64.969913][ T34] audit: type=1400 audit(1788768078.003:208): avc: denied { write } for pid=5855 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.014870][ T34] audit: type=1400 audit(1788768078.053:209): avc: denied { write } for pid=5860 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor2318556748", ["/syz-executor2318556748"], 0x7fff439de8d0 /* 11 vars */) = 0
brk(NULL) = 0x55555d907000
brk(0x55555d907d80) = 0x55555d907d80
arch_prctl(ARCH_SET_FS, 0x55555d907400) = 0
set_tid_address(0x55555d9076d0) = 5864
set_robust_list(0x55555d9076e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor2318556748", 4096) = 23
getrandom("\x22\xbb\xd0\x62\x5a\xff\x8b\x08", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55555d907d80
brk(0x55555d928d80) = 0x55555d928d80
brk(0x55555d929000) = 0x55555d929000
mprotect(0x7f3a78ce5000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
sendto(3, [{nlmsg_len=32, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=1, nlmsg_pid=0}, "\x03\x01\x00\x00\x0c\x00\x02\x00\x6e\x6c\x38\x30\x32\x31\x31\x00"], 32, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 32
recvfrom(3, [{nlmsg_len=2636, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=1, nlmsg_pid=5864}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x26], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 367], [{nla_len=2424, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x8}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x9}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xa}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xb}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xc}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BEACON], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xd}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xe}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xf}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x10}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x11}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x12}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x13}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x14}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x15}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x16}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x17}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x18}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x19}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REQ_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RELOAD_REGDB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TRIGGER_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ABORT_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x20}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x21}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x22}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x23}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_AUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x24}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x25}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEAUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x26}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x27}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x28}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x29}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_CONNECT_PARAMS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISCONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY_NETNS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SURVEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x2e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x30}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FLUSH_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x31}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x32}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x33}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_TX_BITRATE_MASK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x34}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x35}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x36}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME_WAIT_CANCEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x37}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x38}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x39}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CQM], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x40}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x41}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REKEY_OFFLOAD], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x42}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_MGMT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x43}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_OPER], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x44}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UNEXPECTED_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x45}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_PROBE_CLIENT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x46}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_BEACONS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x47}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_NOACK_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x48}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x49}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANGE_NAN_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa6 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x50}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa7 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x51}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MCAST_RATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x52}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MAC_ACL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x53}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RADAR_DETECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x54}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_PROTOCOL_FEATURES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x55}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_FT_IES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x56}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_START], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x57}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_STOP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x58}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x59}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_VENDOR], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_QOS_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x60}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x61}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MULTICAST_TO_UNICAST], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x62}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x63}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x64}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_EXTERNAL_AUTH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], ...]], [{nla_len=148, nla_type=CTRL_ATTR_MCAST_GROUPS}, [[{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x17], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]], [{nla_len=24, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x18], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x73\x63\x61\x6e\x00"...]]], [{nla_len=28, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x19], [{nla_len=15, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x72\x65\x67\x75\x6c\x61\x74\x6f\x72\x79\x00"...]]], [{nla_len=24, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1a], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6d\x6c\x6d\x65\x00"...]]], [{nla_len=24, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1b], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x76\x65\x6e\x64\x6f\x72\x00"...]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1c], [{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6e\x61\x6e\x00"...]]]]]]], 4096, 0, NULL, NULL) = 2636
close(3) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = 0
ioctl(3, SIOCSIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
close(3) = 0
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x6, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x5}, "\x06\x00\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
recvfrom(3, [{nlmsg_len=36, nlmsg_type=NLMSG_ERROR, nlmsg_flags=NLM_F_CAPPED, nlmsg_seq=1, nlmsg_pid=5864}, {error=0, msg={nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}}], 4096, 0, NULL, NULL) = 36
close(3) = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
ioctl(3, SIOCSIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = 0
close(3) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x41, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x26}, "\x6c\x09\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
recvfrom(3, [{nlmsg_len=36, nlmsg_type=NLMSG_ERROR, nlmsg_flags=NLM_F_CAPPED, nlmsg_seq=1, nlmsg_pid=5864}, {error=0, msg={nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}}], 4096, 0, NULL, NULL) = 36
close(3) = 0
socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)) = 3
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4
ioctl(4, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(4) = 0
bind(3, {sa_family=AF_PACKET, sll_protocol=htons(ETH_P_ALL), sll_ifindex=if_nametoindex("wlan0"), sll_hatype=ARPHRD_NETROM, sll_pkttype=PACKET_HOST, sll_halen=0}, 20) = 0
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
close(3) = 0
[+] Set wlan0 DOWN
[+] Set wlan0 to MONITOR mode
[+] Set wlan0 UP
[+] Set frequency to 2412 MHz
[+] Bound packet socket to wlan0
[+] Sent malicious frames
write(1, "[+] Set wlan0 DOWN\n[+] Set wlan0 to MONITOR mode\n[+] Set wlan0 UP\n[+] Set frequency to 2412 MHz\n[+] "..., 155) = 155
exit_group(0) = ?
+++ exited with 0 +++
[ 66.394674][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.394741][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 66.633030][ T34] kauditd_printk_skb: 18 callbacks suppressed
[ 66.633086][ T34] audit: type=1400 audit(1788768079.663:228): avc: denied { write } for pid=5905 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.665769][ T34] audit: type=1400 audit(1788768079.703:229): avc: denied { write } for pid=5908 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
]
|
| 440/3 |
2026/09/07 08:01 |
agent |
repro-oracle |
35m
Model:
Results: map[Feedback:The reproduction attempt failed to trigger the bug because it injected frames into the default `wlan0` interface, which does not have the `HAS_RATE_CONTROL` flag set.
### Root Cause Analysis
1. When injecting a frame via `AF_PACKET` with a radiotap header containing `IEEE80211_RADIOTAP_RATE` and `rate = 0`, `ieee80211_parse_tx_radiotap()` initializes `info->control.rates[0].idx = -1`. Since `rate = 0` does not match any valid bitrate, `idx` remains `-1`.
2. Because `idx < 0`, `ieee80211_parse_tx_radiotap()` clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
3. In the TX path, `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` **unless** the hardware has the `HAS_RATE_CONTROL` flag set.
4. If `ieee80211_tx_h_rate_ctrl()` is called, it falls back to standard rate control, which overwrites `info->control.rates[0].idx` with a valid, non-negative index (e.g., `0`).
5. When `mac80211_hwsim_tx_frame_no_nl()` subsequently calls `mac80211_hwsim_write_tsf()`, `idx` is no longer negative, so the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` does not trigger.
### How to Trigger the Bug
To prevent `ieee80211_tx_h_rate_ctrl()` from overwriting `idx`, the `mac80211_hwsim` radio must have the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`) or NAN Data support.
You need to modify the reproducer to first create a new `mac80211_hwsim` radio with MLO support using Netlink:
1. Open a Netlink socket and resolve the `MAC80211_HWSIM` family ID.
2. Send a `HWSIM_CMD_NEW_RADIO` (4) command with the `HWSIM_ATTR_MLO_SUPPORT` (25) flag attribute.
3. Wait briefly for the new interface (e.g., `wlan1` or `wlan2`) to be created.
4. Set the new interface DOWN, change its mode to `NL80211_IFTYPE_MONITOR`, and set it UP.
5. Bind an `AF_PACKET` socket to the new interface and inject the same frame with `IEEE80211_RADIOTAP_RATE` and `rate = 0`.
This will cause `ieee80211_tx_h_rate_ctrl()` to be skipped, preserving `idx = -1` until it reaches `mac80211_hwsim_write_tsf()`, successfully triggering the `WARN_ON_ONCE`. ProbePassed:true TerminalError: TitleMatches:true]
Instruction: You are a security researcher with deep Linux kernel background.
Analyze the results of running the generated program.
=== CRITICAL ENVIRONMENT & TARGET CLASSIFICATION ===
Set 'TerminalError' to a descriptive error message ONLY if:
1. The execution failed due to missing hardware device nodes, subsystems, kernel modules, or privilege limits
that cannot be loaded, created, or bypassed by user-space C code edits in the VM guest.
2. The target source files or functions described in the bug description do not exist in the checked-out codebase,
meaning the codebase version is mismatched and the target code is absent.
=== CRITICAL PROHIBITIONS ===
- Do NOT classify a run as a terminal failure or assume a bug is fixed based on git log entries, commit titles,
or commit messages. Reproducibility can ONLY be determined by executing reproducer candidates in the VM.
- Do NOT suggest C code strategies, repairs, or namespace bypasses when setting 'TerminalError'.
=== PHASE 2: BUG REPRODUCTION (EVALUATION) ===
The executed program was a full reproducer candidate attempting to trigger the target bug/crash.
Use this to guide your classification and feedback:
1. If a crash was triggered (Reproduced is true):
- Determine if the triggered crash matches the expected bug.
- If you conclude they represent the same underlying bug (the same root cause)
despite different titles, crash signatures, or call traces, set TitleMatches
to true and provide a detailed, technical, and verbose explanation of the
equivalence in the 'Feedback' field.
- If they do not represent the same bug (a completely unrelated crash/collision),
set TitleMatches to false and explain the collision in 'Feedback'.
- If they match exactly, set TitleMatches to true and provide a brief confirmation in 'Feedback'.
2. If the execution was successful (exit 0) WITHOUT a crash (Reproduced is false):
- The reproduction attempt failed to trigger the bug. Analyze the console/strace output
to understand why the bug did not trigger (e.g., timing, input arguments, environment setup)
and provide feedback on how to improve the reproducer logic to trigger the crash.
Critical Diagnostic Rule for Reproduction Failures:
If the reproduction attempt fails (e.g., a system call returns an error, or a
warning/error message appears in the console log), you MUST:
1. Identify the failing system call from the execution trace or strace output.
2. Identify any corresponding warning or error messages in the console log.
3. Immediately search the kernel source tree for the warning message strings or
the code of the failing system call/subsystem to locate the validation logic.
4. Trace the kernel's validation logic to diagnose the exact constraint violation
or input mismatch in the generated program.
5. Provide a technical diagnosis in the feedback explaining the exact kernel constraint that was violated and why.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
IsProbe: false
Reproduced: false
Console Output: [ 63.331937][ T33] audit: type=1400 audit(1788767995.171:200): avc: denied { transition } for pid=5819 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339522][ T33] audit: type=1400 audit(1788767995.171:201): avc: denied { noatsecure } for pid=5819 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339540][ T33] audit: type=1400 audit(1788767995.171:202): avc: denied { rlimitinh } for pid=5819 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 63.339553][ T33] audit: type=1400 audit(1788767995.171:203): avc: denied { siginh } for pid=5819 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:50003' (ED25519) to the list of known hosts.
[ 65.595027][ T33] audit: type=1400 audit(1788767997.441:204): avc: denied { bind } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[ 65.604720][ T33] audit: type=1400 audit(1788767997.451:205): avc: denied { create } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.611713][ T33] audit: type=1400 audit(1788767997.451:206): avc: denied { bind } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.619282][ T33] audit: type=1400 audit(1788767997.451:207): avc: denied { write } for pid=5832 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.626998][ T33] audit: type=1400 audit(1788767997.471:208): avc: denied { write } for pid=5831 comm="syz-executor296" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 65.647228][ T33] audit: type=1400 audit(1788767997.491:209): avc: denied { write } for pid=5835 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[+] Set wlan0 DOWN
[+] Set wlan0 to MONITOR mode
[+] Set wlan0 UP
[+] Set frequency to 2412 MHz
[+] Bound packet socket to wlan0
[+] Sent malicious frames
[ 66.425197][ T1380] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.425255][ T1380] ieee802154 phy1 wpan1: encryption failed: -22
[ 68.355948][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 68.356010][ T33] audit: type=1400 audit(1788768000.201:220): avc: denied { write } for pid=5867 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 68.395962][ T33] audit: type=1400 audit(1788768000.241:221): avc: denied { write } for pid=5870 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Strace Output: /strace -e \!wait4,clock_nanosleep,nanosleep -s 100 -x -f /syz-executor2318556748
<...>
[ 61.154660][ T34] kauditd_printk_skb: 10 callbacks suppressed
[ 61.154720][ T34] audit: type=1400 audit(1788768074.193:200): avc: denied { transition } for pid=5827 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154753][ T34] audit: type=1400 audit(1788768074.193:201): avc: denied { noatsecure } for pid=5827 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154784][ T34] audit: type=1400 audit(1788768074.193:202): avc: denied { rlimitinh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.154813][ T34] audit: type=1400 audit(1788768074.193:203): avc: denied { siginh } for pid=5827 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 64.528336][ T34] audit: type=1400 audit(1788768077.563:204): avc: denied { write } for pid=5837 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.573396][ T34] audit: type=1400 audit(1788768077.613:205): avc: denied { write } for pid=5840 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.797297][ T34] audit: type=1400 audit(1788768077.833:206): avc: denied { write } for pid=5847 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 64.849267][ T34] audit: type=1400 audit(1788768077.883:207): avc: denied { write } for pid=5851 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Warning: Permanently added '[localhost]:40463' (ED25519) to the list of known hosts.
[ 64.969913][ T34] audit: type=1400 audit(1788768078.003:208): avc: denied { write } for pid=5855 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.014870][ T34] audit: type=1400 audit(1788768078.053:209): avc: denied { write } for pid=5860 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
execve("/syz-executor2318556748", ["/syz-executor2318556748"], 0x7fff439de8d0 /* 11 vars */) = 0
brk(NULL) = 0x55555d907000
brk(0x55555d907d80) = 0x55555d907d80
arch_prctl(ARCH_SET_FS, 0x55555d907400) = 0
set_tid_address(0x55555d9076d0) = 5864
set_robust_list(0x55555d9076e0, 24) = 0
rseq({cpu_id_start=0, cpu_id=RSEQ_CPU_ID_UNINITIALIZED, rseq_cs=NULL, flags=0, node_id=0, mm_cid=0, slice_ctrl={request=0, granted=0, __reserved=0}, __reserved=0}, 33, 0, 0x53053053) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
readlinkat(AT_FDCWD, "/proc/self/exe", "/syz-executor2318556748", 4096) = 23
getrandom("\x22\xbb\xd0\x62\x5a\xff\x8b\x08", 8, GRND_NONBLOCK) = 8
brk(NULL) = 0x55555d907d80
brk(0x55555d928d80) = 0x55555d928d80
brk(0x55555d929000) = 0x55555d929000
mprotect(0x7f3a78ce5000, 20480, PROT_READ) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
sendto(3, [{nlmsg_len=32, nlmsg_type=0x10 /* NLMSG_??? */, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=1, nlmsg_pid=0}, "\x03\x01\x00\x00\x0c\x00\x02\x00\x6e\x6c\x38\x30\x32\x31\x31\x00"], 32, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 32
recvfrom(3, [{nlmsg_len=2636, nlmsg_type=nlctrl, nlmsg_flags=0, nlmsg_seq=1, nlmsg_pid=5864}, {cmd=CTRL_CMD_NEWFAMILY, version=2}, [[{nla_len=12, nla_type=CTRL_ATTR_FAMILY_NAME}, "\x6e\x6c\x38\x30\x32\x31\x31\x00"...], [{nla_len=6, nla_type=CTRL_ATTR_FAMILY_ID}, 0x26], [{nla_len=8, nla_type=CTRL_ATTR_VERSION}, 1], [{nla_len=8, nla_type=CTRL_ATTR_HDRSIZE}, 0], [{nla_len=8, nla_type=CTRL_ATTR_MAXATTR}, 367], [{nla_len=2424, nla_type=CTRL_ATTR_OPS}, [[{nla_len=20, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x7}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_INTERFACE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x8}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x9}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xa}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xb}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_KEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xc}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BEACON], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xd}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xe}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_AP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0xf}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x10}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x11}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_STATION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x12}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x13}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MPP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x14}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x15}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_NEW_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x16}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_MPATH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x17}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_BSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x18}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x19}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REQ_SET_REG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RELOAD_REGDB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x1d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MESH_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TRIGGER_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x1f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ABORT_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x20}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x21}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x22}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_SCHED_SCAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x23}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_AUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x24}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x25}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEAUTHENTICATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x26}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISASSOCIATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x27}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x28}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_IBSS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x29}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_CONNECT_PARAMS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x2b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DISCONNECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WIPHY_NETNS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_SURVEY], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DUMP]]], [{nla_len=20, nla_type=0x2e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x2f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x30}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FLUSH_PMKSA], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x31}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x32}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x33}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_TX_BITRATE_MASK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x34}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x35}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x36}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_FRAME_WAIT_CANCEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x37}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x38}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_POWER_SAVE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x39}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CQM], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_CHANNEL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_MESH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_JOIN_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_LEAVE_OCB], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x3f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x40}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_WOWLAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x41}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_REKEY_OFFLOAD], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x42}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_MGMT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x43}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_OPER], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x44}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UNEXPECTED_FRAME], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x45}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_PROBE_CLIENT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x46}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_REGISTER_BEACONS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x47}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_NOACK_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x48}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x49}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_P2P_DEVICE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x4a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_START_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_STOP_NAN], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_NAN_FUNCTION], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANGE_NAN_CONFIG], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x4f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa6 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x50}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, 0xa7 /* NL80211_CMD_??? */], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x51}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MCAST_RATE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x52}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MAC_ACL], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x53}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_RADAR_DETECT], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x54}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_PROTOCOL_FEATURES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x55}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_UPDATE_FT_IES], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x56}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_START], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x57}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CRIT_PROTOCOL_STOP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x58}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_GET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], [{nla_len=20, nla_type=0x59}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_COALESCE], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5a}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5b}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_VENDOR], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_DUMP|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5c}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_QOS_MAP], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5d}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_ADD_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5e}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_TX_TS], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x5f}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x60}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x61}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_MULTICAST_TO_UNICAST], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x62}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_SET_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x63}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_DEL_PMK], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL|GENL_UNS_ADMIN_PERM]]], [{nla_len=20, nla_type=0x64}, [[{nla_len=8, nla_type=CTRL_ATTR_OP_ID}, NL80211_CMD_EXTERNAL_AUTH], [{nla_len=8, nla_type=CTRL_ATTR_OP_FLAGS}, GENL_ADMIN_PERM|GENL_CMD_CAP_DO|GENL_CMD_CAP_HASPOL]]], ...]], [{nla_len=148, nla_type=CTRL_ATTR_MCAST_GROUPS}, [[{nla_len=24, nla_type=0x1}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x17], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x63\x6f\x6e\x66\x69\x67\x00"...]]], [{nla_len=24, nla_type=0x2}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x18], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x73\x63\x61\x6e\x00"...]]], [{nla_len=28, nla_type=0x3}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x19], [{nla_len=15, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x72\x65\x67\x75\x6c\x61\x74\x6f\x72\x79\x00"...]]], [{nla_len=24, nla_type=0x4}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1a], [{nla_len=9, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6d\x6c\x6d\x65\x00"...]]], [{nla_len=24, nla_type=0x5}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1b], [{nla_len=11, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x76\x65\x6e\x64\x6f\x72\x00"...]]], [{nla_len=20, nla_type=0x6}, [[{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_ID}, 0x1c], [{nla_len=8, nla_type=CTRL_ATTR_MCAST_GRP_NAME}, "\x6e\x61\x6e\x00"...]]]]]]], 4096, 0, NULL, NULL) = 2636
close(3) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = 0
ioctl(3, SIOCSIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
close(3) = 0
fstat(1, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x6, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x5}, "\x06\x00\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
recvfrom(3, [{nlmsg_len=36, nlmsg_type=NLMSG_ERROR, nlmsg_flags=NLM_F_CAPPED, nlmsg_seq=1, nlmsg_pid=5864}, {error=0, msg={nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}}], 4096, 0, NULL, NULL) = 36
close(3) = 0
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 3
ioctl(3, SIOCGIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_BROADCAST|IFF_MULTICAST}) = 0
ioctl(3, SIOCSIFFLAGS, {ifr_name="wlan0", ifr_flags=IFF_UP|IFF_BROADCAST|IFF_MULTICAST}) = 0
close(3) = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
ioctl(3, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(3) = 0
socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC) = 3
bind(3, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 0
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x41, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x26}, "\x6c\x09\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
recvfrom(3, [{nlmsg_len=36, nlmsg_type=NLMSG_ERROR, nlmsg_flags=NLM_F_CAPPED, nlmsg_seq=1, nlmsg_pid=5864}, {error=0, msg={nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}}], 4096, 0, NULL, NULL) = 36
close(3) = 0
socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)) = 3
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4
ioctl(4, SIOCGIFINDEX, {ifr_name="wlan0", ifr_ifindex=8}) = 0
close(4) = 0
bind(3, {sa_family=AF_PACKET, sll_protocol=htons(ETH_P_ALL), sll_ifindex=if_nametoindex("wlan0"), sll_hatype=ARPHRD_NETROM, sll_pkttype=PACKET_HOST, sll_halen=0}, 20) = 0
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33
close(3) = 0
[+] Set wlan0 DOWN
[+] Set wlan0 to MONITOR mode
[+] Set wlan0 UP
[+] Set frequency to 2412 MHz
[+] Bound packet socket to wlan0
[+] Sent malicious frames
write(1, "[+] Set wlan0 DOWN\n[+] Set wlan0 to MONITOR mode\n[+] Set wlan0 UP\n[+] Set frequency to 2412 MHz\n[+] "..., 155) = 155
exit_group(0) = ?
+++ exited with 0 +++
[ 66.394674][ T1379] ieee802154 phy0 wpan0: encryption failed: -22
[ 66.394741][ T1379] ieee802154 phy1 wpan1: encryption failed: -22
[ 66.633030][ T34] kauditd_printk_skb: 18 callbacks suppressed
[ 66.633086][ T34] audit: type=1400 audit(1788768079.663:228): avc: denied { write } for pid=5905 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 66.665769][ T34] audit: type=1400 audit(1788768079.703:229): avc: denied { write } for pid=5908 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
Crash Report:
|
| 441/4 |
2026/09/07 08:01 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 24235
output: 32
thoughts: 1652
Thoughts: **Analyzing the `mac80211_hwsim_write_tsf` Warning and Unexpected Success**
Here's my current thought process regarding the results of the program execution. My primary objective was to analyze the output of the generated program and understand why a specific bug, `WARNING in mac80211_hwsim_write_tsf`, manifested.
The execution itself was successful, returning an exit code of 0, and crucially, it did *not* crash. This "Reproduced is false" status immediately raised a flag, as I expected the bug to be triggered. So, my immediate question became: why didn't it trigger?
I turned to the `strace` output for clues. I observed the creation of an `AF_PACKET` socket (`socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL)) = 3`) and an `AF_UNIX` socket, which was then used to get the interface index for `wlan0`. This is standard setup for interacting with network devices.
The critical piece of information I extracted from `strace` was the `sendto` call: `sendto(3, "\x00\x00\x09\x00\x04\x00\x00\x00\x00\x08\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 33, 0, NULL, 0) = 33`. The fact that `sendto` returned 33 indicates that the packet, which was 33 bytes long, was successfully sent. This directly contradicts what I might have assumed if the bug *had* been reproduced, implying the packet transmission itself wasn't the point of failure.
However, I then re-examined the bug description, specifically the warnings:
```
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
```
The warning `c->control.rates[0].idx < 0` is the core issue. This indicates that some rate index being accessed is invalid. The fact that this occurs within `mac80211_hwsim_write_tsf`, which is called when *sending* a frame, is a key connection.
My next step was to delve into the functions involved: `mac80211_hwsim_write_tsf` and `mac80211_hwsim_get_tx_rate`. I also noted the "80 bytes leftover after parsing attributes" from the `netlink` message. This strongly suggests that the syzkaller program wasn't just sending a raw packet via `AF_PACKET`, but was also using `netlink` to configure something *before* or *in conjunction with* sending the packet, and this netlink message was malformed or misconfigured, leading to the leftover data. I considered if the netlink command was related to `NL80211_CMD_FRAME` or a similar configuration command that might indirectly cause the rate index issue.
Then I examined the call trace provided:
```
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
```
This trace confirms that the packet, originating from the `AF_PACKET` socket, was injected into the system through `ieee80211_monitor_start_xmit`. My hypothesis is that within `ieee80211_monitor_start_xmit`, the radiotap header of the injected packet is parsed. If this radiotap header contains an invalid rate index, it would directly lead to the observed `c->control.rates[0].idx < 0` error. This means the issue is likely not with the *transmission* of the raw packet itself, but with how the packet's metadata (specifically, the radiotap header indicating the transmission rate) is being interpreted or constructed by the syzkaller fuzzer. The "80 bytes leftover" in the netlink message might be related to setting up the parameters that ultimately result in this malformed radiotap header being processed.
|
| 442/4 |
2026/09/07 08:01 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_monitor_start_xmit]
Results: map[SourceCode:2324: netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2325: struct net_device *dev)
2326: {
2327: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2328: struct ieee80211_chanctx_conf *chanctx_conf;
2329: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2330: struct ieee80211_hdr *hdr;
2331: struct ieee80211_sub_if_data *tmp_sdata, *sdata;
2332: struct cfg80211_chan_def *chandef;
2333: u16 len_rthdr;
2334: int hdrlen;
2335:
2336: sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2337: if (unlikely(!ieee80211_sdata_running(sdata)))
2338: goto fail;
2339:
2340: memset(info, 0, sizeof(*info));
2341: info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
2342: IEEE80211_TX_CTL_INJECTED;
2343:
2344: /* Sanity-check the length of the radiotap header */
2345: if (!ieee80211_validate_radiotap_len(skb))
2346: goto fail;
2347:
2348: /* we now know there is a radiotap header with a length we can use */
2349: len_rthdr = ieee80211_get_radiotap_len(skb->data);
2350:
2351: /*
2352: * fix up the pointers accounting for the radiotap
2353: * header still being in there. We are being given
2354: * a precooked IEEE80211 header so no need for
2355: * normal processing
2356: */
2357: skb_set_mac_header(skb, len_rthdr);
2358: /*
2359: * these are just fixed to the end of the rt area since we
2360: * don't have any better information and at this point, nobody cares
2361: */
2362: skb_set_network_header(skb, len_rthdr);
2363: skb_set_transport_header(skb, len_rthdr);
2364:
2365: if (skb->len < len_rthdr + 2)
2366: goto fail;
2367:
2368: hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
2369: hdrlen = ieee80211_hdrlen(hdr->frame_control);
2370:
2371: if (skb->len < len_rthdr + hdrlen)
2372: goto fail;
2373:
2374: /*
2375: * Initialize skb->protocol if the injected frame is a data frame
2376: * carrying a rfc1042 header
2377: */
2378: if (ieee80211_is_data(hdr->frame_control) &&
2379: skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) {
2380: u8 *payload = (u8 *)hdr + hdrlen;
2381:
2382: if (ether_addr_equal(payload, rfc1042_header))
2383: skb->protocol = cpu_to_be16((payload[6] << 8) |
2384: payload[7]);
2385: }
2386:
2387: rcu_read_lock();
2388:
2389: /*
2390: * We process outgoing injected frames that have a local address
2391: * we handle as though they are non-injected frames.
2392: * This code here isn't entirely correct, the local MAC address
2393: * isn't always enough to find the interface to use; for proper
2394: * VLAN support we have an nl80211-based mechanism.
2395: *
2396: * This is necessary, for example, for old hostapd versions that
2397: * don't use nl80211-based management TX/RX.
2398: */
2399: list_for_each_entry_rcu(tmp_sdata, &local->interfaces, list) {
2400: if (!ieee80211_sdata_running(tmp_sdata))
2401: continue;
2402: if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2403: tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2404: continue;
2405: if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) {
2406: sdata = tmp_sdata;
2407: break;
2408: }
2409: }
2410:
2411: chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
2412: if (!chanctx_conf) {
2413: tmp_sdata = rcu_dereference(local->monitor_sdata);
2414: if (tmp_sdata)
2415: chanctx_conf =
2416: rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf);
2417: }
2418:
2419: if (!chanctx_conf) {
2420: struct ieee80211_chanctx *ctx;
2421: bool first = true;
2422:
2423: list_for_each_entry_rcu(ctx, &local->chanctx_list, list) {
2424: if (!first)
2425: goto fail_rcu;
2426: chanctx_conf = &ctx->conf;
2427: first = false;
2428: }
2429: }
2430:
2431: if (chanctx_conf)
2432: chandef = &chanctx_conf->def;
2433: else
2434: goto fail_rcu;
2435:
2436: /*
2437: * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still
2438: * shouldn't transmit on disabled channels.
2439: */
2440: if (!cfg80211_chandef_usable(local->hw.wiphy, chandef,
2441: IEEE80211_CHAN_DISABLED))
2442: goto fail_rcu;
2443:
2444: /*
2445: * Frame injection is not allowed if beaconing is not allowed
2446: * or if we need radar detection. Beaconing is usually not allowed when
2447: * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
2448: * Passive scan is also used in world regulatory domains where
2449: * your country is not known and as such it should be treated as
2450: * NO TX unless the channel is explicitly allowed in which case
2451: * your current regulatory domain would not have the passive scan
2452: * flag.
2453: *
2454: * Since AP mode uses monitor interfaces to inject/TX management
2455: * frames we can make AP mode the exception to this rule once it
2456: * supports radar detection as its implementation can deal with
2457: * radar detection by itself. We can do that later by adding a
2458: * monitor flag interfaces used for AP support.
2459: */
2460: if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
2461: sdata->vif.type))
2462: goto fail_rcu;
2463:
2464: info->band = chandef->chan->band;
2465:
2466: /* Initialize skb->priority according to frame type and TID class,
2467: * with respect to the sub interface that the frame will actually
2468: * be transmitted on. If the DONT_REORDER flag is set, the original
2469: * skb-priority is preserved to assure frames injected with this
2470: * flag are not reordered relative to each other.
2471: */
2472: ieee80211_select_queue_80211(sdata, skb, hdr);
2473: skb_set_queue_mapping(skb, ieee80211_ac_from_tid(skb->priority));
2474:
2475: /*
2476: * Process the radiotap header. This will now take into account the
2477: * selected chandef above to accurately set injection rates and
2478: * retransmissions.
2479: */
2480: if (!ieee80211_parse_tx_radiotap(skb, dev))
2481: goto fail_rcu;
2482:
2483: /* remove the injection radiotap header */
2484: skb_pull(skb, len_rthdr);
2485:
2486: ieee80211_xmit(sdata, NULL, skb);
2487: rcu_read_unlock();
2488:
2489: return NETDEV_TX_OK;
2490:
2491: fail_rcu:
2492: rcu_read_unlock();
2493: fail:
2494: dev_kfree_skb(skb);
2495: return NETDEV_TX_OK; /* meaning, we dealt with the skb */
2496: }
SourceFile:net/mac80211/tx.c]
|
| 443/4 |
2026/09/07 08:02 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 28863
output: 33
thoughts: 47
Thoughts: **My Thought Process Regarding Radiotap Header Parsing in IEEE 802.11 Transmissions**
Alright, so my primary focus right now is understanding how we're handling the radiotap header during transmission for IEEE 802.11 frames. My current understanding is that the crucial parsing logic for this header resides within the `ieee80211_parse_tx_radiotap` function. To gain a deeper insight into the specifics of this process – what information is extracted, how it's validated, and what subsequent actions are taken based on its contents – I absolutely need to delve into the implementation of `ieee80211_parse_tx_radiotap` itself. This function is clearly the gateway for processing this metadata before the frame is actually transmitted, and I need to see its inner workings to fully grasp the entire transmission pipeline from a radiotap perspective.
|
| 444/4 |
2026/09/07 08:02 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_parse_tx_radiotap]
Results: map[SourceCode:2106: bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
2107: struct net_device *dev)
2108: {
2109: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2110: struct ieee80211_radiotap_iterator iterator;
2111: struct ieee80211_radiotap_header *rthdr =
2112: (struct ieee80211_radiotap_header *) skb->data;
2113: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2114: int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
2115: NULL);
2116: u16 txflags;
2117: u16 rate = 0;
2118: bool rate_found = false;
2119: u8 rate_retries = 0;
2120: u16 rate_flags = 0;
2121: u8 mcs_known, mcs_flags, mcs_bw;
2122: u16 vht_known;
2123: u8 vht_mcs = 0, vht_nss = 0;
2124: int i;
2125:
2126: if (!ieee80211_validate_radiotap_len(skb))
2127: return false;
2128:
2129: info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
2130: IEEE80211_TX_CTL_DONTFRAG;
2131:
2132: /*
2133: * for every radiotap entry that is present
2134: * (ieee80211_radiotap_iterator_next returns -ENOENT when no more
2135: * entries present, or -EINVAL on error)
2136: */
2137:
2138: while (!ret) {
2139: ret = ieee80211_radiotap_iterator_next(&iterator);
2140:
2141: if (ret)
2142: continue;
2143:
2144: /* see if this argument is something we can use */
2145: switch (iterator.this_arg_index) {
2146: /*
2147: * You must take care when dereferencing iterator.this_arg
2148: * for multibyte types... the pointer is not aligned. Use
2149: * get_unaligned((type *)iterator.this_arg) to dereference
2150: * iterator.this_arg for type "type" safely on all arches.
2151: */
2152: case IEEE80211_RADIOTAP_FLAGS:
2153: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
2154: /*
2155: * this indicates that the skb we have been
2156: * handed has the 32-bit FCS CRC at the end...
2157: * we should react to that by snipping it off
2158: * because it will be recomputed and added
2159: * on transmission
2160: */
2161: if (skb->len < (iterator._max_length + FCS_LEN))
2162: return false;
2163:
2164: skb_trim(skb, skb->len - FCS_LEN);
2165: }
2166: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
2167: info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
2168: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
2169: info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
2170: break;
2171:
2172: case IEEE80211_RADIOTAP_TX_FLAGS:
2173: txflags = get_unaligned_le16(iterator.this_arg);
2174: if (txflags & IEEE80211_RADIOTAP_F_TX_NOACK)
2175: info->flags |= IEEE80211_TX_CTL_NO_ACK;
2176: if (txflags & IEEE80211_RADIOTAP_F_TX_NOSEQNO)
2177: info->control.flags |= IEEE80211_TX_CTRL_NO_SEQNO;
2178: if (txflags & IEEE80211_RADIOTAP_F_TX_ORDER)
2179: info->control.flags |=
2180: IEEE80211_TX_CTRL_DONT_REORDER;
2181: break;
2182:
2183: case IEEE80211_RADIOTAP_RATE:
2184: rate = *iterator.this_arg;
2185: rate_flags = 0;
2186: rate_found = true;
2187: break;
2188:
2189: case IEEE80211_RADIOTAP_ANTENNA:
2190: /* this can appear multiple times, keep a bitmap */
2191: /* control.antennas is only a 2-bit bitmap */
2192: if (*iterator.this_arg < 2)
2193: info->control.antennas |= BIT(*iterator.this_arg);
2194: break;
2195:
2196: case IEEE80211_RADIOTAP_DATA_RETRIES:
2197: rate_retries = *iterator.this_arg;
2198: break;
2199:
2200: case IEEE80211_RADIOTAP_MCS:
2201: mcs_known = iterator.this_arg[0];
2202: mcs_flags = iterator.this_arg[1];
2203: if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
2204: break;
2205:
2206: rate_found = true;
2207: rate = iterator.this_arg[2];
2208: rate_flags = IEEE80211_TX_RC_MCS;
2209:
2210: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
2211: mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
2212: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2213:
2214: mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
2215: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
2216: mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
2217: rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
2218:
2219: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC &&
2220: mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC)
2221: info->flags |= IEEE80211_TX_CTL_LDPC;
2222:
2223: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
2224: u8 stbc = u8_get_bits(mcs_flags,
2225: IEEE80211_RADIOTAP_MCS_STBC_MASK);
2226:
2227: info->flags |=
2228: u32_encode_bits(stbc,
2229: IEEE80211_TX_CTL_STBC);
2230: }
2231: break;
2232:
2233: case IEEE80211_RADIOTAP_VHT:
2234: vht_known = get_unaligned_le16(iterator.this_arg);
2235: rate_found = true;
2236:
2237: rate_flags = IEEE80211_TX_RC_VHT_MCS;
2238: if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
2239: (iterator.this_arg[2] &
2240: IEEE80211_RADIOTAP_VHT_FLAG_SGI))
2241: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2242: if (vht_known &
2243: IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
2244: if (iterator.this_arg[3] == 1)
2245: rate_flags |=
2246: IEEE80211_TX_RC_40_MHZ_WIDTH;
2247: else if (iterator.this_arg[3] == 4)
2248: rate_flags |=
2249: IEEE80211_TX_RC_80_MHZ_WIDTH;
2250: else if (iterator.this_arg[3] == 11)
2251: rate_flags |=
2252: IEEE80211_TX_RC_160_MHZ_WIDTH;
2253: }
2254:
2255: vht_mcs = iterator.this_arg[4] >> 4;
2256: if (vht_mcs > 11)
2257: vht_mcs = 0;
2258: vht_nss = iterator.this_arg[4] & 0xF;
2259: if (!vht_nss || vht_nss > 8)
2260: vht_nss = 1;
2261: break;
2262:
2263: /*
2264: * Please update the file
2265: * Documentation/networking/mac80211-injection.rst
2266: * when parsing new fields here.
2267: */
2268:
2269: default:
2270: break;
2271: }
2272: }
2273:
2274: if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
2275: return false;
2276:
2277: if (rate_found) {
2278: struct ieee80211_supported_band *sband =
2279: local->hw.wiphy->bands[info->band];
2280:
2281: info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
2282:
2283: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
2284: info->control.rates[i].idx = -1;
2285: info->control.rates[i].flags = 0;
2286: info->control.rates[i].count = 0;
2287: }
2288:
2289: if (rate_flags & IEEE80211_TX_RC_MCS) {
2290: /* reset antennas if not enough */
2291: if (IEEE80211_HT_MCS_CHAINS(rate) >
2292: hweight8(info->control.antennas))
2293: info->control.antennas = 0;
2294:
2295: info->control.rates[0].idx = rate;
2296: } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
2297: /* reset antennas if not enough */
2298: if (vht_nss > hweight8(info->control.antennas))
2299: info->control.antennas = 0;
2300:
2301: ieee80211_rate_set_vht(info->control.rates, vht_mcs,
2302: vht_nss);
2303: } else if (sband) {
2304: for (i = 0; i < sband->n_bitrates; i++) {
2305: if (rate * 5 != sband->bitrates[i].bitrate)
2306: continue;
2307:
2308: info->control.rates[0].idx = i;
2309: break;
2310: }
2311: }
2312:
2313: if (info->control.rates[0].idx < 0)
2314: info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
2315:
2316: info->control.rates[0].flags = rate_flags;
2317: info->control.rates[0].count = min_t(u8, rate_retries + 1,
2318: local->hw.max_rate_tries);
2319: }
2320:
2321: return true;
2322: }
SourceFile:net/mac80211/tx.c]
|
| 445/4 |
2026/09/07 08:02 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 32800
output: 31
thoughts: 167
Thoughts: **My Thought Process Unpacking `ieee80211_parse_tx_radiotap` and its Impact on Rate Selection**
My initial observation was focused on the `ieee80211_parse_tx_radiotap` function and its handling of the rate index. I noticed that it explicitly sets `info->control.rates[0].idx` to `-1` as a starting point before attempting to determine the actual rate index. This immediately struck me as a deliberate initialization, likely to signify an unknown or unset rate at that stage.
The subsequent behavior, where `IEEE80211_TX_CTRL_RATE_INJECT` is cleared from `info->control.flags` *if* the rate index isn't found, is what really piqued my interest. This conditional clearing is a critical piece of the puzzle. My internal monologue then connected this to the potential downstream implications.
The core of my concern became: if `IEEE80211_TX_CTRL_RATE_INJECT` is no longer set, how can other parts of the system, specifically `mac80211_hwsim_get_tx_rate`, still rely on it? This seemed like a potential contradiction or a point where the intended flow of information might be broken. It raised the question of whether the flag's removal would effectively disable the rate injection mechanism for the hardware simulation.
This thought led me to the logical next step: I needed to explicitly examine the code for both `mac80211_hwsim_get_tx_rate` and the more general `ieee80211_get_tx_rate` functions. My aim was to understand their dependencies on `IEEE80211_TX_CTRL_RATE_INJECT` and how they would behave in the scenario where this flag is cleared by `ieee80211_parse_tx_radiotap` due to an unresolvable rate index. I was essentially trying to trace the path of this flag's influence and identify any potential disconnects in the rate selection logic.
|
| 446/4 |
2026/09/07 08:02 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_get_tx_rate]
Results: map[SourceCode:3409: static inline struct ieee80211_rate *
3410: ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
3411: const struct ieee80211_tx_info *c)
3412: {
3413: if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
3414: return NULL;
3415:
3416: if (c->band >= NUM_NL80211_BANDS)
3417: return NULL;
3418:
3419: return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
3420: }
SourceFile:include/net/mac80211.h]
|
| 447/4 |
2026/09/07 08:02 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 33233
output: 35
thoughts: 190
Thoughts: **A Deep Dive into Tx Rate Handling in mac80211_hwsim**
My immediate thought upon reviewing the `ieee80211_get_tx_rate` function was a sharp point of concern: it issues a warning if `c->control.rates[0].idx` is less than zero. This is a critical observation because, as I continued to trace the logic, I found a discrepancy with how `ieee80211_parse_tx_radiotap` operates. My analysis of `ieee80211_parse_tx_radiotap` revealed that it *explicitly handles* the case where `info->control.rates[0].idx < 0`. Specifically, it proceeds to:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
info->control.rates[0].flags = rate_flags;
info->control.rates[0].count = min_t(u8, rate_retries + 1,
local->hw.max_rate_tries);
```
The crucial takeaway here is that this code block *does not correct* the `idx = -1` condition. It proceeds to set other fields within `info->control.rates[0]`, but the problematic negative index remains. This directly leads me to anticipate what happens next, particularly within the `mac80211_hwsim_tx_frame_no_nl` function, where this potentially malformed rate information is likely to be processed. The presence of a negative index, which is clearly flagged as a warning condition in another part of the stack, suggests a potential for unexpected behavior or outright errors downstream. My mind is now focused on understanding how `mac80211_hwsim_tx_frame_no_nl` interacts with this specific state and whether it has any protective mechanisms or, conversely, if it will propagate this anomaly, leading to the observed warning or other issues.
|
| 448/4 |
2026/09/07 08:02 |
tool |
codesearch-definition-source |
0m
Args: map[Name:mac80211_hwsim_tx_frame_no_nl]
Results: map[SourceCode:1902: static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
1903: struct sk_buff *skb,
1904: struct ieee80211_channel *chan)
1905: {
1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
1907: bool ack = false;
1908: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1909: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1910: struct ieee80211_rx_status rx_status;
1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
1912:
1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
1914:
1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
1916:
1917: memset(&rx_status, 0, sizeof(rx_status));
1918: rx_status.flag |= RX_FLAG_MACTIME_START;
1919: rx_status.freq = chan->center_freq;
1920: rx_status.freq_offset = chan->freq_offset ? 1 : 0;
1921: rx_status.band = chan->band;
1922: if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) {
1923: rx_status.rate_idx =
1924: ieee80211_rate_get_vht_mcs(&info->control.rates[0]);
1925: rx_status.nss =
1926: ieee80211_rate_get_vht_nss(&info->control.rates[0]);
1927: rx_status.encoding = RX_ENC_VHT;
1928: } else {
1929: rx_status.rate_idx = info->control.rates[0].idx;
1930: if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
1931: rx_status.encoding = RX_ENC_HT;
1932: }
1933: if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
1934: rx_status.bw = RATE_INFO_BW_40;
1935: else if (info->control.rates[0].flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
1936: rx_status.bw = RATE_INFO_BW_80;
1937: else if (info->control.rates[0].flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
1938: rx_status.bw = RATE_INFO_BW_160;
1939: else
1940: rx_status.bw = RATE_INFO_BW_20;
1941: if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
1942: rx_status.enc_flags |= RX_ENC_FLAG_SHORT_GI;
1943: /* TODO: simulate optional packet loss */
1944: rx_status.signal = data->rx_rssi;
1945: if (info->control.vif)
1946: rx_status.signal += info->control.vif->bss_conf.txpower;
1947:
1948: if (data->ps != PS_DISABLED)
1949: hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
1950:
1951: /* release the skb's source info */
1952: skb_orphan(skb);
1953: skb_dst_drop(skb);
1954: skb->mark = 0;
1955: skb_ext_reset(skb);
1956: nf_reset_ct(skb);
1957:
1958: if (ieee80211_is_beacon(hdr->frame_control) ||
1959: ieee80211_is_probe_resp(hdr->frame_control))
1960: rx_status.boottime_ns = ktime_get_boottime_ns();
1961:
1962: /* Copy skb to all enabled radios that are on the current frequency */
1963: spin_lock(&hwsim_radio_lock);
1964: list_for_each_entry(data2, &hwsim_radios, list) {
1965: struct sk_buff *nskb;
1966: struct tx_iter_data tx_iter_data = {
1967: .receive = false,
1968: .hw = data2->hw,
1969: .channel = chan,
1970: .rx_status = &rx_status,
1971: };
1972:
1973: if (data == data2)
1974: continue;
1975:
1976: if (!data2->started || (data2->idle && !data2->tmp_chan) ||
1977: !hwsim_ps_rx_ok(data2, skb))
1978: continue;
1979:
1980: if (!(data->group & data2->group))
1981: continue;
1982:
1983: if (data->netgroup != data2->netgroup)
1984: continue;
1985:
1986: /*
1987: * Set mactime early since NAN RX filtering relies on it
1988: * for slot calculation
1989: */
1990: rx_status.mactime = sim_tsf + data2->tsf_offset;
1991:
1992: if (!hwsim_chans_compat(chan, data2->tmp_chan) &&
1993: !hwsim_chans_compat(chan, data2->channel)) {
1994: ieee80211_iterate_active_interfaces_atomic(
1995: data2->hw, IEEE80211_IFACE_ITER_NORMAL,
1996: mac80211_hwsim_tx_iter, &tx_iter_data);
1997: if (!tx_iter_data.receive)
1998: continue;
1999: }
2000:
2001: /*
2002: * reserve some space for our vendor and the normal
2003: * radiotap header, since we're copying anyway
2004: */
2005: if (skb->len < PAGE_SIZE && paged_rx) {
2006: struct page *page = alloc_page(GFP_ATOMIC);
2007:
2008: if (!page)
2009: continue;
2010:
2011: nskb = dev_alloc_skb(128);
2012: if (!nskb) {
2013: __free_page(page);
2014: continue;
2015: }
2016:
2017: memcpy(page_address(page), skb->data, skb->len);
2018: skb_add_rx_frag(nskb, 0, page, 0, skb->len, skb->len);
2019: } else {
2020: nskb = skb_copy(skb, GFP_ATOMIC);
2021: if (!nskb)
2022: continue;
2023: }
2024:
2025: if (mac80211_hwsim_addr_match(data2, hdr->addr1))
2026: ack = true;
2027:
2028: mac80211_hwsim_rx(data2, &rx_status, nskb);
2029: }
2030: spin_unlock(&hwsim_radio_lock);
2031:
2032: return ack;
2033: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 449/4 |
2026/09/07 08:02 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 35845
output: 32
thoughts: 71
Thoughts: **My Thought Process**
Okay, so I'm tracing the execution path here, and I've just landed on the `mac80211_hwsim_tx_frame_no_nl` function. My immediate focus is on what happens immediately after the frame transmission is initiated, specifically concerning the TSF (Timestamp Synchronization Function). I noticed it calls `mac80211_hwsim_write_tsf(data, skb, sim_tsf);`. This is a clear indication that the TSF needs to be updated or written to the frame's metadata or properties at this point. So, naturally, my next step is to dive into the `mac80211_hwsim_write_tsf` function itself to understand precisely how it's handling this TSF update.
|
| 450/4 |
2026/09/07 08:02 |
tool |
codesearch-definition-source |
0m
Args: map[Name:mac80211_hwsim_write_tsf]
Results: map[SourceCode:1605: static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
1606: struct sk_buff *skb, u64 sim_time)
1607: {
1608: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1609: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1610: struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1611: struct ieee80211_rate *txrate;
1612: /* TODO: get MCS */
1613: int bitrate = 100;
1614:
1615: spin_lock_bh(&data->tsf_offset_lock);
1616:
1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
1618: if (txrate)
1619: bitrate = txrate->bitrate;
1620:
1621: if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
1622: ieee80211_is_probe_resp(hdr->frame_control)) {
1623: mgmt->u.probe_resp.timestamp =
1624: cpu_to_le64(sim_time + data->tsf_offset +
1625: 24 * 8 * 10 / bitrate);
1626: } else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
1627: ieee80211_is_beacon(mgmt->frame_control)) {
1628: mgmt->u.beacon.timestamp = cpu_to_le64(sim_time +
1629: data->tsf_offset +
1630: 24 * 8 * 10 /
1631: bitrate);
1632: } else if (skb->len >= offsetofend(struct ieee80211_ext,
1633: u.s1g_beacon.timestamp) &&
1634: ieee80211_is_s1g_beacon(mgmt->frame_control)) {
1635: struct ieee80211_ext *ext = (void *)mgmt;
1636:
1637: ext->u.s1g_beacon.timestamp = cpu_to_le32(sim_time +
1638: data->tsf_offset +
1639: 10 * 8 * 10 /
1640: bitrate);
1641: }
1642:
1643: spin_unlock_bh(&data->tsf_offset_lock);
1644: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 451/4 |
2026/09/07 08:02 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 36794
output: 33
thoughts: 274
Thoughts: **My Thought Process Regarding `mac80211_hwsim` and TX Rate Handling**
Okay, so I'm tracing the execution path and I've landed on `mac80211_hwsim_write_tsf`. I see it makes a call to `mac80211_hwsim_get_tx_rate`, passing along the `data->hw` and the `info` struct. My immediate next step is to follow that call into `mac80211_hwsim_get_tx_rate`.
Digging into `mac80211_hwsim_get_tx_rate`, I observe that it, in turn, calls `ieee80211_get_tx_rate`. And within `ieee80211_get_tx_rate`, I notice this `WARN_ON_ONCE(c->control.rates[0].idx < 0)` check. This immediately flags a potential issue for me – an assertion that the rate index should not be negative.
However, before I get too concerned about that warning, I need to re-examine the specific implementation of `mac80211_hwsim_get_tx_rate`. I see it's defined as:
```c
static inline struct ieee80211_rate *
mac80211_hwsim_get_tx_rate(const struct ieee80211_hw *hw,
const struct ieee80211_tx_info *c)
{
if (!(c->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))
return NULL;
return ieee80211_get_tx_rate(hw, c);
}
```
Ah, now this is interesting. The `mac80211_hwsim_get_tx_rate` function has a crucial conditional check. It only proceeds to call `ieee80211_get_tx_rate` (and thus potentially trigger that `WARN_ON_ONCE`) if the `IEEE80211_TX_CTRL_RATE_INJECT` flag is *not* set in `c->control.flags`. If that flag isn't set, it simply returns `NULL`.
This is important because it means the `WARN_ON_ONCE` inside `ieee80211_get_tx_rate` might not even be reachable in certain scenarios within `mac80211_hwsim`'s operation, specifically when `IEEE80211_TX_CTRL_RATE_INJECT` is not being used for the transmission information passed to `mac80211_hwsim_get_tx_rate`. My initial assumption about the warning being a direct consequence of `mac80211_hwsim_write_tsf`'s call was slightly premature, as the `hwsim` layer itself introduces a gatekeeper.
|
| 452/4 |
2026/09/07 08:03 |
tool |
codesearch-definition-source |
0m
Args: map[Name:mac80211_hwsim_get_tx_rate]
Results: map[SourceCode:1327: static struct ieee80211_rate *
1328: mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
1329: struct ieee80211_tx_info *info)
1330: {
1331: if (info->control.rates[0].flags &
1332: (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
1333: return NULL;
1334:
1335: return ieee80211_get_tx_rate(hw, info);
1336: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 453/4 |
2026/09/07 08:03 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 37323
output: 32
thoughts: 1925
Thoughts: **The Curious Case of the Missing TX Rate**
I've been digging into a rather peculiar behavior within `mac80211_hwsim`, specifically around how it handles transmitted data rates. It seems there's a critical oversight: the `mac80211_hwsim_get_tx_rate` function, which is supposed to determine the appropriate transmission rate, doesn't actually check for the `IEEE80211_TX_CTRL_RATE_INJECT` flag. Instead, it solely relies on whether the `IEEE80211_TX_RC_MCS` or `IEEE80211_TX_RC_VHT_MCS` flags are set within `info->control.rates[0]`.
If these specific MCS flags aren't present, the function then falls back to calling the generic `ieee80211_get_tx_rate(hw, info)`. This is where things get interesting. I noticed that `ieee80211_parse_tx_radiotap`, when it processes a radiotap header, will clear the `IEEE80211_TX_CTRL_RATE_INJECT` flag and set `info->control.rates[0].idx` to `-1` if it *cannot* find a matching rate from the available `sband->bitrates`.
The problem arises because `mac80211_hwsim_get_tx_rate` *doesn't* check that `IEEE80211_TX_CTRL_RATE_INJECT` flag. So, even if `rate_found` is true in `ieee80211_parse_tx_radiotap`, but the specific rate value provided in the radiotap header (e.g., `rate * 5` not matching `sband->bitrates[i].bitrate`) is invalid or unresolvable, `info->control.rates[0].idx` can still end up as `-1`.
When this invalid `idx` of `-1` is passed to `ieee80211_get_tx_rate`, it triggers a `WARN_ON_ONCE(c->control.rates[0].idx < 0)`.
Now, the crucial question is, how do I actually trigger this warning? My initial thought was to send a packet via `AF_PACKET` to a monitor interface, ensuring it has a radiotap header with the `IEEE80211_RADIOTAP_RATE` field present, and importantly, setting the rate value to something that simply doesn't exist in `sband->bitrates` – something like `0` or `255`.
Looking at the provided reproducer, it sent a packet with this radiotap header: `"\x00\x00\x09\x00\x04\x00\x00\x00\x00"`. Let's break that down:
* `it_version = 0`, `it_pad = 0`
* `it_len = 9`
* `it_present = 0x00000004`, indicating the `IEEE80211_RADIOTAP_RATE` field is present.
* The rate itself is `0`.
The header length is 9 bytes (2 for version/pad, 2 for length, 4 for present flags, and 1 for the rate). The data follows from offset 9.
I also noticed that `mac80211_hwsim_write_tsf` calls `mac80211_hwsim_get_tx_rate` unconditionally. It doesn't matter what type of frame it is – probe response, beacon, or otherwise. This implies that the `txrate` retrieval and subsequent rate processing will always occur.
This leads to my confusion: if `rate = 0` is sent, and `rate * 5` will also be `0`, which is highly unlikely to match any actual configured bitrate, then `info->control.rates[0].idx` should indeed remain `-1`. This `idx` of `-1` should then be passed to `ieee80211_get_tx_rate`, leading to the warning. However, the reproducer's console output shows `encryption failed: -22` messages but *no* `WARN_ON_ONCE` related to the TX rate.
I'm still trying to figure out why the reproducer didn't trigger the warning. I need to re-examine how `ieee80211_monitor_start_xmit` sets `info->band` and how `ieee80211_parse_tx_radiotap` uses it in conjunction with the `sband` lookup. If `sband` happens to be NULL for the given `info->band` during the parsing, then `idx` would remain unset, and if the rate value isn't found in the non-existent `sband->bitrates`, `idx` could still end up as `-1` and the warning would be triggered. I need to understand if the `sband` was NULL in the reproducer's scenario or if there's another path I'm missing that prevents the `-1` index from reaching `ieee80211_get_tx_rate`.
|
| 454/4 |
2026/09/07 08:03 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_monitor_start_xmit]
Results: map[SourceCode:2324: netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2325: struct net_device *dev)
2326: {
2327: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2328: struct ieee80211_chanctx_conf *chanctx_conf;
2329: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2330: struct ieee80211_hdr *hdr;
2331: struct ieee80211_sub_if_data *tmp_sdata, *sdata;
2332: struct cfg80211_chan_def *chandef;
2333: u16 len_rthdr;
2334: int hdrlen;
2335:
2336: sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2337: if (unlikely(!ieee80211_sdata_running(sdata)))
2338: goto fail;
2339:
2340: memset(info, 0, sizeof(*info));
2341: info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
2342: IEEE80211_TX_CTL_INJECTED;
2343:
2344: /* Sanity-check the length of the radiotap header */
2345: if (!ieee80211_validate_radiotap_len(skb))
2346: goto fail;
2347:
2348: /* we now know there is a radiotap header with a length we can use */
2349: len_rthdr = ieee80211_get_radiotap_len(skb->data);
2350:
2351: /*
2352: * fix up the pointers accounting for the radiotap
2353: * header still being in there. We are being given
2354: * a precooked IEEE80211 header so no need for
2355: * normal processing
2356: */
2357: skb_set_mac_header(skb, len_rthdr);
2358: /*
2359: * these are just fixed to the end of the rt area since we
2360: * don't have any better information and at this point, nobody cares
2361: */
2362: skb_set_network_header(skb, len_rthdr);
2363: skb_set_transport_header(skb, len_rthdr);
2364:
2365: if (skb->len < len_rthdr + 2)
2366: goto fail;
2367:
2368: hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
2369: hdrlen = ieee80211_hdrlen(hdr->frame_control);
2370:
2371: if (skb->len < len_rthdr + hdrlen)
2372: goto fail;
2373:
2374: /*
2375: * Initialize skb->protocol if the injected frame is a data frame
2376: * carrying a rfc1042 header
2377: */
2378: if (ieee80211_is_data(hdr->frame_control) &&
2379: skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) {
2380: u8 *payload = (u8 *)hdr + hdrlen;
2381:
2382: if (ether_addr_equal(payload, rfc1042_header))
2383: skb->protocol = cpu_to_be16((payload[6] << 8) |
2384: payload[7]);
2385: }
2386:
2387: rcu_read_lock();
2388:
2389: /*
2390: * We process outgoing injected frames that have a local address
2391: * we handle as though they are non-injected frames.
2392: * This code here isn't entirely correct, the local MAC address
2393: * isn't always enough to find the interface to use; for proper
2394: * VLAN support we have an nl80211-based mechanism.
2395: *
2396: * This is necessary, for example, for old hostapd versions that
2397: * don't use nl80211-based management TX/RX.
2398: */
2399: list_for_each_entry_rcu(tmp_sdata, &local->interfaces, list) {
2400: if (!ieee80211_sdata_running(tmp_sdata))
2401: continue;
2402: if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2403: tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2404: continue;
2405: if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) {
2406: sdata = tmp_sdata;
2407: break;
2408: }
2409: }
2410:
2411: chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
2412: if (!chanctx_conf) {
2413: tmp_sdata = rcu_dereference(local->monitor_sdata);
2414: if (tmp_sdata)
2415: chanctx_conf =
2416: rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf);
2417: }
2418:
2419: if (!chanctx_conf) {
2420: struct ieee80211_chanctx *ctx;
2421: bool first = true;
2422:
2423: list_for_each_entry_rcu(ctx, &local->chanctx_list, list) {
2424: if (!first)
2425: goto fail_rcu;
2426: chanctx_conf = &ctx->conf;
2427: first = false;
2428: }
2429: }
2430:
2431: if (chanctx_conf)
2432: chandef = &chanctx_conf->def;
2433: else
2434: goto fail_rcu;
2435:
2436: /*
2437: * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still
2438: * shouldn't transmit on disabled channels.
2439: */
2440: if (!cfg80211_chandef_usable(local->hw.wiphy, chandef,
2441: IEEE80211_CHAN_DISABLED))
2442: goto fail_rcu;
2443:
2444: /*
2445: * Frame injection is not allowed if beaconing is not allowed
2446: * or if we need radar detection. Beaconing is usually not allowed when
2447: * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
2448: * Passive scan is also used in world regulatory domains where
2449: * your country is not known and as such it should be treated as
2450: * NO TX unless the channel is explicitly allowed in which case
2451: * your current regulatory domain would not have the passive scan
2452: * flag.
2453: *
2454: * Since AP mode uses monitor interfaces to inject/TX management
2455: * frames we can make AP mode the exception to this rule once it
2456: * supports radar detection as its implementation can deal with
2457: * radar detection by itself. We can do that later by adding a
2458: * monitor flag interfaces used for AP support.
2459: */
2460: if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
2461: sdata->vif.type))
2462: goto fail_rcu;
2463:
2464: info->band = chandef->chan->band;
2465:
2466: /* Initialize skb->priority according to frame type and TID class,
2467: * with respect to the sub interface that the frame will actually
2468: * be transmitted on. If the DONT_REORDER flag is set, the original
2469: * skb-priority is preserved to assure frames injected with this
2470: * flag are not reordered relative to each other.
2471: */
2472: ieee80211_select_queue_80211(sdata, skb, hdr);
2473: skb_set_queue_mapping(skb, ieee80211_ac_from_tid(skb->priority));
2474:
2475: /*
2476: * Process the radiotap header. This will now take into account the
2477: * selected chandef above to accurately set injection rates and
2478: * retransmissions.
2479: */
2480: if (!ieee80211_parse_tx_radiotap(skb, dev))
2481: goto fail_rcu;
2482:
2483: /* remove the injection radiotap header */
2484: skb_pull(skb, len_rthdr);
2485:
2486: ieee80211_xmit(sdata, NULL, skb);
2487: rcu_read_unlock();
2488:
2489: return NETDEV_TX_OK;
2490:
2491: fail_rcu:
2492: rcu_read_unlock();
2493: fail:
2494: dev_kfree_skb(skb);
2495: return NETDEV_TX_OK; /* meaning, we dealt with the skb */
2496: }
SourceFile:net/mac80211/tx.c]
|
| 455/4 |
2026/09/07 08:03 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 42224
output: 26
thoughts: 718
Thoughts: **A Deep Dive into a Potential Beaconing Issue with `cfg80211` and Syzkaller**
I'm scrutinizing this code path where `cfg80211_reg_can_beacon` is called, and it immediately strikes me: this function can return `false`. If that happens, the logic dictates that the packet will be dropped, leading to a `fail_rcu` jump. This is a critical point, as it means we're not unconditionally allowing beacons.
Now, I'm looking at the reproducer, and it's explicitly setting the frequency to 2412 MHz. My initial thought is that beaconing is generally permitted on this frequency, so this specific frequency shouldn't inherently be a blocker.
However, the accompanying bug report throws a curveball: "netlink: 80 bytes leftover after parsing attributes in process syz.4.6946". This is a significant clue. It tells me that the syzkaller test case constructed a netlink message that was malformed or contained unexpected data – specifically, 80 bytes that the kernel's netlink parser couldn't account for.
Let's trace what the reproducer is actually sending. The first netlink message is this:
```c
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x6, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x5}, "\x06\x00\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
```
I recognize `cmd=0x6` as `NL80211_CMD_SET_INTERFACE`. The attributes confirm this: `nla_type=0x3` corresponds to `NL80211_ATTR_IFINDEX`, and `nla_type=0x5` is `NL80211_ATTR_IFTYPE`. Crucially, the `IFTYPE` is set to `6`, which translates to `NL80211_IFTYPE_MONITOR`. So, the reproducer is configuring the interface to monitor mode.
Next, it sends this:
```c
sendto(3, [{nlmsg_len=36, nlmsg_type=nl80211, nlmsg_flags=NLM_F_REQUEST|NLM_F_ACK, nlmsg_seq=1, nlmsg_pid=0}, {cmd=0x41, version=1}, [[{nla_len=8, nla_type=0x3}, "\x08\x00\x00\x00"], [{nla_len=8, nla_type=0x26}, "\x6c\x09\x00\x00"]]], 36, 0, {sa_family=AF_NETLINK, nl_pid=0, nl_groups=00000000}, 12) = 36
```
This `cmd=0x41` is what I need to confirm. My first instinct is `NL80211_CMD_SET_WIPHY`, but I'm going to double-check the `nl80211_commands` enumeration to be absolutely certain. The interaction between the netlink parsing error and the specific configuration being sent is what I'm trying to piece together. The "80 bytes leftover" suggests an issue in how the kernel is handling the attributes for *one* of these commands, and I need to pinpoint which one and why it's causing the `cfg80211_reg_can_beacon` check to fail.
|
| 456/4 |
2026/09/07 08:04 |
tool |
codesearch-definition-source |
0m
Args: map[Name:nl80211_commands]
Results: map[SourceCode: 346: /**
347: * enum nl80211_commands - supported nl80211 commands
348: *
349: * @NL80211_CMD_UNSPEC: unspecified command to catch errors
350: *
351: * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
352: * to get a list of all present wiphys.
353: * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
354: * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
355: * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
356: * %NL80211_ATTR_WIPHY_FREQ_OFFSET (and the attributes determining the
357: * channel width; this is used for setting monitor mode channel),
358: * %NL80211_ATTR_WIPHY_RETRY_SHORT, %NL80211_ATTR_WIPHY_RETRY_LONG,
359: * %NL80211_ATTR_WIPHY_FRAG_THRESHOLD, and/or
360: * %NL80211_ATTR_WIPHY_RTS_THRESHOLD. However, for setting the channel,
361: * see %NL80211_CMD_SET_CHANNEL instead, the support here is for backward
362: * compatibility only.
363: * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
364: * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
365: * %NL80211_ATTR_WIPHY_NAME.
366: * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes
367: * %NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME.
368: *
369: * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration;
370: * either a dump request for all interfaces or a specific get with a
371: * single %NL80211_ATTR_IFINDEX is supported.
372: * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
373: * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
374: * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
375: * to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX,
376: * %NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also
377: * be sent from userspace to request creation of a new virtual interface,
378: * then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and
379: * %NL80211_ATTR_IFNAME.
380: * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
381: * %NL80211_ATTR_IFINDEX and %NL80211_ATTR_WIPHY. Can also be sent from
382: * userspace to request deletion of a virtual interface, then requires
383: * attribute %NL80211_ATTR_IFINDEX. If multiple BSSID advertisements are
384: * enabled using %NL80211_ATTR_MBSSID_CONFIG, %NL80211_ATTR_MBSSID_ELEMS,
385: * and if this command is used for the transmitting interface, then all
386: * the non-transmitting interfaces are deleted as well.
387: *
388: * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
389: * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC
390: * represents peer's MLD address for MLO pairwise key. For MLO group key,
391: * the link is identified by %NL80211_ATTR_MLO_LINK_ID.
392: * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
393: * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
394: * For MLO connection, the link to set default key is identified by
395: * %NL80211_ATTR_MLO_LINK_ID.
396: * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
397: * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
398: * and %NL80211_ATTR_KEY_SEQ attributes. %NL80211_ATTR_MAC represents
399: * peer's MLD address for MLO pairwise key. The link to add MLO
400: * group key is identified by %NL80211_ATTR_MLO_LINK_ID.
401: * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
402: * or %NL80211_ATTR_MAC. %NL80211_ATTR_MAC represents peer's MLD address
403: * for MLO pairwise key. The link to delete group key is identified by
404: * %NL80211_ATTR_MLO_LINK_ID.
405: *
406: * @NL80211_CMD_GET_BEACON: (not used)
407: * @NL80211_CMD_SET_BEACON: change the beacon on an access point interface
408: * using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL
409: * attributes. For drivers that generate the beacon and probe responses
410: * internally, the following attributes must be provided: %NL80211_ATTR_IE,
411: * %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP.
412: * @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters
413: * are like for %NL80211_CMD_SET_BEACON, and additionally parameters that
414: * do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL,
415: * %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID,
416: * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHER_SUITES_PAIRWISE,
417: * %NL80211_ATTR_CIPHER_SUITE_GROUP, %NL80211_ATTR_WPA_VERSIONS,
418: * %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY,
419: * %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_INACTIVITY_TIMEOUT,
420: * %NL80211_ATTR_ACL_POLICY and %NL80211_ATTR_MAC_ADDRS.
421: * The channel to use can be set on the interface or be given using the
422: * %NL80211_ATTR_WIPHY_FREQ and %NL80211_ATTR_WIPHY_FREQ_OFFSET, and the
423: * attributes determining channel width.
424: * @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP
425: * @NL80211_CMD_STOP_AP: Stop AP operation on the given interface
426: * @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP
427: *
428: * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
429: * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
430: * @NL80211_CMD_SET_STATION: Set station attributes for station identified by
431: * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
432: * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the
433: * interface identified by %NL80211_ATTR_IFINDEX.
434: * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
435: * or, if no MAC address given, all stations, on the interface identified
436: * by %NL80211_ATTR_IFINDEX. For MLD station, MLD address is used in
437: * %NL80211_ATTR_MAC. %NL80211_ATTR_MGMT_SUBTYPE and
438: * %NL80211_ATTR_REASON_CODE can optionally be used to specify which type
439: * of disconnection indication should be sent to the station
440: * (Deauthentication or Disassociation frame and reason code for that
441: * frame). %NL80211_ATTR_MLO_LINK_ID can be used optionally to remove
442: * stations connected and using at least that link as one of its links.
443: *
444: * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
445: * destination %NL80211_ATTR_MAC on the interface identified by
446: * %NL80211_ATTR_IFINDEX.
447: * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
448: * destination %NL80211_ATTR_MAC on the interface identified by
449: * %NL80211_ATTR_IFINDEX.
450: * @NL80211_CMD_NEW_MPATH: Create a new mesh path for the destination given by
451: * %NL80211_ATTR_MAC via %NL80211_ATTR_MPATH_NEXT_HOP.
452: * @NL80211_CMD_DEL_MPATH: Delete a mesh path to the destination given by
453: * %NL80211_ATTR_MAC.
454: * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
455: * %NL80211_ATTR_IFINDEX.
456: *
457: * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
458: * regulatory domain. If %NL80211_ATTR_WIPHY is specified and the device
459: * has a private regulatory domain, it will be returned. Otherwise, the
460: * global regdomain will be returned.
461: * A device will have a private regulatory domain if it uses the
462: * regulatory_hint() API. Even when a private regdomain is used the channel
463: * information will still be mended according to further hints from
464: * the regulatory core to help with compliance. A dump version of this API
465: * is now available which will returns the global regdomain as well as
466: * all private regdomains of present wiphys (for those that have it).
467: * If a wiphy is self-managed (%NL80211_ATTR_WIPHY_SELF_MANAGED_REG), then
468: * its private regdomain is the only valid one for it. The regulatory
469: * core is not used to help with compliance in this case.
470: * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
471: * after being queried by the kernel. CRDA replies by sending a regulatory
472: * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
473: * current alpha2 if it found a match. It also provides
474: * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each
475: * regulatory rule is a nested set of attributes given by
476: * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and
477: * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by
478: * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and
479: * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP.
480: * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain
481: * to the specified ISO/IEC 3166-1 alpha2 country code. The core will
482: * store this as a valid request and then query userspace for it.
483: *
484: * @NL80211_CMD_GET_MESH_CONFIG: Get mesh networking properties for the
485: * interface identified by %NL80211_ATTR_IFINDEX
486: *
487: * @NL80211_CMD_SET_MESH_CONFIG: Set mesh networking properties for the
488: * interface identified by %NL80211_ATTR_IFINDEX
489: *
490: * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
491: * interface is identified with %NL80211_ATTR_IFINDEX and the management
492: * frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be
493: * added to the end of the specified management frame is specified with
494: * %NL80211_ATTR_IE. If the command succeeds, the requested data will be
495: * added to all specified management frames generated by
496: * kernel/firmware/driver.
497: * Note: This command has been removed and it is only reserved at this
498: * point to avoid re-using existing command number. The functionality this
499: * command was planned for has been provided with cleaner design with the
500: * option to specify additional IEs in NL80211_CMD_TRIGGER_SCAN,
501: * NL80211_CMD_AUTHENTICATE, NL80211_CMD_ASSOCIATE,
502: * NL80211_CMD_DEAUTHENTICATE, and NL80211_CMD_DISASSOCIATE.
503: *
504: * @NL80211_CMD_GET_SCAN: get scan results
505: * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
506: * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
507: * probe requests at CCK rate or not. %NL80211_ATTR_BSSID can be used to
508: * specify a BSSID to scan for; if not included, the wildcard BSSID will
509: * be used.
510: * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
511: * NL80211_CMD_GET_SCAN and on the "scan" multicast group)
512: * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
513: * partial scan results may be available
514: *
515: * @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
516: * intervals and certain number of cycles, as specified by
517: * %NL80211_ATTR_SCHED_SCAN_PLANS. If %NL80211_ATTR_SCHED_SCAN_PLANS is
518: * not specified and only %NL80211_ATTR_SCHED_SCAN_INTERVAL is specified,
519: * scheduled scan will run in an infinite loop with the specified interval.
520: * These attributes are mutually exclusive,
521: * i.e. NL80211_ATTR_SCHED_SCAN_INTERVAL must not be passed if
522: * NL80211_ATTR_SCHED_SCAN_PLANS is defined.
523: * If for some reason scheduled scan is aborted by the driver, all scan
524: * plans are canceled (including scan plans that did not start yet).
525: * Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
526: * are passed, they are used in the probe requests. For
527: * broadcast, a broadcast SSID must be passed (ie. an empty
528: * string). If no SSID is passed, no probe requests are sent and
529: * a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES,
530: * if passed, define which channels should be scanned; if not
531: * passed, all channels allowed for the current regulatory domain
532: * are used. Extra IEs can also be passed from the userspace by
533: * using the %NL80211_ATTR_IE attribute. The first cycle of the
534: * scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY
535: * is supplied. If the device supports multiple concurrent scheduled
536: * scans, it will allow such when the caller provides the flag attribute
537: * %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it.
538: * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if
539: * scheduled scan is not running. The caller may assume that as soon
540: * as the call returns, it is safe to start a new scheduled scan again.
541: * @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
542: * results available.
543: * @NL80211_CMD_SCHED_SCAN_STOPPED: indicates that the scheduled scan has
544: * stopped. The driver may issue this event at any time during a
545: * scheduled scan. One reason for stopping the scan is if the hardware
546: * does not support starting an association or a normal scan while running
547: * a scheduled scan. This event is also sent when the
548: * %NL80211_CMD_STOP_SCHED_SCAN command is received or when the interface
549: * is brought down while a scheduled scan was running.
550: *
551: * @NL80211_CMD_GET_SURVEY: get survey results, e.g. channel occupation
552: * or noise level
553: * @NL80211_CMD_NEW_SURVEY_RESULTS: survey data notification (as a reply to
554: * NL80211_CMD_GET_SURVEY and on the "scan" multicast group)
555: *
556: * @NL80211_CMD_SET_PMKSA: Add a PMKSA cache entry using %NL80211_ATTR_MAC
557: * (for the BSSID), %NL80211_ATTR_PMKID, and optionally %NL80211_ATTR_PMK
558: * (PMK is used for PTKSA derivation in case of FILS shared key offload) or
559: * using %NL80211_ATTR_SSID, %NL80211_ATTR_FILS_CACHE_ID,
560: * %NL80211_ATTR_PMKID, and %NL80211_ATTR_PMK in case of FILS
561: * authentication where %NL80211_ATTR_FILS_CACHE_ID is the identifier
562: * advertised by a FILS capable AP identifying the scope of PMKSA in an
563: * ESS.
564: * @NL80211_CMD_DEL_PMKSA: Delete a PMKSA cache entry, using %NL80211_ATTR_MAC
565: * (for the BSSID) and %NL80211_ATTR_PMKID or using %NL80211_ATTR_SSID,
566: * %NL80211_ATTR_FILS_CACHE_ID, and %NL80211_ATTR_PMKID in case of FILS
567: * authentication. Additionally in case of SAE offload and OWE offloads
568: * PMKSA entry can be deleted using %NL80211_ATTR_SSID.
569: * @NL80211_CMD_FLUSH_PMKSA: Flush all PMKSA cache entries.
570: *
571: * @NL80211_CMD_REG_CHANGE: indicates to userspace the regulatory domain
572: * has been changed and provides details of the request information
573: * that caused the change such as who initiated the regulatory request
574: * (%NL80211_ATTR_REG_INITIATOR), the wiphy_idx
575: * (%NL80211_ATTR_REG_ALPHA2) on which the request was made from if
576: * the initiator was %NL80211_REGDOM_SET_BY_COUNTRY_IE or
577: * %NL80211_REGDOM_SET_BY_DRIVER, the type of regulatory domain
578: * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is
579: * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
580: * to (%NL80211_ATTR_REG_ALPHA2).
581: * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon
582: * has been found while world roaming thus enabling active scan or
583: * any mode of operation that initiates TX (beacons) on a channel
584: * where we would not have been able to do either before. As an example
585: * if you are world roaming (regulatory domain set to world or if your
586: * driver is using a custom world roaming regulatory domain) and while
587: * doing a passive scan on the 5 GHz band you find an AP there (if not
588: * on a DFS channel) you will now be able to actively scan for that AP
589: * or use AP mode on your card on that same channel. Note that this will
590: * never be used for channels 1-11 on the 2 GHz band as they are always
591: * enabled world wide. This beacon hint is only sent if your device had
592: * either disabled active scanning or beaconing on a channel. We send to
593: * userspace the wiphy on which we removed a restriction from
594: * (%NL80211_ATTR_WIPHY) and the channel on which this occurred
595: * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER)
596: * the beacon hint was processed.
597: *
598: * @NL80211_CMD_AUTHENTICATE: authentication request and notification.
599: * This command is used both as a command (request to authenticate) and
600: * as an event on the "mlme" multicast group indicating completion of the
601: * authentication process.
602: * When used as a command, %NL80211_ATTR_IFINDEX is used to identify the
603: * interface. %NL80211_ATTR_MAC is used to specify PeerSTAAddress (and
604: * BSSID in case of station mode). %NL80211_ATTR_SSID is used to specify
605: * the SSID (mainly for association, but is included in authentication
606: * request, too, to help BSS selection. %NL80211_ATTR_WIPHY_FREQ +
607: * %NL80211_ATTR_WIPHY_FREQ_OFFSET is used to specify the frequency of the
608: * channel in MHz. %NL80211_ATTR_AUTH_TYPE is used to specify the
609: * authentication type. %NL80211_ATTR_IE is used to define IEs
610: * (VendorSpecificInfo, but also including RSN IE and FT IEs) to be added
611: * to the frame.
612: * When used as an event, this reports reception of an Authentication
613: * frame in station and IBSS modes when the local MLME processed the
614: * frame, i.e., it was for the local STA and was received in correct
615: * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
616: * MLME SAP interface (kernel providing MLME, userspace SME). The
617: * included %NL80211_ATTR_FRAME attribute contains the management frame
618: * (including both the header and frame body, but not FCS). This event is
619: * also used to indicate if the authentication attempt timed out. In that
620: * case the %NL80211_ATTR_FRAME attribute is replaced with a
621: * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which
622: * pending authentication timed out).
623: * @NL80211_CMD_ASSOCIATE: association request and notification; like
624: * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
625: * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
626: * MLME-ASSOCIATE.confirm or MLME-REASSOCIATE.confirm primitives). The
627: * %NL80211_ATTR_PREV_BSSID attribute is used to specify whether the
628: * request is for the initial association to an ESS (that attribute not
629: * included) or for reassociation within the ESS (that attribute is
630: * included).
631: * @NL80211_CMD_DEAUTHENTICATE: deauthentication request and notification; like
632: * NL80211_CMD_AUTHENTICATE but for Deauthentication frames (similar to
633: * MLME-DEAUTHENTICATION.request and MLME-DEAUTHENTICATE.indication
634: * primitives).
635: * @NL80211_CMD_DISASSOCIATE: disassociation request and notification; like
636: * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
637: * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
638: *
639: * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael
640: * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the
641: * event includes %NL80211_ATTR_MAC to describe the source MAC address of
642: * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key
643: * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and
644: * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
645: * event matches with MLME-MICHAELMICFAILURE.indication() primitive
646: *
647: * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
648: * FREQ attribute (for the initial frequency if no peer can be found)
649: * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
650: * should be fixed rather than automatically determined. Can only be
651: * executed on a network interface that is UP, and fixed BSSID/FREQ
652: * may be rejected. Another optional parameter is the beacon interval,
653: * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
654: * given defaults to 100 TU (102.4ms).
655: * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
656: * determined by the network interface.
657: *
658: * @NL80211_CMD_TESTMODE: testmode command, takes a wiphy (or ifindex) attribute
659: * to identify the device, and the TESTDATA blob attribute to pass through
660: * to the driver.
661: *
662: * @NL80211_CMD_CONNECT: connection request and notification; this command
663: * requests to connect to a specified network but without separating
664: * auth and assoc steps. For this, you need to specify the SSID in a
665: * %NL80211_ATTR_SSID attribute, and can optionally specify the association
666: * IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE,
667: * %NL80211_ATTR_USE_MFP, %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ,
668: * %NL80211_ATTR_WIPHY_FREQ_OFFSET, %NL80211_ATTR_CONTROL_PORT,
669: * %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
670: * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
671: * %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
672: * %NL80211_ATTR_WIPHY_FREQ_HINT.
673: * If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
674: * restrictions on BSS selection, i.e., they effectively prevent roaming
675: * within the ESS. %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT
676: * can be included to provide a recommendation of the initial BSS while
677: * allowing the driver to roam to other BSSes within the ESS and also to
678: * ignore this recommendation if the indicated BSS is not ideal. Only one
679: * set of BSSID,frequency parameters is used (i.e., either the enforcing
680: * %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
681: * %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
682: * Driver shall not modify the IEs specified through %NL80211_ATTR_IE if
683: * %NL80211_ATTR_MAC is included. However, if %NL80211_ATTR_MAC_HINT is
684: * included, these IEs through %NL80211_ATTR_IE are specified by the user
685: * space based on the best possible BSS selected. Thus, if the driver ends
686: * up selecting a different BSS, it can modify these IEs accordingly (e.g.
687: * userspace asks the driver to perform PMKSA caching with BSS1 and the
688: * driver ends up selecting BSS2 with different PMKSA cache entry; RSNIE
689: * has to get updated with the apt PMKID).
690: * %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
691: * the ESS in case the device is already associated and an association with
692: * a different BSS is desired.
693: * Background scan period can optionally be
694: * specified in %NL80211_ATTR_BG_SCAN_PERIOD,
695: * if not specified default background scan configuration
696: * in driver is used and if period value is 0, bg scan will be disabled.
697: * This attribute is ignored if driver does not support roam scan.
698: * It is also sent as an event, with the BSSID and response IEs when the
699: * connection is established or failed to be established. This can be
700: * determined by the %NL80211_ATTR_STATUS_CODE attribute (0 = success,
701: * non-zero = failure). If %NL80211_ATTR_TIMED_OUT is included in the
702: * event, the connection attempt failed due to not being able to initiate
703: * authentication/association or not receiving a response from the AP.
704: * Non-zero %NL80211_ATTR_STATUS_CODE value is indicated in that case as
705: * well to remain backwards compatible.
706: * @NL80211_CMD_ROAM: Notification indicating the card/driver roamed by itself.
707: * When a security association was established on an 802.1X network using
708: * fast transition, this event should be followed by an
709: * %NL80211_CMD_PORT_AUTHORIZED event.
710: * Following a %NL80211_CMD_ROAM event userspace can issue
711: * %NL80211_CMD_GET_SCAN in order to obtain the scan information for the
712: * new BSS the card/driver roamed to.
713: * @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
714: * userspace that a connection was dropped by the AP or due to other
715: * reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
716: * %NL80211_ATTR_REASON_CODE attributes are used.
717: *
718: * @NL80211_CMD_SET_WIPHY_NETNS: Set a wiphy's netns. Note that all devices
719: * associated with this wiphy must be down and will follow.
720: *
721: * @NL80211_CMD_REMAIN_ON_CHANNEL: Request to remain awake on the specified
722: * channel for the specified amount of time. This can be used to do
723: * off-channel operations like transmit a Public Action frame and wait for
724: * a response while being associated to an AP on another channel.
725: * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
726: * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
727: * frequency for the operation.
728: * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds
729: * to remain on the channel. This command is also used as an event to
730: * notify when the requested duration starts (it may take a while for the
731: * driver to schedule this time due to other concurrent needs for the
732: * radio). An optional attribute %NL80211_ATTR_MAC can be used to filter
733: * incoming frames during remain-on-channel, such that frames
734: * addressed to the specified destination MAC are reported.
735: * When called, this operation returns a cookie (%NL80211_ATTR_COOKIE)
736: * that will be included with any events pertaining to this request;
737: * the cookie is also used to cancel the request.
738: * @NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL: This command can be used to cancel a
739: * pending remain-on-channel duration if the desired operation has been
740: * completed prior to expiration of the originally requested duration.
741: * %NL80211_ATTR_WIPHY or %NL80211_ATTR_IFINDEX is used to specify the
742: * radio. The %NL80211_ATTR_COOKIE attribute must be given as well to
743: * uniquely identify the request.
744: * This command is also used as an event to notify when a requested
745: * remain-on-channel duration has expired.
746: *
747: * @NL80211_CMD_SET_TX_BITRATE_MASK: Set the mask of rates to be used in TX
748: * rate selection. %NL80211_ATTR_IFINDEX is used to specify the interface
749: * and @NL80211_ATTR_TX_RATES the set of allowed rates.
750: *
751: * @NL80211_CMD_REGISTER_FRAME: Register for receiving certain mgmt frames
752: * (via @NL80211_CMD_FRAME) for processing in userspace. This command
753: * requires an interface index, a frame type attribute (optional for
754: * backward compatibility reasons, if not given assumes action frames)
755: * and a match attribute containing the first few bytes of the frame
756: * that should match, e.g. a single byte for only a category match or
757: * four bytes for vendor frames including the OUI. The registration
758: * cannot be dropped, but is removed automatically when the netlink
759: * socket is closed. Multiple registrations can be made.
760: * The %NL80211_ATTR_RECEIVE_MULTICAST flag attribute can be given if
761: * %NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS is available, in which
762: * case the registration can also be modified to include/exclude the
763: * flag, rather than requiring unregistration to change it.
764: * @NL80211_CMD_REGISTER_ACTION: Alias for @NL80211_CMD_REGISTER_FRAME for
765: * backward compatibility
766: * @NL80211_CMD_FRAME: Management frame TX request and RX notification. This
767: * command is used both as a request to transmit a management frame and
768: * as an event indicating reception of a frame that was not processed in
769: * kernel code, but is for us (i.e., which may need to be processed in a
770: * user space application). %NL80211_ATTR_FRAME is used to specify the
771: * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ is used
772: * to indicate on which channel the frame is to be transmitted or was
773: * received. If this channel is not the current channel (remain-on-channel
774: * or the operational channel) the device will switch to the given channel
775: * and transmit the frame, optionally waiting for a response for the time
776: * specified using %NL80211_ATTR_DURATION. When called, this operation
777: * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
778: * TX status event pertaining to the TX request.
779: * %NL80211_ATTR_TX_NO_CCK_RATE is used to decide whether to send the
780: * management frames at CCK rate or not in 2GHz band.
781: * %NL80211_ATTR_CSA_C_OFFSETS_TX is an array of offsets to CSA
782: * counters which will be updated to the current value. This attribute
783: * is used during CSA period.
784: * For TX on an MLD, the frequency can be omitted and the link ID be
785: * specified, or if transmitting to a known peer MLD (with MLD addresses
786: * in the frame) both can be omitted and the link will be selected by
787: * lower layers.
788: * For RX notification, %NL80211_ATTR_RX_HW_TIMESTAMP may be included to
789: * indicate the frame RX timestamp and %NL80211_ATTR_TX_HW_TIMESTAMP may
790: * be included to indicate the ack TX timestamp.
791: * @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
792: * command may be used with the corresponding cookie to cancel the wait
793: * time if it is known that it is no longer necessary. This command is
794: * also sent as an event whenever the driver has completed the off-channel
795: * wait time.
796: * @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility.
797: * @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame
798: * transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
799: * the TX command and %NL80211_ATTR_FRAME includes the contents of the
800: * frame. %NL80211_ATTR_ACK flag is included if the recipient acknowledged
801: * the frame. %NL80211_ATTR_TX_HW_TIMESTAMP may be included to indicate the
802: * tx timestamp and %NL80211_ATTR_RX_HW_TIMESTAMP may be included to
803: * indicate the ack RX timestamp.
804: * @NL80211_CMD_ACTION_TX_STATUS: Alias for @NL80211_CMD_FRAME_TX_STATUS for
805: * backward compatibility.
806: *
807: * @NL80211_CMD_SET_POWER_SAVE: Set powersave, using %NL80211_ATTR_PS_STATE
808: * @NL80211_CMD_GET_POWER_SAVE: Get powersave status in %NL80211_ATTR_PS_STATE
809: *
810: * @NL80211_CMD_SET_CQM: Connection quality monitor configuration. This command
811: * is used to configure connection quality monitoring notification trigger
812: * levels.
813: * @NL80211_CMD_NOTIFY_CQM: Connection quality monitor notification. This
814: * command is used as an event to indicate the that a trigger level was
815: * reached.
816: * @NL80211_CMD_SET_CHANNEL: Set the channel (using %NL80211_ATTR_WIPHY_FREQ
817: * and the attributes determining channel width) the given interface
818: * (identified by %NL80211_ATTR_IFINDEX) shall operate on.
819: * In case multiple channels are supported by the device, the mechanism
820: * with which it switches channels is implementation-defined.
821: * When a monitor interface is given, it can only switch channel while
822: * no other interfaces are operating to avoid disturbing the operation
823: * of any other interfaces, and other interfaces will again take
824: * precedence when they are used.
825: *
826: * @NL80211_CMD_SET_WDS_PEER: Set the MAC address of the peer on a WDS interface
827: * (no longer supported).
828: *
829: * @NL80211_CMD_SET_MULTICAST_TO_UNICAST: Configure if this AP should perform
830: * multicast to unicast conversion. When enabled, all multicast packets
831: * with ethertype ARP, IPv4 or IPv6 (possibly within an 802.1Q header)
832: * will be sent out to each station once with the destination (multicast)
833: * MAC address replaced by the station's MAC address. Note that this may
834: * break certain expectations of the receiver, e.g. the ability to drop
835: * unicast IP packets encapsulated in multicast L2 frames, or the ability
836: * to not send destination unreachable messages in such cases.
837: * This can only be toggled per BSS. Configure this on an interface of
838: * type %NL80211_IFTYPE_AP. It applies to all its VLAN interfaces
839: * (%NL80211_IFTYPE_AP_VLAN), except for those in 4addr (WDS) mode.
840: * If %NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED is not present with this
841: * command, the feature is disabled.
842: *
843: * @NL80211_CMD_JOIN_MESH: Join a mesh. The mesh ID must be given, and initial
844: * mesh config parameters may be given.
845: * @NL80211_CMD_LEAVE_MESH: Leave the mesh network -- no special arguments, the
846: * network is determined by the network interface.
847: *
848: * @NL80211_CMD_UNPROT_DEAUTHENTICATE: Unprotected deauthentication frame
849: * notification. This event is used to indicate that an unprotected
850: * deauthentication frame was dropped when MFP is in use.
851: * @NL80211_CMD_UNPROT_DISASSOCIATE: Unprotected disassociation frame
852: * notification. This event is used to indicate that an unprotected
853: * disassociation frame was dropped when MFP is in use.
854: *
855: * @NL80211_CMD_NEW_PEER_CANDIDATE: Notification on the reception of a
856: * beacon or probe response from a compatible mesh peer. This is only
857: * sent while no station information (sta_info) exists for the new peer
858: * candidate and when @NL80211_MESH_SETUP_USERSPACE_AUTH,
859: * @NL80211_MESH_SETUP_USERSPACE_AMPE, or
860: * @NL80211_MESH_SETUP_USERSPACE_MPM is set. On reception of this
861: * notification, userspace may decide to create a new station
862: * (@NL80211_CMD_NEW_STATION). To stop this notification from
863: * reoccurring, the userspace authentication daemon may want to create the
864: * new station with the AUTHENTICATED flag unset and maybe change it later
865: * depending on the authentication result.
866: *
867: * @NL80211_CMD_GET_WOWLAN: get Wake-on-Wireless-LAN (WoWLAN) settings.
868: * @NL80211_CMD_SET_WOWLAN: set Wake-on-Wireless-LAN (WoWLAN) settings.
869: * Since wireless is more complex than wired ethernet, it supports
870: * various triggers. These triggers can be configured through this
871: * command with the %NL80211_ATTR_WOWLAN_TRIGGERS attribute. For
872: * more background information, see
873: * https://wireless.wiki.kernel.org/en/users/Documentation/WoWLAN.
874: * The @NL80211_CMD_SET_WOWLAN command can also be used as a notification
875: * from the driver reporting the wakeup reason. In this case, the
876: * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason
877: * for the wakeup, if it was caused by wireless. If it is not present
878: * in the wakeup notification, the wireless device didn't cause the
879: * wakeup but reports that it was woken up.
880: *
881: * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
882: * the necessary information for supporting GTK rekey offload. This
883: * feature is typically used during WoWLAN. The configuration data
884: * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and
885: * contains the data in sub-attributes). After rekeying happened,
886: * this command may also be sent by the driver as an MLME event to
887: * inform userspace of the new replay counter.
888: *
889: * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace
890: * of PMKSA caching candidates.
891: *
892: * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
893: * In addition, this can be used as an event to request userspace to take
894: * actions on TDLS links (set up a new link or tear down an existing one).
895: * In such events, %NL80211_ATTR_TDLS_OPERATION indicates the requested
896: * operation, %NL80211_ATTR_MAC contains the peer MAC address, and
897: * %NL80211_ATTR_REASON_CODE the reason code to be used (only with
898: * %NL80211_TDLS_TEARDOWN).
899: * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. The
900: * %NL80211_ATTR_TDLS_ACTION attribute determines the type of frame to be
901: * sent. Public Action codes (802.11-2012 8.1.5.1) will be sent as
902: * 802.11 management frames, while TDLS action codes (802.11-2012
903: * 8.5.13.1) will be encapsulated and sent as data frames. The currently
904: * supported Public Action code is %WLAN_PUB_ACTION_TDLS_DISCOVER_RES
905: * and the currently supported TDLS actions codes are given in
906: * &enum ieee80211_tdls_actioncode.
907: *
908: * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
909: * (or GO) interface (i.e. hostapd) to ask for unexpected frames to
910: * implement sending deauth to stations that send unexpected class 3
911: * frames. For NAN_DATA interfaces, this is used to report frames from
912: * unknown peers (A2 not assigned to any active NDP).
913: * Also used as the event sent by the kernel when such a frame is received.
914: * For the event, the %NL80211_ATTR_MAC attribute carries the TA and
915: * other attributes like the interface index are present.
916: * If used as the command it must have an interface index and you can
917: * only unsubscribe from the event by closing the socket. Subscription
918: * is also for %NL80211_CMD_UNEXPECTED_4ADDR_FRAME events.
919: *
920: * @NL80211_CMD_UNEXPECTED_4ADDR_FRAME: Sent as an event indicating that the
921: * associated station identified by %NL80211_ATTR_MAC sent a 4addr frame
922: * and wasn't already in a 4-addr VLAN. The event will be sent similarly
923: * to the %NL80211_CMD_UNEXPECTED_FRAME event, to the same listener.
924: *
925: * @NL80211_CMD_PROBE_PEER: Probe a connected peer by sending a null data
926: * frame and reporting when the frame is acknowledged.
927: * In AP/GO mode, %NL80211_ATTR_MAC is required to identify the client.
928: * In STA/P2P-client mode, %NL80211_ATTR_MAC must be omitted (the AP is
929: * implied); the driver must advertise %NL80211_EXT_FEATURE_PROBE_AP.
930: * The command returns a direct reply with an %NL80211_ATTR_COOKIE that
931: * is later used to match up the event with the request. The event
932: * includes the same data and has %NL80211_ATTR_ACK set if the frame
933: * was ACKed.
934: *
935: * @NL80211_CMD_REGISTER_BEACONS: Register this socket to receive beacons from
936: * other BSSes when any interfaces are in AP mode. This helps implement
937: * OLBC handling in hostapd. Beacons are reported in %NL80211_CMD_FRAME
938: * messages. Note that per PHY only one application may register.
939: *
940: * @NL80211_CMD_SET_NOACK_MAP: sets a bitmap for the individual TIDs whether
941: * No Acknowledgement Policy should be applied.
942: *
943: * @NL80211_CMD_CH_SWITCH_NOTIFY: An AP or GO may decide to switch channels
944: * independently of the userspace SME, send this event indicating
945: * %NL80211_ATTR_IFINDEX is now on %NL80211_ATTR_WIPHY_FREQ and the
946: * attributes determining channel width. This indication may also be
947: * sent when a remotely-initiated switch (e.g., when a STA receives a CSA
948: * from the remote AP) is completed;
949: *
950: * @NL80211_CMD_CH_SWITCH_STARTED_NOTIFY: Notify that a channel switch
951: * has been started on an interface, regardless of the initiator
952: * (ie. whether it was requested from a remote device or
953: * initiated on our own). It indicates that
954: * %NL80211_ATTR_IFINDEX will be on %NL80211_ATTR_WIPHY_FREQ
955: * after %NL80211_ATTR_CH_SWITCH_COUNT TBTT's. The userspace may
956: * decide to react to this indication by requesting other
957: * interfaces to change channel as well.
958: *
959: * @NL80211_CMD_START_P2P_DEVICE: Start the given P2P Device, identified by
960: * its %NL80211_ATTR_WDEV identifier. It must have been created with
961: * %NL80211_CMD_NEW_INTERFACE previously. After it has been started, the
962: * P2P Device can be used for P2P operations, e.g. remain-on-channel and
963: * public action frame TX.
964: * @NL80211_CMD_STOP_P2P_DEVICE: Stop the given P2P Device, identified by
965: * its %NL80211_ATTR_WDEV identifier.
966: *
967: * @NL80211_CMD_CONN_FAILED: connection request to an AP failed; used to
968: * notify userspace that AP has rejected the connection request from a
969: * station, due to particular reason. %NL80211_ATTR_CONN_FAILED_REASON
970: * is used for this.
971: *
972: * @NL80211_CMD_SET_MCAST_RATE: Change the rate used to send multicast frames
973: * for IBSS or MESH vif.
974: *
975: * @NL80211_CMD_SET_MAC_ACL: sets ACL for MAC address based access control.
976: * This is to be used with the drivers advertising the support of MAC
977: * address based access control. List of MAC addresses is passed in
978: * %NL80211_ATTR_MAC_ADDRS and ACL policy is passed in
979: * %NL80211_ATTR_ACL_POLICY. Driver will enable ACL with this list, if it
980: * is not already done. The new list will replace any existing list. Driver
981: * will clear its ACL when the list of MAC addresses passed is empty. This
982: * command is used in AP/P2P GO mode. Driver has to make sure to clear its
983: * ACL list during %NL80211_CMD_STOP_AP.
984: *
985: * @NL80211_CMD_RADAR_DETECT: Start a Channel availability check (CAC). Once
986: * a radar is detected or the channel availability scan (CAC) has finished
987: * or was aborted, or a radar was detected, usermode will be notified with
988: * this event. This command is also used to notify userspace about radars
989: * while operating on this channel.
990: * %NL80211_ATTR_RADAR_EVENT is used to inform about the type of the
991: * event.
992: *
993: * @NL80211_CMD_GET_PROTOCOL_FEATURES: Get global nl80211 protocol features,
994: * i.e. features for the nl80211 protocol rather than device features.
995: * Returns the features in the %NL80211_ATTR_PROTOCOL_FEATURES bitmap.
996: *
997: * @NL80211_CMD_UPDATE_FT_IES: Pass down the most up-to-date Fast Transition
998: * Information Element to the WLAN driver
999: *
1000: * @NL80211_CMD_FT_EVENT: Send a Fast transition event from the WLAN driver
1001: * to the supplicant. This will carry the target AP's MAC address along
1002: * with the relevant Information Elements. This event is used to report
1003: * received FT IEs (MDIE, FTIE, RSN IE, TIE, RICIE).
1004: *
1005: * @NL80211_CMD_CRIT_PROTOCOL_START: Indicates user-space will start running
1006: * a critical protocol that needs more reliability in the connection to
1007: * complete.
1008: *
1009: * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can
1010: * return back to normal.
1011: *
1012: * @NL80211_CMD_GET_COALESCE: Get currently supported coalesce rules.
1013: * @NL80211_CMD_SET_COALESCE: Configure coalesce rules or clear existing rules.
1014: *
1015: * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the
1016: * new channel information (Channel Switch Announcement - CSA)
1017: * in the beacon for some time (as defined in the
1018: * %NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the
1019: * new channel. Userspace provides the new channel information (using
1020: * %NL80211_ATTR_WIPHY_FREQ and the attributes determining channel
1021: * width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform
1022: * other station that transmission must be blocked until the channel
1023: * switch is complete.
1024: *
1025: * @NL80211_CMD_VENDOR: Vendor-specified command/event. The command is specified
1026: * by the %NL80211_ATTR_VENDOR_ID attribute and a sub-command in
1027: * %NL80211_ATTR_VENDOR_SUBCMD. Parameter(s) can be transported in
1028: * %NL80211_ATTR_VENDOR_DATA.
1029: * For feature advertisement, the %NL80211_ATTR_VENDOR_DATA attribute is
1030: * used in the wiphy data as a nested attribute containing descriptions
1031: * (&struct nl80211_vendor_cmd_info) of the supported vendor commands.
1032: * This may also be sent as an event with the same attributes.
1033: *
1034: * @NL80211_CMD_SET_QOS_MAP: Set Interworking QoS mapping for IP DSCP values.
1035: * The QoS mapping information is included in %NL80211_ATTR_QOS_MAP. If
1036: * that attribute is not included, QoS mapping is disabled. Since this
1037: * QoS mapping is relevant for IP packets, it is only valid during an
1038: * association. This is cleared on disassociation and AP restart.
1039: *
1040: * @NL80211_CMD_ADD_TX_TS: Ask the kernel to add a traffic stream for the given
1041: * %NL80211_ATTR_TSID and %NL80211_ATTR_MAC with %NL80211_ATTR_USER_PRIO
1042: * and %NL80211_ATTR_ADMITTED_TIME parameters.
1043: * Note that the action frame handshake with the AP shall be handled by
1044: * userspace via the normal management RX/TX framework, this only sets
1045: * up the TX TS in the driver/device.
1046: * If the admitted time attribute is not added then the request just checks
1047: * if a subsequent setup could be successful, the intent is to use this to
1048: * avoid setting up a session with the AP when local restrictions would
1049: * make that impossible. However, the subsequent "real" setup may still
1050: * fail even if the check was successful.
1051: * @NL80211_CMD_DEL_TX_TS: Remove an existing TS with the %NL80211_ATTR_TSID
1052: * and %NL80211_ATTR_MAC parameters. It isn't necessary to call this
1053: * before removing a station entry entirely, or before disassociating
1054: * or similar, cleanup will happen in the driver/device in this case.
1055: *
1056: * @NL80211_CMD_GET_MPP: Get mesh path attributes for mesh proxy path to
1057: * destination %NL80211_ATTR_MAC on the interface identified by
1058: * %NL80211_ATTR_IFINDEX.
1059: *
1060: * @NL80211_CMD_JOIN_OCB: Join the OCB network. The center frequency and
1061: * bandwidth of a channel must be given.
1062: * @NL80211_CMD_LEAVE_OCB: Leave the OCB network -- no special arguments, the
1063: * network is determined by the network interface.
1064: *
1065: * @NL80211_CMD_TDLS_CHANNEL_SWITCH: Start channel-switching with a TDLS peer,
1066: * identified by the %NL80211_ATTR_MAC parameter. A target channel is
1067: * provided via %NL80211_ATTR_WIPHY_FREQ and other attributes determining
1068: * channel width/type. The target operating class is given via
1069: * %NL80211_ATTR_OPER_CLASS.
1070: * The driver is responsible for continually initiating channel-switching
1071: * operations and returning to the base channel for communication with the
1072: * AP.
1073: * @NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH: Stop channel-switching with a TDLS
1074: * peer given by %NL80211_ATTR_MAC. Both peers must be on the base channel
1075: * when this command completes.
1076: *
1077: * @NL80211_CMD_WIPHY_REG_CHANGE: Similar to %NL80211_CMD_REG_CHANGE, but used
1078: * as an event to indicate changes for devices with wiphy-specific regdom
1079: * management.
1080: *
1081: * @NL80211_CMD_ABORT_SCAN: Stop an ongoing scan. Returns -ENOENT if a scan is
1082: * not running. The driver indicates the status of the scan through
1083: * cfg80211_scan_done().
1084: *
1085: * @NL80211_CMD_START_NAN: Start NAN operation, identified by its
1086: * %NL80211_ATTR_WDEV interface. This interface must have been
1087: * previously created with %NL80211_CMD_NEW_INTERFACE. After it
1088: * has been started, the NAN interface will create or join a
1089: * cluster. This command must have a valid
1090: * %NL80211_ATTR_NAN_MASTER_PREF attribute and optional
1091: * %NL80211_ATTR_BANDS attributes. If %NL80211_ATTR_BANDS is
1092: * omitted or set to 0, it means don't-care and the device will
1093: * decide what to use. Additional cluster configuration may be
1094: * optionally provided with %NL80211_ATTR_NAN_CONFIG.
1095: * After this command NAN functions can be added.
1096: * @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by
1097: * its %NL80211_ATTR_WDEV interface.
1098: * @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined
1099: * with %NL80211_ATTR_NAN_FUNC nested attribute. When called, this
1100: * operation returns the strictly positive and unique instance id
1101: * (%NL80211_ATTR_NAN_FUNC_INST_ID) and a cookie (%NL80211_ATTR_COOKIE)
1102: * of the function upon success.
1103: * Since instance ID's can be re-used, this cookie is the right
1104: * way to identify the function. This will avoid races when a termination
1105: * event is handled by the user space after it has already added a new
1106: * function that got the same instance id from the kernel as the one
1107: * which just terminated.
1108: * This cookie may be used in NAN events even before the command
1109: * returns, so userspace shouldn't process NAN events until it processes
1110: * the response to this command.
1111: * Look at %NL80211_ATTR_SOCKET_OWNER as well.
1112: * @NL80211_CMD_DEL_NAN_FUNCTION: Delete a NAN function by cookie.
1113: * This command is also used as a notification sent when a NAN function is
1114: * terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID
1115: * and %NL80211_ATTR_COOKIE attributes.
1116: * @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN
1117: * configuration. NAN must be operational (%NL80211_CMD_START_NAN
1118: * was executed). It must contain at least one of the following
1119: * attributes: %NL80211_ATTR_NAN_MASTER_PREF,
1120: * %NL80211_ATTR_BANDS. If %NL80211_ATTR_BANDS is omitted, the
1121: * current configuration is not changed. If it is present but
1122: * set to zero, the configuration is changed to don't-care
1123: * (i.e. the device can decide what to do).
1124: * Additional parameters may be provided with
1125: * %NL80211_ATTR_NAN_CONFIG. User space should provide all previously
1126: * configured nested attributes under %NL80211_ATTR_NAN_CONFIG, even if
1127: * only a subset was changed.
1128: * @NL80211_CMD_NAN_MATCH: Notification sent when a match is reported.
1129: * This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and
1130: * %NL80211_ATTR_COOKIE.
1131: *
1132: * @NL80211_CMD_UPDATE_CONNECT_PARAMS: Update one or more connect parameters
1133: * for subsequent roaming cases if the driver or firmware uses internal
1134: * BSS selection. This command can be issued only while connected and it
1135: * does not result in a change for the current association. Currently,
1136: * only the %NL80211_ATTR_IE data is used and updated with this command.
1137: *
1138: * @NL80211_CMD_SET_PMK: For offloaded 4-Way handshake, set the PMK or PMK-R0
1139: * for the given authenticator address (specified with %NL80211_ATTR_MAC).
1140: * When %NL80211_ATTR_PMKR0_NAME is set, %NL80211_ATTR_PMK specifies the
1141: * PMK-R0, otherwise it specifies the PMK.
1142: * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously
1143: * configured PMK for the authenticator address identified by
1144: * %NL80211_ATTR_MAC.
1145: * @NL80211_CMD_PORT_AUTHORIZED: An event that indicates port is authorized and
1146: * open for regular data traffic. For STA/P2P-client, this event is sent
1147: * with AP MAC address and for AP/P2P-GO, the event carries the STA/P2P-
1148: * client MAC address.
1149: * Drivers that support 4 way handshake offload should send this event for
1150: * STA/P2P-client after successful 4-way HS or after 802.1X FT following
1151: * NL80211_CMD_CONNECT or NL80211_CMD_ROAM. Drivers using AP/P2P-GO 4-way
1152: * handshake offload should send this event on successful completion of
1153: * 4-way handshake with the peer (STA/P2P-client).
1154: * @NL80211_CMD_CONTROL_PORT_FRAME: Control Port (e.g. PAE) frame TX request
1155: * and RX notification. This command is used both as a request to transmit
1156: * a control port frame and as a notification that a control port frame
1157: * has been received. %NL80211_ATTR_FRAME is used to specify the
1158: * frame contents. The frame is the raw EAPoL data, without ethernet or
1159: * 802.11 headers.
1160: * For an MLD transmitter, the %NL80211_ATTR_MLO_LINK_ID may be given and
1161: * its effect will depend on the destination: If the destination is known
1162: * to be an MLD, this will be used as a hint to select the link to transmit
1163: * the frame on. If the destination is not an MLD, this will select both
1164: * the link to transmit on and the source address will be set to the link
1165: * address of that link.
1166: * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
1167: * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added
1168: * indicating the protocol type of the received frame; whether the frame
1169: * was received unencrypted and the MAC address of the peer respectively.
1170: *
1171: * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded.
1172: *
1173: * @NL80211_CMD_EXTERNAL_AUTH: This interface is exclusively defined for host
1174: * drivers that do not define separate commands for authentication and
1175: * association, but rely on user space for the authentication to happen.
1176: * This interface acts both as the event request (driver to user space)
1177: * to trigger the authentication and command response (userspace to
1178: * driver) to indicate the authentication status.
1179: *
1180: * User space uses the %NL80211_CMD_CONNECT command to the host driver to
1181: * trigger a connection. The host driver selects a BSS and further uses
1182: * this interface to offload only the authentication part to the user
1183: * space. Authentication frames are passed between the driver and user
1184: * space through the %NL80211_CMD_FRAME interface. Host driver proceeds
1185: * further with the association after getting successful authentication
1186: * status. User space indicates the authentication status through
1187: * %NL80211_ATTR_STATUS_CODE attribute in %NL80211_CMD_EXTERNAL_AUTH
1188: * command interface.
1189: *
1190: * Host driver sends MLD address of the AP with %NL80211_ATTR_MLD_ADDR in
1191: * %NL80211_CMD_EXTERNAL_AUTH event to indicate user space to enable MLO
1192: * during the authentication offload in STA mode while connecting to MLD
1193: * APs. Host driver should check %NL80211_ATTR_MLO_SUPPORT flag capability
1194: * in %NL80211_CMD_CONNECT to know whether the user space supports enabling
1195: * MLO during the authentication offload or not.
1196: * User space should enable MLO during the authentication only when it
1197: * receives the AP MLD address in authentication offload request. User
1198: * space shouldn't enable MLO when the authentication offload request
1199: * doesn't indicate the AP MLD address even if the AP is MLO capable.
1200: * User space should use %NL80211_ATTR_MLD_ADDR as peer's MLD address and
1201: * interface address identified by %NL80211_ATTR_IFINDEX as self MLD
1202: * address. User space and host driver to use MLD addresses in RA, TA and
1203: * BSSID fields of the frames between them, and host driver translates the
1204: * MLD addresses to/from link addresses based on the link chosen for the
1205: * authentication.
1206: *
1207: * Host driver reports this status on an authentication failure to the
1208: * user space through the connect result as the user space would have
1209: * initiated the connection through the connect request.
1210: *
1211: * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notifies that a station's
1212: * HT opmode or VHT opmode changed using any of %NL80211_ATTR_SMPS_MODE,
1213: * %NL80211_ATTR_CHANNEL_WIDTH, %NL80211_ATTR_NSS attributes with its
1214: * address (specified in %NL80211_ATTR_MAC).
1215: * Note that 80+80 and 160 MHz might not be differentiated, i.e. may
1216: * report %NL80211_CHAN_WIDTH_160 instead of %NL80211_CHAN_WIDTH_80P80.
1217: *
1218: * @NL80211_CMD_GET_FTM_RESPONDER_STATS: Retrieve FTM responder statistics, in
1219: * the %NL80211_ATTR_FTM_RESPONDER_STATS attribute.
1220: *
1221: * @NL80211_CMD_PEER_MEASUREMENT_START: start a (set of) peer measurement(s)
1222: * with the given parameters, which are encapsulated in the nested
1223: * %NL80211_ATTR_PEER_MEASUREMENTS attribute. Optionally, MAC address
1224: * randomization may be enabled and configured by specifying the
1225: * %NL80211_ATTR_MAC and %NL80211_ATTR_MAC_MASK attributes.
1226: * If a timeout is requested, use the %NL80211_ATTR_TIMEOUT attribute.
1227: * A u64 cookie for further %NL80211_ATTR_COOKIE use is returned in
1228: * the netlink extended ack message.
1229: *
1230: * To cancel a measurement, close the socket that requested it.
1231: *
1232: * Measurement results are reported to the socket that requested the
1233: * measurement using @NL80211_CMD_PEER_MEASUREMENT_RESULT when they
1234: * become available, so applications must ensure a large enough socket
1235: * buffer size.
1236: *
1237: * Depending on driver support it may or may not be possible to start
1238: * multiple concurrent measurements.
1239: * @NL80211_CMD_PEER_MEASUREMENT_RESULT: This command number is used for the
1240: * result notification from the driver to the requesting socket.
1241: * @NL80211_CMD_PEER_MEASUREMENT_COMPLETE: Notification only, indicating that
1242: * the measurement completed, using the measurement cookie
1243: * (%NL80211_ATTR_COOKIE).
1244: *
1245: * @NL80211_CMD_NOTIFY_RADAR: Notify the kernel that a radar signal was
1246: * detected and reported by a neighboring device on the channel
1247: * indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes
1248: * determining the width and type.
1249: *
1250: * @NL80211_CMD_UPDATE_OWE_INFO: This interface allows the host driver to
1251: * offload OWE processing to user space. This intends to support
1252: * OWE AKM by the host drivers that implement SME but rely
1253: * on the user space for the cryptographic/DH IE processing in AP mode.
1254: *
1255: * @NL80211_CMD_PROBE_MESH_LINK: The requirement for mesh link metric
1256: * refreshing, is that from one mesh point we be able to send some data
1257: * frames to other mesh points which are not currently selected as a
1258: * primary traffic path, but which are only 1 hop away. The absence of
1259: * the primary path to the chosen node makes it necessary to apply some
1260: * form of marking on a chosen packet stream so that the packets can be
1261: * properly steered to the selected node for testing, and not by the
1262: * regular mesh path lookup. Further, the packets must be of type data
1263: * so that the rate control (often embedded in firmware) is used for
1264: * rate selection.
1265: *
1266: * Here attribute %NL80211_ATTR_MAC is used to specify connected mesh
1267: * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
1268: * content. The frame is ethernet data.
1269: *
1270: * @NL80211_CMD_SET_TID_CONFIG: Data frame TID specific configuration
1271: * is passed using %NL80211_ATTR_TID_CONFIG attribute.
1272: *
1273: * @NL80211_CMD_UNPROT_BEACON: Unprotected or incorrectly protected Beacon
1274: * frame. This event is used to indicate that a received Beacon frame was
1275: * dropped because it did not include a valid MME MIC while beacon
1276: * protection was enabled (BIGTK configured in station mode).
1277: *
1278: * @NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS: Report TX status of a control
1279: * port frame transmitted with %NL80211_CMD_CONTROL_PORT_FRAME.
1280: * %NL80211_ATTR_COOKIE identifies the TX command and %NL80211_ATTR_FRAME
1281: * includes the contents of the frame. %NL80211_ATTR_ACK flag is included
1282: * if the recipient acknowledged the frame.
1283: *
1284: * @NL80211_CMD_SET_SAR_SPECS: SAR power limitation configuration is
1285: * passed using %NL80211_ATTR_SAR_SPEC. %NL80211_ATTR_WIPHY is used to
1286: * specify the wiphy index to be applied to.
1287: *
1288: * @NL80211_CMD_OBSS_COLOR_COLLISION: This notification is sent out whenever
1289: * mac80211/drv detects a bss color collision.
1290: *
1291: * @NL80211_CMD_COLOR_CHANGE_REQUEST: This command is used to indicate that
1292: * userspace wants to change the BSS color.
1293: *
1294: * @NL80211_CMD_COLOR_CHANGE_STARTED: Notify userland, that a color change has
1295: * started
1296: *
1297: * @NL80211_CMD_COLOR_CHANGE_ABORTED: Notify userland, that the color change has
1298: * been aborted
1299: *
1300: * @NL80211_CMD_COLOR_CHANGE_COMPLETED: Notify userland that the color change
1301: * has completed
1302: *
1303: * @NL80211_CMD_SET_FILS_AAD: Set FILS AAD data to the driver using -
1304: * &NL80211_ATTR_MAC - for STA MAC address
1305: * &NL80211_ATTR_FILS_KEK - for KEK
1306: * &NL80211_ATTR_FILS_NONCES - for FILS Nonces
1307: * (STA Nonce 16 bytes followed by AP Nonce 16 bytes)
1308: *
1309: * @NL80211_CMD_ASSOC_COMEBACK: notification about an association
1310: * temporal rejection with comeback. The event includes %NL80211_ATTR_MAC
1311: * to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to
1312: * specify the timeout value.
1313: *
1314: * @NL80211_CMD_ADD_LINK: Add a new link to an interface. The
1315: * %NL80211_ATTR_MLO_LINK_ID attribute is used for the new link.
1316: * @NL80211_CMD_REMOVE_LINK: Remove a link from an interface. This may come
1317: * without %NL80211_ATTR_MLO_LINK_ID as an easy way to remove all links
1318: * in preparation for e.g. roaming to a regular (non-MLO) AP.
1319: *
1320: * @NL80211_CMD_ADD_LINK_STA: Add a link to an MLD station
1321: * @NL80211_CMD_MODIFY_LINK_STA: Modify a link of an MLD station
1322: * @NL80211_CMD_REMOVE_LINK_STA: Remove a link of an MLD station
1323: *
1324: * @NL80211_CMD_SET_HW_TIMESTAMP: Enable/disable HW timestamping of Timing
1325: * measurement and Fine timing measurement frames. If %NL80211_ATTR_MAC
1326: * is included, enable/disable HW timestamping only for frames to/from the
1327: * specified MAC address. Otherwise enable/disable HW timestamping for
1328: * all TM/FTM frames (including ones that were enabled with specific MAC
1329: * address). If %NL80211_ATTR_HW_TIMESTAMP_ENABLED is not included, disable
1330: * HW timestamping.
1331: * The number of peers that HW timestamping can be enabled for concurrently
1332: * is indicated by %NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS.
1333: *
1334: * @NL80211_CMD_LINKS_REMOVED: Notify userspace about the removal of STA MLD
1335: * setup links due to AP MLD removing the corresponding affiliated APs with
1336: * Multi-Link reconfiguration. %NL80211_ATTR_MLO_LINKS is used to provide
1337: * information about the removed STA MLD setup links.
1338: *
1339: * @NL80211_CMD_SET_TID_TO_LINK_MAPPING: Set the TID to Link Mapping for a
1340: * non-AP MLD station. The %NL80211_ATTR_MLO_TTLM_DLINK and
1341: * %NL80211_ATTR_MLO_TTLM_ULINK attributes are used to specify the
1342: * TID to Link mapping for downlink/uplink traffic.
1343: *
1344: * @NL80211_CMD_ASSOC_MLO_RECONF: For a non-AP MLD station, request to
1345: * add/remove links to/from the association. To indicate link
1346: * reconfiguration request results from the driver, this command is also
1347: * used as an event to notify userspace about the added links information.
1348: * For notifying the removed links information, the existing
1349: * %NL80211_CMD_LINKS_REMOVED command is used. This command is also used to
1350: * notify userspace about newly added links for the current connection in
1351: * case of AP-initiated link recommendation requests, received via
1352: * a BTM (BSS Transition Management) request or a link reconfig notify
1353: * frame, where the driver handles the link recommendation offload.
1354: *
1355: * @NL80211_CMD_EPCS_CFG: EPCS configuration for a station. Used by userland to
1356: * control EPCS configuration. Used to notify userland on the current state
1357: * of EPCS.
1358: *
1359: * @NL80211_CMD_NAN_NEXT_DW_NOTIFICATION: This command is used to notify
1360: * user space about the next NAN Discovery Window (DW). User space may use
1361: * it to prepare frames to be sent in the next DW.
1362: * %NL80211_ATTR_WIPHY_FREQ is used to indicate the frequency of the next
1363: * DW. SDF transmission should be requested with %NL80211_CMD_FRAME and
1364: * the device/driver shall take care of the actual transmission timing.
1365: * This notification is only sent to the NAN interface owning socket
1366: * (see %NL80211_ATTR_SOCKET_OWNER flag).
1367: * @NL80211_CMD_NAN_CLUSTER_JOINED: This command is used to notify
1368: * user space that the NAN new cluster has been joined. The cluster ID is
1369: * indicated by %NL80211_ATTR_MAC.
1370: *
1371: * @NL80211_CMD_INCUMBENT_SIGNAL_DETECT: Once any incumbent signal is detected
1372: * on the operating channel in 6 GHz band, userspace is notified with the
1373: * signal interference bitmap using
1374: * %NL80211_ATTR_INCUMBENT_SIGNAL_INTERFERENCE_BITMAP. The current channel
1375: * definition is also sent.
1376: *
1377: * @NL80211_CMD_NAN_SET_LOCAL_SCHED: Set the local NAN schedule. NAN must be
1378: * operational (%NL80211_CMD_START_NAN was executed). Must contain
1379: * %NL80211_ATTR_NAN_TIME_SLOTS and %NL80211_ATTR_NAN_AVAIL_BLOB, but
1380: * %NL80211_ATTR_NAN_CHANNEL is optional (for example in case of a channel
1381: * removal, that channel won't be provided).
1382: * If %NL80211_ATTR_NAN_SCHED_DEFERRED is set, the command is a request
1383: * from the device to perform an announced schedule update. See
1384: * %NL80211_ATTR_NAN_SCHED_DEFERRED for more details.
1385: * If not set, the schedule should be applied immediately.
1386: * @NL80211_CMD_NAN_SCHED_UPDATE_DONE: Event sent to user space to notify that
1387: * a deferred local NAN schedule update (requested with
1388: * %NL80211_CMD_NAN_SET_LOCAL_SCHED and %NL80211_ATTR_NAN_SCHED_DEFERRED)
1389: * has been completed. The presence of %NL80211_ATTR_NAN_SCHED_UPDATE_SUCCESS
1390: * indicates that the update was successful.
1391: * @NL80211_CMD_NAN_SET_PEER_SCHED: Set the peer NAN schedule. NAN
1392: * must be operational (%NL80211_CMD_START_NAN was executed).
1393: * Required attributes: %NL80211_ATTR_MAC (peer NMI address) and
1394: * %NL80211_ATTR_NAN_COMMITTED_DW.
1395: * Optionally, the full schedule can be provided by including all of:
1396: * %NL80211_ATTR_NAN_SEQ_ID, %NL80211_ATTR_NAN_CHANNEL (one or more), and
1397: * %NL80211_ATTR_NAN_PEER_MAPS (see &enum nl80211_nan_peer_map_attrs).
1398: * If any of these three optional attributes is provided, all three must
1399: * be provided.
1400: * Each peer channel must be compatible with at least one local channel
1401: * set by %NL80211_CMD_SET_LOCAL_NAN_SCHED. Different maps must not
1402: * contain compatible channels.
1403: * For single-radio devices (n_radio <= 1), different maps must not
1404: * schedule the same time slot, as the device cannot operate on multiple
1405: * channels simultaneously.
1406: * When updating an existing peer schedule, the full new schedule must be
1407: * provided - partial updates are not supported. The new schedule will
1408: * completely replace the previous one.
1409: * The peer schedule is automatically removed when the NMI station is
1410: * removed.
1411: * @NL80211_CMD_NAN_ULW_UPDATE: Notification from the driver to user space
1412: * with the updated ULW blob of the device. User space can use this blob
1413: * to attach to frames sent to peers. This notification contains
1414: * %NL80211_ATTR_NAN_ULW with the ULW blob.
1415: * @NL80211_CMD_NAN_CHANNEL_EVAC: Notification to indicate that a NAN
1416: * channel has been evacuated due to resource conflicts with other
1417: * interfaces. This can happen when another interface sharing the channel
1418: * resource with NAN needs to move to a different channel (e.g., channel
1419: * switch or link switch on a BSS interface).
1420: * The notification contains %NL80211_ATTR_NAN_CHANNEL attribute
1421: * identifying the evacuated channel.
1422: * User space may reconfigure the local schedule in response to this
1423: * notification.
1424: * @NL80211_CMD_START_PD: Start PD operation, identified by its
1425: * %NL80211_ATTR_WDEV interface. This interface must have been previously
1426: * created with %NL80211_CMD_NEW_INTERFACE.
1427: * @NL80211_CMD_STOP_PD: Stop the PD operation, identified by
1428: * its %NL80211_ATTR_WDEV interface.
1429: *
1430: * @NL80211_CMD_MAX: highest used command number
1431: * @__NL80211_CMD_AFTER_LAST: internal use
1432: */
1433: enum nl80211_commands {
1434: /* don't change the order or add anything between, this is ABI! */
1435: NL80211_CMD_UNSPEC,
1436:
1437: NL80211_CMD_GET_WIPHY, /* can dump */
1438: NL80211_CMD_SET_WIPHY,
1439: NL80211_CMD_NEW_WIPHY,
1440: NL80211_CMD_DEL_WIPHY,
1441:
1442: NL80211_CMD_GET_INTERFACE, /* can dump */
1443: NL80211_CMD_SET_INTERFACE,
1444: NL80211_CMD_NEW_INTERFACE,
1445: NL80211_CMD_DEL_INTERFACE,
1446:
1447: NL80211_CMD_GET_KEY,
1448: NL80211_CMD_SET_KEY,
1449: NL80211_CMD_NEW_KEY,
1450: NL80211_CMD_DEL_KEY,
1451:
1452: NL80211_CMD_GET_BEACON,
1453: NL80211_CMD_SET_BEACON,
1454: NL80211_CMD_START_AP,
1455: NL80211_CMD_NEW_BEACON = NL80211_CMD_START_AP,
1456: NL80211_CMD_STOP_AP,
1457: NL80211_CMD_DEL_BEACON = NL80211_CMD_STOP_AP,
1458:
1459: NL80211_CMD_GET_STATION,
1460: NL80211_CMD_SET_STATION,
1461: NL80211_CMD_NEW_STATION,
1462: NL80211_CMD_DEL_STATION,
1463:
1464: NL80211_CMD_GET_MPATH,
1465: NL80211_CMD_SET_MPATH,
1466: NL80211_CMD_NEW_MPATH,
1467: NL80211_CMD_DEL_MPATH,
1468:
1469: NL80211_CMD_SET_BSS,
1470:
1471: NL80211_CMD_SET_REG,
1472: NL80211_CMD_REQ_SET_REG,
1473:
1474: NL80211_CMD_GET_MESH_CONFIG,
1475: NL80211_CMD_SET_MESH_CONFIG,
1476:
1477: NL80211_CMD_SET_MGMT_EXTRA_IE /* reserved; not used */,
1478:
1479: NL80211_CMD_GET_REG,
1480:
1481: NL80211_CMD_GET_SCAN,
1482: NL80211_CMD_TRIGGER_SCAN,
1483: NL80211_CMD_NEW_SCAN_RESULTS,
1484: NL80211_CMD_SCAN_ABORTED,
1485:
1486: NL80211_CMD_REG_CHANGE,
1487:
1488: NL80211_CMD_AUTHENTICATE,
1489: NL80211_CMD_ASSOCIATE,
1490: NL80211_CMD_DEAUTHENTICATE,
1491: NL80211_CMD_DISASSOCIATE,
1492:
1493: NL80211_CMD_MICHAEL_MIC_FAILURE,
1494:
1495: NL80211_CMD_REG_BEACON_HINT,
1496:
1497: NL80211_CMD_JOIN_IBSS,
1498: NL80211_CMD_LEAVE_IBSS,
1499:
1500: NL80211_CMD_TESTMODE,
1501:
1502: NL80211_CMD_CONNECT,
1503: NL80211_CMD_ROAM,
1504: NL80211_CMD_DISCONNECT,
1505:
1506: NL80211_CMD_SET_WIPHY_NETNS,
1507:
1508: NL80211_CMD_GET_SURVEY,
1509: NL80211_CMD_NEW_SURVEY_RESULTS,
1510:
1511: NL80211_CMD_SET_PMKSA,
1512: NL80211_CMD_DEL_PMKSA,
1513: NL80211_CMD_FLUSH_PMKSA,
1514:
1515: NL80211_CMD_REMAIN_ON_CHANNEL,
1516: NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL,
1517:
1518: NL80211_CMD_SET_TX_BITRATE_MASK,
1519:
1520: NL80211_CMD_REGISTER_FRAME,
1521: NL80211_CMD_REGISTER_ACTION = NL80211_CMD_REGISTER_FRAME,
1522: NL80211_CMD_FRAME,
1523: NL80211_CMD_ACTION = NL80211_CMD_FRAME,
1524: NL80211_CMD_FRAME_TX_STATUS,
1525: NL80211_CMD_ACTION_TX_STATUS = NL80211_CMD_FRAME_TX_STATUS,
1526:
1527: NL80211_CMD_SET_POWER_SAVE,
1528: NL80211_CMD_GET_POWER_SAVE,
1529:
1530: NL80211_CMD_SET_CQM,
1531: NL80211_CMD_NOTIFY_CQM,
1532:
1533: NL80211_CMD_SET_CHANNEL,
1534: NL80211_CMD_SET_WDS_PEER,
1535:
1536: NL80211_CMD_FRAME_WAIT_CANCEL,
1537:
1538: NL80211_CMD_JOIN_MESH,
1539: NL80211_CMD_LEAVE_MESH,
1540:
1541: NL80211_CMD_UNPROT_DEAUTHENTICATE,
1542: NL80211_CMD_UNPROT_DISASSOCIATE,
1543:
1544: NL80211_CMD_NEW_PEER_CANDIDATE,
1545:
1546: NL80211_CMD_GET_WOWLAN,
1547: NL80211_CMD_SET_WOWLAN,
1548:
1549: NL80211_CMD_START_SCHED_SCAN,
1550: NL80211_CMD_STOP_SCHED_SCAN,
1551: NL80211_CMD_SCHED_SCAN_RESULTS,
1552: NL80211_CMD_SCHED_SCAN_STOPPED,
1553:
1554: NL80211_CMD_SET_REKEY_OFFLOAD,
1555:
1556: NL80211_CMD_PMKSA_CANDIDATE,
1557:
1558: NL80211_CMD_TDLS_OPER,
1559: NL80211_CMD_TDLS_MGMT,
1560:
1561: NL80211_CMD_UNEXPECTED_FRAME,
1562:
1563: NL80211_CMD_PROBE_PEER,
1564:
1565: NL80211_CMD_REGISTER_BEACONS,
1566:
1567: NL80211_CMD_UNEXPECTED_4ADDR_FRAME,
1568:
1569: NL80211_CMD_SET_NOACK_MAP,
1570:
1571: NL80211_CMD_CH_SWITCH_NOTIFY,
1572:
1573: NL80211_CMD_START_P2P_DEVICE,
1574: NL80211_CMD_STOP_P2P_DEVICE,
1575:
1576: NL80211_CMD_CONN_FAILED,
1577:
1578: NL80211_CMD_SET_MCAST_RATE,
1579:
1580: NL80211_CMD_SET_MAC_ACL,
1581:
1582: NL80211_CMD_RADAR_DETECT,
1583:
1584: NL80211_CMD_GET_PROTOCOL_FEATURES,
1585:
1586: NL80211_CMD_UPDATE_FT_IES,
1587: NL80211_CMD_FT_EVENT,
1588:
1589: NL80211_CMD_CRIT_PROTOCOL_START,
1590: NL80211_CMD_CRIT_PROTOCOL_STOP,
1591:
1592: NL80211_CMD_GET_COALESCE,
1593: NL80211_CMD_SET_COALESCE,
1594:
1595: NL80211_CMD_CHANNEL_SWITCH,
1596:
1597: NL80211_CMD_VENDOR,
1598:
1599: NL80211_CMD_SET_QOS_MAP,
1600:
1601: NL80211_CMD_ADD_TX_TS,
1602: NL80211_CMD_DEL_TX_TS,
1603:
1604: NL80211_CMD_GET_MPP,
1605:
1606: NL80211_CMD_JOIN_OCB,
1607: NL80211_CMD_LEAVE_OCB,
1608:
1609: NL80211_CMD_CH_SWITCH_STARTED_NOTIFY,
1610:
1611: NL80211_CMD_TDLS_CHANNEL_SWITCH,
1612: NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
1613:
1614: NL80211_CMD_WIPHY_REG_CHANGE,
1615:
1616: NL80211_CMD_ABORT_SCAN,
1617:
1618: NL80211_CMD_START_NAN,
1619: NL80211_CMD_STOP_NAN,
1620: NL80211_CMD_ADD_NAN_FUNCTION,
1621: NL80211_CMD_DEL_NAN_FUNCTION,
1622: NL80211_CMD_CHANGE_NAN_CONFIG,
1623: NL80211_CMD_NAN_MATCH,
1624:
1625: NL80211_CMD_SET_MULTICAST_TO_UNICAST,
1626:
1627: NL80211_CMD_UPDATE_CONNECT_PARAMS,
1628:
1629: NL80211_CMD_SET_PMK,
1630: NL80211_CMD_DEL_PMK,
1631:
1632: NL80211_CMD_PORT_AUTHORIZED,
1633:
1634: NL80211_CMD_RELOAD_REGDB,
1635:
1636: NL80211_CMD_EXTERNAL_AUTH,
1637:
1638: NL80211_CMD_STA_OPMODE_CHANGED,
1639:
1640: NL80211_CMD_CONTROL_PORT_FRAME,
1641:
1642: NL80211_CMD_GET_FTM_RESPONDER_STATS,
1643:
1644: NL80211_CMD_PEER_MEASUREMENT_START,
1645: NL80211_CMD_PEER_MEASUREMENT_RESULT,
1646: NL80211_CMD_PEER_MEASUREMENT_COMPLETE,
1647:
1648: NL80211_CMD_NOTIFY_RADAR,
1649:
1650: NL80211_CMD_UPDATE_OWE_INFO,
1651:
1652: NL80211_CMD_PROBE_MESH_LINK,
1653:
1654: NL80211_CMD_SET_TID_CONFIG,
1655:
1656: NL80211_CMD_UNPROT_BEACON,
1657:
1658: NL80211_CMD_CONTROL_PORT_FRAME_TX_STATUS,
1659:
1660: NL80211_CMD_SET_SAR_SPECS,
1661:
1662: NL80211_CMD_OBSS_COLOR_COLLISION,
1663:
1664: NL80211_CMD_COLOR_CHANGE_REQUEST,
1665:
1666: NL80211_CMD_COLOR_CHANGE_STARTED,
1667: NL80211_CMD_COLOR_CHANGE_ABORTED,
1668: NL80211_CMD_COLOR_CHANGE_COMPLETED,
1669:
1670: NL80211_CMD_SET_FILS_AAD,
1671:
1672: NL80211_CMD_ASSOC_COMEBACK,
1673:
1674: NL80211_CMD_ADD_LINK,
1675: NL80211_CMD_REMOVE_LINK,
1676:
1677: NL80211_CMD_ADD_LINK_STA,
1678: NL80211_CMD_MODIFY_LINK_STA,
1679: NL80211_CMD_REMOVE_LINK_STA,
1680:
1681: NL80211_CMD_SET_HW_TIMESTAMP,
1682:
1683: NL80211_CMD_LINKS_REMOVED,
1684:
1685: NL80211_CMD_SET_TID_TO_LINK_MAPPING,
1686:
1687: NL80211_CMD_ASSOC_MLO_RECONF,
1688: NL80211_CMD_EPCS_CFG,
1689:
1690: NL80211_CMD_NAN_NEXT_DW_NOTIFICATION,
1691: NL80211_CMD_NAN_CLUSTER_JOINED,
1692:
1693: NL80211_CMD_INCUMBENT_SIGNAL_DETECT,
1694:
1695: NL80211_CMD_NAN_SET_LOCAL_SCHED,
1696:
1697: NL80211_CMD_NAN_SCHED_UPDATE_DONE,
1698:
1699: NL80211_CMD_NAN_SET_PEER_SCHED,
1700:
1701: NL80211_CMD_NAN_ULW_UPDATE,
1702:
1703: NL80211_CMD_NAN_CHANNEL_EVAC,
1704:
1705: NL80211_CMD_START_PD,
1706: NL80211_CMD_STOP_PD,
1707:
1708: /* add new commands above here */
1709:
1710: /* used to define NL80211_CMD_MAX below */
1711: __NL80211_CMD_AFTER_LAST,
1712: NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
1713: };
SourceFile:include/uapi/linux/nl80211.h]
|
| 457/4 |
2026/09/07 08:04 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 74865
output: 31
thoughts: 2267
Thoughts: **My Thought Process Unraveling the Netlink Command Mystery**
Initially, I saw `0x41` and my mind immediately went to 65. Then, I cross-referenced this with `NL80211_CMD_SET_REKEY_OFFLOAD` and, sure enough, that also maps to 65. A bit of confusion started to creep in when I looked at the reproducer's `sendto` call. It clearly shows `cmd=0x41`. My next step was to check the attribute types within that packet. I identified `nla_type=0x26` as `NL80211_ATTR_WIPHY_FREQ`, which corresponds to the frequency setting. This led me to question: if `cmd=0x41` is `NL80211_CMD_SET_REKEY_OFFLOAD`, why is it being used with `NL80211_ATTR_WIPHY_FREQ`? This felt like a mismatch.
I then decided to meticulously count the `NL80211_CMD` values from the source code definition, starting from `NL80211_CMD_UNSPEC` at 0. This is when I hit a wall of potential disconnects. I noticed the `strace` output mentioning `CTRL_ATTR_OP_ID` and `NL80211_CMD_SET_REKEY_OFFLOAD` again, reinforcing the idea that `0x41` *was* indeed `NL80211_CMD_SET_REKEY_OFFLOAD`. However, the comment in the reproducer explicitly stated, "[+] Set frequency to 2412 MHz," which immediately made me think of `NL80211_CMD_SET_CHANNEL`.
This discrepancy drove me to explicitly check the enum value for `NL80211_CMD_SET_CHANNEL`. My findings confirmed it's `0x3a`, which is 58. This further deepened my confusion: why would the reproducer use `cmd=0x41` if it intended to set the channel? I suspected the reproducer might have simply hardcoded `0x41` without verifying the correct command.
Then, I re-examined the `strace` output, specifically the `sendto` and `recvfrom` calls. The `sendto` call showed `cmd=0x41`. The critical piece of information came from the `recvfrom` output, which indicated `error=0`, signifying success. This success with `NL80211_CMD_SET_REKEY_OFFLOAD` when it appeared to be attempting a channel setting was highly unusual. I considered that `nlmsg_type=nl80211` in the `strace` might be a generic placeholder and that the actual family ID was obtained earlier via `CTRL_CMD_NEWFAMILY`. The initial `nlmsg_type=0x10` (GENL_ID_CTRL) followed by a response that assigns `0x26` (38) as the `nl80211` family ID solidified this understanding.
The reproducer *did* send `cmd=0x6` (which is `NL80211_CMD_SET_INTERFACE`) and then `cmd=0x41`. The persistent success of `0x41` with `error=0` made me rethink my initial assumptions. I re-checked the definitions: `NL80211_CMD_SET_CHANNEL` is 58 (0x3a), `NL80211_CMD_SET_WIPHY` is 2, `NL80211_CMD_SET_WIPHY_NETNS` is 44 (0x2c), `NL80211_CMD_SET_MAC_ACL` is 82 (0x52), and critically, `NL80211_CMD_SET_REKEY_OFFLOAD` is indeed 65 (0x41).
My hypothesis started to shift. Could `NL80211_CMD_SET_REKEY_OFFLOAD` actually succeed with `error=0` even if the `NL80211_ATTR_REKEY_DATA` attribute was missing, perhaps due to some internal handling in `nl80211_set_rekey_data`? I recalled that `nl80211_set_rekey_data` *should* return `-EINVAL` if `NL80211_ATTR_REKEY_DATA` isn't present. However, the `error=0` in the `strace` was a strong indicator of success.
The most compelling explanation then became that the reproducer *had* hardcoded `0x41`, believing it to be `NL80211_CMD_SET_CHANNEL`, but this command was actually being interpreted by the kernel as `NL80211_CMD_SET_REKEY_OFFLOAD`. The fact that it returned `error=0` implied that the `NL80211_CMD_SET_REKEY_OFFLOAD` handler might have a permissive path that allows it to complete successfully even without the specific data it usually expects, or perhaps the attributes provided were implicitly handled in a way that didn't trigger an error. This is the core of my current understanding of this peculiar interaction.
|
| 458/4 |
2026/09/07 08:04 |
tool |
codesearch-definition-source |
0m
Args: map[Name:nl80211_set_rekey_data]
Results: map[SourceCode:16261: static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
16262: {
16263: struct cfg80211_registered_device *rdev = info->user_ptr[0];
16264: struct net_device *dev = info->user_ptr[1];
16265: struct wireless_dev *wdev = dev->ieee80211_ptr;
16266: struct nlattr *tb[NUM_NL80211_REKEY_DATA];
16267: struct cfg80211_gtk_rekey_data rekey_data = {};
16268: int err;
16269:
16270: if (!info->attrs[NL80211_ATTR_REKEY_DATA])
16271: return -EINVAL;
16272:
16273: err = nla_parse_nested_deprecated(tb, MAX_NL80211_REKEY_DATA,
16274: info->attrs[NL80211_ATTR_REKEY_DATA],
16275: nl80211_rekey_policy, info->extack);
16276: if (err)
16277: return err;
16278:
16279: if (!tb[NL80211_REKEY_DATA_REPLAY_CTR] || !tb[NL80211_REKEY_DATA_KEK] ||
16280: !tb[NL80211_REKEY_DATA_KCK])
16281: return -EINVAL;
16282: if (nla_len(tb[NL80211_REKEY_DATA_KEK]) != NL80211_KEK_LEN &&
16283: !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK &&
16284: nla_len(tb[NL80211_REKEY_DATA_KEK]) == NL80211_KEK_EXT_LEN))
16285: return -ERANGE;
16286: if (nla_len(tb[NL80211_REKEY_DATA_KCK]) != NL80211_KCK_LEN &&
16287: !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK &&
16288: nla_len(tb[NL80211_REKEY_DATA_KCK]) == NL80211_KCK_EXT_LEN) &&
16289: !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KCK_32 &&
16290: nla_len(tb[NL80211_REKEY_DATA_KCK]) == NL80211_KCK_EXT_LEN_32))
16291: return -ERANGE;
16292:
16293: rekey_data.kek = nla_data(tb[NL80211_REKEY_DATA_KEK]);
16294: rekey_data.kck = nla_data(tb[NL80211_REKEY_DATA_KCK]);
16295: rekey_data.replay_ctr = nla_data(tb[NL80211_REKEY_DATA_REPLAY_CTR]);
16296: rekey_data.kek_len = nla_len(tb[NL80211_REKEY_DATA_KEK]);
16297: rekey_data.kck_len = nla_len(tb[NL80211_REKEY_DATA_KCK]);
16298: if (tb[NL80211_REKEY_DATA_AKM])
16299: rekey_data.akm = nla_get_u32(tb[NL80211_REKEY_DATA_AKM]);
16300:
16301: if (!wdev->connected)
16302: return -ENOTCONN;
16303:
16304: if (!rdev->ops->set_rekey_data)
16305: return -EOPNOTSUPP;
16306:
16307: return rdev_set_rekey_data(rdev, dev, &rekey_data);
16308: }
SourceFile:net/wireless/nl80211.c]
|
| 459/4 |
2026/09/07 08:04 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 78407
output: 26
thoughts: 555
Thoughts: **My Thought Process Unraveling the Rekey Offload Anomaly**
This is perplexing. I'm staring at this `strace` output and something just isn't adding up. My expectation, based on the `NL80211_CMD_SET_REKEY_OFFLOAD` command, is that if there's an `EINVAL` being returned somewhere in the lower layers, the `recvfrom` call should reflect that, likely with a non-zero error code in the `NLMSG_ERROR` message.
But here's the kicker: the `strace` clearly shows `recvfrom` returning with `error=0`. What does `error=0` in an `NLMSG_ERROR` message signify? To me, and I'm sure to you as well, that *means success*. This is where my internal alarm bells started ringing.
I'm tracing the command itself. I see that `cmd=0x41`. A quick mental lookup, or a quick grep through the kernel headers, confirms that `0x41` corresponds precisely to `NL80211_CMD_SET_REKEY_OFFLOAD`. So, the command I sent is indeed the one I think it is.
Now, I'm digging deeper into the *expected behavior* of `NL80211_CMD_SET_REKEY_OFFLOAD`. I recall that this particular command has the `GENL_UNS_ADMIN_PERM` flag associated with it. This implies a certain level of privilege or administrative action is required.
The core of my confusion lies in the `nl80211_set_rekey_data` function. If this function were to encounter an invalid argument, as my initial assumption suggested, it *should* return `-EINVAL`. And if that `-EINVAL` is properly propagated up the Netlink stack, the `error` field in the `NLMSG_ERROR` message that `recvfrom` returns *should* be `-EINVAL` (which is -22 in decimal).
But it's not. It's 0. This discrepancy is what's driving my investigation. The successful `recvfrom` combined with the `NLMSG_ERROR` containing `error=0` strongly suggests that, from the perspective of the Netlink message processing, the command *was* successfully received and processed, even if the underlying operation *might* have failed. This points to a potential disconnect or a nuance in how errors are handled or reported at different layers of the Netlink interface for this specific command. My next step is to meticulously examine the `nl80211_ops` structure and the implementation details of the handler for `NL80211_CMD_SET_REKEY_OFFLOAD` to understand how it's constructing this `NLMSG_ERROR` response and why it's reporting success when I suspect a potential invalid input.
|
| 460/4 |
2026/09/07 08:04 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:19713: static const struct genl_ops nl80211_ops[] = {
19714: {
19715: .cmd = NL80211_CMD_GET_WIPHY,
19716: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
19717: .doit = nl80211_get_wiphy,
19718: .dumpit = nl80211_dump_wiphy,
19719: .done = nl80211_dump_wiphy_done,
19720: /* can be retrieved by unprivileged users */
19721: .internal_flags = IFLAGS(NL80211_FLAG_NEED_WIPHY),
19722: },
19723: {
19724: .cmd = NL80211_CMD_GET_STATION,
19725: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
19726: .doit = nl80211_get_station,
19727: .dumpit = nl80211_dump_station,
19728: .done = nl80211_dump_station_done,
19729: .internal_flags = IFLAGS(NL80211_FLAG_NEED_WDEV),
19730: },
19731: };
SourceFile:net/wireless/nl80211.c]
|
| 461/4 |
2026/09/07 08:04 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 79416
output: 33
thoughts: 39
Thoughts: **My Thought Process**
Alright, so I'm looking at this `nl80211_ops` structure, and honestly, it feels… bloated. It's just gotten so big, and I'm questioning whether all of it is truly necessary or if it's become a bit unwieldy. My immediate reaction is to try and get a handle on its scope, to see what specific functionality is being managed by this large object. The most efficient way I can think of to do that, given the context, is to narrow my focus to a particular command. I'm specifically interested in the rekeying offload functionality, as that's a distinct area within the broader netlink protocol for wireless. Therefore, I'm going to `grep` for `NL80211_CMD_SET_REKEY_OFFLOAD`. This will help me isolate the relevant parts of the code or configuration related to that specific command, allowing me to assess its presence and perhaps begin to understand its implementation within the larger `nl80211_ops` context.
|
| 462/4 |
2026/09/07 08:05 |
tool |
grepper |
0m
Args: map[Expression:\.cmd = NL80211_CMD_SET_REKEY_OFFLOAD]
Results: map[Output:net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-20205- {
net/wireless/nl80211.c:20206: .cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
net/wireless/nl80211.c-20207- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
]
|
| 463/4 |
2026/09/07 08:05 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 79641
output: 42
thoughts: 35
Thoughts: **My Thought Process**
My current objective is to investigate how the `NL80211_CMD_SET_REKEY_OFFLOAD` command is handled within the `nl80211_small_ops` structure. I'm performing a focused examination of this specific operation, likely because I'm either implementing this functionality, debugging an issue related to rekeying offload, or analyzing the overall control flow for wireless device configuration. My immediate next step is to locate and inspect the entry for `NL80211_CMD_SET_REKEY_OFFLOAD` within the `nl80211_small_ops` table. This will tell me which function is responsible for processing this command and what its internal logic entails.
|
| 464/4 |
2026/09/07 08:05 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:20205 LineCount:10]
Results: map[Contents:20205: {
20206: .cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
20207: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
20208: .doit = nl80211_set_rekey_data,
20209: .flags = GENL_UNS_ADMIN_PERM,
20210: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
20211: NL80211_FLAG_CLEAR_SKB),
20212: },
20213: {
20214: .cmd = NL80211_CMD_TDLS_MGMT,
]
|
| 465/4 |
2026/09/07 08:05 |
llm |
repro-oracle |
6m
Model:
Tokens:
input: 79930
output: 94
thoughts: 62911
|
| 466/4 |
2026/09/07 08:12 |
tool |
codeexpert |
3m
Args: map[Question:Why does `NL80211_CMD_SET_REKEY_OFFLOAD` return 0 when `NL80211_ATTR_REKEY_DATA` is missing? In `nl80211_set_rekey_data`, it returns `-EINVAL` if it's missing. Is there another place where it's handled?]
Results: map[Answer:### Summary
There is **no other handler** for `NL80211_CMD_SET_REKEY_OFFLOAD` in the Linux kernel. In `net/wireless/nl80211.c`, `NL80211_CMD_SET_REKEY_OFFLOAD` is registered exclusively to `nl80211_set_rekey_data()` via `nl80211_small_ops`:
```c
{
.cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = nl80211_set_rekey_data,
.flags = GENL_UNS_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_CLEAR_SKB),
},
```
Inside `nl80211_set_rekey_data()`, the handler explicitly checks for the presence of `NL80211_ATTR_REKEY_DATA` and returns `-EINVAL` if it is missing:
```c
if (!info->attrs[NL80211_ATTR_REKEY_DATA])
return -EINVAL;
```
---
### Why a Caller or Userspace May Observe `0` (Success)
If userspace or a test program appears to receive a `0` return code when omitting `NL80211_ATTR_REKEY_DATA`, this is due to how Generic Netlink socket communication and error reporting work rather than the kernel returning `0` from the command handler:
1. **`send()` / `sendmsg()` Netlink Syscall Semantics**:
- The `send()` or `sendmsg()` system call on a Netlink socket returns the number of bytes queued into the kernel socket buffer. It does **not** return the return code of the Netlink command handler executed inside the kernel.
- If userspace checks only the return status of `sendmsg()`, it will indicate success (bytes sent > 0).
2. **Asynchronous Error Delivery via `NLMSG_ERROR`**:
- When `nl80211_set_rekey_data()` returns `-EINVAL`, `netlink_rcv_skb()` in `net/netlink/af_netlink.c` catches the error and sends an `NLMSG_ERROR` Netlink packet containing `nlmsgerr.error = -EINVAL` back to the sender socket:
```c
if (nlh->nlmsg_flags & NLM_F_ACK || err)
netlink_ack(skb, nlh, err, &extack);
```
- If the application/library does not call `recvmsg()` / `nl_recvmsgs()` to read the response message, it will not observe the `-EINVAL` error returned by the kernel.
3. **Pre-Doit Execution**:
- `NL80211_CMD_SET_REKEY_OFFLOAD` specifies `NL80211_FLAG_NEED_NETDEV_UP`. Before `nl80211_set_rekey_data()` is reached, `nl80211_pre_doit()` checks for interface attributes (`NL80211_ATTR_IFINDEX` or `NL80211_ATTR_WDEV`) and ensures the interface is up. If those are absent or the device is down, `nl80211_pre_doit()` returns `-EINVAL` or `-ENETDOWN` before `nl80211_set_rekey_data()` runs.
---
### Dual Role of `NL80211_CMD_SET_REKEY_OFFLOAD` as an Event
`NL80211_CMD_SET_REKEY_OFFLOAD` is also used as an asynchronous notification event sent **from** the kernel to userspace (via `nl80211_gtk_rekey_notify()` over `NL80211_MCGRP_MLME`) when driver/hardware GTK rekeying finishes. In that notification message, only `NL80211_REKEY_DATA_REPLAY_CTR` is populated inside `NL80211_ATTR_REKEY_DATA` to inform userspace of the updated replay counter.]
|
| 467/5 |
2026/09/07 08:12 |
agent |
codeexpert |
3m
Model:
Results: map[Answer:### Summary
There is **no other handler** for `NL80211_CMD_SET_REKEY_OFFLOAD` in the Linux kernel. In `net/wireless/nl80211.c`, `NL80211_CMD_SET_REKEY_OFFLOAD` is registered exclusively to `nl80211_set_rekey_data()` via `nl80211_small_ops`:
```c
{
.cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = nl80211_set_rekey_data,
.flags = GENL_UNS_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_CLEAR_SKB),
},
```
Inside `nl80211_set_rekey_data()`, the handler explicitly checks for the presence of `NL80211_ATTR_REKEY_DATA` and returns `-EINVAL` if it is missing:
```c
if (!info->attrs[NL80211_ATTR_REKEY_DATA])
return -EINVAL;
```
---
### Why a Caller or Userspace May Observe `0` (Success)
If userspace or a test program appears to receive a `0` return code when omitting `NL80211_ATTR_REKEY_DATA`, this is due to how Generic Netlink socket communication and error reporting work rather than the kernel returning `0` from the command handler:
1. **`send()` / `sendmsg()` Netlink Syscall Semantics**:
- The `send()` or `sendmsg()` system call on a Netlink socket returns the number of bytes queued into the kernel socket buffer. It does **not** return the return code of the Netlink command handler executed inside the kernel.
- If userspace checks only the return status of `sendmsg()`, it will indicate success (bytes sent > 0).
2. **Asynchronous Error Delivery via `NLMSG_ERROR`**:
- When `nl80211_set_rekey_data()` returns `-EINVAL`, `netlink_rcv_skb()` in `net/netlink/af_netlink.c` catches the error and sends an `NLMSG_ERROR` Netlink packet containing `nlmsgerr.error = -EINVAL` back to the sender socket:
```c
if (nlh->nlmsg_flags & NLM_F_ACK || err)
netlink_ack(skb, nlh, err, &extack);
```
- If the application/library does not call `recvmsg()` / `nl_recvmsgs()` to read the response message, it will not observe the `-EINVAL` error returned by the kernel.
3. **Pre-Doit Execution**:
- `NL80211_CMD_SET_REKEY_OFFLOAD` specifies `NL80211_FLAG_NEED_NETDEV_UP`. Before `nl80211_set_rekey_data()` is reached, `nl80211_pre_doit()` checks for interface attributes (`NL80211_ATTR_IFINDEX` or `NL80211_ATTR_WDEV`) and ensures the interface is up. If those are absent or the device is down, `nl80211_pre_doit()` returns `-EINVAL` or `-ENETDOWN` before `nl80211_set_rekey_data()` runs.
---
### Dual Role of `NL80211_CMD_SET_REKEY_OFFLOAD` as an Event
`NL80211_CMD_SET_REKEY_OFFLOAD` is also used as an asynchronous notification event sent **from** the kernel to userspace (via `nl80211_gtk_rekey_notify()` over `NL80211_MCGRP_MLME`) when driver/hardware GTK rekeying finishes. In that notification message, only `NL80211_REKEY_DATA_REPLAY_CTR` is populated inside `NL80211_ATTR_REKEY_DATA` to inform userspace of the updated replay counter.]
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Use tools extensively while researching the question. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Why does `NL80211_CMD_SET_REKEY_OFFLOAD` return 0 when `NL80211_ATTR_REKEY_DATA` is missing? In `nl80211_set_rekey_data`, it returns `-EINVAL` if it's missing. Is there another place where it's handled?
|
| 468/6 |
2026/09/07 08:12 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 2389
output: 79
thoughts: 184
Thoughts: **My Investigation into `NL80211_CMD_SET_REKEY_OFFLOAD` Return Codes**
I'm trying to understand a specific behavior I've observed regarding the `NL80211_CMD_SET_REKEY_OFFLOAD` command. My understanding, based on a review of the `nl80211_set_rekey_data` function, is that if `NL80211_ATTR_REKEY_DATA` is missing, the function should return `-EINVAL`. However, I'm seeing a return code of `0` for the `NL80211_CMD_SET_REKEY_OFFLOAD` command in this scenario. This discrepancy suggests there might be another part of the codebase handling this command or a conditional logic I'm not fully grasping. To resolve this, my immediate next step is to thoroughly search the codebase for all occurrences of `NL80211_CMD_SET_REKEY_OFFLOAD` and `nl80211_set_rekey_data`. I plan to leverage tools like `grepper` or `codesearch-find-references` to efficiently locate these references and trace the execution flow.
|
| 469/6 |
2026/09/07 08:12 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_REKEY_OFFLOAD]
Results: map[Output:include/uapi/linux/nl80211.h-880- *
include/uapi/linux/nl80211.h:881: * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
include/uapi/linux/nl80211.h-882- * the necessary information for supporting GTK rekey offload. This
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1553-
include/uapi/linux/nl80211.h:1554: NL80211_CMD_SET_REKEY_OFFLOAD,
include/uapi/linux/nl80211.h-1555-
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-20205- {
net/wireless/nl80211.c:20206: .cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
net/wireless/nl80211.c-20207- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
--
net/wireless/nl80211.c=22373=static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-22384-
net/wireless/nl80211.c:22385: hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SET_REKEY_OFFLOAD);
net/wireless/nl80211.c-22386- if (!hdr) {
]
|
| 470/6 |
2026/09/07 08:12 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/wireless/nl80211.c Name:nl80211_set_rekey_data]
Results: map[SourceCode:16261: static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
16262: {
16263: struct cfg80211_registered_device *rdev = info->user_ptr[0];
16264: struct net_device *dev = info->user_ptr[1];
16265: struct wireless_dev *wdev = dev->ieee80211_ptr;
16266: struct nlattr *tb[NUM_NL80211_REKEY_DATA];
16267: struct cfg80211_gtk_rekey_data rekey_data = {};
16268: int err;
16269:
16270: if (!info->attrs[NL80211_ATTR_REKEY_DATA])
16271: return -EINVAL;
16272:
16273: err = nla_parse_nested_deprecated(tb, MAX_NL80211_REKEY_DATA,
16274: info->attrs[NL80211_ATTR_REKEY_DATA],
16275: nl80211_rekey_policy, info->extack);
16276: if (err)
16277: return err;
16278:
16279: if (!tb[NL80211_REKEY_DATA_REPLAY_CTR] || !tb[NL80211_REKEY_DATA_KEK] ||
16280: !tb[NL80211_REKEY_DATA_KCK])
16281: return -EINVAL;
16282: if (nla_len(tb[NL80211_REKEY_DATA_KEK]) != NL80211_KEK_LEN &&
16283: !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK &&
16284: nla_len(tb[NL80211_REKEY_DATA_KEK]) == NL80211_KEK_EXT_LEN))
16285: return -ERANGE;
16286: if (nla_len(tb[NL80211_REKEY_DATA_KCK]) != NL80211_KCK_LEN &&
16287: !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK &&
16288: nla_len(tb[NL80211_REKEY_DATA_KCK]) == NL80211_KCK_EXT_LEN) &&
16289: !(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_EXT_KCK_32 &&
16290: nla_len(tb[NL80211_REKEY_DATA_KCK]) == NL80211_KCK_EXT_LEN_32))
16291: return -ERANGE;
16292:
16293: rekey_data.kek = nla_data(tb[NL80211_REKEY_DATA_KEK]);
16294: rekey_data.kck = nla_data(tb[NL80211_REKEY_DATA_KCK]);
16295: rekey_data.replay_ctr = nla_data(tb[NL80211_REKEY_DATA_REPLAY_CTR]);
16296: rekey_data.kek_len = nla_len(tb[NL80211_REKEY_DATA_KEK]);
16297: rekey_data.kck_len = nla_len(tb[NL80211_REKEY_DATA_KCK]);
16298: if (tb[NL80211_REKEY_DATA_AKM])
16299: rekey_data.akm = nla_get_u32(tb[NL80211_REKEY_DATA_AKM]);
16300:
16301: if (!wdev->connected)
16302: return -ENOTCONN;
16303:
16304: if (!rdev->ops->set_rekey_data)
16305: return -EOPNOTSUPP;
16306:
16307: return rdev_set_rekey_data(rdev, dev, &rekey_data);
16308: }
SourceFile:net/wireless/nl80211.c]
|
| 471/6 |
2026/09/07 08:12 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 4434
output: 42
thoughts: 77
Thoughts: **My Thought Process on nl80211 Rekey Offload Configuration**
Alright, so my current focus is on understanding how the `NL80211_CMD_SET_REKEY_OFFLOAD` command is integrated into the kernel's wireless networking subsystem. To do this, I need to delve into the implementation details within `net/wireless/nl80211.c`. Specifically, I'm looking at the code around line 20205. My hypothesis is that the actual handling of this command will be defined within the `nl80211_ops` structure, or potentially within `nl80211_small_ops` if it's a simpler operation. I'm also keeping an open mind that there might be other relevant sections of code elsewhere that define or influence how this particular nl80211 command is set up and executed. My goal here is to pinpoint the exact functions or callbacks responsible for processing `SET_REKEY_OFFLOAD` and understand their internal logic and dependencies.
|
| 472/6 |
2026/09/07 08:12 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:20200 LineCount:40]
Results: map[Contents:20200: .doit = nl80211_set_wowlan,
20201: .flags = GENL_UNS_ADMIN_PERM,
20202: .internal_flags = IFLAGS(NL80211_FLAG_NEED_WIPHY),
20203: },
20204: #endif
20205: {
20206: .cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
20207: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
20208: .doit = nl80211_set_rekey_data,
20209: .flags = GENL_UNS_ADMIN_PERM,
20210: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
20211: NL80211_FLAG_CLEAR_SKB),
20212: },
20213: {
20214: .cmd = NL80211_CMD_TDLS_MGMT,
20215: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
20216: .doit = nl80211_tdls_mgmt,
20217: .flags = GENL_UNS_ADMIN_PERM,
20218: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
20219: NL80211_FLAG_MLO_VALID_LINK_ID),
20220: },
20221: {
20222: .cmd = NL80211_CMD_TDLS_OPER,
20223: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
20224: .doit = nl80211_tdls_oper,
20225: .flags = GENL_UNS_ADMIN_PERM,
20226: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP),
20227: },
20228: {
20229: .cmd = NL80211_CMD_UNEXPECTED_FRAME,
20230: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
20231: .doit = nl80211_register_unexpected_frame,
20232: .flags = GENL_UNS_ADMIN_PERM,
20233: .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV),
20234: },
20235: {
20236: .cmd = NL80211_CMD_PROBE_PEER,
20237: .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
20238: .doit = nl80211_probe_peer,
20239: .flags = GENL_UNS_ADMIN_PERM,
]
|
| 473/6 |
2026/09/07 08:12 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 5428
output: 27
thoughts: 155
Thoughts: **My Deep Dive into Rekeying Mechanisms**
Alright, this is what's going through my head right now. I'm deep in this code, trying to untangle how rekeying is handled, and it's not immediately obvious. My instinct is to go broad and then narrow down. So, my first thought is: where are the critical hooks for this operation? I'm thinking about the lifecycle of a netlink message related to rekeying. Specifically, I want to investigate the pre- and post-operation handlers. Are there functions like `nl80211_pre_doit` or `nl80211_post_doit` that are triggered before or after the core rekeying logic executes?
But it's not just about the `nl80211` family of events. I need to consider the broader netlink infrastructure. Is there a generic netlink handling path that might be involved? This could be a more fundamental layer I need to understand.
Then, I'm zeroing in on the specific attribute that signals rekeying. `NL80211_ATTR_REKEY_DATA` is the key here, and I need to see how it's parsed and processed. Are there any helper functions like `nl80211_set_rekey_data` that encapsulate this logic?
I'm also considering some flags that might influence how the operation proceeds. What about `NL80211_FLAG_CLEAR_SKB`? Does this imply anything about the state of the socket buffer during rekeying, and is it relevant to my understanding? And then there's `NL80211_FLAG_NEED_NETDEV_UP`. This flag suggests that the network device must be in an up state for rekeying to occur, which is a significant constraint to keep in mind.
Beyond these specific functions and flags, I'm also thinking about the policy or configuration aspects. Is there a `nl80211_policy` that defines how `NL80211_ATTR_REKEY_DATA` is expected to be used, or what parameters are allowed?
Ultimately, to get a comprehensive picture, I need to see the full context. My next, and probably most crucial, step is to perform a global search for `NL80211_ATTR_REKEY_DATA` across the entire codebase. I need to find every single place this attribute is referenced, parsed, or acted upon. This will reveal the intricate web of interactions and dependencies that govern the rekeying process, ensuring I don't miss any critical path or edge case.
|
| 474/6 |
2026/09/07 08:12 |
tool |
grepper |
0m
Args: map[Expression:NL80211_ATTR_REKEY_DATA]
Results: map[Output:include/uapi/linux/nl80211.h-883- * feature is typically used during WoWLAN. The configuration data
include/uapi/linux/nl80211.h:884: * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and
include/uapi/linux/nl80211.h-885- * contains the data in sub-attributes). After rekeying happened,
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-2184- *
include/uapi/linux/nl80211.h:2185: * @NL80211_ATTR_REKEY_DATA: nested attribute containing the information
include/uapi/linux/nl80211.h-2186- * necessary for GTK rekeying in the device, see &enum nl80211_rekey_data.
--
include/uapi/linux/nl80211.h=3192=enum nl80211_attrs {
--
include/uapi/linux/nl80211.h-3386-
include/uapi/linux/nl80211.h:3387: NL80211_ATTR_REKEY_DATA,
include/uapi/linux/nl80211.h-3388-
--
net/wireless/nl80211.c=700=static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
--
net/wireless/nl80211.c-848- [NL80211_ATTR_SCHED_SCAN_INTERVAL] = { .type = NLA_U32 },
net/wireless/nl80211.c:849: [NL80211_ATTR_REKEY_DATA] = { .type = NLA_NESTED },
net/wireless/nl80211.c-850- [NL80211_ATTR_SCAN_SUPP_RATES] = { .type = NLA_NESTED },
--
net/wireless/nl80211.c=16261=static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-16269-
net/wireless/nl80211.c:16270: if (!info->attrs[NL80211_ATTR_REKEY_DATA])
net/wireless/nl80211.c-16271- return -EINVAL;
--
net/wireless/nl80211.c-16273- err = nla_parse_nested_deprecated(tb, MAX_NL80211_REKEY_DATA,
net/wireless/nl80211.c:16274: info->attrs[NL80211_ATTR_REKEY_DATA],
net/wireless/nl80211.c-16275- nl80211_rekey_policy, info->extack);
--
net/wireless/nl80211.c=22373=static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-22395-
net/wireless/nl80211.c:22396: rekey_attr = nla_nest_start_noflag(msg, NL80211_ATTR_REKEY_DATA);
net/wireless/nl80211.c-22397- if (!rekey_attr)
]
|
| 475/6 |
2026/09/07 08:12 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 6614
output: 27
thoughts: 91
Thoughts: **My Thought Process on Netlink nl80211 Message Handling**
Okay, before I dive deeper into this specific netlink message, my immediate instinct is to understand the lifecycle and handling mechanisms surrounding nl80211 commands. I need to get a clear picture of how these messages are processed. Therefore, my first step is to investigate the flow. I'll be looking for key points in the netlink message handling pipeline, specifically around the `nl80211_pre_doit` and `nl80211_post_doit` functions. These are likely critical junctures where state is managed or actions are prepared and finalized. Concurrently, I'm also curious about flags that might influence how the underlying socket buffer (SKB) is managed. The presence of `NL80211_FLAG_CLEAR_SKB` suggests a specific mechanism for cleaning up or releasing the SKB, which could have performance or resource implications, and I want to understand when and why this flag is set and what its precise effect is within the nl80211 framework. Essentially, I'm performing a targeted exploration to illuminate the operational details and potential nuances of nl80211 message dispatch.
|
| 476/6 |
2026/09/07 08:12 |
tool |
grepper |
0m
Args: map[Expression:NL80211_FLAG_CLEAR_SKB]
Results: map[Output:net/wireless/nl80211.c=19348=nl80211_epcs_cfg(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-19376- NL80211_FLAG_CHECK_NETDEV_UP)
net/wireless/nl80211.c:19377:#define NL80211_FLAG_CLEAR_SKB 0x20
net/wireless/nl80211.c-19378-#define NL80211_FLAG_NO_WIPHY_MTX 0x40
--
net/wireless/nl80211.c-19418- NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c:19419: NL80211_FLAG_CLEAR_SKB | \
net/wireless/nl80211.c-19420- NL80211_FLAG_MLO_UNSUPPORTED) \
--
net/wireless/nl80211.c-19429- NL80211_FLAG_NEED_NETDEV_UP | \
net/wireless/nl80211.c:19430: NL80211_FLAG_CLEAR_SKB) \
net/wireless/nl80211.c-19431- SELECTOR(__sel, WDEV_UP, \
--
net/wireless/nl80211.c-19434- NL80211_FLAG_NEED_WDEV_UP | \
net/wireless/nl80211.c:19435: NL80211_FLAG_CLEAR_SKB) \
net/wireless/nl80211.c-19436- SELECTOR(__sel, WDEV_UP_LINK, \
--
net/wireless/nl80211.c-19443- NL80211_FLAG_NEED_WIPHY | \
net/wireless/nl80211.c:19444: NL80211_FLAG_CLEAR_SKB) \
net/wireless/nl80211.c-19445- SELECTOR(__sel, WDEV_UP_RTNL_NOMTX, \
--
net/wireless/nl80211.c=19564=static void nl80211_post_doit(const struct genl_split_ops *ops,
--
net/wireless/nl80211.c-19596- */
net/wireless/nl80211.c:19597: if (internal_flags & NL80211_FLAG_CLEAR_SKB) {
net/wireless/nl80211.c-19598- struct nlmsghdr *nlh = nlmsg_hdr(skb);
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-19788- .internal_flags = IFLAGS(NL80211_FLAG_NEED_WDEV_UP |
net/wireless/nl80211.c:19789: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-19790- },
--
net/wireless/nl80211.c-19796- .internal_flags = IFLAGS(NL80211_FLAG_NEED_WDEV_UP |
net/wireless/nl80211.c:19797: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-19798- },
--
net/wireless/nl80211.c-19979- .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c:19980: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-19981- },
--
net/wireless/nl80211.c-19987- .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c:19988: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-19989- },
--
net/wireless/nl80211.c-20033- .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c:20034: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-20035- },
--
net/wireless/nl80211.c-20041- .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c:20042: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-20043- },
--
net/wireless/nl80211.c-20070- .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c:20071: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-20072- },
--
net/wireless/nl80211.c-20210- .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c:20211: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-20212- },
--
net/wireless/nl80211.c-20401- .internal_flags = IFLAGS(NL80211_FLAG_NEED_WIPHY |
net/wireless/nl80211.c:20402: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-20403- },
--
net/wireless/nl80211.c-20452- .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
net/wireless/nl80211.c:20453: NL80211_FLAG_CLEAR_SKB),
net/wireless/nl80211.c-20454- },
]
|
| 477/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 8589
output: 47
thoughts: 136
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_REKEY_OFFLOAD` Behavior**
I'm encountering an unexpected behavior with the `NL80211_CMD_SET_REKEY_OFFLOAD` command. Specifically, I'm seeing it return a success code (0) even when the `NL80211_ATTR_REKEY_DATA` attribute is absent. This seems counterintuitive; if the command is meant to set rekeying data, and that data isn't provided, I would expect a failure or at least a clear indication of missing information.
To understand this discrepancy, I need to delve deeper into the `nl80211` framework. My immediate next step is to meticulously examine the relevant code sections. I'll start by scrutinizing `nl80211_pre_doit`, as it's often where initial command validation and attribute checking occurs. Following that, I'll broaden my investigation to `nl80211_post_doit` to see if there's any post-execution logic that might explain or mitigate this apparent issue. Furthermore, I will search for any other instances where `set_rekey_data` is called, and where `NL80211_CMD_SET_REKEY_OFFLOAD` or the general concept of "rekeying" is handled, to build a comprehensive picture of the command's lifecycle and expected behavior. My primary focus for now is to get a solid grasp of what `nl80211_pre_doit` is doing in relation to this command.
|
| 478/6 |
2026/09/07 08:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/wireless/nl80211.c Name:nl80211_pre_doit]
Results: map[SourceCode:19462: static int nl80211_pre_doit(const struct genl_split_ops *ops,
19463: struct sk_buff *skb,
19464: struct genl_info *info)
19465: {
19466: struct cfg80211_registered_device *rdev = NULL;
19467: struct wireless_dev *wdev = NULL;
19468: struct net_device *dev = NULL;
19469: u32 internal_flags;
19470: int err;
19471:
19472: if (WARN_ON(ops->internal_flags >= ARRAY_SIZE(nl80211_internal_flags)))
19473: return -EINVAL;
19474:
19475: internal_flags = nl80211_internal_flags[ops->internal_flags];
19476:
19477: rtnl_lock();
19478: if (internal_flags & NL80211_FLAG_NEED_WIPHY) {
19479: rdev = cfg80211_get_dev_from_info(genl_info_net(info), info);
19480: if (IS_ERR(rdev)) {
19481: err = PTR_ERR(rdev);
19482: goto out_unlock;
19483: }
19484: info->user_ptr[0] = rdev;
19485: } else if (internal_flags & NL80211_FLAG_NEED_NETDEV ||
19486: internal_flags & NL80211_FLAG_NEED_WDEV) {
19487: wdev = __cfg80211_wdev_from_attrs(NULL, genl_info_net(info),
19488: info->attrs);
19489: if (IS_ERR(wdev)) {
19490: err = PTR_ERR(wdev);
19491: goto out_unlock;
19492: }
19493:
19494: dev = wdev->netdev;
19495: dev_hold(dev);
19496: rdev = wiphy_to_rdev(wdev->wiphy);
19497:
19498: if (internal_flags & NL80211_FLAG_NEED_NETDEV) {
19499: if (!dev) {
19500: err = -EINVAL;
19501: goto out_unlock;
19502: }
19503:
19504: info->user_ptr[1] = dev;
19505: } else {
19506: info->user_ptr[1] = wdev;
19507: }
19508:
19509: if (internal_flags & NL80211_FLAG_CHECK_NETDEV_UP &&
19510: !wdev_running(wdev)) {
19511: err = -ENETDOWN;
19512: goto out_unlock;
19513: }
19514:
19515: info->user_ptr[0] = rdev;
19516: }
19517:
19518: if (internal_flags & NL80211_FLAG_MLO_VALID_LINK_ID) {
19519: struct nlattr *link_id = info->attrs[NL80211_ATTR_MLO_LINK_ID];
19520:
19521: if (!wdev) {
19522: err = -EINVAL;
19523: goto out_unlock;
19524: }
19525:
19526: /* MLO -> require valid link ID */
19527: if (wdev->valid_links &&
19528: (!link_id ||
19529: !(wdev->valid_links & BIT(nla_get_u8(link_id))))) {
19530: err = -EINVAL;
19531: goto out_unlock;
19532: }
19533:
19534: /* non-MLO -> no link ID attribute accepted */
19535: if (!wdev->valid_links && link_id) {
19536: err = -EINVAL;
19537: goto out_unlock;
19538: }
19539: }
19540:
19541: if (internal_flags & NL80211_FLAG_MLO_UNSUPPORTED) {
19542: if (info->attrs[NL80211_ATTR_MLO_LINK_ID] ||
19543: (wdev && wdev->valid_links)) {
19544: err = -EINVAL;
19545: goto out_unlock;
19546: }
19547: }
19548:
19549: if (rdev && !(internal_flags & NL80211_FLAG_NO_WIPHY_MTX)) {
19550: wiphy_lock(&rdev->wiphy);
19551: /* we keep the mutex locked until post_doit */
19552: __release(&rdev->wiphy.mtx);
19553: }
19554: if (!(internal_flags & NL80211_FLAG_NEED_RTNL))
19555: rtnl_unlock();
19556:
19557: return 0;
19558: out_unlock:
19559: rtnl_unlock();
19560: dev_put(dev);
19561: return err;
19562: }
SourceFile:net/wireless/nl80211.c]
|
| 479/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 10442
output: 47
thoughts: 20
Thoughts: **My Thought Process for Reviewing `nl80211_post_doit`**
As I'm digging into the intricacies of the `nl80211` subsystem, a crucial part of wireless networking in Linux, I need to ensure comprehensive understanding. My current focus is on the post-execution phase of operations, specifically after an action has been initiated. Therefore, I've decided to investigate the `nl80211_post_doit` function. My intention here is to thoroughly understand what happens *after* a command or configuration has been processed, what cleanup or follow-up actions are taken, and how the system ensures consistency and proper state management following these operations. This step is vital to confirm that my grasp of the entire lifecycle of `nl80211` operations is complete and that I haven't overlooked any critical post-processing logic.
|
| 480/6 |
2026/09/07 08:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/wireless/nl80211.c Name:nl80211_post_doit]
Results: map[SourceCode:19564: static void nl80211_post_doit(const struct genl_split_ops *ops,
19565: struct sk_buff *skb,
19566: struct genl_info *info)
19567: {
19568: u32 internal_flags = nl80211_internal_flags[ops->internal_flags];
19569:
19570: if (info->user_ptr[1]) {
19571: if (internal_flags & NL80211_FLAG_NEED_WDEV) {
19572: struct wireless_dev *wdev = info->user_ptr[1];
19573:
19574: dev_put(wdev->netdev);
19575: } else {
19576: dev_put(info->user_ptr[1]);
19577: }
19578: }
19579:
19580: if (info->user_ptr[0] &&
19581: !(internal_flags & NL80211_FLAG_NO_WIPHY_MTX)) {
19582: struct cfg80211_registered_device *rdev = info->user_ptr[0];
19583:
19584: /* we kept the mutex locked since pre_doit */
19585: __acquire(&rdev->wiphy.mtx);
19586: wiphy_unlock(&rdev->wiphy);
19587: }
19588:
19589: if (internal_flags & NL80211_FLAG_NEED_RTNL)
19590: rtnl_unlock();
19591:
19592: /* If needed, clear the netlink message payload from the SKB
19593: * as it might contain key data that shouldn't stick around on
19594: * the heap after the SKB is freed. The netlink message header
19595: * is still needed for further processing, so leave it intact.
19596: */
19597: if (internal_flags & NL80211_FLAG_CLEAR_SKB) {
19598: struct nlmsghdr *nlh = nlmsg_hdr(skb);
19599:
19600: memset(nlmsg_data(nlh), 0, nlmsg_len(nlh));
19601: }
19602: }
SourceFile:net/wireless/nl80211.c]
|
| 481/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 11217
output: 18
thoughts: 168
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_REKEY_OFFLOAD` and Missing Attributes**
Right, let me walk you through my thinking on this. I'm looking at this question about `NL80211_CMD_SET_REKEY_OFFLOAD` returning 0 even when `NL80211_ATTR_REKEY_DATA` is absent, which seems contradictory to `nl80211_set_rekey_data` returning `-EINVAL` under the same condition. This immediately flags a discrepancy that needs investigation.
My first instinct is to verify the premise. Is it *actually* returning 0 in that scenario? And if so, *why*? This leads me to question the flow of control. What part of the kernel is handling `NL80211_CMD_SET_REKEY_OFFLOAD`? Is there a different handler than the one I'm familiar with, or a more general mechanism at play? The question itself hints at this by asking, "Is there another place where it's handled?"
So, the next logical step is a thorough search. I need to cast a wide net to find where this command is processed and how it handles its attributes. My search strategy would involve looking for keywords directly related to the command itself (`SET_REKEY_OFFLOAD`), related functionality (`set_rekey`, `rekey`), and broader networking contexts where such offloading might occur (`generic netlink`, `wowlan` – though wowlan might be a bit of a long shot, it's good to consider related offloading mechanisms). I'd be searching the *entire kernel tree* because the behavior might be determined by a generic netlink handler, a different subsystem, or even a configuration option that bypasses the direct `nl80211_set_rekey_data` check. I'm looking for any code path that consumes `NL80211_CMD_SET_REKEY_OFFLOAD` and then, potentially, decides to return 0 regardless of the presence of specific attributes.
|
| 482/6 |
2026/09/07 08:13 |
tool |
grepper |
0m
Args: map[Expression:set_rekey]
Results: map[Output:drivers/net/wireless/ath/ath11k/mac.c=9493=static void ath11k_mac_op_ipv6_changed(struct ieee80211_hw *hw,
--
drivers/net/wireless/ath/ath11k/mac.c-9572-
drivers/net/wireless/ath/ath11k/mac.c:9573:static void ath11k_mac_op_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/ath/ath11k/mac.c-9574- struct ieee80211_vif *vif,
--
drivers/net/wireless/ath/ath11k/mac.c=10068=static const struct ieee80211_ops ath11k_ops = {
--
drivers/net/wireless/ath/ath11k/mac.c-10082- .set_key = ath11k_mac_op_set_key,
drivers/net/wireless/ath/ath11k/mac.c:10083: .set_rekey_data = ath11k_mac_op_set_rekey_data,
drivers/net/wireless/ath/ath11k/mac.c-10084- .sta_state = ath11k_mac_op_sta_state,
--
drivers/net/wireless/ath/ath12k/mac.c=14086=EXPORT_SYMBOL(ath12k_mac_op_remain_on_channel);
drivers/net/wireless/ath/ath12k/mac.c-14087-
drivers/net/wireless/ath/ath12k/mac.c:14088:void ath12k_mac_op_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/ath/ath12k/mac.c-14089- struct ieee80211_vif *vif,
--
drivers/net/wireless/ath/ath12k/mac.c-14122-}
drivers/net/wireless/ath/ath12k/mac.c:14123:EXPORT_SYMBOL(ath12k_mac_op_set_rekey_data);
drivers/net/wireless/ath/ath12k/mac.c-14124-
--
drivers/net/wireless/ath/ath12k/mac.h=244=int ath12k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
--
drivers/net/wireless/ath/ath12k/mac.h-246- struct ieee80211_key_conf *key);
drivers/net/wireless/ath/ath12k/mac.h:247:void ath12k_mac_op_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/ath/ath12k/mac.h-248- struct ieee80211_vif *vif,
--
drivers/net/wireless/ath/ath12k/wifi7/hw.c=1163=static const struct ieee80211_ops ath12k_ops_wifi7 = {
--
drivers/net/wireless/ath/ath12k/wifi7/hw.c-1179- .set_key = ath12k_mac_op_set_key,
drivers/net/wireless/ath/ath12k/wifi7/hw.c:1180: .set_rekey_data = ath12k_mac_op_set_rekey_data,
drivers/net/wireless/ath/ath12k/wifi7/hw.c-1181- .sta_state = ath12k_mac_op_sta_state,
--
drivers/net/wireless/ath/wcn36xx/main.c=1131=static int wcn36xx_resume(struct ieee80211_hw *hw)
--
drivers/net/wireless/ath/wcn36xx/main.c-1156-
drivers/net/wireless/ath/wcn36xx/main.c:1157:static void wcn36xx_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/ath/wcn36xx/main.c-1158- struct ieee80211_vif *vif,
--
drivers/net/wireless/ath/wcn36xx/main.c=1350=static const struct ieee80211_ops wcn36xx_ops = {
--
drivers/net/wireless/ath/wcn36xx/main.c-1361- .resume = wcn36xx_resume,
drivers/net/wireless/ath/wcn36xx/main.c:1362: .set_rekey_data = wcn36xx_set_rekey_data,
drivers/net/wireless/ath/wcn36xx/main.c-1363-#endif
--
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c=5926=static int
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:5927:brcmf_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *ndev,
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c-5928- struct cfg80211_gtk_rekey_data *gtk)
--
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c=8330=struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
--
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c-8409- if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_WOWL_GTK))
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:8410: ops->set_rekey_data = brcmf_cfg80211_set_rekey_data;
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c-8411-#endif
--
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c=303=static void iwlagn_mac_stop(struct ieee80211_hw *hw, bool suspend)
--
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c-324-
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c:325:static void iwlagn_mac_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c-326- struct ieee80211_vif *vif,
--
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c=1572=const struct ieee80211_ops iwlagn_hw_ops = {
--
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c-1592- .update_tkip_key = iwlagn_mac_update_tkip_key,
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c:1593: .set_rekey_data = iwlagn_mac_set_rekey_data,
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c-1594- .conf_tx = iwlagn_mac_conf_tx,
--
drivers/net/wireless/intel/iwlwifi/mld/d3.c=180=struct iwl_mld_resume_data {
--
drivers/net/wireless/intel/iwlwifi/mld/d3.c-198-
drivers/net/wireless/intel/iwlwifi/mld/d3.c:199:void iwl_mld_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/intel/iwlwifi/mld/d3.c-200- struct ieee80211_vif *vif,
--
drivers/net/wireless/intel/iwlwifi/mld/d3.h=41=int iwl_mld_wowlan_resume(struct iwl_mld *mld);
drivers/net/wireless/intel/iwlwifi/mld/d3.h:42:void iwl_mld_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/intel/iwlwifi/mld/d3.h-43- struct ieee80211_vif *vif,
--
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c=2914=const struct ieee80211_ops iwl_mld_hw_ops = {
--
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c-2969- .set_wakeup = iwl_mld_set_wakeup,
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:2970: .set_rekey_data = iwl_mld_set_rekey_data,
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c-2971-#if IS_ENABLED(CONFIG_IPV6)
--
drivers/net/wireless/intel/iwlwifi/mvm/d3.c-18-
drivers/net/wireless/intel/iwlwifi/mvm/d3.c:19:void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/intel/iwlwifi/mvm/d3.c-20- struct ieee80211_vif *vif,
--
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c=6351=const struct ieee80211_ops iwl_mvm_hw_ops = {
--
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c-6422- .set_wakeup = iwl_mvm_set_wakeup,
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:6423: .set_rekey_data = iwl_mvm_set_rekey_data,
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c-6424-#if IS_ENABLED(CONFIG_IPV6)
--
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c=889=const struct ieee80211_ops iwl_mvm_mld_hw_ops = {
--
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c-959- .set_wakeup = iwl_mvm_set_wakeup,
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c:960: .set_rekey_data = iwl_mvm_set_rekey_data,
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c-961-#if IS_ENABLED(CONFIG_IPV6)
--
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h=2143=void iwl_mvm_set_wakeup(struct ieee80211_hw *hw, bool enabled);
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h:2144:void iwl_mvm_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h-2145- struct ieee80211_vif *vif,
--
drivers/net/wireless/marvell/mwifiex/cfg80211.c=3643=static void mwifiex_cfg80211_set_wakeup(struct wiphy *wiphy,
--
drivers/net/wireless/marvell/mwifiex/cfg80211.c-3650-
drivers/net/wireless/marvell/mwifiex/cfg80211.c:3651:static int mwifiex_set_rekey_data(struct wiphy *wiphy, struct net_device *dev,
drivers/net/wireless/marvell/mwifiex/cfg80211.c-3652- struct cfg80211_gtk_rekey_data *data)
--
drivers/net/wireless/marvell/mwifiex/cfg80211.c=4571=static const struct cfg80211_ops mwifiex_cfg80211_ops = {
--
drivers/net/wireless/marvell/mwifiex/cfg80211.c-4609- .set_wakeup = mwifiex_cfg80211_set_wakeup,
drivers/net/wireless/marvell/mwifiex/cfg80211.c:4610: .set_rekey_data = mwifiex_set_rekey_data,
drivers/net/wireless/marvell/mwifiex/cfg80211.c-4611-#endif
--
drivers/net/wireless/mediatek/mt76/mt7615/init.c=188=mt7615_check_offload_capability(struct mt7615_dev *dev)
--
drivers/net/wireless/mediatek/mt76/mt7615/init.c-207- dev->ops->sched_scan_stop = NULL;
drivers/net/wireless/mediatek/mt76/mt7615/init.c:208: dev->ops->set_rekey_data = NULL;
drivers/net/wireless/mediatek/mt76/mt7615/init.c-209- dev->ops->remain_on_channel = NULL;
--
drivers/net/wireless/mediatek/mt76/mt7615/main.c=1299=static void mt7615_set_wakeup(struct ieee80211_hw *hw, bool enabled)
--
drivers/net/wireless/mediatek/mt76/mt7615/main.c-1306-
drivers/net/wireless/mediatek/mt76/mt7615/main.c:1307:static void mt7615_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/mediatek/mt76/mt7615/main.c-1308- struct ieee80211_vif *vif,
--
drivers/net/wireless/mediatek/mt76/mt7615/main.c=1319=const struct ieee80211_ops mt7615_ops = {
--
drivers/net/wireless/mediatek/mt76/mt7615/main.c-1366- .set_wakeup = mt7615_set_wakeup,
drivers/net/wireless/mediatek/mt76/mt7615/main.c:1367: .set_rekey_data = mt7615_set_rekey_data,
drivers/net/wireless/mediatek/mt76/mt7615/main.c-1368-#endif /* CONFIG_PM */
--
drivers/net/wireless/mediatek/mt76/mt7921/main.c=1169=static int mt7921_resume(struct ieee80211_hw *hw)
--
drivers/net/wireless/mediatek/mt76/mt7921/main.c-1189-
drivers/net/wireless/mediatek/mt76/mt7921/main.c:1190:static void mt7921_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/mediatek/mt76/mt7921/main.c-1191- struct ieee80211_vif *vif,
--
drivers/net/wireless/mediatek/mt76/mt7921/main.c=1548=const struct ieee80211_ops mt7921_ops = {
--
drivers/net/wireless/mediatek/mt76/mt7921/main.c-1593- .set_wakeup = mt792x_set_wakeup,
drivers/net/wireless/mediatek/mt76/mt7921/main.c:1594: .set_rekey_data = mt7921_set_rekey_data,
drivers/net/wireless/mediatek/mt76/mt7921/main.c-1595-#endif /* CONFIG_PM */
--
drivers/net/wireless/mediatek/mt76/mt7925/main.c=1730=static int mt7925_resume(struct ieee80211_hw *hw)
--
drivers/net/wireless/mediatek/mt76/mt7925/main.c-1750-
drivers/net/wireless/mediatek/mt76/mt7925/main.c:1751:static void mt7925_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/mediatek/mt76/mt7925/main.c-1752- struct ieee80211_vif *vif,
--
drivers/net/wireless/mediatek/mt76/mt7925/main.c=2716=const struct ieee80211_ops mt7925_ops = {
--
drivers/net/wireless/mediatek/mt76/mt7925/main.c-2760- .set_wakeup = mt792x_set_wakeup,
drivers/net/wireless/mediatek/mt76/mt7925/main.c:2761: .set_rekey_data = mt7925_set_rekey_data,
drivers/net/wireless/mediatek/mt76/mt7925/main.c-2762-#endif /* CONFIG_PM */
--
drivers/net/wireless/realtek/rtw89/mac80211.c=1938=static void rtw89_ops_set_wakeup(struct ieee80211_hw *hw, bool enabled)
--
drivers/net/wireless/realtek/rtw89/mac80211.c-1944-
drivers/net/wireless/realtek/rtw89/mac80211.c:1945:static void rtw89_set_rekey_data(struct ieee80211_hw *hw,
drivers/net/wireless/realtek/rtw89/mac80211.c-1946- struct ieee80211_vif *vif,
--
drivers/net/wireless/realtek/rtw89/mac80211.c=2014=const struct ieee80211_ops rtw89_ops = {
--
drivers/net/wireless/realtek/rtw89/mac80211.c-2063- .set_wakeup = rtw89_ops_set_wakeup,
drivers/net/wireless/realtek/rtw89/mac80211.c:2064: .set_rekey_data = rtw89_set_rekey_data,
drivers/net/wireless/realtek/rtw89/mac80211.c-2065-#endif
--
include/net/cfg80211.h=4843=struct mgmt_frame_regs {
--
include/net/cfg80211.h-4917- *
include/net/cfg80211.h:4918: * @set_rekey_data: give the data necessary for GTK rekeying to the driver
include/net/cfg80211.h-4919- *
--
include/net/cfg80211.h=5280=struct cfg80211_ops {
--
include/net/cfg80211.h-5502-
include/net/cfg80211.h:5503: int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
include/net/cfg80211.h-5504- struct cfg80211_gtk_rekey_data *data);
--
include/net/mac80211.h=4068=struct ieee80211_prep_tx_info {
--
include/net/mac80211.h-4211- *
include/net/mac80211.h:4212: * @set_rekey_data: If the device supports GTK rekeying, for example while the
include/net/mac80211.h-4213- * host is suspended, it can assign this callback to retrieve the data
--
include/net/mac80211.h=4742=struct ieee80211_ops {
--
include/net/mac80211.h-4797- u32 iv32, u16 *phase1key);
include/net/mac80211.h:4798: void (*set_rekey_data)(struct ieee80211_hw *hw,
include/net/mac80211.h-4799- struct ieee80211_vif *vif,
--
net/mac80211/cfg.c=4919=static int ieee80211_get_antenna(struct wiphy *wiphy, int radio_idx,
--
net/mac80211/cfg.c-4926-
net/mac80211/cfg.c:4927:static int ieee80211_set_rekey_data(struct wiphy *wiphy,
net/mac80211/cfg.c-4928- struct net_device *dev,
--
net/mac80211/cfg.c-4933-
net/mac80211/cfg.c:4934: if (!local->ops->set_rekey_data)
net/mac80211/cfg.c-4935- return -EOPNOTSUPP;
net/mac80211/cfg.c-4936-
net/mac80211/cfg.c:4937: drv_set_rekey_data(local, sdata, data);
net/mac80211/cfg.c-4938-
--
net/mac80211/cfg.c=5976=const struct cfg80211_ops mac80211_config_ops = {
--
net/mac80211/cfg.c-6046- .get_antenna = ieee80211_get_antenna,
net/mac80211/cfg.c:6047: .set_rekey_data = ieee80211_set_rekey_data,
net/mac80211/cfg.c-6048- .tdls_oper = ieee80211_tdls_oper,
--
net/mac80211/driver-ops.h=875=static inline int drv_set_bitrate_mask(struct ieee80211_local *local,
--
net/mac80211/driver-ops.h-895-
net/mac80211/driver-ops.h:896:static inline void drv_set_rekey_data(struct ieee80211_local *local,
net/mac80211/driver-ops.h-897- struct ieee80211_sub_if_data *sdata,
--
net/mac80211/driver-ops.h-908-
net/mac80211/driver-ops.h:909: trace_drv_set_rekey_data(local, sdata, data);
net/mac80211/driver-ops.h:910: if (local->ops->set_rekey_data)
net/mac80211/driver-ops.h:911: local->ops->set_rekey_data(&local->hw, &sdata->vif, data);
net/mac80211/driver-ops.h-912- trace_drv_return_void(local);
--
net/mac80211/trace.h=1480=TRACE_EVENT(drv_set_bitrate_mask,
--
net/mac80211/trace.h-1506-
net/mac80211/trace.h:1507:TRACE_EVENT(drv_set_rekey_data,
net/mac80211/trace.h-1508- TP_PROTO(struct ieee80211_local *local,
--
net/wireless/nl80211.c=16206=static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-16260-
net/wireless/nl80211.c:16261:static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
net/wireless/nl80211.c-16262-{
--
net/wireless/nl80211.c-16303-
net/wireless/nl80211.c:16304: if (!rdev->ops->set_rekey_data)
net/wireless/nl80211.c-16305- return -EOPNOTSUPP;
net/wireless/nl80211.c-16306-
net/wireless/nl80211.c:16307: return rdev_set_rekey_data(rdev, dev, &rekey_data);
net/wireless/nl80211.c-16308-}
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-20207- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/wireless/nl80211.c:20208: .doit = nl80211_set_rekey_data,
net/wireless/nl80211.c-20209- .flags = GENL_UNS_ADMIN_PERM,
--
net/wireless/rdev-ops.h=901=static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
--
net/wireless/rdev-ops.h-910-
net/wireless/rdev-ops.h:911:static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
net/wireless/rdev-ops.h-912- struct net_device *dev,
--
net/wireless/rdev-ops.h-915- int ret;
net/wireless/rdev-ops.h:916: trace_rdev_set_rekey_data(&rdev->wiphy, dev);
net/wireless/rdev-ops.h:917: ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
net/wireless/rdev-ops.h-918- trace_rdev_return_int(&rdev->wiphy, ret);
--
net/wireless/trace.h=806=DECLARE_EVENT_CLASS(wiphy_netdev_evt,
--
net/wireless/trace.h-819-
net/wireless/trace.h:820:DEFINE_EVENT(wiphy_netdev_evt, rdev_set_rekey_data,
net/wireless/trace.h-821- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
]
|
| 483/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 19042
output: 29
thoughts: 428
Thoughts: **My Thought Process on the `NL80211_CMD_SET_REKEY_OFFLOAD` Behavior**
Okay, let me walk you through how I'm dissecting this particular puzzle regarding `NL80211_CMD_SET_REKEY_OFFLOAD` returning 0 even when `NL80211_ATTR_REKEY_DATA` seems to be missing.
First off, the discrepancy is quite stark: the core `nl80211_set_rekey_data` function *explicitly* returns `-EINVAL` if `NL80211_ATTR_REKEY_DATA` is absent. So, the observation that the command *as a whole* returns 0 points towards something happening *after* that initial validation, or perhaps a different handler entirely. This immediately makes me think about the broader netlink processing pipeline.
My initial instinct is to question *how* this situation could even arise where the command appears successful despite a missing critical attribute. Could it be that generic netlink itself is intercepting or modifying the outcome? Or is there a post-processing step that's masking the error? This is where I start to focus on the layers above the direct `nl80211` handler.
The snippet I've found in `nl80211_post_doit` is particularly interesting. The comment about clearing SKB payloads, specifically mentioning "key data that shouldn't stick around on the heap," immediately flags a potential area of interest. While this specific code is about *clearing* data, the fact that it's in a post-`doit` function suggests that the `doit` function itself might have already executed and returned, and this is a cleanup or further processing phase.
So, I'm now digging into the generic netlink (genetlink) handling itself. I need to understand the flow from userspace, through `genl_rcv_msg`, then `genl_family_rcv_msg_doit`, and any subsequent stages. My goal here is to trace where the `doit` function is invoked and, crucially, what happens to the return value of that `doit` function before it's eventually sent back to userspace. I'm specifically looking for any mechanisms within genetlink that might:
1. **Ignore or override an error return from the `doit` function:** Perhaps the generic netlink layer has its own success path that it defaults to if certain conditions are met, even if the specific protocol handler indicated an error.
2. **Handle attribute validation at a higher level:** While `nl80211` does its own checks, it's possible genetlink has its own attribute processing that might influence the final outcome.
3. **Perform cleanup or specific handling after the `doit`:** As hinted by `nl80211_post_doit`, there might be a sequence of operations where the error is either processed or inadvertently cleared.
Therefore, my immediate next steps are to dive deep into `net/netlink/genetlink.c`, specifically searching for references to `post_doit`, `memset` (in the context of payload clearing), and `nlmsg_len`. I'm also keenly interested in the netlink error handling mechanisms within genetlink – how are errors propagated, and where might they be suppressed or transformed? This is the core of my investigation to reconcile the `-EINVAL` within `nl80211_set_rekey_data` with the observed successful return code for the overall command.
|
| 484/6 |
2026/09/07 08:13 |
tool |
grepper |
0m
Args: map[Expression:post_doit PathPrefix:net/netlink/]
Results: map[Output:net/netlink/genetlink.c=255=genl_cmd_full_to_split(struct genl_split_ops *op,
--
net/netlink/genetlink.c-271- op->doit = full->doit;
net/netlink/genetlink.c:272: op->post_doit = family->post_doit;
net/netlink/genetlink.c-273- }
--
net/netlink/genetlink.c=1081=static int genl_family_rcv_msg_doit(const struct genl_family *family,
--
net/netlink/genetlink.c-1115-
net/netlink/genetlink.c:1116: if (ops->post_doit)
net/netlink/genetlink.c:1117: ops->post_doit(ops, skb, &info);
net/netlink/genetlink.c-1118-
]
|
| 485/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 19751
output: 46
thoughts: 32
Thoughts: **A Deep Dive into `genl_family_rcv_msg_doit`: Unpacking the Netlink Message Handling**
Alright, I've just been poring over `genl_family_rcv_msg_doit` in `net/netlink/genetlink.c`, and I've got some thoughts. This function, as I understand it, is a cornerstone of the Generic Netlink family's message processing. My primary goal in dissecting it is to grasp the intricate dance of handling incoming Netlink messages within the kernel.
First off, the context: this function is invoked when a Netlink message arrives destined for a specific Generic Netlink family. My immediate thought is about the robustness and flexibility this mechanism provides. It’s not just a simple dispatch; it’s a sophisticated pipeline designed to validate, route, and execute the request.
I'm tracing the flow, and the initial steps are crucial for security and sanity. I see checks being performed, like ensuring the message itself is properly formed and that the sender has the necessary permissions. This is absolutely vital – a kernel module is dealing with user-space requests, and you can't afford to be careless with what you execute or even look at. The validation phase, though sometimes tedious to trace, is where the system builds its defenses.
Following that, the core logic revolves around identifying the specific operation requested within the Netlink message. Generic Netlink, by its very design, allows families to define their own command sets. So, `genl_family_rcv_msg_doit` must be mapping the `cmd` field of the Netlink message to the appropriate handler function within the registered family. This mapping is the heart of the dispatch mechanism. I'm imagining a lookup table or a similar structure, efficiently guiding the incoming message to its designated handler. The elegance here lies in how it allows for extensibility; new commands can be added to a family without altering the core `genl_family_rcv_msg_doit` logic, as long as they adhere to the family's defined interface.
Then comes the execution. Once the handler is identified, it's called. This is where the actual work happens – processing data, interacting with other kernel subsystems, or sending a response back to the user. I'm mindful that this handler function will have access to the message payload and all the context necessary to fulfill the request. The way this handler is invoked, passing the relevant `nlmsg_hdr` and potentially other context structures, is key to making this whole system work seamlessly.
I'm also paying close attention to error handling and cleanup. What happens if the handler fails? What about resource management? `genl_family_rcv_msg_doit` must gracefully handle these scenarios, ensuring that no resources are leaked and that an appropriate error message is sent back to the user. This isn't just about the happy path; the robust handling of edge cases and failures is what separates a well-engineered system from a fragile one.
Finally, my overarching thought is about the modularity and extensibility that `genl_family_rcv_msg_doit` embodies. It acts as a central point for handling Generic Netlink messages, abstracting away the underlying transport mechanism and allowing families to define their own communication protocols. This design principle is incredibly powerful, enabling a rich and flexible interface between userspace and the kernel. It's a testament to the Linux kernel's design philosophy of providing well-defined, extensible interfaces.
|
| 486/6 |
2026/09/07 08:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netlink/genetlink.c Name:genl_family_rcv_msg_doit]
Results: map[SourceCode:1081: static int genl_family_rcv_msg_doit(const struct genl_family *family,
1082: struct sk_buff *skb,
1083: struct nlmsghdr *nlh,
1084: struct netlink_ext_ack *extack,
1085: const struct genl_split_ops *ops,
1086: int hdrlen, struct net *net)
1087: {
1088: struct nlattr **attrbuf;
1089: struct genl_info info;
1090: int err;
1091:
1092: attrbuf = genl_family_rcv_msg_attrs_parse(family, nlh, extack,
1093: ops, hdrlen,
1094: GENL_DONT_VALIDATE_STRICT);
1095: if (IS_ERR(attrbuf))
1096: return PTR_ERR(attrbuf);
1097:
1098: info.snd_seq = nlh->nlmsg_seq;
1099: info.snd_portid = NETLINK_CB(skb).portid;
1100: info.family = family;
1101: info.nlhdr = nlh;
1102: info.genlhdr = nlmsg_data(nlh);
1103: info.attrs = attrbuf;
1104: info.extack = extack;
1105: genl_info_net_set(&info, net);
1106: memset(&info.ctx, 0, sizeof(info.ctx));
1107:
1108: if (ops->pre_doit) {
1109: err = ops->pre_doit(ops, skb, &info);
1110: if (err)
1111: goto out;
1112: }
1113:
1114: err = ops->doit(skb, &info);
1115:
1116: if (ops->post_doit)
1117: ops->post_doit(ops, skb, &info);
1118:
1119: out:
1120: genl_family_rcv_msg_attrs_free(attrbuf);
1121:
1122: return err;
1123: }
SourceFile:net/netlink/genetlink.c]
|
| 487/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 20496
output: 43
thoughts: 210
Thoughts: **My Thought Process Regarding `nl80211_post_doit` and Netlink Message Handling**
My attention has been drawn to a specific section of code, `nl80211_post_doit`. The comment within this function immediately caught my eye:
```c
/* If needed, clear the netlink message payload from the SKB
* as it might contain key data that shouldn't stick around on
* the heap after the SKB is freed. The netlink message header
* is still needed for further processing, so leave it intact.
*/
```
This comment raises a critical point about data security and memory hygiene within the kernel's netlink communication framework. The core concern here is that the `sk_buff` (SKB), which carries the netlink message, might contain sensitive information in its payload. Upon freeing the SKB, this sensitive data could potentially remain in the heap, creating a security vulnerability. The code then proceeds to conditionally clear this payload using `memset` if the `NL80211_FLAG_CLEAR_SKB` flag is set. It's important to note that the `nlmsg_hdr` (netlink message header) is *not* cleared, as it's still required for subsequent processing. This implies a deliberate and targeted approach to sanitizing the SKB, focusing only on the variable data payload.
This observation naturally leads me to investigate the broader context of how netlink messages are received and processed within the kernel. My immediate next step is to examine the `netlink_rcv_skb` function, located in `net/netlink/af_netlink.c`. This function is the central point for receiving SKBs destined for netlink sockets. I need to understand how it handles incoming messages, particularly in relation to the clearing mechanism I've just identified in `nl80211_post_doit`.
Furthermore, I want to delve into the interaction between `netlink_rcv_skb` and the `netlink_ack` function. `netlink_ack` is typically used to send acknowledgments back to the sender of a netlink message. Understanding how these two functions interact, especially in scenarios where sensitive data might have been involved, is crucial. I'm particularly interested in whether `netlink_ack` plays any role in ensuring that sensitive data is appropriately handled or cleared *before* the acknowledgment is sent or if the clearing logic is solely confined to the processing of the received message itself. This line of inquiry aims to build a comprehensive understanding of the netlink message lifecycle and its associated security considerations within the kernel.
|
| 488/6 |
2026/09/07 08:13 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netlink/af_netlink.c Name:netlink_rcv_skb]
Results: map[SourceCode:2530: int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
2531: struct nlmsghdr *,
2532: struct netlink_ext_ack *))
2533: {
2534: struct netlink_ext_ack extack;
2535: struct nlmsghdr *nlh;
2536: int err;
2537:
2538: while (skb->len >= nlmsg_total_size(0)) {
2539: int msglen;
2540:
2541: memset(&extack, 0, sizeof(extack));
2542: nlh = nlmsg_hdr(skb);
2543: err = 0;
2544:
2545: if (nlh->nlmsg_len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len)
2546: return 0;
2547:
2548: /* Only requests are handled by the kernel */
2549: if (!(nlh->nlmsg_flags & NLM_F_REQUEST))
2550: goto ack;
2551:
2552: /* Skip control messages */
2553: if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
2554: goto ack;
2555:
2556: err = cb(skb, nlh, &extack);
2557: if (err == -EINTR)
2558: goto skip;
2559:
2560: ack:
2561: if (nlh->nlmsg_flags & NLM_F_ACK || err)
2562: netlink_ack(skb, nlh, err, &extack);
2563:
2564: skip:
2565: msglen = NLMSG_ALIGN(nlh->nlmsg_len);
2566: if (msglen > skb->len)
2567: msglen = skb->len;
2568: skb_pull(skb, msglen);
2569: }
2570:
2571: return 0;
2572: }
SourceFile:net/netlink/af_netlink.c]
|
| 489/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 21384
output: 21
thoughts: 191
Thoughts: **My Thought Process Regarding Netlink Packet Handling**
Ah, a crucial point of inquiry has just struck me: I need to re-examine the `netlink_rcv_skb` function, specifically the section from lines 2560 through 2568. I'm particularly focused on the `ack:` label and the subsequent conditional `netlink_ack` call, followed by the `skip:` label and the handling of `msglen`. This snippet seems to dictate how acknowledgements are sent and how the received Netlink message is consumed from the buffer.
My immediate follow-up question, which arises from this detailed look at `netlink_rcv_skb`, is about the `nlmsg_len(nlh)` macro or inline function when it's invoked within `nl80211_post_doit`. I need to ascertain its definition and its precise behavior, especially considering the context of processing the Netlink header (`nlh`) in this specific handler. Understanding how `nlmsg_len` calculates the message length is fundamental to correctly parsing and processing the Netlink payload, and its usage within `nl80211_post_doit` suggests it plays a vital role in message boundary determination or data extraction.
|
| 490/6 |
2026/09/07 08:13 |
tool |
grepper |
0m
Args: map[Expression:static inline int nlmsg_len]
Results: map[Output:include/net/netlink.h=608=static inline void *nlmsg_data(const struct nlmsghdr *nlh)
--
include/net/netlink.h-616- */
include/net/netlink.h:617:static inline int nlmsg_len(const struct nlmsghdr *nlh)
include/net/netlink.h-618-{
--
tools/lib/bpf/nlattr.c=45=static int validate_nla(struct nlattr *nla, int maxtype,
--
tools/lib/bpf/nlattr.c-80-
tools/lib/bpf/nlattr.c:81:static inline int nlmsg_len(const struct nlmsghdr *nlh)
tools/lib/bpf/nlattr.c-82-{
]
|
| 491/6 |
2026/09/07 08:13 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 21797
output: 36
thoughts: 21
Thoughts: **My Thought Process on `include/net/netlink.h` Around Line 617**
Alright, so I'm looking at `include/net/netlink.h`, and my attention is drawn to the section around line 617. My immediate impulse is to dive into the code there to understand what's going on. I'm particularly interested in how the Netlink subsystem handles communication, and I suspect this particular section might be crucial for defining some core data structures or perhaps the fundamental mechanics of how Netlink sockets are managed or how messages are exchanged.
As an expert in this domain, I know that header files are the blueprints. They lay out the interfaces, the structures, and the types that govern how different parts of the kernel, and even user-space applications, interact with Netlink. So, this line 617, and its surrounding context, is likely a key entry point to understanding a specific aspect of Netlink's architecture.
My initial hypothesis is that I'm going to find a structure definition, maybe something like `struct netlink_sock` or a related configuration struct. Alternatively, it could be a set of macros or constants that define message types, flags, or internal state identifiers. The precise location is important because it often correlates with a specific functional area. For instance, if it's near socket creation functions, it's probably about socket initialization. If it's near send/receive logic, it will define message formats or buffering.
I'm also considering the possibility that this line might be related to callbacks or event handling. Netlink is an event-driven system, so understanding how these events are represented and processed is paramount. I'll be looking for pointers to functions, or perhaps enumerations that signify different Netlink events.
Ultimately, my goal is to get a clear mental model of the underlying data representation and the API presented at this point in the header. This will inform my understanding of how Netlink messages are constructed, sent, and received, and how the kernel manages the lifecycle of Netlink connections. It’s about deciphering the language that Netlink speaks, and line 617 seems like a good place to start learning that language.
|
| 492/6 |
2026/09/07 08:14 |
tool |
read-file |
0m
Args: map[File:include/net/netlink.h FirstLine:605 LineCount:25]
Results: map[Contents: 605: * nlmsg_data - head of message payload
606: * @nlh: netlink message header
607: */
608: static inline void *nlmsg_data(const struct nlmsghdr *nlh)
609: {
610: return (unsigned char *) nlh + NLMSG_HDRLEN;
611: }
612:
613: /**
614: * nlmsg_len - length of message payload
615: * @nlh: netlink message header
616: */
617: static inline int nlmsg_len(const struct nlmsghdr *nlh)
618: {
619: return nlh->nlmsg_len - NLMSG_HDRLEN;
620: }
621:
622: /**
623: * nlmsg_payload - message payload if the data fits in the len
624: * @nlh: netlink message header
625: * @len: struct length
626: *
627: * Returns: The netlink message payload/data if the length is sufficient,
628: * otherwise NULL.
629: */
]
|
| 493/6 |
2026/09/07 08:14 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 22190
output: 30
thoughts: 190
Thoughts: **My Thought Process on `NL80211_CMD_SET_REKEY_OFFLOAD`**
Alright, so I'm digging into this `NL80211_CMD_SET_REKEY_OFFLOAD` command, and immediately, a couple of things are giving me pause. First, I need to be absolutely sure I'm zeroing out the correct memory. I'm looking at `memset(nlmsg_data(nlh), 0, nlmsg_len(nlh))`. My gut tells me this clears the *payload* data, which is good, but I want to confirm it's not accidentally touching or misinterpreting `nlh->nlmsg_len` itself. It's a subtle distinction, but critical for data integrity.
Then, the behavior itself is raising a flag. Why would `NL80211_CMD_SET_REKEY_OFFLOAD` return a success code (0, presumably, in this context) when `NL80211_ATTR_REKEY_DATA` is completely absent? This doesn't align with my expectations for a command that's clearly designed to *set* rekey information. It suggests there might be an underlying assumption or a permissive default behavior I'm not accounting for, or perhaps a bug where it's not properly validating its inputs.
This anomaly is pushing me to a more comprehensive investigation. I need to cast a wider net. My next step is to dive into the git history. I'll be looking for commits related to this command, or perhaps similar commands within the `cfg80211` subsystem, to see if there's a historical reason for this behavior or if it's a recent change. Syzkaller reports are also high on my list, as they often uncover edge cases and unexpected return codes in kernel interfaces.
Beyond the code itself, I need to consult the external documentation. I'll be searching the official `cfg80211` documentation, looking for any test cases or examples that use `NL80211_CMD_SET_REKEY_OFFLOAD`, and really anywhere else this command might be mentioned or described.
Finally, to ensure I'm not missing anything, I'm going to do a broad, sweeping search for *all* occurrences of `NL80211_CMD_SET_REKEY_OFFLOAD` across the entire codebase. This exhaustive search will help me understand how it's used elsewhere, if at all, and whether this particular behavior is consistent or an isolated anomaly. It's about building a complete picture, from the low-level memory operations to the high-level command semantics and their integration across the system.
|
| 494/6 |
2026/09/07 08:14 |
tool |
grepper |
0m
Args: map[Expression:NL80211_CMD_SET_REKEY_OFFLOAD]
Results: map[Output:include/uapi/linux/nl80211.h-880- *
include/uapi/linux/nl80211.h:881: * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
include/uapi/linux/nl80211.h-882- * the necessary information for supporting GTK rekey offload. This
--
include/uapi/linux/nl80211.h=1433=enum nl80211_commands {
--
include/uapi/linux/nl80211.h-1553-
include/uapi/linux/nl80211.h:1554: NL80211_CMD_SET_REKEY_OFFLOAD,
include/uapi/linux/nl80211.h-1555-
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-20205- {
net/wireless/nl80211.c:20206: .cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
net/wireless/nl80211.c-20207- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
--
net/wireless/nl80211.c=22373=static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-22384-
net/wireless/nl80211.c:22385: hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SET_REKEY_OFFLOAD);
net/wireless/nl80211.c-22386- if (!hdr) {
]
|
| 495/6 |
2026/09/07 08:14 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 22952
output: 43
thoughts: 66
Thoughts: **My Thought Process Regarding `nl80211.h` and Rekey Offload**
Okay, so I'm diving into the `include/uapi/linux/nl80211.h` file, and something caught my eye. I need to pause and really examine this. Specifically, I'm drawn to the comment preceding `NL80211_CMD_SET_REKEY_OFFLOAD`. This is a crucial area, as it deals with offloading cryptographic operations, and understanding the nuances of the associated commands and their documentation is paramount for any expert in this domain. I need to scrutinize the exact wording and implications of that comment to ensure I fully grasp the intended functionality and any potential limitations or considerations related to setting up rekey offload.
|
| 496/6 |
2026/09/07 08:14 |
tool |
read-file |
0m
Args: map[File:include/uapi/linux/nl80211.h FirstLine:875 LineCount:35]
Results: map[Contents: 875: * from the driver reporting the wakeup reason. In this case, the
876: * @NL80211_ATTR_WOWLAN_TRIGGERS attribute will contain the reason
877: * for the wakeup, if it was caused by wireless. If it is not present
878: * in the wakeup notification, the wireless device didn't cause the
879: * wakeup but reports that it was woken up.
880: *
881: * @NL80211_CMD_SET_REKEY_OFFLOAD: This command is used give the driver
882: * the necessary information for supporting GTK rekey offload. This
883: * feature is typically used during WoWLAN. The configuration data
884: * is contained in %NL80211_ATTR_REKEY_DATA (which is nested and
885: * contains the data in sub-attributes). After rekeying happened,
886: * this command may also be sent by the driver as an MLME event to
887: * inform userspace of the new replay counter.
888: *
889: * @NL80211_CMD_PMKSA_CANDIDATE: This is used as an event to inform userspace
890: * of PMKSA caching candidates.
891: *
892: * @NL80211_CMD_TDLS_OPER: Perform a high-level TDLS command (e.g. link setup).
893: * In addition, this can be used as an event to request userspace to take
894: * actions on TDLS links (set up a new link or tear down an existing one).
895: * In such events, %NL80211_ATTR_TDLS_OPERATION indicates the requested
896: * operation, %NL80211_ATTR_MAC contains the peer MAC address, and
897: * %NL80211_ATTR_REASON_CODE the reason code to be used (only with
898: * %NL80211_TDLS_TEARDOWN).
899: * @NL80211_CMD_TDLS_MGMT: Send a TDLS management frame. The
900: * %NL80211_ATTR_TDLS_ACTION attribute determines the type of frame to be
901: * sent. Public Action codes (802.11-2012 8.1.5.1) will be sent as
902: * 802.11 management frames, while TDLS action codes (802.11-2012
903: * 8.5.13.1) will be encapsulated and sent as data frames. The currently
904: * supported Public Action code is %WLAN_PUB_ACTION_TDLS_DISCOVER_RES
905: * and the currently supported TDLS actions codes are given in
906: * &enum ieee80211_tdls_actioncode.
907: *
908: * @NL80211_CMD_UNEXPECTED_FRAME: Used by an application controlling an AP
909: * (or GO) interface (i.e. hostapd) to ask for unexpected frames to
]
|
| 497/6 |
2026/09/07 08:14 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 23935
output: 49
thoughts: 82
Thoughts: **My Thought Process Regarding Rekeying Notification**
Alright, so I was reviewing the code, specifically lines 885-887, which talk about rekeying. The phrasing there, "After rekeying happened, this command may also be sent by the driver as an MLME event to inform userspace of the new replay counter," immediately triggered a thought: "Wait a minute, I need to verify how this rekey notification actually works in practice." My instinct is to not just take documentation or comments at face value but to trace the implementation. Therefore, I immediately decided to jump into the `net/wireless/nl80211.c` file and specifically look for the `nl80211_gtk_rekey_notify` function. This is my standard procedure when encountering a potentially significant detail about event handling or driver interaction – I want to see the concrete code that implements the described behavior.
|
| 498/6 |
2026/09/07 08:14 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/wireless/nl80211.c Name:nl80211_gtk_rekey_notify]
Results: map[SourceCode:22373: static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
22374: struct net_device *netdev, const u8 *bssid,
22375: const u8 *replay_ctr, gfp_t gfp)
22376: {
22377: struct sk_buff *msg;
22378: struct nlattr *rekey_attr;
22379: void *hdr;
22380:
22381: msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
22382: if (!msg)
22383: return;
22384:
22385: hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_SET_REKEY_OFFLOAD);
22386: if (!hdr) {
22387: nlmsg_free(msg);
22388: return;
22389: }
22390:
22391: if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
22392: nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) ||
22393: nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid))
22394: goto nla_put_failure;
22395:
22396: rekey_attr = nla_nest_start_noflag(msg, NL80211_ATTR_REKEY_DATA);
22397: if (!rekey_attr)
22398: goto nla_put_failure;
22399:
22400: if (nla_put(msg, NL80211_REKEY_DATA_REPLAY_CTR,
22401: NL80211_REPLAY_CTR_LEN, replay_ctr))
22402: goto nla_put_failure;
22403:
22404: nla_nest_end(msg, rekey_attr);
22405:
22406: genlmsg_end(msg, hdr);
22407:
22408: genlmsg_multicast_netns(&nl80211_fam, wiphy_net(&rdev->wiphy), msg, 0,
22409: NL80211_MCGRP_MLME, gfp);
22410: return;
22411:
22412: nla_put_failure:
22413: nlmsg_free(msg);
22414: }
SourceFile:net/wireless/nl80211.c]
|
| 499/6 |
2026/09/07 08:14 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 24871
output: 43
thoughts: 1030
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_REKEY_OFFLOAD` Behavior**
Okay, so I've been presented with a question about why `NL80211_CMD_SET_REKEY_OFFLOAD` might return 0, even when `NL80211_ATTR_REKEY_DATA` is missing. The question points out that `nl80211_set_rekey_data`, which seems like the logical handler, *should* return `-EINVAL` in this specific scenario. This implies there might be a discrepancy or another pathway I need to investigate.
My immediate reaction is to question the premise. Is it *truly* returning 0, or is the observation of a 0 return value coming from a specific context, perhaps userspace, a testing framework like syzkaller, or a misunderstanding of the Netlink interaction itself?
I need to break this down:
1. **Netlink ACK Behavior:** The first thing that comes to mind is how Netlink handles acknowledgments and errors. If `NL80211_CMD_SET_REKEY_OFFLOAD` is sent *without* the `NLM_F_ACK` flag set in the `nlmsghdr`, what's the consequence?
* I recall that in Netlink, if a command doesn't have `NLM_F_ACK`, the kernel's `netlink_rcv_skb` function has a conditional ACK call: `if (nlh->nlmsg_flags & NLM_F_ACK || err) netlink_ack(skb, nlh, err, &extack);`.
* Crucially, if `err` is non-zero (like our expected `-EINVAL` from `nl80211_set_rekey_data`), the `netlink_ack` function *is* still called. This function is responsible for sending an `NLMSG_ERROR` response message back to the sender, and this response will contain the error code (`nlmsgerr.error = -EINVAL`).
* From the perspective of the userspace application making the `send()` or `sendmsg()` system call, these calls typically return the number of bytes written (a non-negative value) upon success. They don't directly reflect the *kernel's internal processing error* unless an `NLMSG_ERROR` message is received and parsed. So, even if the kernel *internally* detects an error (`-EINVAL`), the `sendmsg` call itself might succeed and return 0 bytes sent or a positive number if the message was queued, and the error would manifest as a separate Netlink message. This could be a source of confusion.
2. **Alternative Handlers:** The question explicitly asks, "Is there another place where it's handled?" This is a critical avenue to explore. `nl80211_set_rekey_data` might be the *intended* handler, but is it the *only* one, or could `NL80211_CMD_SET_REKEY_OFFLOAD` be processed differently in certain contexts or by other parts of the wireless stack?
* To answer this, I need to trace the `NL80211_CMD_SET_REKEY_OFFLOAD` command's journey. I'd look at the Netlink command registration, specifically how `NL80211_CMD_SET_REKEY_OFFLOAD` is mapped to a kernel function.
* My search strategy would involve looking for:
* Direct references to `NL80211_CMD_SET_REKEY_OFFLOAD` in the codebase.
* References to `NL80211_ATTR_REKEY_DATA` to see where it's expected.
* Broader searches for "rekey" to catch related logic.
* Specific handler functions like `nl80211_set_rekey_data`.
* Potentially related hardware capabilities or flags like `WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK` or driver-level callbacks like `rdev_set_rekey_data`.
* Any use of `NL80211_CMD_` within the `net/wireless/` directory, as this is the primary location for `nl80211` handlers.
My investigation would then proceed by meticulously examining the source code. I'd start with the definitions in `include/uapi/linux/nl80211.h` to confirm the command's existence and value. Then, I'd dive into `net/wireless/nl80211.c`, specifically looking at structures like `nl80211_ops`, `nl80211_small_ops`, and how commands are dispatched. I'd search for any instances where `NL80211_CMD_SET_REKEY_OFFLOAD` might be registered or handled outside the expected `nl80211_set_rekey_data` path, potentially through other `ops` structures or conditional logic. I'd also perform broader searches across the entire kernel, especially within `drivers/net/wireless/`, to ensure no driver-specific handling is occurring that bypasses or alters the expected `nl80211` framework behavior. The goal is to definitively confirm if `NL80211_CMD_SET_REKEY_OFFLOAD` is *exclusively* handled by `nl80211_set_rekey_data`, or if other code paths can intercept or process this command, potentially leading to a different outcome or a misunderstood return value.
|
| 500/6 |
2026/09/07 08:14 |
tool |
grepper |
0m
Args: map[Expression:nl80211_small_ops|nl80211_ops PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=19710=int __missing_selector(void);
--
net/wireless/nl80211.c-19712-
net/wireless/nl80211.c:19713:static const struct genl_ops nl80211_ops[] = {
net/wireless/nl80211.c-19714- {
--
net/wireless/nl80211.c-19732-
net/wireless/nl80211.c:19733:static const struct genl_small_ops nl80211_small_ops[] = {
net/wireless/nl80211.c-19734- {
--
net/wireless/nl80211.c=20611=static struct genl_family nl80211_fam __ro_after_init = {
--
net/wireless/nl80211.c-20620- .module = THIS_MODULE,
net/wireless/nl80211.c:20621: .ops = nl80211_ops,
net/wireless/nl80211.c:20622: .n_ops = ARRAY_SIZE(nl80211_ops),
net/wireless/nl80211.c:20623: .small_ops = nl80211_small_ops,
net/wireless/nl80211.c:20624: .n_small_ops = ARRAY_SIZE(nl80211_small_ops),
net/wireless/nl80211.c-20625- .resv_start_op = NL80211_CMD_REMOVE_LINK_STA + 1,
]
|
| 501/6 |
2026/09/07 08:14 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26409
output: 26
thoughts: 1373
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_REKEY_OFFLOAD`**
Right, let's break down my thinking on this `NL80211_CMD_SET_REKEY_OFFLOAD` command. My initial concern is to ensure I'm understanding its behavior correctly and not missing any edge cases or alternative interpretations.
First, I want to be absolutely certain there aren't any other places in the kernel code where `NL80211_CMD_SET_REKEY_OFFLOAD` is handled beyond the obvious. This is crucial for a comprehensive understanding. My immediate thought is to check the `nl80211_small_ops` structure, which is the primary dispatch table for nl80211 commands. Indeed, I found that `NL80211_CMD_SET_REKEY_OFFLOAD` is explicitly mapped to `nl80211_set_rekey_data` within `nl80211_small_ops`. This confirms that `nl80211_set_rekey_data` is the *sole* handler for this command when it's issued by userspace.
This brings me to a potential point of confusion: why might someone think this command returns 0 even when `NL80211_ATTR_REKEY_DATA` is missing, when my analysis of `nl80211_set_rekey_data` indicates it *should* return `-EINVAL` in that scenario? I need to explore all possibilities that could lead to such a perception.
Let's trace the execution path when userspace *does* send `NL80211_CMD_SET_REKEY_OFFLOAD`. It begins with `genl_rcv_msg` and then `genl_family_rcv_msg_doit`. The system first parses the attributes based on the `nl80211_policy`. Following that, `ops->pre_doit`, which is `nl80211_pre_doit`, is invoked. This function checks for necessary flags like `NL80211_FLAG_NEED_NETDEV_UP`. It then attempts to find the `wdev` using attributes like `NL80211_ATTR_IFINDEX` or `NL80211_ATTR_WDEV`. If these are missing or invalid, `nl80211_pre_doit` will correctly return an error like `-EINVAL` or `-ENODEV`. It also verifies that the network device is up, returning `-ENETDOWN` if it's not. Crucially, it acquires a lock on the `wiphy`. If all these pre-conditions are met, `nl80211_pre_doit` returns 0.
Next, the actual handler, `ops->doit`, which is `nl80211_set_rekey_data`, is called. This is where the check for `NL80211_ATTR_REKEY_DATA` happens. If this attribute is absent, `nl80211_set_rekey_data` *will* return `-EINVAL`.
After `doit` completes, `ops->post_doit` (`nl80211_post_doit`) is executed. This function handles releasing resources like the netdev reference and unlocking the `wiphy` mutex. If `NL80211_FLAG_CLEAR_SKB` is set, it will also clear the SKB payload.
Finally, the error code from `genl_family_rcv_msg_doit` is returned to `genl_rcv_msg` and then to `netlink_rcv_skb`. The `netlink_rcv_skb` function checks if an error occurred (`err`) or if an acknowledgement (`NLM_F_ACK`) was requested. If `err` is non-zero (like our `-EINVAL`), `netlink_ack` will send an `NLMSG_ERROR` message back to userspace with the appropriate error code.
So, based on this detailed trace, a direct userspace request for `NL80211_CMD_SET_REKEY_OFFLOAD` with a missing `NL80211_ATTR_REKEY_DATA` *should* result in an `-EINVAL` being sent back to userspace, not a 0.
This leads me to ponder: what could be the scenario where someone *observes* a return of 0? My immediate thought is that `NL80211_CMD_SET_REKEY_OFFLOAD` might also be used for something other than a direct userspace command. Could it be an event notification?
I recall that `cfg80211_gtk_rekey_notify()` can trigger notifications. Digging into that, I see that `nl80211_gtk_rekey_notify()` indeed uses `NL80211_CMD_SET_REKEY_OFFLOAD` to send a multicast event to the `NL80211_MCGRP_MLME` group. This happens when a rekey event occurs at the hardware or driver level. In the context of such an event, the `NL80211_ATTR_REKEY_DATA` attribute might contain only `NL80211_REKEY_DATA_REPLAY_CTR`. This is a fundamentally different operation than a userspace command seeking to *set* rekey offload parameters, and its "return value" would be interpreted differently by the receiving userspace application – likely as a successful notification, which could be perceived as a "0" in some contexts if not explicitly checked for error.
My last thought is to consider if other rekey-related operations, like WoWLAN rekey configuration or the `NL80211_CMD_SET_WOWLAN` command itself, might have a bearing on this. I'll need to search for `rekey` within the `nl80211_set_wowlan` function and the broader WoWLAN code to ensure no related logic inadvertently influences the interpretation of `NL80211_CMD_SET_REKEY_OFFLOAD`'s behavior.
|
| 502/6 |
2026/09/07 08:14 |
tool |
grepper |
0m
Args: map[Expression:rekey PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=1163=nl80211_coalesce_policy[NUM_NL80211_ATTR_COALESCE_RULE] = {
--
net/wireless/nl80211.c-1171-
net/wireless/nl80211.c:1172:/* policy for GTK rekey offload attributes */
net/wireless/nl80211.c-1173-static const struct nla_policy
net/wireless/nl80211.c:1174:nl80211_rekey_policy[NUM_NL80211_REKEY_DATA] = {
net/wireless/nl80211.c-1175- [NL80211_REKEY_DATA_KEK] = {
--
net/wireless/nl80211.c=15563=static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-15603- nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) ||
net/wireless/nl80211.c:15604: (rdev->wiphy.wowlan_config->gtk_rekey_failure &&
net/wireless/nl80211.c-15605- nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) ||
--
net/wireless/nl80211.c=15813=static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-15864- return -EINVAL;
net/wireless/nl80211.c:15865: new_triggers.gtk_rekey_failure = true;
net/wireless/nl80211.c-15866- regular = true;
--
net/wireless/nl80211.c=16206=static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-16260-
net/wireless/nl80211.c:16261:static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
net/wireless/nl80211.c-16262-{
--
net/wireless/nl80211.c-16266- struct nlattr *tb[NUM_NL80211_REKEY_DATA];
net/wireless/nl80211.c:16267: struct cfg80211_gtk_rekey_data rekey_data = {};
net/wireless/nl80211.c-16268- int err;
--
net/wireless/nl80211.c-16274- info->attrs[NL80211_ATTR_REKEY_DATA],
net/wireless/nl80211.c:16275: nl80211_rekey_policy, info->extack);
net/wireless/nl80211.c-16276- if (err)
--
net/wireless/nl80211.c-16292-
net/wireless/nl80211.c:16293: rekey_data.kek = nla_data(tb[NL80211_REKEY_DATA_KEK]);
net/wireless/nl80211.c:16294: rekey_data.kck = nla_data(tb[NL80211_REKEY_DATA_KCK]);
net/wireless/nl80211.c:16295: rekey_data.replay_ctr = nla_data(tb[NL80211_REKEY_DATA_REPLAY_CTR]);
net/wireless/nl80211.c:16296: rekey_data.kek_len = nla_len(tb[NL80211_REKEY_DATA_KEK]);
net/wireless/nl80211.c:16297: rekey_data.kck_len = nla_len(tb[NL80211_REKEY_DATA_KCK]);
net/wireless/nl80211.c-16298- if (tb[NL80211_REKEY_DATA_AKM])
net/wireless/nl80211.c:16299: rekey_data.akm = nla_get_u32(tb[NL80211_REKEY_DATA_AKM]);
net/wireless/nl80211.c-16300-
--
net/wireless/nl80211.c-16303-
net/wireless/nl80211.c:16304: if (!rdev->ops->set_rekey_data)
net/wireless/nl80211.c-16305- return -EOPNOTSUPP;
net/wireless/nl80211.c-16306-
net/wireless/nl80211.c:16307: return rdev_set_rekey_data(rdev, dev, &rekey_data);
net/wireless/nl80211.c-16308-}
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-20207- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/wireless/nl80211.c:20208: .doit = nl80211_set_rekey_data,
net/wireless/nl80211.c-20209- .flags = GENL_UNS_ADMIN_PERM,
--
net/wireless/nl80211.c=22371=EXPORT_SYMBOL(cfg80211_cqm_beacon_loss_notify);
net/wireless/nl80211.c-22372-
net/wireless/nl80211.c:22373:static void nl80211_gtk_rekey_notify(struct cfg80211_registered_device *rdev,
net/wireless/nl80211.c-22374- struct net_device *netdev, const u8 *bssid,
--
net/wireless/nl80211.c-22377- struct sk_buff *msg;
net/wireless/nl80211.c:22378: struct nlattr *rekey_attr;
net/wireless/nl80211.c-22379- void *hdr;
--
net/wireless/nl80211.c-22395-
net/wireless/nl80211.c:22396: rekey_attr = nla_nest_start_noflag(msg, NL80211_ATTR_REKEY_DATA);
net/wireless/nl80211.c:22397: if (!rekey_attr)
net/wireless/nl80211.c-22398- goto nla_put_failure;
--
net/wireless/nl80211.c-22403-
net/wireless/nl80211.c:22404: nla_nest_end(msg, rekey_attr);
net/wireless/nl80211.c-22405-
--
net/wireless/nl80211.c-22415-
net/wireless/nl80211.c:22416:void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
net/wireless/nl80211.c-22417- const u8 *replay_ctr, gfp_t gfp)
--
net/wireless/nl80211.c-22422-
net/wireless/nl80211.c:22423: trace_cfg80211_gtk_rekey_notify(dev, bssid);
net/wireless/nl80211.c:22424: nl80211_gtk_rekey_notify(rdev, dev, bssid, replay_ctr, gfp);
net/wireless/nl80211.c-22425-}
net/wireless/nl80211.c:22426:EXPORT_SYMBOL(cfg80211_gtk_rekey_notify);
net/wireless/nl80211.c-22427-
--
net/wireless/nl80211.c=22954=void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
--
net/wireless/nl80211.c-22998- goto free_msg;
net/wireless/nl80211.c:22999: if (wakeup->gtk_rekey_failure &&
net/wireless/nl80211.c-23000- nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE))
--
net/wireless/rdev-ops.h=901=static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
--
net/wireless/rdev-ops.h-910-
net/wireless/rdev-ops.h:911:static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
net/wireless/rdev-ops.h-912- struct net_device *dev,
net/wireless/rdev-ops.h:913: struct cfg80211_gtk_rekey_data *data)
net/wireless/rdev-ops.h-914-{
net/wireless/rdev-ops.h-915- int ret;
net/wireless/rdev-ops.h:916: trace_rdev_set_rekey_data(&rdev->wiphy, dev);
net/wireless/rdev-ops.h:917: ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
net/wireless/rdev-ops.h-918- trace_rdev_return_int(&rdev->wiphy, ret);
--
net/wireless/trace.h=354=TRACE_EVENT(rdev_suspend,
--
net/wireless/trace.h-361- __field(bool, magic_pkt)
net/wireless/trace.h:362: __field(bool, gtk_rekey_failure)
net/wireless/trace.h-363- __field(bool, eap_identity_req)
--
net/wireless/trace.h-373- __entry->magic_pkt = wow->magic_pkt;
net/wireless/trace.h:374: __entry->gtk_rekey_failure = wow->gtk_rekey_failure;
net/wireless/trace.h-375- __entry->eap_identity_req = wow->eap_identity_req;
--
net/wireless/trace.h-383- TP_printk(WIPHY_PR_FMT ", wow%s - any: %d, disconnect: %d, "
net/wireless/trace.h:384: "magic pkt: %d, gtk rekey failure: %d, eap identify req: %d, "
net/wireless/trace.h-385- "four way handshake: %d, rfkill release: %d.",
--
net/wireless/trace.h-387- __entry->any, __entry->disconnect, __entry->magic_pkt,
net/wireless/trace.h:388: __entry->gtk_rekey_failure, __entry->eap_identity_req,
net/wireless/trace.h-389- __entry->four_way_handshake, __entry->rfkill_release)
--
net/wireless/trace.h=806=DECLARE_EVENT_CLASS(wiphy_netdev_evt,
--
net/wireless/trace.h-819-
net/wireless/trace.h:820:DEFINE_EVENT(wiphy_netdev_evt, rdev_set_rekey_data,
net/wireless/trace.h-821- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
--
net/wireless/trace.h=3732=TRACE_EVENT(cfg80211_cqm_pktloss_notify,
--
net/wireless/trace.h-3748-
net/wireless/trace.h:3749:DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_gtk_rekey_notify,
net/wireless/trace.h-3750- TP_PROTO(struct net_device *netdev, const u8 *macaddr),
--
net/wireless/trace.h=3959=TRACE_EVENT(cfg80211_report_wowlan_wakeup,
--
net/wireless/trace.h-3968- __field(bool, magic_pkt)
net/wireless/trace.h:3969: __field(bool, gtk_rekey_failure)
net/wireless/trace.h-3970- __field(bool, eap_identity_req)
--
net/wireless/trace.h-3983- __entry->magic_pkt = wakeup ? wakeup->magic_pkt : false;
net/wireless/trace.h:3984: __entry->gtk_rekey_failure = wakeup ? wakeup->gtk_rekey_failure : false;
net/wireless/trace.h-3985- __entry->eap_identity_req = wakeup ? wakeup->eap_identity_req : false;
]
|
| 503/6 |
2026/09/07 08:14 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 31538
output: 40
thoughts: 45
Thoughts: **My Thought Process**
Right, so I need to dive into the kernel's wireless networking subsystem, specifically focusing on the `nl80211_policy` structure. My primary interest is around the `NL80211_ATTR_REKEY_DATA` attribute, and I want to examine how this policy is defined and enforced within `net/wireless/nl80211.c`. This is crucial for understanding the security implications and the expected data format when dealing with rekeying information in netlink messages related to 802.11 operations. I'm essentially trying to map out the expected structure and validation rules for rekey data as handled by the netlink interface.
|
| 504/6 |
2026/09/07 08:15 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:845 LineCount:20]
Results: map[Contents: 845: [NL80211_ATTR_MEASUREMENT_DURATION_MANDATORY] = { .type = NLA_FLAG },
846: [NL80211_ATTR_MESH_PEER_AID] =
847: NLA_POLICY_RANGE(NLA_U16, 1, IEEE80211_MAX_AID),
848: [NL80211_ATTR_SCHED_SCAN_INTERVAL] = { .type = NLA_U32 },
849: [NL80211_ATTR_REKEY_DATA] = { .type = NLA_NESTED },
850: [NL80211_ATTR_SCAN_SUPP_RATES] = { .type = NLA_NESTED },
851: [NL80211_ATTR_HIDDEN_SSID] =
852: NLA_POLICY_RANGE(NLA_U32,
853: NL80211_HIDDEN_SSID_NOT_IN_USE,
854: NL80211_HIDDEN_SSID_ZERO_CONTENTS),
855: [NL80211_ATTR_IE_PROBE_RESP] =
856: NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_ie_attr,
857: IEEE80211_MAX_DATA_LEN),
858: [NL80211_ATTR_IE_ASSOC_RESP] =
859: NLA_POLICY_VALIDATE_FN(NLA_BINARY, validate_ie_attr,
860: IEEE80211_MAX_DATA_LEN),
861: [NL80211_ATTR_ROAM_SUPPORT] = { .type = NLA_FLAG },
862: [NL80211_ATTR_STA_WME] = NLA_POLICY_NESTED(nl80211_sta_wme_policy),
863: [NL80211_ATTR_SCHED_SCAN_MATCH] = { .type = NLA_NESTED },
864: [NL80211_ATTR_TX_NO_CCK_RATE] = { .type = NLA_FLAG },
]
|
| 505/6 |
2026/09/07 08:15 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 32211
output: 41
thoughts: 19
Thoughts: **My Thought Process on `nl80211_rekey_policy`**
Okay, before I dive headfirst into this, I need to pause and meticulously examine the `nl80211_rekey_policy` setting. This is where the devil truly resides, and I can't proceed with any confidence until I have a complete and nuanced understanding of its implications. My primary goal here is to ensure absolute clarity on its behavior, its configurable options, and critically, how it interacts with the broader network security fabric. I'm not just looking for a surface-level definition; I need to understand the underlying mechanisms and potential edge cases. This isn't about a quick check; it's about a deep dive to prevent any unforeseen security vulnerabilities or performance degradation down the line. I'm expecting to find granular control over rekeying intervals, acceptable drift, and perhaps even specific rekeying algorithms, and I need to be prepared to validate each of these thoroughly.
|
| 506/6 |
2026/09/07 08:15 |
tool |
read-file |
0m
Args: map[File:net/wireless/nl80211.c FirstLine:1170 LineCount:20]
Results: map[Contents:1170: };
1171:
1172: /* policy for GTK rekey offload attributes */
1173: static const struct nla_policy
1174: nl80211_rekey_policy[NUM_NL80211_REKEY_DATA] = {
1175: [NL80211_REKEY_DATA_KEK] = {
1176: .type = NLA_BINARY,
1177: .len = NL80211_KEK_EXT_LEN
1178: },
1179: [NL80211_REKEY_DATA_KCK] = {
1180: .type = NLA_BINARY,
1181: .len = NL80211_KCK_EXT_LEN_32
1182: },
1183: [NL80211_REKEY_DATA_REPLAY_CTR] = NLA_POLICY_EXACT_LEN(NL80211_REPLAY_CTR_LEN),
1184: [NL80211_REKEY_DATA_AKM] = { .type = NLA_U32 },
1185: };
1186:
1187: static const struct nla_policy
1188: nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = {
1189: [NL80211_SCHED_SCAN_MATCH_ATTR_SSID] = { .type = NLA_BINARY,
]
|
| 507/6 |
2026/09/07 08:15 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 32687
output: 39
thoughts: 2309
Thoughts: **The Mystery of the Zero Return Code: Unraveling `NL80211_CMD_SET_REKEY_OFFLOAD`**
I've been grappling with a perplexing observation: why might `NL80211_CMD_SET_REKEY_OFFLOAD` appear to return 0 when the `NL80211_ATTR_REKEY_DATA` attribute is missing, given that `nl80211_set_rekey_data` explicitly returns `-EINVAL` in such cases? This discrepancy has led me down a rabbit hole of investigation, meticulously examining the netlink subsystem and the nl80211 implementation.
My initial thought was to confirm the core behavior: does `NL80211_CMD_SET_REKEY_OFFLOAD` *actually* return 0 from the kernel's perspective when the attribute is absent? I needed to be absolutely sure. This prompted me to search the entire kernel codebase for handlers of `NL80211_CMD_SET_REKEY_OFFLOAD`. My search revealed only three key locations: its definition in `include/uapi/linux/nl80211.h`, its registration in `nl80211_small_ops` pointing to `nl80211_set_rekey_data`, and its use in `nl80211_gtk_rekey_notify` for event notifications. Crucially, there are no other direct handlers for this command in the kernel that could be circumventing the expected `-EINVAL` return.
I then re-verified the behavior of `nl80211_set_rekey_data`. Yes, the source code clearly shows it returns `-EINVAL` if `NL80211_ATTR_REKEY_DATA` is missing. This confirmed my understanding of the direct handler.
Next, I considered what happens *before* `nl80211_set_rekey_data` is called. I examined `nl80211_pre_doit`. This function checks for `NL80211_FLAG_NEED_NETDEV_UP` and returns `-EINVAL` if `NL80211_ATTR_IFINDEX` or `NL80211_ATTR_WDEV` are missing, or `-ENETDOWN` if the network device is down. None of these scenarios directly explain a zero return when `NL80211_ATTR_REKEY_DATA` is missing.
This brings me back to the core question: why would someone *observe* a return value of 0? I started contemplating the layers of abstraction and the potential for misinterpretation of return values.
The most plausible explanation lies in the **netlink communication mechanism**. When a user-space application sends a netlink message using `send()` or `sendmsg()`, these system calls return the number of *bytes sent*, not the result of the command's execution within the kernel. A successful `sendmsg()` will return a positive byte count, or 0 if no data was sent. The actual command execution result is communicated back through a separate netlink message, typically an `NLMSG_ERROR` message for errors or an ACK for success, *if requested*. If the user-space application doesn't properly read and interpret this netlink response, or if it mistakenly checks the return value of `sendmsg()` itself, it might incorrectly assume success (a non-error return from `sendmsg()`) even if the kernel command ultimately failed with `-EINVAL`. This is particularly true if `NLM_F_ACK` is not used.
I also briefly considered the context of **syzkaller/fuzzing**, where `sys_sendmsg` also returns byte length. However, syzkaller usually parses netlink responses, so a raw return value might be misleading without that context.
Another angle I explored was the **dual nature of `NL80211_CMD_SET_REKEY_OFFLOAD`**. It's not only a command but also used as an asynchronous multicast notification from the kernel to userspace (via the MLME group) indicating that GTK rekeying offload has completed. In this notification context, the attribute set might be different, and the "return value" perception could be entirely unrelated to a command execution failure. The notification might contain only `NL80211_REKEY_DATA_REPLAY_CTR`, omitting sensitive key material.
Furthermore, I wanted to ensure I wasn't missing any **alternative handling paths** related to GTK rekeying or rekey offload. I investigated functions like `nl80211_set_wowlan` (for rekey failure triggers) and specific driver implementations (e.g., `ieee80211_set_rekey_data` in `net/mac80211/cfg.c`). While these exist, they don't fundamentally alter the netlink command processing for `NL80211_CMD_SET_REKEY_OFFLOAD` itself.
Finally, I pondered the significance of `NL80211_FLAG_CLEAR_SKB`, a flag associated with `NL80211_CMD_SET_REKEY_OFFLOAD`. This flag is used to zero out the message payload in the `skb` after the handler executes, preventing sensitive key material from lingering in kernel memory. I reviewed the `genl_family_rcv_msg_doit` flow and confirmed that if `ops->doit` (i.e., `nl80211_set_rekey_data`) returns an error like `-EINVAL`, the `post_doit` hook is still called, and then `genl_family_rcv_msg_doit` returns the error. This error is then passed to `netlink_ack`, which constructs the appropriate `NLMSG_ERROR` message. This reinforces that the kernel *does* propagate the error.
Therefore, my conclusion is that the observed "zero return" is almost certainly a misunderstanding of the netlink communication protocol. The system call making the request might return success (e.g., bytes sent), while the actual kernel command execution failed and reported this failure via a separate netlink message that was either ignored, misinterpreted, or not properly handled by the requesting user-space process. It's not that the kernel command returns 0, but rather that the netlink request/response mechanism can lead to this perception.
|
| 508/6 |
2026/09/07 08:15 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/netlink/af_netlink.c Name:netlink_ack]
Results: map[SourceCode:2469: void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err,
2470: const struct netlink_ext_ack *extack)
2471: {
2472: struct sk_buff *skb;
2473: struct nlmsghdr *rep;
2474: struct nlmsgerr *errmsg;
2475: size_t payload = sizeof(*errmsg);
2476: struct netlink_sock *nlk = nlk_sk(NETLINK_CB(in_skb).sk);
2477: unsigned int flags = 0;
2478: size_t tlvlen;
2479:
2480: /* Error messages get the original request appended, unless the user
2481: * requests to cap the error message, and get extra error data if
2482: * requested.
2483: */
2484: if (err && !test_bit(NETLINK_F_CAP_ACK, &nlk->flags))
2485: payload += nlmsg_len(nlh);
2486: else
2487: flags |= NLM_F_CAPPED;
2488:
2489: tlvlen = netlink_ack_tlv_len(nlk, err, extack);
2490: if (tlvlen)
2491: flags |= NLM_F_ACK_TLVS;
2492:
2493: skb = nlmsg_new(payload + tlvlen, GFP_KERNEL);
2494: if (!skb)
2495: goto err_skb;
2496:
2497: rep = nlmsg_put(skb, NETLINK_CB(in_skb).portid, nlh->nlmsg_seq,
2498: NLMSG_ERROR, sizeof(*errmsg), flags);
2499: if (!rep)
2500: goto err_bad_put;
2501: errmsg = nlmsg_data(rep);
2502: errmsg->error = err;
2503: errmsg->msg = *nlh;
2504:
2505: if (!(flags & NLM_F_CAPPED)) {
2506: if (!nlmsg_append(skb, nlmsg_len(nlh)))
2507: goto err_bad_put;
2508:
2509: memcpy(nlmsg_data(&errmsg->msg), nlmsg_data(nlh),
2510: nlmsg_len(nlh));
2511: }
2512:
2513: if (tlvlen)
2514: netlink_ack_tlv_fill(skb, nlh, err, extack);
2515:
2516: nlmsg_end(skb, rep);
2517:
2518: nlmsg_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).portid);
2519:
2520: return;
2521:
2522: err_bad_put:
2523: nlmsg_free(skb);
2524: err_skb:
2525: WRITE_ONCE(NETLINK_CB(in_skb).sk->sk_err, ENOBUFS);
2526: sk_error_report(NETLINK_CB(in_skb).sk);
2527: }
SourceFile:net/netlink/af_netlink.c]
|
| 509/6 |
2026/09/07 08:15 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 36000
output: 30
thoughts: 1513
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_REKEY_OFFLOAD` and Missing Attributes**
When I look at `netlink_ack`, I notice a behavior that's crucial for understanding how Netlink errors are propagated. Specifically, when an error occurs, like `err = -EINVAL`, this error code is set in `errmsg->error`. Now, if the `NETLINK_F_CAP_ACK` flag isn't set on the socket, the original message payload from the request (`nlmsg_data(nlh)`) gets copied into the `NLMSG_ERROR` response. This copying is done via `memcpy(nlmsg_data(&errmsg->msg), nlmsg_data(nlh), nlmsg_len(nlh));`. The critical detail here is that if `NL80211_FLAG_CLEAR_SKB` was executed in `post_doit` *before* this copy, `nlmsg_data(nlh)` will have been zeroed out. This means the echoed original message payload in the `NLMSG_ERROR` response will be all zeros, which is a security measure to protect sensitive information that might have been in the original message.
Now, let me re-read the user's question very carefully. They're asking: "Why does `NL80211_CMD_SET_REKEY_OFFLOAD` return 0 when `NL80211_ATTR_REKEY_DATA` is missing? In `nl80211_set_rekey_data`, it returns `-EINVAL` if it's missing. Is there another place where it's handled?"
This question has three distinct parts that I need to address comprehensively:
1. The apparent successful return (0) of `NL80211_CMD_SET_REKEY_OFFLOAD` when `NL80211_ATTR_REKEY_DATA` is absent.
2. The fact that `nl80211_set_rekey_data` *does* explicitly return `-EINVAL` when this attribute is missing.
3. Whether `NL80211_CMD_SET_REKEY_OFFLOAD` is handled elsewhere in the kernel.
Let's break these down.
First, regarding whether `NL80211_CMD_SET_REKEY_OFFLOAD` is handled elsewhere: I've checked the generic Netlink routing for the `nl80211` family. My analysis confirms that `NL80211_CMD_SET_REKEY_OFFLOAD` is registered in `nl80211_small_ops` and its handler is explicitly set to `nl80211_set_rekey_data`. I see no other command handlers or fallback mechanisms for this specific command. So, no, there's no other place where this command is fundamentally handled.
Second, let's trace what happens when `NL80211_CMD_SET_REKEY_OFFLOAD` is invoked *without* `NL80211_ATTR_REKEY_DATA`. My step-by-step mental execution of the kernel code flow is:
* The Netlink subsystem receives the message.
* Genetlink parses the attributes using `nl80211_policy`.
* `nl80211_pre_doit()` runs. This function performs initial checks. It verifies Netdev requirements like `NL80211_FLAG_NEED_NETDEV_UP`. If interface attributes (`NL80211_ATTR_IFINDEX` or `NL80211_ATTR_WDEV`) are missing or invalid, it will return an error like `-EINVAL` or `-ENODEV`. If the interface is present but not UP, it returns `-ENETDOWN`.
* Next, `nl80211_set_rekey_data()` executes. This is where the explicit check for `NL80211_ATTR_REKEY_DATA` happens: `if (!info->attrs[NL80211_ATTR_REKEY_DATA]) return -EINVAL;`. So, yes, inside the kernel, this function *will* return `-EINVAL`.
* Following this, `nl80211_post_doit()` is called. Its role is to clean up resources, such as releasing locks. Crucially, if `NL80211_FLAG_CLEAR_SKB` was set for this command, it will zero out the SKB payload here, as I noted earlier.
* Finally, `genl_family_rcv_msg_doit()` propagates the error code (`-EINVAL` in this case) up to `netlink_rcv_skb()`.
Third, and this is the core of the user's confusion, why would it *appear* to return 0 (success) to a caller or a userspace application? I've identified several common scenarios in Netlink communication that can lead to this perception:
1. **Netlink `sendmsg()` / `send()` syscall semantics**: It's vital to remember that the `sendmsg()` or `sendto()` system call on a Netlink socket returns the number of bytes successfully written into the socket buffer, or 0 if nothing was written. This return value signifies that the message was accepted by the kernel's socket layer for transmission. It absolutely does *not* reflect the execution status of the Netlink command handler within the kernel itself. So, if the `sendmsg` call returns 0, it just means the kernel accepted the request to be sent, not that the request was processed successfully.
2. **Missing `NLM_F_ACK` flag and asynchronous Netlink error reporting**: This is a very common point of confusion. In Netlink, if a request is sent *without* the `NLM_F_ACK` flag set, the kernel does not send an explicit ACK on successful command execution. However, when an *error* occurs (like our `-EINVAL`), `netlink_rcv_skb` *automatically* constructs and sends an `NLMSG_ERROR` response packet back into the Netlink socket queue. This error packet contains `nlmsgerr.error = -EINVAL`. The crucial part here is that if the userspace program or test script *doesn't actively read or parse* this response packet using `recvmsg()` or a library function like `nl_recvmsgs()`, it will never "see" the `-EINVAL`. Consequently, the userspace application will only observe the successful outcome of the `sendmsg()` call (returning 0 or the number of bytes sent), leading to the impression of success.
3. **Dual usage of `NL80211_CMD_SET_REKEY_OFFLOAD` as an Event Notification**: I've observed that `NL80211_CMD_SET_REKEY_OFFLOAD` isn't exclusively a command initiated by userspace. It's also used as an asynchronous event or notification sent *from* the kernel *to* userspace. This happens, for instance, in `nl80211_gtk_rekey_notify` over the `NL80211_MCGRP_MLME` multicast group. In this context, it's used to inform userspace (like `wpa_supplicant`) when hardware-offloaded GTK rekeying has completed, and it reports the new replay counter. When used as an event, the `NL80211_ATTR_REKEY_DATA` attribute might only contain `NL80211_REKEY_DATA_REPLAY_CTR` and *not* the KEK/KCK. This usage pattern is distinct from the command execution path.
4. **`pre_doit` checks failing before `nl80211_set_rekey_data`**: It's worth reiterating that even before `nl80211_set_rekey_data` gets a chance to check for `NL80211_ATTR_REKEY_DATA`, the `nl80211_pre_doit` function might fail. For example, if `NL80211_ATTR_IFINDEX` is also missing, or if the specified network device isn't up, `nl80211_pre_doit` will return an error (like `-EINVAL` or `-ENETDOWN`) before the command handler is even reached.
To ensure I haven't missed anything subtle, I'm performing a final check for any other mentions of `NL80211_CMD_SET_REKEY_OFFLOAD` or `set_rekey_data` within test files, header files, or other related kernel code sections. My current understanding holds that the combination of `sendmsg` semantics and the lack of `NLM_F_ACK` combined with not reading error responses is the primary reason for the perceived "return 0".
|
| 510/6 |
2026/09/07 08:15 |
tool |
grepper |
0m
Args: map[Expression:set_rekey_data PathPrefix:net/wireless/]
Results: map[Output:net/wireless/nl80211.c=16206=static int nl80211_set_coalesce(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-16260-
net/wireless/nl80211.c:16261:static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
net/wireless/nl80211.c-16262-{
--
net/wireless/nl80211.c-16303-
net/wireless/nl80211.c:16304: if (!rdev->ops->set_rekey_data)
net/wireless/nl80211.c-16305- return -EOPNOTSUPP;
net/wireless/nl80211.c-16306-
net/wireless/nl80211.c:16307: return rdev_set_rekey_data(rdev, dev, &rekey_data);
net/wireless/nl80211.c-16308-}
--
net/wireless/nl80211.c=19733=static const struct genl_small_ops nl80211_small_ops[] = {
--
net/wireless/nl80211.c-20207- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
net/wireless/nl80211.c:20208: .doit = nl80211_set_rekey_data,
net/wireless/nl80211.c-20209- .flags = GENL_UNS_ADMIN_PERM,
--
net/wireless/rdev-ops.h=901=static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
--
net/wireless/rdev-ops.h-910-
net/wireless/rdev-ops.h:911:static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
net/wireless/rdev-ops.h-912- struct net_device *dev,
--
net/wireless/rdev-ops.h-915- int ret;
net/wireless/rdev-ops.h:916: trace_rdev_set_rekey_data(&rdev->wiphy, dev);
net/wireless/rdev-ops.h:917: ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
net/wireless/rdev-ops.h-918- trace_rdev_return_int(&rdev->wiphy, ret);
--
net/wireless/trace.h=806=DECLARE_EVENT_CLASS(wiphy_netdev_evt,
--
net/wireless/trace.h-819-
net/wireless/trace.h:820:DEFINE_EVENT(wiphy_netdev_evt, rdev_set_rekey_data,
net/wireless/trace.h-821- TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
]
|
| 511/6 |
2026/09/07 08:15 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 38397
output: 1029
thoughts: 452
Thoughts: **My Thought Process Regarding `NL80211_CMD_SET_REKEY_OFFLOAD` Handling**
As I've thoroughly examined the source code, the situation regarding `NL80211_CMD_SET_REKEY_OFFLOAD` is quite straightforward and verified. I want to articulate this clearly, so let's break down my understanding:
Firstly, to directly answer the core question: There is **no other place** in the kernel where the handling for an `NL80211_CMD_SET_REKEY_OFFLOAD` *request* is defined besides its mapping to the `nl80211_set_rekey_data()` function within the `nl80211_small_ops[]` array. This is the singular entry point for processing this command when initiated by userspace.
Secondly, diving into the kernel's implementation, I confirmed that `nl80211_set_rekey_data()` does indeed check for the presence of the `NL80211_ATTR_REKEY_DATA` attribute using `if (!info->attrs[NL80211_ATTR_REKEY_DATA])`. If this attribute is absent, the function correctly returns `-EINVAL`. It's crucial to note that the kernel handler for this specific *request* scenario **does not** return 0.
This leads me to consider why a userspace application might *perceive* a successful return of 0, even when the kernel logic indicates an error. I've identified a few key reasons for this potential discrepancy:
* **Syscall Level Behavior:** From the userspace perspective, when using netlink sockets, the `sendmsg()` or `send()` system calls return the number of bytes successfully transmitted, or a non-negative value indicating success. This return value is *not* a reflection of the netlink command's handler within the kernel. It simply confirms the socket operation itself succeeded.
* **Netlink Error Handling Mechanisms:** Kernel-generated errors, such as the `-EINVAL` returned by `nl80211_set_rekey_data()`, are not delivered synchronously as the return code of the `send` operation. Instead, they are transmitted asynchronously back to the userspace netlink socket as an `NLMSG_ERROR` message packet. If the userspace application fails to read and parse this response (e.g., by not calling `recvmsg()` or `nl_recvmsgs()` to check for error messages), it can lead to the false impression that the initial send operation was entirely successful, as no explicit error was detected.
* **Pre-Doit Checks:** It's also important to consider that even before `nl80211_set_rekey_data()` is invoked, preliminary checks performed by `nl80211_pre_doit()` might fail. If essential device attributes like `NL80211_ATTR_IFINDEX` are missing, or if the specified interface is down, `nl80211_pre_doit()` will return an appropriate error, such as `-EINVAL` or `-ENETDOWN`, effectively preventing the `set_rekey_data` function from ever being reached.
Finally, I've made a note about a distinct but related use of `NL80211_CMD_SET_REKEY_OFFLOAD`. It's also employed as a multicast notification mechanism. Specifically, the kernel uses this command to send an MLME event notification (`nl80211_gtk_rekey_notify`) to userspace when an offloaded GTK rekeying operation has successfully completed. This is a *kernel-to-userspace* event, not a userspace request, and is therefore a separate operational context.
This comprehensive understanding confirms that my initial assessment is sound, and all relevant code paths have been accounted for. I'm now ready to proceed with generating the final results.
|
| 512/6 |
2026/09/07 08:16 |
tool |
set-results |
0m
Args: map[Answer:### Summary
There is **no other handler** for `NL80211_CMD_SET_REKEY_OFFLOAD` in the Linux kernel. In `net/wireless/nl80211.c`, `NL80211_CMD_SET_REKEY_OFFLOAD` is registered exclusively to `nl80211_set_rekey_data()` via `nl80211_small_ops`:
```c
{
.cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = nl80211_set_rekey_data,
.flags = GENL_UNS_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_CLEAR_SKB),
},
```
Inside `nl80211_set_rekey_data()`, the handler explicitly checks for the presence of `NL80211_ATTR_REKEY_DATA` and returns `-EINVAL` if it is missing:
```c
if (!info->attrs[NL80211_ATTR_REKEY_DATA])
return -EINVAL;
```
---
### Why a Caller or Userspace May Observe `0` (Success)
If userspace or a test program appears to receive a `0` return code when omitting `NL80211_ATTR_REKEY_DATA`, this is due to how Generic Netlink socket communication and error reporting work rather than the kernel returning `0` from the command handler:
1. **`send()` / `sendmsg()` Netlink Syscall Semantics**:
- The `send()` or `sendmsg()` system call on a Netlink socket returns the number of bytes queued into the kernel socket buffer. It does **not** return the return code of the Netlink command handler executed inside the kernel.
- If userspace checks only the return status of `sendmsg()`, it will indicate success (bytes sent > 0).
2. **Asynchronous Error Delivery via `NLMSG_ERROR`**:
- When `nl80211_set_rekey_data()` returns `-EINVAL`, `netlink_rcv_skb()` in `net/netlink/af_netlink.c` catches the error and sends an `NLMSG_ERROR` Netlink packet containing `nlmsgerr.error = -EINVAL` back to the sender socket:
```c
if (nlh->nlmsg_flags & NLM_F_ACK || err)
netlink_ack(skb, nlh, err, &extack);
```
- If the application/library does not call `recvmsg()` / `nl_recvmsgs()` to read the response message, it will not observe the `-EINVAL` error returned by the kernel.
3. **Pre-Doit Execution**:
- `NL80211_CMD_SET_REKEY_OFFLOAD` specifies `NL80211_FLAG_NEED_NETDEV_UP`. Before `nl80211_set_rekey_data()` is reached, `nl80211_pre_doit()` checks for interface attributes (`NL80211_ATTR_IFINDEX` or `NL80211_ATTR_WDEV`) and ensures the interface is up. If those are absent or the device is down, `nl80211_pre_doit()` returns `-EINVAL` or `-ENETDOWN` before `nl80211_set_rekey_data()` runs.
---
### Dual Role of `NL80211_CMD_SET_REKEY_OFFLOAD` as an Event
`NL80211_CMD_SET_REKEY_OFFLOAD` is also used as an asynchronous notification event sent **from** the kernel to userspace (via `nl80211_gtk_rekey_notify()` over `NL80211_MCGRP_MLME`) when driver/hardware GTK rekeying finishes. In that notification message, only `NL80211_REKEY_DATA_REPLAY_CTR` is populated inside `NL80211_ATTR_REKEY_DATA` to inform userspace of the updated replay counter.]
Results: map[Answer:### Summary
There is **no other handler** for `NL80211_CMD_SET_REKEY_OFFLOAD` in the Linux kernel. In `net/wireless/nl80211.c`, `NL80211_CMD_SET_REKEY_OFFLOAD` is registered exclusively to `nl80211_set_rekey_data()` via `nl80211_small_ops`:
```c
{
.cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
.validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
.doit = nl80211_set_rekey_data,
.flags = GENL_UNS_ADMIN_PERM,
.internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_CLEAR_SKB),
},
```
Inside `nl80211_set_rekey_data()`, the handler explicitly checks for the presence of `NL80211_ATTR_REKEY_DATA` and returns `-EINVAL` if it is missing:
```c
if (!info->attrs[NL80211_ATTR_REKEY_DATA])
return -EINVAL;
```
---
### Why a Caller or Userspace May Observe `0` (Success)
If userspace or a test program appears to receive a `0` return code when omitting `NL80211_ATTR_REKEY_DATA`, this is due to how Generic Netlink socket communication and error reporting work rather than the kernel returning `0` from the command handler:
1. **`send()` / `sendmsg()` Netlink Syscall Semantics**:
- The `send()` or `sendmsg()` system call on a Netlink socket returns the number of bytes queued into the kernel socket buffer. It does **not** return the return code of the Netlink command handler executed inside the kernel.
- If userspace checks only the return status of `sendmsg()`, it will indicate success (bytes sent > 0).
2. **Asynchronous Error Delivery via `NLMSG_ERROR`**:
- When `nl80211_set_rekey_data()` returns `-EINVAL`, `netlink_rcv_skb()` in `net/netlink/af_netlink.c` catches the error and sends an `NLMSG_ERROR` Netlink packet containing `nlmsgerr.error = -EINVAL` back to the sender socket:
```c
if (nlh->nlmsg_flags & NLM_F_ACK || err)
netlink_ack(skb, nlh, err, &extack);
```
- If the application/library does not call `recvmsg()` / `nl_recvmsgs()` to read the response message, it will not observe the `-EINVAL` error returned by the kernel.
3. **Pre-Doit Execution**:
- `NL80211_CMD_SET_REKEY_OFFLOAD` specifies `NL80211_FLAG_NEED_NETDEV_UP`. Before `nl80211_set_rekey_data()` is reached, `nl80211_pre_doit()` checks for interface attributes (`NL80211_ATTR_IFINDEX` or `NL80211_ATTR_WDEV`) and ensures the interface is up. If those are absent or the device is down, `nl80211_pre_doit()` returns `-EINVAL` or `-ENETDOWN` before `nl80211_set_rekey_data()` runs.
---
### Dual Role of `NL80211_CMD_SET_REKEY_OFFLOAD` as an Event
`NL80211_CMD_SET_REKEY_OFFLOAD` is also used as an asynchronous notification event sent **from** the kernel to userspace (via `nl80211_gtk_rekey_notify()` over `NL80211_MCGRP_MLME`) when driver/hardware GTK rekeying finishes. In that notification message, only `NL80211_REKEY_DATA_REPLAY_CTR` is populated inside `NL80211_ATTR_REKEY_DATA` to inform userspace of the updated replay counter.]
|
| 513/4 |
2026/09/07 08:16 |
llm |
repro-oracle |
5m
Model:
Tokens:
input: 143949
output: 287
thoughts: 62911
|
| 514/4 |
2026/09/07 08:22 |
tool |
codeexpert |
8m
Args: map[Question:Why did the reproducer fail to trigger the bug? The bug is `WARNING in mac80211_hwsim_write_tsf` with `c->control.rates[0].idx < 0`. The reproducer sends a packet via AF_PACKET to `wlan0` in monitor mode. The radiotap header has `IEEE80211_RADIOTAP_RATE` present, and rate=0. `ieee80211_parse_tx_radiotap` sets `idx = -1`, and clears `IEEE80211_TX_CTRL_RATE_INJECT`. Then `mac80211_hwsim_tx_frame_no_nl` calls `mac80211_hwsim_write_tsf` which calls `mac80211_hwsim_get_tx_rate` which calls `ieee80211_get_tx_rate` which triggers the warning. But the reproducer exits with 0 and no crash. Why? Is it because `cfg80211_reg_can_beacon` returns false in `ieee80211_monitor_start_xmit`? Or is there another check?]
Results: map[Answer:The reproducer exits with 0 and fails to trigger the `WARNING in mac80211_hwsim_write_tsf` for the following reasons:
### 1. Why `rates[0].idx < 0` does not reach `mac80211_hwsim_write_tsf`
The assumption that clearing `IEEE80211_TX_CTRL_RATE_INJECT` leaves `idx = -1` intact all the way to `mac80211_hwsim_write_tsf` is incorrect:
1. **Radiotap Parsing (`ieee80211_parse_tx_radiotap`)**:
When the radiotap header contains `IEEE80211_RADIOTAP_RATE` with `rate = 0`, none of the supported bitrates in `sband->bitrates` match `rate * 5 = 0`. Consequently, `rates[0].idx` remains `-1`, and the kernel executes:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
2. **Mac80211 Rate Control Fallback (`ieee80211_tx_h_rate_ctrl`)**:
When the packet proceeds through `ieee80211_xmit` -> `ieee80211_tx` -> `invoke_tx_handlers_late` -> `ieee80211_tx_h_rate_ctrl`:
- mac80211 only bypasses rate control if the rate injection flag is set:
```c
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
- Because `IEEE80211_TX_CTRL_RATE_INJECT` was cleared by `ieee80211_parse_tx_radiotap`, mac80211 treats the frame as not having an injected rate and invokes standard rate selection via:
`rate_control_get_rate()` -> `rate_control_send_low()` -> `__rate_control_send_low()`.
- `__rate_control_send_low()` selects a valid lowest supported bitrate and **overwrites** `info->control.rates[0].idx` with a non-negative rate index (`rates[0].idx >= 0`, typically 0).
3. **Driver Transmission (`mac80211_hwsim_write_tsf`)**:
By the time `mac80211_hwsim_tx()` -> `mac80211_hwsim_tx_frame_no_nl()` -> `mac80211_hwsim_write_tsf()` is executed, `rates[0].idx` is no longer negative. Therefore, inside `ieee80211_get_tx_rate()`:
```c
if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
return NULL;
```
the warning check evaluates to false and the warning is never triggered.
---
### 2. Is `cfg80211_reg_can_beacon` or another check dropping the frame in `ieee80211_monitor_start_xmit`?
- **`cfg80211_reg_can_beacon`**: For monitor mode interfaces (`NL80211_IFTYPE_MONITOR`) on standard 2.4GHz channels (channels 1–11), `cfg80211_chandef_dfs_required()` returns 0 and standard channels have no radar or `NO_IR` restrictions in default world regulatory domains, so `cfg80211_reg_can_beacon()` returns `true`.
- **Channel context check (`chanctx_conf`)**: If the monitor interface was brought up without configuring a channel (or if there are multiple channel contexts in `local->chanctx_list`), `chanctx_conf` will be `NULL` in `ieee80211_monitor_start_xmit`, causing the frame to be dropped at `goto fail_rcu;` before `ieee80211_parse_tx_radiotap()` or `ieee80211_xmit()` is reached.
---
### 3. Why the reproducer process exits with 0
`ieee80211_monitor_start_xmit` returns `NETDEV_TX_OK` (0) in all cases (both on successful transmission and on internal error drops via `fail_rcu` / `fail`). For `AF_PACKET`, `sendto()` succeeds as long as the packet is accepted by the network device driver's `ndo_start_xmit` handler, so the user-space reproducer receives a successful return code and exits with 0.]
|
| 515/5 |
2026/09/07 08:22 |
agent |
codeexpert |
8m
Model:
Results: map[Answer:The reproducer exits with 0 and fails to trigger the `WARNING in mac80211_hwsim_write_tsf` for the following reasons:
### 1. Why `rates[0].idx < 0` does not reach `mac80211_hwsim_write_tsf`
The assumption that clearing `IEEE80211_TX_CTRL_RATE_INJECT` leaves `idx = -1` intact all the way to `mac80211_hwsim_write_tsf` is incorrect:
1. **Radiotap Parsing (`ieee80211_parse_tx_radiotap`)**:
When the radiotap header contains `IEEE80211_RADIOTAP_RATE` with `rate = 0`, none of the supported bitrates in `sband->bitrates` match `rate * 5 = 0`. Consequently, `rates[0].idx` remains `-1`, and the kernel executes:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
2. **Mac80211 Rate Control Fallback (`ieee80211_tx_h_rate_ctrl`)**:
When the packet proceeds through `ieee80211_xmit` -> `ieee80211_tx` -> `invoke_tx_handlers_late` -> `ieee80211_tx_h_rate_ctrl`:
- mac80211 only bypasses rate control if the rate injection flag is set:
```c
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
- Because `IEEE80211_TX_CTRL_RATE_INJECT` was cleared by `ieee80211_parse_tx_radiotap`, mac80211 treats the frame as not having an injected rate and invokes standard rate selection via:
`rate_control_get_rate()` -> `rate_control_send_low()` -> `__rate_control_send_low()`.
- `__rate_control_send_low()` selects a valid lowest supported bitrate and **overwrites** `info->control.rates[0].idx` with a non-negative rate index (`rates[0].idx >= 0`, typically 0).
3. **Driver Transmission (`mac80211_hwsim_write_tsf`)**:
By the time `mac80211_hwsim_tx()` -> `mac80211_hwsim_tx_frame_no_nl()` -> `mac80211_hwsim_write_tsf()` is executed, `rates[0].idx` is no longer negative. Therefore, inside `ieee80211_get_tx_rate()`:
```c
if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
return NULL;
```
the warning check evaluates to false and the warning is never triggered.
---
### 2. Is `cfg80211_reg_can_beacon` or another check dropping the frame in `ieee80211_monitor_start_xmit`?
- **`cfg80211_reg_can_beacon`**: For monitor mode interfaces (`NL80211_IFTYPE_MONITOR`) on standard 2.4GHz channels (channels 1–11), `cfg80211_chandef_dfs_required()` returns 0 and standard channels have no radar or `NO_IR` restrictions in default world regulatory domains, so `cfg80211_reg_can_beacon()` returns `true`.
- **Channel context check (`chanctx_conf`)**: If the monitor interface was brought up without configuring a channel (or if there are multiple channel contexts in `local->chanctx_list`), `chanctx_conf` will be `NULL` in `ieee80211_monitor_start_xmit`, causing the frame to be dropped at `goto fail_rcu;` before `ieee80211_parse_tx_radiotap()` or `ieee80211_xmit()` is reached.
---
### 3. Why the reproducer process exits with 0
`ieee80211_monitor_start_xmit` returns `NETDEV_TX_OK` (0) in all cases (both on successful transmission and on internal error drops via `fail_rcu` / `fail`). For `AF_PACKET`, `sendto()` succeeds as long as the packet is accepted by the network device driver's `ndo_start_xmit` handler, so the user-space reproducer receives a successful return code and exits with 0.]
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Use tools extensively while researching the question. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Why did the reproducer fail to trigger the bug? The bug is `WARNING in mac80211_hwsim_write_tsf` with `c->control.rates[0].idx < 0`. The reproducer sends a packet via AF_PACKET to `wlan0` in monitor mode. The radiotap header has `IEEE80211_RADIOTAP_RATE` present, and rate=0. `ieee80211_parse_tx_radiotap` sets `idx = -1`, and clears `IEEE80211_TX_CTRL_RATE_INJECT`. Then `mac80211_hwsim_tx_frame_no_nl` calls `mac80211_hwsim_write_tsf` which calls `mac80211_hwsim_get_tx_rate` which calls `ieee80211_get_tx_rate` which triggers the warning. But the reproducer exits with 0 and no crash. Why? Is it because `cfg80211_reg_can_beacon` returns false in `ieee80211_monitor_start_xmit`? Or is there another check?
|
| 516/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 2582
output: 161
thoughts: 450
Thoughts: **My Investigative Journey into the `mac80211_hwsim` Bug**
My primary objective here is to understand precisely why my carefully crafted reproducer, designed to trigger a `WARNING in mac80211_hwsim_write_tsf` due to `c->control.rates[0].idx < 0`, ultimately fails to elicit the bug and exits gracefully with a status of 0. I've simulated sending a packet via `AF_PACKET` to a monitor-mode `wlan0` interface. The key element of my reproducer is the radiotap header, specifically the presence of `IEEE80211_RADIOTAP_RATE` with a value of 0.
I know that `ieee80211_parse_tx_radiotap` processes this, correctly resulting in `idx = -1` and clearing the `IEEE80211_TX_CTRL_RATE_INJECT` flag. Subsequently, `mac80211_hwsim_tx_frame_no_nl` is called, which in turn invokes `mac80211_hwsim_write_tsf`. This function, through `mac80211_hwsim_get_tx_rate` and then `ieee80211_get_tx_rate`, is where I expect the warning to be generated. However, the bug remains elusive.
This leads me to hypothesize about potential blockers. My initial suspicion is that the failure might be due to `cfg80211_reg_can_beacon` returning `false` within `ieee80211_monitor_start_xmit`. I need to confirm if this function is indeed being called and if its return value is preventing the problematic code path from being fully executed. Alternatively, there might be another, as yet undiscovered, check within the `mac80211_hwsim` module or the broader `mac80211` framework that's intercepting the execution before the warning can manifest.
To get to the bottom of this, my next step is to systematically investigate the codebase. I'll be leveraging powerful code search and grepping tools to meticulously trace the execution flow. Specifically, I intend to search for the following key functions and symbols: `mac80211_hwsim_write_tsf`, `ieee80211_monitor_start_xmit`, `mac80211_hwsim_tx_frame_no_nl`, `ieee80211_parse_tx_radiotap`, `ieee80211_get_tx_rate`, `mac80211_hwsim_get_tx_rate`, and `cfg80211_reg_can_beacon`. By running several targeted queries, I aim to pinpoint the exact point of divergence between my expected behavior and the actual observed outcome.
|
| 517/6 |
2026/09/07 08:22 |
tool |
codesearch-definition-source |
0m
Args: map[Name:mac80211_hwsim_write_tsf]
Results: map[SourceCode:1605: static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
1606: struct sk_buff *skb, u64 sim_time)
1607: {
1608: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1609: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1610: struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
1611: struct ieee80211_rate *txrate;
1612: /* TODO: get MCS */
1613: int bitrate = 100;
1614:
1615: spin_lock_bh(&data->tsf_offset_lock);
1616:
1617: txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
1618: if (txrate)
1619: bitrate = txrate->bitrate;
1620:
1621: if (skb->len >= offsetofend(typeof(*mgmt), u.probe_resp.timestamp) &&
1622: ieee80211_is_probe_resp(hdr->frame_control)) {
1623: mgmt->u.probe_resp.timestamp =
1624: cpu_to_le64(sim_time + data->tsf_offset +
1625: 24 * 8 * 10 / bitrate);
1626: } else if (skb->len >= offsetofend(typeof(*mgmt), u.beacon.timestamp) &&
1627: ieee80211_is_beacon(mgmt->frame_control)) {
1628: mgmt->u.beacon.timestamp = cpu_to_le64(sim_time +
1629: data->tsf_offset +
1630: 24 * 8 * 10 /
1631: bitrate);
1632: } else if (skb->len >= offsetofend(struct ieee80211_ext,
1633: u.s1g_beacon.timestamp) &&
1634: ieee80211_is_s1g_beacon(mgmt->frame_control)) {
1635: struct ieee80211_ext *ext = (void *)mgmt;
1636:
1637: ext->u.s1g_beacon.timestamp = cpu_to_le32(sim_time +
1638: data->tsf_offset +
1639: 10 * 8 * 10 /
1640: bitrate);
1641: }
1642:
1643: spin_unlock_bh(&data->tsf_offset_lock);
1644: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 518/6 |
2026/09/07 08:22 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_monitor_start_xmit]
Results: map[SourceCode:2324: netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2325: struct net_device *dev)
2326: {
2327: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2328: struct ieee80211_chanctx_conf *chanctx_conf;
2329: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2330: struct ieee80211_hdr *hdr;
2331: struct ieee80211_sub_if_data *tmp_sdata, *sdata;
2332: struct cfg80211_chan_def *chandef;
2333: u16 len_rthdr;
2334: int hdrlen;
2335:
2336: sdata = IEEE80211_DEV_TO_SUB_IF(dev);
2337: if (unlikely(!ieee80211_sdata_running(sdata)))
2338: goto fail;
2339:
2340: memset(info, 0, sizeof(*info));
2341: info->flags = IEEE80211_TX_CTL_REQ_TX_STATUS |
2342: IEEE80211_TX_CTL_INJECTED;
2343:
2344: /* Sanity-check the length of the radiotap header */
2345: if (!ieee80211_validate_radiotap_len(skb))
2346: goto fail;
2347:
2348: /* we now know there is a radiotap header with a length we can use */
2349: len_rthdr = ieee80211_get_radiotap_len(skb->data);
2350:
2351: /*
2352: * fix up the pointers accounting for the radiotap
2353: * header still being in there. We are being given
2354: * a precooked IEEE80211 header so no need for
2355: * normal processing
2356: */
2357: skb_set_mac_header(skb, len_rthdr);
2358: /*
2359: * these are just fixed to the end of the rt area since we
2360: * don't have any better information and at this point, nobody cares
2361: */
2362: skb_set_network_header(skb, len_rthdr);
2363: skb_set_transport_header(skb, len_rthdr);
2364:
2365: if (skb->len < len_rthdr + 2)
2366: goto fail;
2367:
2368: hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);
2369: hdrlen = ieee80211_hdrlen(hdr->frame_control);
2370:
2371: if (skb->len < len_rthdr + hdrlen)
2372: goto fail;
2373:
2374: /*
2375: * Initialize skb->protocol if the injected frame is a data frame
2376: * carrying a rfc1042 header
2377: */
2378: if (ieee80211_is_data(hdr->frame_control) &&
2379: skb->len >= len_rthdr + hdrlen + sizeof(rfc1042_header) + 2) {
2380: u8 *payload = (u8 *)hdr + hdrlen;
2381:
2382: if (ether_addr_equal(payload, rfc1042_header))
2383: skb->protocol = cpu_to_be16((payload[6] << 8) |
2384: payload[7]);
2385: }
2386:
2387: rcu_read_lock();
2388:
2389: /*
2390: * We process outgoing injected frames that have a local address
2391: * we handle as though they are non-injected frames.
2392: * This code here isn't entirely correct, the local MAC address
2393: * isn't always enough to find the interface to use; for proper
2394: * VLAN support we have an nl80211-based mechanism.
2395: *
2396: * This is necessary, for example, for old hostapd versions that
2397: * don't use nl80211-based management TX/RX.
2398: */
2399: list_for_each_entry_rcu(tmp_sdata, &local->interfaces, list) {
2400: if (!ieee80211_sdata_running(tmp_sdata))
2401: continue;
2402: if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR ||
2403: tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
2404: continue;
2405: if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) {
2406: sdata = tmp_sdata;
2407: break;
2408: }
2409: }
2410:
2411: chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
2412: if (!chanctx_conf) {
2413: tmp_sdata = rcu_dereference(local->monitor_sdata);
2414: if (tmp_sdata)
2415: chanctx_conf =
2416: rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf);
2417: }
2418:
2419: if (!chanctx_conf) {
2420: struct ieee80211_chanctx *ctx;
2421: bool first = true;
2422:
2423: list_for_each_entry_rcu(ctx, &local->chanctx_list, list) {
2424: if (!first)
2425: goto fail_rcu;
2426: chanctx_conf = &ctx->conf;
2427: first = false;
2428: }
2429: }
2430:
2431: if (chanctx_conf)
2432: chandef = &chanctx_conf->def;
2433: else
2434: goto fail_rcu;
2435:
2436: /*
2437: * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still
2438: * shouldn't transmit on disabled channels.
2439: */
2440: if (!cfg80211_chandef_usable(local->hw.wiphy, chandef,
2441: IEEE80211_CHAN_DISABLED))
2442: goto fail_rcu;
2443:
2444: /*
2445: * Frame injection is not allowed if beaconing is not allowed
2446: * or if we need radar detection. Beaconing is usually not allowed when
2447: * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
2448: * Passive scan is also used in world regulatory domains where
2449: * your country is not known and as such it should be treated as
2450: * NO TX unless the channel is explicitly allowed in which case
2451: * your current regulatory domain would not have the passive scan
2452: * flag.
2453: *
2454: * Since AP mode uses monitor interfaces to inject/TX management
2455: * frames we can make AP mode the exception to this rule once it
2456: * supports radar detection as its implementation can deal with
2457: * radar detection by itself. We can do that later by adding a
2458: * monitor flag interfaces used for AP support.
2459: */
2460: if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
2461: sdata->vif.type))
2462: goto fail_rcu;
2463:
2464: info->band = chandef->chan->band;
2465:
2466: /* Initialize skb->priority according to frame type and TID class,
2467: * with respect to the sub interface that the frame will actually
2468: * be transmitted on. If the DONT_REORDER flag is set, the original
2469: * skb-priority is preserved to assure frames injected with this
2470: * flag are not reordered relative to each other.
2471: */
2472: ieee80211_select_queue_80211(sdata, skb, hdr);
2473: skb_set_queue_mapping(skb, ieee80211_ac_from_tid(skb->priority));
2474:
2475: /*
2476: * Process the radiotap header. This will now take into account the
2477: * selected chandef above to accurately set injection rates and
2478: * retransmissions.
2479: */
2480: if (!ieee80211_parse_tx_radiotap(skb, dev))
2481: goto fail_rcu;
2482:
2483: /* remove the injection radiotap header */
2484: skb_pull(skb, len_rthdr);
2485:
2486: ieee80211_xmit(sdata, NULL, skb);
2487: rcu_read_unlock();
2488:
2489: return NETDEV_TX_OK;
2490:
2491: fail_rcu:
2492: rcu_read_unlock();
2493: fail:
2494: dev_kfree_skb(skb);
2495: return NETDEV_TX_OK; /* meaning, we dealt with the skb */
2496: }
SourceFile:net/mac80211/tx.c]
|
| 519/6 |
2026/09/07 08:22 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_parse_tx_radiotap]
Results: map[SourceCode:2106: bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
2107: struct net_device *dev)
2108: {
2109: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2110: struct ieee80211_radiotap_iterator iterator;
2111: struct ieee80211_radiotap_header *rthdr =
2112: (struct ieee80211_radiotap_header *) skb->data;
2113: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2114: int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
2115: NULL);
2116: u16 txflags;
2117: u16 rate = 0;
2118: bool rate_found = false;
2119: u8 rate_retries = 0;
2120: u16 rate_flags = 0;
2121: u8 mcs_known, mcs_flags, mcs_bw;
2122: u16 vht_known;
2123: u8 vht_mcs = 0, vht_nss = 0;
2124: int i;
2125:
2126: if (!ieee80211_validate_radiotap_len(skb))
2127: return false;
2128:
2129: info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
2130: IEEE80211_TX_CTL_DONTFRAG;
2131:
2132: /*
2133: * for every radiotap entry that is present
2134: * (ieee80211_radiotap_iterator_next returns -ENOENT when no more
2135: * entries present, or -EINVAL on error)
2136: */
2137:
2138: while (!ret) {
2139: ret = ieee80211_radiotap_iterator_next(&iterator);
2140:
2141: if (ret)
2142: continue;
2143:
2144: /* see if this argument is something we can use */
2145: switch (iterator.this_arg_index) {
2146: /*
2147: * You must take care when dereferencing iterator.this_arg
2148: * for multibyte types... the pointer is not aligned. Use
2149: * get_unaligned((type *)iterator.this_arg) to dereference
2150: * iterator.this_arg for type "type" safely on all arches.
2151: */
2152: case IEEE80211_RADIOTAP_FLAGS:
2153: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
2154: /*
2155: * this indicates that the skb we have been
2156: * handed has the 32-bit FCS CRC at the end...
2157: * we should react to that by snipping it off
2158: * because it will be recomputed and added
2159: * on transmission
2160: */
2161: if (skb->len < (iterator._max_length + FCS_LEN))
2162: return false;
2163:
2164: skb_trim(skb, skb->len - FCS_LEN);
2165: }
2166: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
2167: info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
2168: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
2169: info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
2170: break;
2171:
2172: case IEEE80211_RADIOTAP_TX_FLAGS:
2173: txflags = get_unaligned_le16(iterator.this_arg);
2174: if (txflags & IEEE80211_RADIOTAP_F_TX_NOACK)
2175: info->flags |= IEEE80211_TX_CTL_NO_ACK;
2176: if (txflags & IEEE80211_RADIOTAP_F_TX_NOSEQNO)
2177: info->control.flags |= IEEE80211_TX_CTRL_NO_SEQNO;
2178: if (txflags & IEEE80211_RADIOTAP_F_TX_ORDER)
2179: info->control.flags |=
2180: IEEE80211_TX_CTRL_DONT_REORDER;
2181: break;
2182:
2183: case IEEE80211_RADIOTAP_RATE:
2184: rate = *iterator.this_arg;
2185: rate_flags = 0;
2186: rate_found = true;
2187: break;
2188:
2189: case IEEE80211_RADIOTAP_ANTENNA:
2190: /* this can appear multiple times, keep a bitmap */
2191: /* control.antennas is only a 2-bit bitmap */
2192: if (*iterator.this_arg < 2)
2193: info->control.antennas |= BIT(*iterator.this_arg);
2194: break;
2195:
2196: case IEEE80211_RADIOTAP_DATA_RETRIES:
2197: rate_retries = *iterator.this_arg;
2198: break;
2199:
2200: case IEEE80211_RADIOTAP_MCS:
2201: mcs_known = iterator.this_arg[0];
2202: mcs_flags = iterator.this_arg[1];
2203: if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
2204: break;
2205:
2206: rate_found = true;
2207: rate = iterator.this_arg[2];
2208: rate_flags = IEEE80211_TX_RC_MCS;
2209:
2210: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
2211: mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
2212: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2213:
2214: mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
2215: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
2216: mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
2217: rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
2218:
2219: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC &&
2220: mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC)
2221: info->flags |= IEEE80211_TX_CTL_LDPC;
2222:
2223: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
2224: u8 stbc = u8_get_bits(mcs_flags,
2225: IEEE80211_RADIOTAP_MCS_STBC_MASK);
2226:
2227: info->flags |=
2228: u32_encode_bits(stbc,
2229: IEEE80211_TX_CTL_STBC);
2230: }
2231: break;
2232:
2233: case IEEE80211_RADIOTAP_VHT:
2234: vht_known = get_unaligned_le16(iterator.this_arg);
2235: rate_found = true;
2236:
2237: rate_flags = IEEE80211_TX_RC_VHT_MCS;
2238: if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
2239: (iterator.this_arg[2] &
2240: IEEE80211_RADIOTAP_VHT_FLAG_SGI))
2241: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2242: if (vht_known &
2243: IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
2244: if (iterator.this_arg[3] == 1)
2245: rate_flags |=
2246: IEEE80211_TX_RC_40_MHZ_WIDTH;
2247: else if (iterator.this_arg[3] == 4)
2248: rate_flags |=
2249: IEEE80211_TX_RC_80_MHZ_WIDTH;
2250: else if (iterator.this_arg[3] == 11)
2251: rate_flags |=
2252: IEEE80211_TX_RC_160_MHZ_WIDTH;
2253: }
2254:
2255: vht_mcs = iterator.this_arg[4] >> 4;
2256: if (vht_mcs > 11)
2257: vht_mcs = 0;
2258: vht_nss = iterator.this_arg[4] & 0xF;
2259: if (!vht_nss || vht_nss > 8)
2260: vht_nss = 1;
2261: break;
2262:
2263: /*
2264: * Please update the file
2265: * Documentation/networking/mac80211-injection.rst
2266: * when parsing new fields here.
2267: */
2268:
2269: default:
2270: break;
2271: }
2272: }
2273:
2274: if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
2275: return false;
2276:
2277: if (rate_found) {
2278: struct ieee80211_supported_band *sband =
2279: local->hw.wiphy->bands[info->band];
2280:
2281: info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
2282:
2283: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
2284: info->control.rates[i].idx = -1;
2285: info->control.rates[i].flags = 0;
2286: info->control.rates[i].count = 0;
2287: }
2288:
2289: if (rate_flags & IEEE80211_TX_RC_MCS) {
2290: /* reset antennas if not enough */
2291: if (IEEE80211_HT_MCS_CHAINS(rate) >
2292: hweight8(info->control.antennas))
2293: info->control.antennas = 0;
2294:
2295: info->control.rates[0].idx = rate;
2296: } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
2297: /* reset antennas if not enough */
2298: if (vht_nss > hweight8(info->control.antennas))
2299: info->control.antennas = 0;
2300:
2301: ieee80211_rate_set_vht(info->control.rates, vht_mcs,
2302: vht_nss);
2303: } else if (sband) {
2304: for (i = 0; i < sband->n_bitrates; i++) {
2305: if (rate * 5 != sband->bitrates[i].bitrate)
2306: continue;
2307:
2308: info->control.rates[0].idx = i;
2309: break;
2310: }
2311: }
2312:
2313: if (info->control.rates[0].idx < 0)
2314: info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
2315:
2316: info->control.rates[0].flags = rate_flags;
2317: info->control.rates[0].count = min_t(u8, rate_retries + 1,
2318: local->hw.max_rate_tries);
2319: }
2320:
2321: return true;
2322: }
SourceFile:net/mac80211/tx.c]
|
| 520/6 |
2026/09/07 08:22 |
tool |
codesearch-definition-source |
0m
Args: map[Name:mac80211_hwsim_get_tx_rate]
Results: map[SourceCode:1327: static struct ieee80211_rate *
1328: mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
1329: struct ieee80211_tx_info *info)
1330: {
1331: if (info->control.rates[0].flags &
1332: (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
1333: return NULL;
1334:
1335: return ieee80211_get_tx_rate(hw, info);
1336: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 521/6 |
2026/09/07 08:22 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_get_tx_rate]
Results: map[SourceCode:3409: static inline struct ieee80211_rate *
3410: ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
3411: const struct ieee80211_tx_info *c)
3412: {
3413: if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
3414: return NULL;
3415:
3416: if (c->band >= NUM_NL80211_BANDS)
3417: return NULL;
3418:
3419: return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
3420: }
SourceFile:include/net/mac80211.h]
|
| 522/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 11297
output: 35
thoughts: 71
Thoughts: **My Thought Process on Packet Transmission in mac80211_hwsim**
My primary objective is to meticulously understand the journey of a packet from its inception to its transmission, specifically within the `mac80211_hwsim` driver. I want to pinpoint every stage where a packet might encounter issues – be it dropped, rejected, or simply not making it out the door. To achieve this, I'm going to dive deep into the transmission path of `mac80211` and then specifically examine the `mac80211_hwsim` implementation.
My current focus is on tracing the flow of packets and identifying potential points of failure. This involves understanding the sequence of events that leads to a packet being sent, and more importantly, where that process can go awry. I'm keenly interested in the mechanisms that govern transmission, particularly within the context of the simulated hardware driver.
To get a granular understanding, I intend to investigate the function `mac80211_hwsim_tx_frame_no_nl` and its surrounding call stack. This function likely represents a critical juncture in the transmission process for this specific driver. By analyzing its callers and how it's invoked, I can begin to map out the higher-level logic that triggers packet transmission. Concurrently, I'll be dissecting the broader `mac80211` transmission path. This will provide the foundational understanding of how `mac80211` generally handles packet sending, which I can then overlay with the specific behaviors of `mac80211_hwsim`. The goal is to build a comprehensive picture, from the general `mac80211` framework down to the simulated hardware specifics of `mac80211_hwsim`, identifying any deviations or particular handling that could lead to packet loss or rejection.
|
| 523/6 |
2026/09/07 08:22 |
tool |
codesearch-definition-source |
0m
Args: map[Name:mac80211_hwsim_tx_frame_no_nl]
Results: map[SourceCode:1902: static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
1903: struct sk_buff *skb,
1904: struct ieee80211_channel *chan)
1905: {
1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
1907: bool ack = false;
1908: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1909: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1910: struct ieee80211_rx_status rx_status;
1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
1912:
1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
1914:
1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
1916:
1917: memset(&rx_status, 0, sizeof(rx_status));
1918: rx_status.flag |= RX_FLAG_MACTIME_START;
1919: rx_status.freq = chan->center_freq;
1920: rx_status.freq_offset = chan->freq_offset ? 1 : 0;
1921: rx_status.band = chan->band;
1922: if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) {
1923: rx_status.rate_idx =
1924: ieee80211_rate_get_vht_mcs(&info->control.rates[0]);
1925: rx_status.nss =
1926: ieee80211_rate_get_vht_nss(&info->control.rates[0]);
1927: rx_status.encoding = RX_ENC_VHT;
1928: } else {
1929: rx_status.rate_idx = info->control.rates[0].idx;
1930: if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
1931: rx_status.encoding = RX_ENC_HT;
1932: }
1933: if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
1934: rx_status.bw = RATE_INFO_BW_40;
1935: else if (info->control.rates[0].flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
1936: rx_status.bw = RATE_INFO_BW_80;
1937: else if (info->control.rates[0].flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
1938: rx_status.bw = RATE_INFO_BW_160;
1939: else
1940: rx_status.bw = RATE_INFO_BW_20;
1941: if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
1942: rx_status.enc_flags |= RX_ENC_FLAG_SHORT_GI;
1943: /* TODO: simulate optional packet loss */
1944: rx_status.signal = data->rx_rssi;
1945: if (info->control.vif)
1946: rx_status.signal += info->control.vif->bss_conf.txpower;
1947:
1948: if (data->ps != PS_DISABLED)
1949: hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
1950:
1951: /* release the skb's source info */
1952: skb_orphan(skb);
1953: skb_dst_drop(skb);
1954: skb->mark = 0;
1955: skb_ext_reset(skb);
1956: nf_reset_ct(skb);
1957:
1958: if (ieee80211_is_beacon(hdr->frame_control) ||
1959: ieee80211_is_probe_resp(hdr->frame_control))
1960: rx_status.boottime_ns = ktime_get_boottime_ns();
1961:
1962: /* Copy skb to all enabled radios that are on the current frequency */
1963: spin_lock(&hwsim_radio_lock);
1964: list_for_each_entry(data2, &hwsim_radios, list) {
1965: struct sk_buff *nskb;
1966: struct tx_iter_data tx_iter_data = {
1967: .receive = false,
1968: .hw = data2->hw,
1969: .channel = chan,
1970: .rx_status = &rx_status,
1971: };
1972:
1973: if (data == data2)
1974: continue;
1975:
1976: if (!data2->started || (data2->idle && !data2->tmp_chan) ||
1977: !hwsim_ps_rx_ok(data2, skb))
1978: continue;
1979:
1980: if (!(data->group & data2->group))
1981: continue;
1982:
1983: if (data->netgroup != data2->netgroup)
1984: continue;
1985:
1986: /*
1987: * Set mactime early since NAN RX filtering relies on it
1988: * for slot calculation
1989: */
1990: rx_status.mactime = sim_tsf + data2->tsf_offset;
1991:
1992: if (!hwsim_chans_compat(chan, data2->tmp_chan) &&
1993: !hwsim_chans_compat(chan, data2->channel)) {
1994: ieee80211_iterate_active_interfaces_atomic(
1995: data2->hw, IEEE80211_IFACE_ITER_NORMAL,
1996: mac80211_hwsim_tx_iter, &tx_iter_data);
1997: if (!tx_iter_data.receive)
1998: continue;
1999: }
2000:
2001: /*
2002: * reserve some space for our vendor and the normal
2003: * radiotap header, since we're copying anyway
2004: */
2005: if (skb->len < PAGE_SIZE && paged_rx) {
2006: struct page *page = alloc_page(GFP_ATOMIC);
2007:
2008: if (!page)
2009: continue;
2010:
2011: nskb = dev_alloc_skb(128);
2012: if (!nskb) {
2013: __free_page(page);
2014: continue;
2015: }
2016:
2017: memcpy(page_address(page), skb->data, skb->len);
2018: skb_add_rx_frag(nskb, 0, page, 0, skb->len, skb->len);
2019: } else {
2020: nskb = skb_copy(skb, GFP_ATOMIC);
2021: if (!nskb)
2022: continue;
2023: }
2024:
2025: if (mac80211_hwsim_addr_match(data2, hdr->addr1))
2026: ack = true;
2027:
2028: mac80211_hwsim_rx(data2, &rx_status, nskb);
2029: }
2030: spin_unlock(&hwsim_radio_lock);
2031:
2032: return ack;
2033: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 524/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 13790
output: 66
thoughts: 816
Thoughts: **My Investigation into mac80211_hwsim Transmission Flow**
My primary goal here is to understand how `mac80211_hwsim_tx_frame_no_nl` is invoked and, more specifically, to trace the requirements of `mac80211_hwsim_write_tsf`. I've been looking closely at the `mac80211_hwsim_write_tsf` function and have observed its handling of different management frame types – probe responses, beacons, and S1G beacons – based on the packet's length and the frame control information.
What caught my attention was the unconditional call to `mac80211_hwsim_get_tx_rate(data->hw, info)` within `mac80211_hwsim_write_tsf`, specifically around line 1617. It seems this is executed regardless of the frame type being processed, right after acquiring the `tsf_offset_lock`.
Digging into `mac80211_hwsim_get_tx_rate`, I see a crucial conditional check: it returns `NULL` if the transmit rate flags indicate MCS or VHT MCS. Otherwise, it proceeds to call `ieee80211_get_tx_rate`.
The `ieee80211_get_tx_rate` function, in turn, performs its own checks. It ensures the rate index is valid and that the band information is within bounds. If these checks pass, it then retrieves the specific `ieee80211_rate` structure from the `wiphy`'s band data using the provided index.
My next step is to determine what triggers the transmission functions, either `mac80211_hwsim_tx_frame_no_nl` or its more general counterpart `mac80211_hwsim_tx_frame`. To do this, I'm focusing on finding all references to `mac80211_hwsim_write_tsf` or, more broadly, tracing how packet transmissions are initiated within `mac80211_hwsim_main.c`. This will help me connect the dots from the transmission request to the rate selection and TSF writing logic I've been examining.
|
| 525/6 |
2026/09/07 08:22 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c IncludeSnippetLines:10 Name:mac80211_hwsim_write_tsf]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_tx_frame_nl SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:1675 SourceSnippet:1665: /* If the queue contains MAX_QUEUE skb's drop some */
1666: if (skb_queue_len(&data->pending) >= MAX_QUEUE) {
1667: /* Dropping until WARN_QUEUE level */
1668: while (skb_queue_len(&data->pending) >= WARN_QUEUE) {
1669: ieee80211_free_txskb(hw, skb_dequeue(&data->pending));
1670: data->tx_dropped++;
1671: }
1672: }
1673:
1674: sim_tsf = mac80211_hwsim_get_sim_tsf();
1675: mac80211_hwsim_write_tsf(data, my_skb, sim_tsf);
1676:
1677: skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_ATOMIC);
1678: if (skb == NULL)
1679: goto nla_put_failure;
1680:
1681: msg_head = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0,
1682: HWSIM_CMD_FRAME);
1683: if (msg_head == NULL) {
1684: pr_debug("mac80211_hwsim: problem with msg_head\n");
1685: goto nla_put_failure;
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_tx_frame_no_nl SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:1913 SourceSnippet:1903: struct sk_buff *skb,
1904: struct ieee80211_channel *chan)
1905: {
1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
1907: bool ack = false;
1908: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1909: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1910: struct ieee80211_rx_status rx_status;
1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
1912:
1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
1914:
1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
1916:
1917: memset(&rx_status, 0, sizeof(rx_status));
1918: rx_status.flag |= RX_FLAG_MACTIME_START;
1919: rx_status.freq = chan->center_freq;
1920: rx_status.freq_offset = chan->freq_offset ? 1 : 0;
1921: rx_status.band = chan->band;
1922: if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) {
1923: rx_status.rate_idx =
]] TruncatedOutput:false]
|
| 526/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 15657
output: 69
thoughts: 102
Thoughts: **My Exploration of `mac80211_hwsim` Transmit Functions**
My initial focus is on understanding the control flow and invocation points for the transmit functions within the `mac80211_hwsim` module, specifically `mac80211_hwsim_tx_frame_no_nl` and `mac80211_hwsim_tx_frame_nl`. To achieve this, I'm initiating a search for all references to these two functions, as well as the more general `mac80211_hwsim_tx` identifier. This broad approach aims to capture any code that directly calls these functions, or uses them as part of a larger transmission mechanism, providing a comprehensive view of their integration within the driver.
|
| 527/6 |
2026/09/07 08:22 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c IncludeSnippetLines:10 Name:mac80211_hwsim_tx_frame_no_nl]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_tx SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:2276 SourceSnippet:2266:
2267: /* wmediumd mode check */
2268: _portid = READ_ONCE(data->wmediumd);
2269:
2270: if (_portid || hwsim_virtio_enabled)
2271: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, channel);
2272:
2273: /* NO wmediumd detected, perfect medium simulation */
2274: data->tx_pkts++;
2275: data->tx_bytes += skb->len;
2276: ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel);
2277:
2278: if (ack && skb->len >= 16)
2279: mac80211_hwsim_monitor_ack(channel, hdr->addr2);
2280:
2281: ieee80211_tx_info_clear_status(txi);
2282:
2283: /* frame was transmitted at most favorable rate at first attempt */
2284: txi->control.rates[0].count = 1;
2285: txi->control.rates[1].idx = -1;
2286:
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_tx_frame SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:2428 SourceSnippet:2418: ieee80211_get_tx_rates(txi->control.vif, NULL, skb,
2419: txi->control.rates,
2420: ARRAY_SIZE(txi->control.rates));
2421: }
2422:
2423: if (_portid || hwsim_virtio_enabled)
2424: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, chan);
2425:
2426: data->tx_pkts++;
2427: data->tx_bytes += skb->len;
2428: mac80211_hwsim_tx_frame_no_nl(hw, skb, chan);
2429: dev_kfree_skb(skb);
2430: }
]] TruncatedOutput:false]
|
| 528/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 16534
output: 23
thoughts: 90
Thoughts: **My Thought Process on Tracing `mac80211_hwsim_tx`**
Okay, my immediate goal is to understand the transmission path within the `mac80211_hwsim` driver. Specifically, I need to pinpoint where the actual frame transmission is initiated. To do this, I'm going to start by examining the callers of the `mac80211_hwsim_tx` function. This is a standard debugging and code analysis approach – get to the entry point of interest and then work outwards.
Following that, I'll drill down further by looking at `mac80211_hwsim_tx_frame`. It's highly probable that `mac80211_hwsim_tx` acts as an entry point or a high-level handler, and `mac80211_hwsim_tx_frame` will likely contain more granular logic related to the frame itself.
My next step involves inspecting the `mac80211_hwsim_ops` structure. This is where the hardware simulation driver will expose its operations to the core `mac80211` subsystem. I'll be looking for the specific field within this structure that `mac80211_hwsim_tx` (or a related function) is registered against. This is crucial for understanding how the `mac80211` framework interacts with my simulated hardware.
Finally, to locate where these operations are actually defined and initialized, I'll perform a search for `ops` within the `mac80211_hwsim_main.c` file. This is where the driver's primary implementation and setup routines reside, and it's where I expect to find the definition and assignment of the `mac80211_hwsim_ops` structure, thus connecting the dots from the high-level `mac80211` calls to the specific simulation logic.
|
| 529/6 |
2026/09/07 08:22 |
tool |
grepper |
0m
Error:
Args: map[PathPrefix:drivers/net/wireless/virtual/]
|
| 530/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 16652
output: 45
thoughts: 9
Thoughts: **My Thought Process for Interacting with Grepper**
Alright, so here's how I'm approaching this. My primary objective is to leverage the capabilities of "grepper" for a specific task. I've identified that the most direct and efficient way to achieve my goal is by invoking "grepper" with a specific "Expression." This "Expression" is crucial; it's essentially the set of instructions or the pattern I'm feeding into grepper to guide its operation. My mental model here is that grepper acts as a sophisticated pattern-matching engine or a search utility, and by providing a well-defined "Expression," I'm telling it exactly *what* to look for or *how* to process the data it encounters. I'm assuming, given my expertise, that grepper is designed to interpret and execute such expressions effectively, whether that means finding specific lines of text, extracting data based on a complex pattern, or even performing some form of transformation. The act of "calling grepper with Expression" is the core of my strategy, the foundational step in whatever larger process I'm undertaking.
|
| 531/6 |
2026/09/07 08:22 |
tool |
grepper |
0m
Args: map[Expression:\.tx\b PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=4274=static int mac80211_hwsim_set_radar_background(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4299-#define HWSIM_COMMON_OPS \
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4300: .tx = mac80211_hwsim_tx, \
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4301- .wake_tx_queue = ieee80211_hwsim_wake_tx_queue, \
]
|
| 532/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 16902
output: 28
thoughts: 197
Thoughts: **My Thought Process on Injecting Frames in Monitor Mode within mac80211**
My primary interest is understanding the transmission (tx) behavior within the mac80211 driver specifically when a frame is injected while the interface is in monitor mode. I intend to trace the execution flow from the initial injection point through to the actual hardware transmission.
To achieve this, I plan to follow a specific path:
* Start with `ieee80211_monitor_start_xmit`.
* Then, move to `ieee80211_xmit`, observing how the injected frame is handled.
* This will lead me through the core transmission logic, ultimately reaching the driver-specific transmission function, `drv_tx`.
* My final destination in this initial trace will be the hardware simulation driver's transmission function, `mac80211_hwsim_tx`, to understand how the injected frames are represented and passed down.
I will pay particular attention to the details within `ieee80211_monitor_start_xmit`, focusing on what occurs when `ieee80211_parse_tx_radiotap` is invoked, as this is likely where the injected frame's metadata is processed. Subsequently, I'll examine `ieee80211_xmit` to grasp how this processed frame is integrated into the mac80211 transmission pipeline.
To gain a comprehensive understanding, I will be delving into the source code of `net/mac80211/tx.c`, specifically around the functions mentioned above. My focus will be on the mechanisms that handle monitor mode transmissions, how rate control is applied (or bypassed) for injected frames, and any other relevant transmission logic that might be affected by the monitor mode context.
|
| 533/6 |
2026/09/07 08:22 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:2041: void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
2042: struct sta_info *sta, struct sk_buff *skb)
2043: {
2044: struct ieee80211_local *local = sdata->local;
2045: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2046: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
2047: int headroom;
2048: enum ieee80211_encrypt encrypt;
2049:
2050: if (info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)
2051: encrypt = ENCRYPT_NO;
2052: else if (ieee80211_is_mgmt(hdr->frame_control))
2053: encrypt = ENCRYPT_MGMT;
2054: else
2055: encrypt = ENCRYPT_DATA;
2056:
2057: headroom = local->tx_headroom;
2058: if (encrypt != ENCRYPT_NO)
2059: headroom += IEEE80211_ENCRYPT_HEADROOM;
2060: headroom -= skb_headroom(skb);
2061: headroom = max_t(int, 0, headroom);
2062:
2063: if (ieee80211_skb_resize(sdata, skb, headroom, encrypt)) {
2064: ieee80211_free_txskb(&local->hw, skb);
2065: return;
2066: }
2067:
2068: /* reload after potential resize */
2069: hdr = (struct ieee80211_hdr *) skb->data;
2070: info->control.vif = &sdata->vif;
2071:
2072: if (ieee80211_vif_is_mesh(&sdata->vif)) {
2073: if (ieee80211_is_data(hdr->frame_control) &&
2074: is_unicast_ether_addr(hdr->addr1)) {
2075: if (mesh_nexthop_resolve(sdata, skb))
2076: return; /* skb queued: don't free */
2077: } else {
2078: ieee80211_mps_set_frame_flags(sdata, NULL, hdr);
2079: }
2080: }
2081:
2082: ieee80211_set_qos_hdr(sdata, skb);
2083: ieee80211_tx(sdata, sta, skb, false);
2084: }
SourceFile:net/mac80211/tx.c]
|
| 534/6 |
2026/09/07 08:22 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 17968
output: 27
thoughts: 37
|
| 535/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args:
Results: map[SourceCode:1949: /*
1950: * Returns false if the frame couldn't be transmitted but was queued instead.
1951: */
1952: static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
1953: struct sta_info *sta, struct sk_buff *skb,
1954: bool txpending)
1955: {
1956: struct ieee80211_local *local = sdata->local;
1957: struct ieee80211_tx_data tx;
1958: ieee80211_tx_result res_prepare;
1959: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1960: bool result = true;
1961:
1962: if (unlikely(skb->len < 10)) {
1963: dev_kfree_skb(skb);
1964: return true;
1965: }
1966:
1967: /* initialises tx */
1968: res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
1969:
1970: if (unlikely(res_prepare == TX_DROP)) {
1971: ieee80211_free_txskb(&local->hw, skb);
1972: tx.sdata->tx_handlers_drop++;
1973: return true;
1974: } else if (unlikely(res_prepare == TX_QUEUED)) {
1975: return true;
1976: }
1977:
1978: /* set up hw_queue value early */
1979: if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) ||
1980: !ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
1981: info->hw_queue =
1982: sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
1983:
1984: if (invoke_tx_handlers_early(&tx))
1985: return true;
1986:
1987: if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
1988: return true;
1989:
1990: if (!invoke_tx_handlers_late(&tx))
1991: result = __ieee80211_tx(local, &tx.skbs, tx.sta, txpending);
1992:
1993: return result;
1994: }
SourceFile:net/mac80211/tx.c]
|
| 536/6 |
2026/09/07 08:23 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 18829
output: 79
thoughts: 81
Thoughts: **My Thought Process Regarding Network Packet Transmission Handlers**
My immediate instinct upon encountering these functions – `invoke_tx_handlers_early(&tx)`, `invoke_tx_handlers_late(&tx)`, and `ieee80211_tx_prepare` – is to dive deep into their specific behaviors and functionalities within the network transmission pipeline. I need to understand precisely *what* each of these functions accomplishes, and more importantly, *when* they are executed relative to each other and the overall transmission process.
My primary objective is to dissect the sequence and purpose of these critical steps in preparing a packet for transmission. I want to determine if `invoke_tx_handlers_early` and `invoke_tx_handlers_late` represent distinct phases of a generalized, perhaps extensible, handler invocation mechanism, and how `ieee80211_tx_prepare` then fits into this framework. Is `ieee80211_tx_prepare` a specific instance of one of these invocation points, or is it a separate, yet related, preparation stage?
I'm looking to ascertain the scope and impact of each function:
* **`invoke_tx_handlers_early(&tx)`**: What operations are being performed *before* the core IEEE 802.11 preparation? What kind of early-stage processing is happening here? What data within the `tx` structure might be modified or analyzed at this juncture?
* **`invoke_tx_handlers_late(&tx)`**: Similarly, what actions are taken *after* the main preparation but *before* the final transmission commit? Are these handlers for last-minute adjustments, validation, or perhaps resource cleanup?
* **`ieee80211_tx_prepare`**: This function name strongly suggests it's responsible for the nitty-gritty of configuring the packet for the specific requirements of the IEEE 802.11 standard. This likely involves setting MAC headers, determining appropriate rates, potentially managing QoS parameters, and ensuring compliance with physical layer specifications.
My aim is to build a clear mental model of the packet's journey, understanding how these functions contribute to its readiness for the airwaves. I'm thinking about the dependencies, potential side effects, and the overall control flow. This detailed examination will allow me to identify any potential bottlenecks, areas for optimization, or points where specific driver or protocol logic might be injected. Essentially, I'm trying to reverse-engineer the transmission preparation logic by thoroughly understanding these key components.
|
| 537/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:invoke_tx_handlers_early]
Results: map[SourceCode:1815: /*
1816: * Invoke TX handlers, return 0 on success and non-zero if the
1817: * frame was dropped or queued.
1818: *
1819: * The handlers are split into an early and late part. The latter is everything
1820: * that can be sensitive to reordering, and will be deferred to after packets
1821: * are dequeued from the intermediate queues (when they are enabled).
1822: */
1823: static int invoke_tx_handlers_early(struct ieee80211_tx_data *tx)
1824: {
1825: ieee80211_tx_result res = TX_DROP;
1826:
1827: #define CALL_TXH(txh) \
1828: do { \
1829: res = txh(tx); \
1830: if (res != TX_CONTINUE) \
1831: goto txh_done; \
1832: } while (0)
1833:
1834: CALL_TXH(ieee80211_tx_h_dynamic_ps);
1835: CALL_TXH(ieee80211_tx_h_check_assoc);
1836: CALL_TXH(ieee80211_tx_h_ps_buf);
1837: CALL_TXH(ieee80211_tx_h_check_control_port_protocol);
1838: CALL_TXH(ieee80211_tx_h_select_key);
1839:
1840: txh_done:
1841: if (unlikely(res == TX_DROP)) {
1842: tx->sdata->tx_handlers_drop++;
1843: if (tx->skb)
1844: ieee80211_free_txskb(&tx->local->hw, tx->skb);
1845: else
1846: ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs);
1847: return -1;
1848: } else if (unlikely(res == TX_QUEUED)) {
1849: I802_DEBUG_INC(tx->local->tx_handlers_queued);
1850: return -1;
1851: }
1852:
1853: return 0;
1854: }
SourceFile:net/mac80211/tx.c]
|
| 538/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:invoke_tx_handlers_late]
Results: map[SourceCode:1856: /*
1857: * Late handlers can be called while the sta lock is held. Handlers that can
1858: * cause packets to be generated will cause deadlock!
1859: */
1860: static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx)
1861: {
1862: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
1863: ieee80211_tx_result res = TX_CONTINUE;
1864:
1865: if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1866: CALL_TXH(ieee80211_tx_h_rate_ctrl);
1867:
1868: if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) {
1869: __skb_queue_tail(&tx->skbs, tx->skb);
1870: tx->skb = NULL;
1871: goto txh_done;
1872: }
1873:
1874: CALL_TXH(ieee80211_tx_h_michael_mic_add);
1875: CALL_TXH(ieee80211_tx_h_sequence);
1876: CALL_TXH(ieee80211_tx_h_fragment);
1877: /* handlers after fragment must be aware of tx info fragmentation! */
1878: CALL_TXH(ieee80211_tx_h_stats);
1879: CALL_TXH(ieee80211_tx_h_encrypt);
1880: if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1881: CALL_TXH(ieee80211_tx_h_calculate_duration);
1882: #undef CALL_TXH
1883:
1884: txh_done:
1885: if (unlikely(res == TX_DROP)) {
1886: tx->sdata->tx_handlers_drop++;
1887: if (tx->skb)
1888: ieee80211_free_txskb(&tx->local->hw, tx->skb);
1889: else
1890: ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs);
1891: return -1;
1892: } else if (unlikely(res == TX_QUEUED)) {
1893: I802_DEBUG_INC(tx->local->tx_handlers_queued);
1894: return -1;
1895: }
1896:
1897: return 0;
1898: }
SourceFile:net/mac80211/tx.c]
|
| 539/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_tx_prepare]
Results: map[SourceCode:1202: /*
1203: * initialises @tx
1204: * pass %NULL for the station if unknown, a valid pointer if known
1205: * or an ERR_PTR() if the station is known not to exist
1206: */
1207: static ieee80211_tx_result
1208: ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1209: struct ieee80211_tx_data *tx,
1210: struct sta_info *sta, struct sk_buff *skb)
1211: {
1212: struct ieee80211_local *local = sdata->local;
1213: struct ieee80211_hdr *hdr;
1214: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1215: bool aggr_check = false;
1216: int tid;
1217:
1218: memset(tx, 0, sizeof(*tx));
1219: tx->skb = skb;
1220: tx->local = local;
1221: tx->sdata = sdata;
1222: __skb_queue_head_init(&tx->skbs);
1223:
1224: /*
1225: * If this flag is set to true anywhere, and we get here,
1226: * we are doing the needed processing, so remove the flag
1227: * now.
1228: */
1229: info->control.flags &= ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
1230:
1231: hdr = (struct ieee80211_hdr *) skb->data;
1232:
1233: if (likely(sta)) {
1234: if (!IS_ERR(sta))
1235: tx->sta = sta;
1236: } else {
1237: if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
1238: tx->sta = rcu_dereference(sdata->u.vlan.sta);
1239: if (!tx->sta && sdata->wdev.use_4addr)
1240: return TX_DROP;
1241: } else if (tx->sdata->control_port_protocol == tx->skb->protocol) {
1242: tx->sta = sta_info_get_bss(sdata, hdr->addr1);
1243: }
1244: if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) {
1245: tx->sta = sta_info_get(sdata, hdr->addr1);
1246: aggr_check = true;
1247: }
1248: }
1249:
1250: if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
1251: !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
1252: ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION) &&
1253: !ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) {
1254: struct tid_ampdu_tx *tid_tx;
1255:
1256: tid = ieee80211_get_tid(hdr);
1257: tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1258: if (!tid_tx && aggr_check) {
1259: ieee80211_aggr_check(sdata, tx->sta, skb);
1260: tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1261: }
1262:
1263: if (tid_tx) {
1264: bool queued;
1265:
1266: queued = ieee80211_tx_prep_agg(tx, skb, info,
1267: tid_tx, tid);
1268:
1269: if (unlikely(queued))
1270: return TX_QUEUED;
1271: }
1272: }
1273:
1274: if (is_multicast_ether_addr(hdr->addr1)) {
1275: tx->flags &= ~IEEE80211_TX_UNICAST;
1276: info->flags |= IEEE80211_TX_CTL_NO_ACK;
1277: } else
1278: tx->flags |= IEEE80211_TX_UNICAST;
1279:
1280: if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) {
1281: if (!(tx->flags & IEEE80211_TX_UNICAST) ||
1282: skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
1283: info->flags & IEEE80211_TX_CTL_AMPDU)
1284: info->flags |= IEEE80211_TX_CTL_DONTFRAG;
1285: }
1286:
1287: if (!tx->sta)
1288: info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1289: else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
1290: info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1291: ieee80211_check_fast_xmit(tx->sta);
1292: }
1293:
1294: info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
1295:
1296: return TX_CONTINUE;
1297: }
SourceFile:net/mac80211/tx.c]
|
| 540/6 |
2026/09/07 08:23 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 22284
output: 33
thoughts: 129
Thoughts: **A Deep Dive into Transmission Handler Execution and Rate Control in hwsim**
My current focus is on understanding the execution flow within `invoke_tx_handlers_late`, specifically concerning the rate control handler. I've spotted a conditional call to `ieee80211_tx_h_rate_ctrl` that hinges on the `HAS_RATE_CONTROL` capability of the hardware. This immediately sparks a critical question in my mind: does `hwsim`, the simulation environment I'm working with, actually possess the `HAS_RATE_CONTROL` flag, or is it absent?
The implications of this are significant. If `hwsim` *doesn't* have `HAS_RATE_CONTROL`, then this handler, `ieee80211_tx_h_rate_ctrl`, would logically be bypassed. But what *exactly* does `ieee80211_tx_h_rate_ctrl` do? Is it a core component for managing transmission rates, or is it a more specialized function that might be gracefully skipped in a simulation context? To truly grasp the behavior and ensure accurate simulation, I need to thoroughly investigate the implementation and purpose of `ieee80211_tx_h_rate_ctrl`. My next step, therefore, is to meticulously examine its code to determine its role and how it interacts with the overall transmission process, especially in relation to the `HAS_RATE_CONTROL` flag. This will allow me to definitively ascertain whether the rate control logic is being exercised or intentionally omitted within the `hwsim` environment.
|
| 541/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_tx_h_rate_ctrl]
Results: map[SourceCode: 674: static ieee80211_tx_result debug_noinline
675: ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
676: {
677: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
678: struct ieee80211_hdr *hdr = (void *)tx->skb->data;
679: struct ieee80211_supported_band *sband;
680: u32 len;
681: struct ieee80211_tx_rate_control txrc;
682: struct ieee80211_sta_rates *ratetbl = NULL;
683: bool encap = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
684: bool assoc = false;
685:
686: memset(&txrc, 0, sizeof(txrc));
687:
688: if (info->band < NUM_NL80211_BANDS)
689: sband = tx->local->hw.wiphy->bands[info->band];
690: else
691: return TX_CONTINUE;
692:
693: len = min_t(u32, tx->skb->len + FCS_LEN,
694: tx->local->hw.wiphy->frag_threshold);
695:
696: /* set up the tx rate control struct we give the RC algo */
697: txrc.hw = &tx->local->hw;
698: txrc.sband = sband;
699: txrc.bss_conf = &tx->sdata->vif.bss_conf;
700: txrc.skb = tx->skb;
701: txrc.reported_rate.idx = -1;
702:
703: if (unlikely(info->control.flags & IEEE80211_TX_CTRL_DONT_USE_RATE_MASK)) {
704: txrc.rate_idx_mask = ~0;
705: } else {
706: txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band];
707:
708: if (tx->sdata->rc_has_mcs_mask[info->band])
709: txrc.rate_idx_mcs_mask =
710: tx->sdata->rc_rateidx_mcs_mask[info->band];
711: }
712:
713: txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
714: tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
715: tx->sdata->vif.type == NL80211_IFTYPE_ADHOC ||
716: tx->sdata->vif.type == NL80211_IFTYPE_OCB);
717:
718: /* set up RTS protection if desired */
719: if (len > tx->local->hw.wiphy->rts_threshold) {
720: txrc.rts = true;
721: }
722:
723: info->control.use_rts = txrc.rts;
724: info->control.use_cts_prot = tx->sdata->vif.bss_conf.use_cts_prot;
725:
726: /*
727: * Use short preamble if the BSS can handle it, but not for
728: * management frames unless we know the receiver can handle
729: * that -- the management frame might be to a station that
730: * just wants a probe response.
731: */
732: if (tx->sdata->vif.bss_conf.use_short_preamble &&
733: (ieee80211_is_tx_data(tx->skb) ||
734: (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE))))
735: txrc.short_preamble = true;
736:
737: info->control.short_preamble = txrc.short_preamble;
738:
739: /* don't ask rate control when rate already injected via radiotap */
740: if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
741: return TX_CONTINUE;
742:
743: if (tx->sta)
744: assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
745:
746: /*
747: * Lets not bother rate control if we're associated and cannot
748: * talk to the sta. This should not happen.
749: */
750: if (WARN(test_bit(SCAN_SW_SCANNING, &tx->local->scanning) && assoc &&
751: !rate_usable_index_exists(sband, &tx->sta->sta),
752: "%s: Dropped data frame as no usable bitrate found while "
753: "scanning and associated. Target station: "
754: "%pM on %d GHz band\n",
755: tx->sdata->name,
756: encap ? ((struct ethhdr *)hdr)->h_dest : hdr->addr1,
757: info->band ? 5 : 2))
758: return TX_DROP;
759:
760: /*
761: * If we're associated with the sta at this point we know we can at
762: * least send the frame at the lowest bit rate.
763: */
764: rate_control_get_rate(tx->sdata, tx->sta, &txrc);
765:
766: if (tx->sta && !info->control.skip_table)
767: ratetbl = rcu_dereference(tx->sta->sta.rates);
768:
769: if (unlikely(info->control.rates[0].idx < 0)) {
770: if (ratetbl) {
771: struct ieee80211_tx_rate rate = {
772: .idx = ratetbl->rate[0].idx,
773: .flags = ratetbl->rate[0].flags,
774: .count = ratetbl->rate[0].count
775: };
776:
777: if (ratetbl->rate[0].idx < 0)
778: return TX_DROP;
779:
780: tx->rate = rate;
781: } else {
782: return TX_DROP;
783: }
784: } else {
785: tx->rate = info->control.rates[0];
786: }
787:
788: if (txrc.reported_rate.idx < 0) {
789: txrc.reported_rate = tx->rate;
790: if (tx->sta && ieee80211_is_tx_data(tx->skb))
791: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
792: } else if (tx->sta)
793: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
794:
795: if (ratetbl)
796: return TX_CONTINUE;
797:
798: if (unlikely(!info->control.rates[0].count))
799: info->control.rates[0].count = 1;
800:
801: if (WARN_ON_ONCE((info->control.rates[0].count > 1) &&
802: (info->flags & IEEE80211_TX_CTL_NO_ACK)))
803: info->control.rates[0].count = 1;
804:
805: return TX_CONTINUE;
806: }
SourceFile:net/mac80211/tx.c]
|
| 542/6 |
2026/09/07 08:23 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 24837
output: 25
thoughts: 844
Thoughts: **My Thought Process Regarding Rate Injection and Control**
Alright, I've been digging into the `ieee80211_tx_h_rate_ctrl` function, specifically around lines 740-785, and I'm tracing what happens when the `IEEE80211_TX_CTRL_RATE_INJECT` flag is *not* set.
My initial path led me to `ieee80211_parse_tx_radiotap`. Here, I observed a critical condition:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This means if `rates[0].idx` is less than 0 after parsing, the `IEEE80211_TX_CTRL_RATE_INJECT` flag will be cleared.
Then, I considered the scenario where the input `rate` is 0. In `ieee80211_parse_tx_radiotap`, this is what happens:
* `rate_found` becomes `true`.
* `info->control.flags` is OR'd with `IEEE80211_TX_CTRL_RATE_INJECT`.
* All `rates[i].idx` are set to `-1`.
Now, when it gets to the legacy rates loop (since it's not MCS/VHT), I see this logic:
```c
} else if (sband) {
for (i = 0; i < sband->n_bitrates; i++) {
if (rate * 5 != sband->bitrates[i].bitrate)
continue;
info->control.rates[0].idx = i;
break;
}
}
```
The problem here is that if `rate` is 0, then `rate * 5` is also 0. There's no actual bitrate defined as 0 in `sband->bitrates`. Consequently, the loop completes without finding a match, and `info->control.rates[0].idx` remains at its initialized value of `-1`.
This brings us back to that earlier check:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
So, because `info->control.rates[0].idx` is still `-1`, the `IEEE80211_TX_CTRL_RATE_INJECT` flag is indeed cleared, and `info->control.rates[0].idx` is left as `-1`.
The frame then proceeds through the transmission path: `ieee80211_xmit` -> `ieee80211_tx` -> `invoke_tx_handlers_late` -> and finally, `ieee80211_tx_h_rate_ctrl`.
This is where it gets interesting. Back in `ieee80211_tx_h_rate_ctrl`, there's this early exit condition:
```c
/* don't ask rate control when rate already injected via radiotap */
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
Since I've established that `IEEE80211_TX_CTRL_RATE_INJECT` was cleared in `ieee80211_parse_tx_radiotap` for a rate of 0, this condition is *not* met, and the function does *not* return early.
Following the execution flow, I see that `tx->sta` is likely NULL in cases like monitor mode injection or when the station is unknown. Then, `rate_control_get_rate(tx->sdata, tx->sta, &txrc)` is called.
My immediate question now is: What exactly does `rate_control_get_rate` do when `tx->sta` is NULL? Does it populate `info->control.rates[0].idx` in any way? Or does it return a state where `idx` is still less than 0?
And crucially, what happens next if `ratetbl` is NULL (which it would be if `tx->sta` is NULL)? The code looks like this:
```c
if (unlikely(info->control.rates[0].idx < 0)) {
if (ratetbl) {
...
} else {
return TX_DROP;
}
}
```
This is the key point! If `info->control.rates[0].idx` is still negative after the call to `rate_control_get_rate` and `ratetbl` is NULL, the frame will be dropped. I need to dive into the implementation of `rate_control_get_rate` and any related rate control functions to understand how they handle this specific scenario with a NULL station context and a zero input rate.
|
| 543/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:rate_control_get_rate]
Results: map[SourceCode: 919: void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
920: struct sta_info *sta,
921: struct ieee80211_tx_rate_control *txrc)
922: {
923: struct rate_control_ref *ref = sdata->local->rate_ctrl;
924: void *priv_sta = NULL;
925: struct ieee80211_sta *ista = NULL;
926: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
927: int i;
928:
929: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
930: info->control.rates[i].idx = -1;
931: info->control.rates[i].flags = 0;
932: info->control.rates[i].count = 0;
933: }
934:
935: if (rate_control_send_low(sta ? &sta->sta : NULL, txrc))
936: return;
937:
938: if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
939: return;
940:
941: if (sta && test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) {
942: ista = &sta->sta;
943: priv_sta = sta->rate_ctrl_priv;
944: }
945:
946: if (ista) {
947: spin_lock_bh(&sta->rate_ctrl_lock);
948: ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
949: spin_unlock_bh(&sta->rate_ctrl_lock);
950: } else {
951: rate_control_send_low(NULL, txrc);
952: }
953:
954: if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))
955: return;
956:
957: ieee80211_get_tx_rates(&sdata->vif, ista, txrc->skb,
958: info->control.rates,
959: ARRAY_SIZE(info->control.rates));
960: }
SourceFile:net/mac80211/rate.c]
|
| 544/6 |
2026/09/07 08:23 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26461
output: 56
thoughts: 58
Thoughts: **My Thought Process for Handling Transmission Rate Control**
Alright, so I'm looking at this function call, `rate_control_send_low(sta ? &sta->sta : NULL, txrc)`. The immediate thought is, "What is this `rate_control_send_low` doing, and what is it using `txrc` for?" This leads me to examine the `rate_control_send_low` function itself, but also its dependencies.
Crucially, I need to understand how the system determines the transmission rate. This brings `ieee8011_get_tx_rates` to mind. My hypothesis is that `rate_control_send_low` is likely invoking or being influenced by `ieee8011_get_tx_rates` to make its decision. Therefore, I need to trace how `txrc` (presumably a transmission rate control structure or parameter) is populated and how it ultimately informs the rate selection within `ieee8011_get_tx_rates` or a similar mechanism.
The `sta ? &sta->sta : NULL` part also catches my attention. This conditional logic suggests that the rate control behavior might differ slightly depending on whether a specific station (`sta`) is involved. If a station is present, it's likely passing a pointer to station-specific rate control information. If not, it's passing NULL, implying a more general, perhaps default, rate control strategy is employed. I need to understand what specific station data is being passed and how it influences the rate selection process.
Ultimately, my goal is to piece together the flow: how is the transmission rate determined, how does the presence or absence of a specific station affect this determination, and what role does `txrc` play in this decision-making process, likely in conjunction with `ieee8011_get_tx_rates`?
|
| 545/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:rate_control_send_low]
Results: map[SourceCode: 414: static bool rate_control_send_low(struct ieee80211_sta *pubsta,
415: struct ieee80211_tx_rate_control *txrc)
416: {
417: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
418: struct ieee80211_supported_band *sband = txrc->sband;
419: struct sta_info *sta;
420: int mcast_rate;
421: bool use_basicrate = false;
422:
423: if (!sband)
424: return false;
425:
426: if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
427: __rate_control_send_low(txrc->hw, sband, pubsta, info,
428: txrc->rate_idx_mask);
429:
430: if (!pubsta && txrc->bss) {
431: mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
432: if (mcast_rate > 0) {
433: info->control.rates[0].idx = mcast_rate - 1;
434: return true;
435: }
436: use_basicrate = true;
437: } else if (pubsta) {
438: sta = container_of(pubsta, struct sta_info, sta);
439: if (ieee80211_vif_is_mesh(&sta->sdata->vif))
440: use_basicrate = true;
441: }
442:
443: if (use_basicrate)
444: rc_send_low_basicrate(&info->control.rates[0],
445: txrc->bss_conf->basic_rates,
446: sband);
447:
448: return true;
449: }
450: return false;
451: }
SourceFile:net/mac80211/rate.c]
|
| 546/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_get_tx_rates]
Results: map[SourceCode: 882: void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
883: struct ieee80211_sta *sta,
884: struct sk_buff *skb,
885: struct ieee80211_tx_rate *dest,
886: int max_rates)
887: {
888: struct ieee80211_sub_if_data *sdata;
889: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
890: struct ieee80211_supported_band *sband;
891: u32 mask = ~0;
892:
893: rate_control_fill_sta_table(sta, info, dest, max_rates);
894:
895: if (!vif)
896: return;
897:
898: sdata = vif_to_sdata(vif);
899: if (info->band >= NUM_NL80211_BANDS)
900: return;
901:
902: sband = sdata->local->hw.wiphy->bands[info->band];
903:
904: if (ieee80211_is_tx_data(skb))
905: rate_control_apply_mask(sdata, sta, sband, dest, max_rates);
906:
907: if (!(info->control.flags & IEEE80211_TX_CTRL_DONT_USE_RATE_MASK))
908: mask = sdata->rc_rateidx_mask[info->band];
909:
910: if (dest[0].idx < 0)
911: __rate_control_send_low(&sdata->local->hw, sband, sta, info,
912: mask);
913:
914: if (sta)
915: rate_fixup_ratelist(vif, sband, info, dest, max_rates);
916: }
SourceFile:net/mac80211/rate.c]
|
| 547/6 |
2026/09/07 08:23 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 27860
output: 26
thoughts: 31
Thoughts: **My Thought Process on `__rate_control_send_low`**
Alright, my primary objective here is to get a grip on what `__rate_control_send_low` is actually *doing*. My immediate instinct is to dive straight into the source code, to examine the `__rate_control_send_low` function itself. I need to understand its internal logic, its parameters, and what it returns. Essentially, I'm looking for a detailed breakdown of its functionality from the ground up.
|
| 548/6 |
2026/09/07 08:23 |
tool |
codesearch-definition-source |
0m
Args: map[Name:__rate_control_send_low]
Results: map[SourceCode: 366: static void __rate_control_send_low(struct ieee80211_hw *hw,
367: struct ieee80211_supported_band *sband,
368: struct ieee80211_sta *sta,
369: struct ieee80211_tx_info *info,
370: u32 rate_mask)
371: {
372: u32 rate_flags = 0;
373: int i;
374:
375: if (sband->band == NL80211_BAND_S1GHZ) {
376: info->control.rates[0].flags |= IEEE80211_TX_RC_S1G_MCS;
377: info->control.rates[0].idx = 0;
378: return;
379: }
380:
381: if ((sband->band == NL80211_BAND_2GHZ) &&
382: (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE))
383: rate_flags |= IEEE80211_RATE_ERP_G;
384:
385: info->control.rates[0].idx = 0;
386: for (i = 0; i < sband->n_bitrates; i++) {
387: if (!(rate_mask & BIT(i)))
388: continue;
389:
390: if ((rate_flags & sband->bitrates[i].flags) != rate_flags)
391: continue;
392:
393: if (!rate_supported(sta, sband->band, i))
394: continue;
395:
396: info->control.rates[0].idx = i;
397: break;
398: }
399: WARN_ONCE(i == sband->n_bitrates,
400: "no supported rates for sta %pM (0x%x, band %d) in rate_mask 0x%x with flags 0x%x\n",
401: sta ? sta->addr : NULL,
402: sta ? sta->deflink.supp_rates[sband->band] : -1,
403: sband->band,
404: rate_mask, rate_flags);
405:
406: info->control.rates[0].count =
407: (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
408: 1 : hw->max_rate_tries;
409:
410: info->control.skip_table = 1;
411: }
SourceFile:net/mac80211/rate.c]
|
| 549/6 |
2026/09/07 08:23 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 28730
output: 34
thoughts: 3914
Thoughts: **My Thought Process Unraveling the `mac80211_hwsim_write_tsf` Warning**
Okay, let me try and piece this together from my perspective. The core of this is this perplexing warning: `WARNING in mac80211_hwsim_write_tsf` with `c->control.rates[0].idx < 0`. The reproducer, which involves sending a packet via AF_PACKET to a monitor mode interface with a radiotap header specifying rate=0, *should* have triggered this, but it didn't. This discrepancy is the main puzzle I'm trying to solve.
First, I'm looking at `__rate_control_send_low`. It appears that `rate_control_get_rate` *does* set `info->control.rates[0].idx` to a valid rate (like 0) when `IEEE80211_TX_CTRL_RATE_INJECT` is *not* set. This makes me wonder: under what specific circumstances does `info->control.rates[0].idx` actually end up being less than 0 when the bug triggers?
This leads me to re-examine the bug report and the reproducer's behavior. The reproducer sends a packet, the radiotap header has `IEEE80211_RADIOTAP_RATE` set to 0. `ieee80211_parse_tx_radiotap` then sets `idx = -1` and clears `IEEE80211_TX_CTRL_RATE_INJECT`. Subsequently, `mac80211_hwsim_tx_frame_no_nl` calls `mac80211_hwsim_write_tsf`, which in turn calls `mac80211_hwsim_get_tx_rate`, and *that's* where the warning `ieee80211_get_tx_rate` (which I now know contains the `WARN_ON_ONCE(c->control.rates[0].idx < 0)`) is supposed to fire. But the reproducer exits cleanly. Why? Is it because `cfg80211_reg_can_beacon` returns false in `ieee80211_monitor_start_xmit`? Or is there something else going on?
To figure this out, I need to understand the flow. I'm thinking about checking commit history or using git logs to see how this bug was introduced or fixed, and more importantly, why the reproducer failed to trigger it. Since I don't have a live git log tool handy, I'll have to scrutinize the source code.
I'll start by dissecting `ieee80211_monitor_start_xmit` line by line. I see it handles the `skb`, sets up `IEEE80211_TX_CTL_INJECTED`, validates the radiotap header, adjusts pointers, and then attempts to find the correct channel context. The critical part for me is this check:
```c
if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
sdata->vif.type))
goto fail_rcu;
```
If this returns false, it jumps to `fail_rcu`, which ultimately calls `dev_kfree_skb(skb)` and returns `NETDEV_TX_OK`. Ah! This is a key observation. In networking, `NETDEV_TX_OK` means the packet was handled, even if it was dropped internally by the driver. This explains why the AF_PACKET `sendto()` in userspace succeeds and the process exits with 0. The packet was essentially "consumed" by the kernel, even though it never went out on the wire.
So, the question shifts: did the packet get dropped *before* the `WARN_ON_ONCE` could be triggered, or was it dropped in a way that masked the warning? Or, more intriguingly, was it possible that the packet was processed further, and `ieee80211_tx_h_rate_ctrl` *did* modify `rates[0].idx` to a non-negative value before the warning check could occur in `mac80211_hwsim_write_tsf`?
My next step is to understand how `mac80211_hwsim_write_tsf` is actually called with `c->control.rates[0].idx < 0`. I see it's called from `mac80211_hwsim_tx_frame_no_nl` (and related functions). And `mac80211_hwsim_tx_frame_no_nl` itself is called by `mac80211_hwsim_tx`.
Now I need to trace back how `mac80211_hwsim_tx` is invoked from the core `ieee80211_xmit` path. I'll be looking at the driver's transmission handlers, specifically for `drv_tx`. This seems like the most promising avenue to understand the full path and identify precisely where the `rates[0].idx < 0` condition arises and why it might be suppressed or modified in the context of the reproducer.
|
| 550/6 |
2026/09/07 08:24 |
tool |
grepper |
0m
Args: map[Expression:drv_tx\b PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/driver-ops.h=25=get_bss_sdata(struct ieee80211_sub_if_data *sdata)
--
net/mac80211/driver-ops.h-33-
net/mac80211/driver-ops.h:34:static inline void drv_tx(struct ieee80211_local *local,
net/mac80211/driver-ops.h-35- struct ieee80211_tx_control *control,
--
net/mac80211/tx.c=1686=static bool ieee80211_tx_frags(struct ieee80211_local *local,
--
net/mac80211/tx.c-1752- __skb_unlink(skb, skbs);
net/mac80211/tx.c:1753: drv_tx(local, &control, skb);
net/mac80211/tx.c-1754- }
--
net/mac80211/tx.c=4643=static bool __ieee80211_tx_8023(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/tx.c-4674-
net/mac80211/tx.c:4675: drv_tx(local, &control, skb);
net/mac80211/tx.c-4676-
--
net/mac80211/util.c=286=static void wake_tx_push_queue(struct ieee80211_local *local,
--
net/mac80211/util.c-299-
net/mac80211/util.c:300: drv_tx(local, &control, skb);
net/mac80211/util.c-301- }
]
|
| 551/6 |
2026/09/07 08:24 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 33194
output: 29
thoughts: 128
Thoughts: **My Journey Through `ieee80211_tx` and the `mac80211_hwsim` Mockup**
My current line of inquiry is focused on understanding the flow of data through the `ieee80211_tx` function, a critical junction in the 802.11 networking stack. To do this, I've decided to follow the execution path and examine the driver operations. My immediate next step is to delve into the `drv_tx` function, which I know resides within `net/mac80211/driver-ops.h`.
Upon inspecting `drv_tx`, I see a straightforward inline function:
```c
static inline void drv_tx(...) {
local->ops->tx(&local->hw, control, skb);
}
```
This tells me that `drv_tx` is essentially a dispatcher. It accesses the hardware-specific operations (`local->ops->tx`) associated with the local 802.11 device (`local->hw`), passing along the necessary control information and the socket buffer (`skb`) containing the data to be transmitted.
Now, my attention shifts to how this plays out in the context of `mac80211_hwsim`. I recall that for this simulated hardware environment, the `.tx` operation is specifically handled by `mac80211_hwsim_tx`. Therefore, my immediate and pressing next step is to meticulously examine the implementation of `mac80211_hwsim_tx` itself. This is where I expect to find the simulated behavior of a real Wi-Fi driver, and understanding its internal workings will be key to my overall comprehension of the transmission process in this simulated environment.
|
| 552/6 |
2026/09/07 08:24 |
tool |
codesearch-definition-source |
0m
Args: map[Name:mac80211_hwsim_tx]
Results: map[SourceCode:2104: static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
2105: struct ieee80211_tx_control *control,
2106: struct sk_buff *skb)
2107: {
2108: struct mac80211_hwsim_data *data = hw->priv;
2109: struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
2110: struct ieee80211_hdr *hdr = (void *)skb->data;
2111: struct ieee80211_chanctx_conf *chanctx_conf;
2112: struct ieee80211_channel *channel;
2113: struct ieee80211_vif *vif = txi->control.vif;
2114: bool ack, unicast_data;
2115: enum nl80211_chan_width confbw = NL80211_CHAN_WIDTH_20_NOHT;
2116: u32 _portid, i;
2117: int tx_link_id = -1;
2118:
2119: if (WARN_ON(skb->len < 10)) {
2120: /* Should not happen; just a sanity check for addr1 use */
2121: ieee80211_free_txskb(hw, skb);
2122: return;
2123: }
2124:
2125: unicast_data = is_unicast_ether_addr(hdr->addr1) &&
2126: ieee80211_is_data(hdr->frame_control);
2127:
2128: if (unicast_data && ieee80211_encrypt_tx_skb(skb) < 0) {
2129: ieee80211_free_txskb(hw, skb);
2130: return;
2131: }
2132: /* re-assign hdr since skb data may have shifted after encryption */
2133: hdr = (void *)skb->data;
2134:
2135: if (vif && !data->tmp_chan &&
2136: (vif->type == NL80211_IFTYPE_NAN ||
2137: vif->type == NL80211_IFTYPE_NAN_DATA)) {
2138: struct cfg80211_chan_def chandef;
2139:
2140: mac80211_hwsim_nan_get_tx_chandef(hw, &chandef);
2141: if (WARN_ON(!chandef.chan)) {
2142: /* No valid channel in current slot, drop frame */
2143: ieee80211_free_txskb(hw, skb);
2144: return;
2145: }
2146: channel = chandef.chan;
2147: confbw = chandef.width;
2148: } else if (!data->use_chanctx) {
2149: channel = data->channel;
2150: confbw = data->bw;
2151: } else if (txi->hw_queue == 4) {
2152: channel = data->tmp_chan;
2153: } else {
2154: u8 link = u32_get_bits(IEEE80211_SKB_CB(skb)->control.flags,
2155: IEEE80211_TX_CTRL_MLO_LINK);
2156: struct ieee80211_link_sta *link_sta = NULL;
2157: struct ieee80211_sta *sta = control->sta;
2158: struct ieee80211_bss_conf *bss_conf;
2159:
2160: /* This can happen in case of monitor injection */
2161: if (!vif) {
2162: ieee80211_free_txskb(hw, skb);
2163: return;
2164: }
2165:
2166: if (link != IEEE80211_LINK_UNSPECIFIED) {
2167: bss_conf = rcu_dereference(vif->link_conf[link]);
2168: if (sta)
2169: link_sta = rcu_dereference(sta->link[link]);
2170: } else {
2171: bss_conf = mac80211_hwsim_select_tx_link(data, vif, sta,
2172: hdr, &link_sta);
2173: }
2174:
2175: if (bss_conf)
2176: tx_link_id = bss_conf->link_id;
2177:
2178: if (unlikely(!bss_conf)) {
2179: /* if it's an MLO STA, it might have deactivated all
2180: * links temporarily - but we don't handle real PS in
2181: * this code yet, so just drop the frame in that case
2182: */
2183: WARN(link != IEEE80211_LINK_UNSPECIFIED || !sta || !sta->mlo,
2184: "link:%d, sta:%pM, sta->mlo:%d\n",
2185: link, sta ? sta->addr : NULL, sta ? sta->mlo : -1);
2186: ieee80211_free_txskb(hw, skb);
2187: return;
2188: }
2189:
2190: /* Do address translations only between shared links. It is
2191: * possible that while an non-AP MLD station and an AP MLD
2192: * station have shared links, the frame is intended to be sent
2193: * on a link which is not shared (for example when sending a
2194: * probe response).
2195: */
2196: if (sta && sta->mlo && link_sta) {
2197: /* address translation to link addresses on TX */
2198: ether_addr_copy(hdr->addr1, link_sta->addr);
2199: ether_addr_copy(hdr->addr2, bss_conf->addr);
2200: /* translate A3 only if it's the BSSID */
2201: if (!ieee80211_has_tods(hdr->frame_control) &&
2202: !ieee80211_has_fromds(hdr->frame_control)) {
2203: if (ether_addr_equal(hdr->addr3, sta->addr))
2204: ether_addr_copy(hdr->addr3, link_sta->addr);
2205: else if (ether_addr_equal(hdr->addr3, vif->addr))
2206: ether_addr_copy(hdr->addr3, bss_conf->addr);
2207: }
2208: /* no need to look at A4, if present it's SA */
2209: }
2210:
2211: chanctx_conf = rcu_dereference(bss_conf->chanctx_conf);
2212: if (chanctx_conf) {
2213: channel = chanctx_conf->def.chan;
2214: confbw = chanctx_conf->def.width;
2215: } else {
2216: channel = NULL;
2217: }
2218: }
2219:
2220: if (!unicast_data && ieee80211_encrypt_tx_skb(skb) < 0) {
2221: ieee80211_free_txskb(hw, skb);
2222: return;
2223: }
2224: /* re-assign hdr since skb data may have shifted after encryption */
2225: hdr = (void *)skb->data;
2226:
2227: if (WARN(!channel, "TX w/o channel - queue = %d\n", txi->hw_queue)) {
2228: ieee80211_free_txskb(hw, skb);
2229: return;
2230: }
2231:
2232: if (data->idle && !data->tmp_chan) {
2233: wiphy_dbg(hw->wiphy, "Trying to TX when idle - reject\n");
2234: ieee80211_free_txskb(hw, skb);
2235: return;
2236: }
2237:
2238: if (vif)
2239: hwsim_check_magic(vif);
2240: if (control->sta)
2241: hwsim_check_sta_magic(control->sta);
2242:
2243: if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
2244: ieee80211_get_tx_rates(vif, control->sta, skb,
2245: txi->control.rates,
2246: ARRAY_SIZE(txi->control.rates));
2247:
2248: for (i = 0; i < ARRAY_SIZE(txi->control.rates); i++) {
2249: u16 rflags = txi->control.rates[i].flags;
2250: /* initialize to data->bw for 5/10 MHz handling */
2251: enum nl80211_chan_width bw = data->bw;
2252:
2253: if (txi->control.rates[i].idx == -1)
2254: break;
2255:
2256: if (rflags & IEEE80211_TX_RC_40_MHZ_WIDTH)
2257: bw = NL80211_CHAN_WIDTH_40;
2258: else if (rflags & IEEE80211_TX_RC_80_MHZ_WIDTH)
2259: bw = NL80211_CHAN_WIDTH_80;
2260: else if (rflags & IEEE80211_TX_RC_160_MHZ_WIDTH)
2261: bw = NL80211_CHAN_WIDTH_160;
2262:
2263: if (WARN_ON(hwsim_get_chanwidth(bw) > hwsim_get_chanwidth(confbw)))
2264: return;
2265: }
2266:
2267: /* wmediumd mode check */
2268: _portid = READ_ONCE(data->wmediumd);
2269:
2270: if (_portid || hwsim_virtio_enabled)
2271: return mac80211_hwsim_tx_frame_nl(hw, skb, _portid, channel);
2272:
2273: /* NO wmediumd detected, perfect medium simulation */
2274: data->tx_pkts++;
2275: data->tx_bytes += skb->len;
2276: ack = mac80211_hwsim_tx_frame_no_nl(hw, skb, channel);
2277:
2278: if (ack && skb->len >= 16)
2279: mac80211_hwsim_monitor_ack(channel, hdr->addr2);
2280:
2281: ieee80211_tx_info_clear_status(txi);
2282:
2283: /* frame was transmitted at most favorable rate at first attempt */
2284: txi->control.rates[0].count = 1;
2285: txi->control.rates[1].idx = -1;
2286:
2287: if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) && ack)
2288: txi->flags |= IEEE80211_TX_STAT_ACK;
2289:
2290: if (tx_link_id >= 0) {
2291: txi->status.link_valid = 1;
2292: txi->status.link_id = tx_link_id;
2293: }
2294:
2295: ieee80211_tx_status_irqsafe(hw, skb);
2296: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 553/6 |
2026/09/07 08:24 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 36902
output: 50
thoughts: 141
Thoughts: **My Thought Process Regarding `mac80211_hwsim_tx` and Rate Control Table Support**
Right, I'm diving into the `mac80211_hwsim_tx` function, and my attention is immediately drawn to this conditional block:
```c
if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
ieee80211_get_tx_rates(vif, control->sta, skb,
txi->control.rates,
ARRAY_SIZE(txi->control.rates));
```
This code snippet is clearly attempting to retrieve transmit rates using `ieee80211_get_tx_rates` *only if* the hardware capabilities include `SUPPORTS_RC_TABLE`. This immediately triggers a critical question in my mind: does the `mac80211_hwsim` driver, which is simulating hardware, actually *set* this `SUPPORTS_RC_TABLE` flag in its hardware configuration?
My next step, therefore, must be to meticulously examine the hardware features that `mac80211_hwsim` configures when it initializes. I need to understand if it's simulating this particular capability, as the presence or absence of `SUPPORTS_RC_TABLE` will directly dictate whether this rate control table lookup logic is ever executed within the `mac80211_hwsim` context. If it doesn't set the flag, then this `if` condition will always be false, and the code within it will never run, which is a significant detail about the simulation's behavior.
|
| 554/6 |
2026/09/07 08:24 |
tool |
grepper |
0m
Error:
Args: map[Expression:IEEE80211_HW_ PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results:
|
| 555/6 |
2026/09/07 08:24 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 37091
output: 44
thoughts: 35
Thoughts: **My Thought Process on Identifying Potential Flag Usage in mac80211_hwsim_main.c**
Alright, so I'm diving into the `mac80211_hwsim` driver, and my immediate instinct is to get a handle on how it manages its internal state and configuration. For me, the most straightforward way to do that is by looking for common patterns that developers use to represent such things – and that's where flags come in.
My primary hypothesis is that there will be some sort of bitmask or a set of boolean flags used to control various aspects of the simulated hardware. These could dictate things like operational modes, hardware capabilities, or perhaps even error conditions. Therefore, my first action is to perform a targeted search within the core file, `mac80211_hwsim_main.c`.
I'm specifically looking for:
1. `flags`: This is the most generic and common identifier. If there's a central flag variable or a structure member named `flags`, it's a prime candidate for holding significant configuration information.
2. `flags2`: I'm also considering that more complex drivers might use a second set of flags, perhaps for newer features or a secondary set of operational states. This is a secondary, but still important, search term.
3. `hw->flags`: This is a more specific search. I know that `mac80211` drivers typically operate on a `struct ieee80211_hw` object, which represents the actual hardware. It's highly probable that the `mac80211_hwsim` driver will use a `flags` member within *this* structure to convey hardware-specific capabilities or operational states *to* the `mac80211` core. This search is particularly interesting because it suggests a direct interaction with the generic `mac80211` framework's view of the hardware.
My expectation is that finding these terms will lead me directly to variables that are set and checked throughout the code, giving me a clear picture of how the simulated hardware's behavior is being governed. This will be my starting point for understanding the driver's internal logic.
|
| 556/6 |
2026/09/07 08:24 |
tool |
grepper |
0m
Error:
Args: map[Expression:hw->flags PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results:
|
| 557/6 |
2026/09/07 08:24 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 37168
output: 52
thoughts: 51
Thoughts: **My Thought Process on Registering hwsim with ieee80211**
Right, so the first thing on my mind is to understand how this `hwsim` module, which I'm assuming is some kind of hardware simulation for Wi-Fi, actually hooks into the core `ieee80211` subsystem. To get a handle on that, I need to see where and how it's registering itself. My immediate instinct is to look for the function responsible for allocating and initializing the hardware structure within `mac80211`. A quick search for `ieee80211_alloc_hw` in the `mac80211_hwsim_main.c` file seems like the most direct and efficient way to pinpoint this registration point. This function is likely the entry point where `hwsim` presents its simulated hardware capabilities to the broader Wi-Fi driver framework.
|
| 558/6 |
2026/09/07 08:24 |
tool |
grepper |
0m
Args: map[Expression:ieee80211_alloc_hw PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=5674=static int mac80211_hwsim_new_radio(struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5698- ops = &mac80211_hwsim_mchan_ops;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5699: hw = ieee80211_alloc_hw_nm(sizeof(*data), ops, param->hwname);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5700- if (!hw) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5701: pr_debug("mac80211_hwsim: ieee80211_alloc_hw failed\n");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5702- err = -ENOMEM;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5705-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5706: /* ieee80211_alloc_hw_nm may have used a default name */
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5707- param->hwname = wiphy_name(hw->wiphy);
]
|
| 559/6 |
2026/09/07 08:24 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 37676
output: 50
thoughts: 32
Thoughts: **My Thought Process Regarding `mac80211_hwsim_new_radio`**
My immediate inclination is to dive into the specific code block you've pointed out, `mac80211_hwsim_new_radio`, with a particular focus between lines 5700 and 5800. As an expert in this domain, I understand that this section is likely to be crucial for the fundamental initialization and setup of a virtual radio device within the `mac80211_hwsim` framework.
My first thought is to meticulously examine the function's entry point within that range. I'll be looking for how the necessary data structures are allocated and populated. Specifically, I'll be paying close attention to the instantiation of the `ieee80211_hw` structure, as this is the primary representation of a hardware radio in the `mac80211` subsystem. What parameters are being set? Are there any hardware capabilities being emulated or simulated here that are particularly relevant to the overall behavior of the virtual radio?
I'll then trace the subsequent steps within that code segment. This will likely involve the registration of the virtual radio with the `mac80211` core. I'll be keen to see how the callbacks (e.g., for operations like TX, RX, configuration changes) are being registered. Are they pointing to the simulated implementations provided by `hwsim`, or are there any nuances in how these are hooked up? Understanding these callbacks is paramount to grasping how my virtual radio will interact with the higher layers of the networking stack.
Furthermore, I'll be scrutinizing the process of setting up any associated network interfaces. How is the `netdev` being created and associated with the `ieee80211_hw`? What configuration parameters are being applied at this stage, such as MTU, MAC address assignment, and initial interface flags?
I'll also be on the lookout for any error handling or sanity checks within this initialization phase. Given that this is a simulation, I anticipate robust checks to ensure the integrity of the virtual hardware setup. What are the potential failure points, and how does the code respond to them?
Finally, I will consider the implications of this initialization process on the overall `hwsim` functionality. How does the setup of this specific radio influence the ability to create multiple virtual radios, manage their interactions, and simulate various RF conditions? My focus will be on understanding the foundational elements that enable the rich simulation capabilities of `mac80211_hwsim`.
|
| 560/6 |
2026/09/07 08:24 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5700 LineCount:80]
Results: map[Contents:5700: if (!hw) {
5701: pr_debug("mac80211_hwsim: ieee80211_alloc_hw failed\n");
5702: err = -ENOMEM;
5703: goto failed;
5704: }
5705:
5706: /* ieee80211_alloc_hw_nm may have used a default name */
5707: param->hwname = wiphy_name(hw->wiphy);
5708:
5709: if (info)
5710: net = genl_info_net(info);
5711: else
5712: net = &init_net;
5713: wiphy_net_set(hw->wiphy, net);
5714:
5715: data = hw->priv;
5716: data->hw = hw;
5717:
5718: data->dev = device_create(&hwsim_class, NULL, 0, hw, "hwsim%d", idx);
5719: if (IS_ERR(data->dev)) {
5720: printk(KERN_DEBUG
5721: "mac80211_hwsim: device_create failed (%ld)\n",
5722: PTR_ERR(data->dev));
5723: err = -ENOMEM;
5724: goto failed_drvdata;
5725: }
5726: data->dev->driver = &mac80211_hwsim_driver.driver;
5727: err = device_bind_driver(data->dev);
5728: if (err != 0) {
5729: pr_debug("mac80211_hwsim: device_bind_driver failed (%d)\n",
5730: err);
5731: goto failed_bind;
5732: }
5733:
5734: skb_queue_head_init(&data->pending);
5735:
5736: SET_IEEE80211_DEV(hw, data->dev);
5737: if (!param->perm_addr) {
5738: eth_zero_addr(addr);
5739: addr[0] = 0x02;
5740: addr[3] = idx >> 8;
5741: addr[4] = idx;
5742: memcpy(data->addresses[0].addr, addr, ETH_ALEN);
5743: /* Why need here second address ? */
5744: memcpy(data->addresses[1].addr, addr, ETH_ALEN);
5745: data->addresses[1].addr[0] |= 0x40;
5746: memcpy(data->addresses[2].addr, addr, ETH_ALEN);
5747: data->addresses[2].addr[0] |= 0x50;
5748:
5749: hw->wiphy->n_addresses = 3;
5750: hw->wiphy->addresses = data->addresses;
5751: /* possible address clash is checked at hash table insertion */
5752: } else {
5753: memcpy(data->addresses[0].addr, param->perm_addr, ETH_ALEN);
5754: /* compatibility with automatically generated mac addr */
5755: memcpy(data->addresses[1].addr, param->perm_addr, ETH_ALEN);
5756: memcpy(data->addresses[2].addr, param->perm_addr, ETH_ALEN);
5757: hw->wiphy->n_addresses = 3;
5758: hw->wiphy->addresses = data->addresses;
5759: }
5760:
5761: data->channels = param->channels;
5762: data->use_chanctx = param->use_chanctx;
5763: data->idx = idx;
5764: data->destroy_on_close = param->destroy_on_close;
5765: if (info)
5766: data->portid = info->snd_portid;
5767:
5768: /* setup interface limits, only on interface types we support */
5769: if (param->iftypes & BIT(NL80211_IFTYPE_ADHOC)) {
5770: data->if_limits[n_limits].max = 1;
5771: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_ADHOC);
5772: n_limits++;
5773: }
5774:
5775: if (param->iftypes & HWSIM_DEFAULT_IF_LIMIT) {
5776: data->if_limits[n_limits].max = 2048;
5777: /*
5778: * For this case, we may only support a subset of
5779: * HWSIM_DEFAULT_IF_LIMIT, therefore we only want to add the
]
|
| 561/6 |
2026/09/07 08:24 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 39117
output: 50
thoughts: 22
Thoughts: **My Thought Process Regarding `mac80211_hwsim_new_radio`**
Ah, yes, I'm digging deeper into the `mac80211_hwsim` module, specifically focusing on the `mac80211_hwsim_new_radio` function. My current line of inquiry is centered on understanding the internal workings and behavior of this crucial function. I want to dissect its responsibilities, how it initializes and registers a new simulated radio device within the `mac80211` framework, and what parameters it expects or influences. I'm anticipating that this function will be key to setting up the fundamental attributes of a virtual wireless interface, and my next step is to trace its execution flow and examine the data structures it manipulates to gain a comprehensive grasp of its role.
|
| 562/6 |
2026/09/07 08:25 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5780 LineCount:80]
Results: map[Contents:5780: * bits that both param->iftype & HWSIM_DEFAULT_IF_LIMIT have.
5781: */
5782: data->if_limits[n_limits].types =
5783: HWSIM_DEFAULT_IF_LIMIT & param->iftypes;
5784: n_limits++;
5785: }
5786:
5787: if (param->iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
5788: data->if_limits[n_limits].max = 1;
5789: data->if_limits[n_limits].types =
5790: BIT(NL80211_IFTYPE_P2P_DEVICE);
5791: n_limits++;
5792: }
5793:
5794: if (param->iftypes & BIT(NL80211_IFTYPE_NAN)) {
5795: data->if_limits[n_limits].max = 1;
5796: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN);
5797: n_limits++;
5798:
5799: hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ) |
5800: BIT(NL80211_BAND_5GHZ);
5801:
5802: hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
5803: WIPHY_NAN_FLAGS_USERSPACE_DE;
5804: hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
5805: NAN_OP_MODE_80P80MHZ |
5806: NAN_OP_MODE_160MHZ;
5807:
5808: hw->wiphy->nan_capa.n_antennas = 0x22;
5809: hw->wiphy->nan_capa.max_channel_switch_time = 0;
5810:
5811: wiphy_ext_feature_set(hw->wiphy,
5812: NL80211_EXT_FEATURE_SECURE_NAN);
5813:
5814: hrtimer_setup(&data->nan.slot_timer,
5815: mac80211_hwsim_nan_slot_timer,
5816: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5817: hrtimer_setup(&data->nan.resume_txqs_timer,
5818: mac80211_hwsim_nan_resume_txqs_timer,
5819: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5820: hrtimer_setup(&data->nan.discovery_beacon_timer,
5821: mac80211_hwsim_nan_discovery_beacon_timer,
5822: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5823:
5824: spin_lock_init(&data->nan.state_lock);
5825: }
5826:
5827: if (param->iftypes & BIT(NL80211_IFTYPE_NAN_DATA)) {
5828: data->if_limits[n_limits].max = 2;
5829: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN_DATA);
5830: n_limits++;
5831:
5832: hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap;
5833: hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap;
5834: hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap;
5835:
5836: /*
5837: * NAN switches between bands/channels per its schedule,
5838: * so mac80211 rate control can't work here.
5839: */
5840: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5841: }
5842:
5843: data->if_combination.radar_detect_widths =
5844: BIT(NL80211_CHAN_WIDTH_5) |
5845: BIT(NL80211_CHAN_WIDTH_10) |
5846: BIT(NL80211_CHAN_WIDTH_20_NOHT) |
5847: BIT(NL80211_CHAN_WIDTH_20) |
5848: BIT(NL80211_CHAN_WIDTH_40) |
5849: BIT(NL80211_CHAN_WIDTH_80) |
5850: BIT(NL80211_CHAN_WIDTH_160);
5851:
5852: if (data->use_chanctx) {
5853: hw->wiphy->max_scan_ssids = 255;
5854: hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
5855: hw->wiphy->max_remain_on_channel_duration = 1000;
5856: data->if_combination.num_different_channels = data->channels;
5857: } else {
5858: data->if_combination.num_different_channels = 1;
5859: }
]
|
| 563/6 |
2026/09/07 08:25 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 40745
output: 20
thoughts: 89
Thoughts: **A Deep Dive into Rate Control in mac80211's Hardware Simulation**
My immediate thought is to understand the conditions under which rate control (`HAS_RATE_CONTROL`) is enabled within the `mac80211_hwsim` module. I've noted a specific dependency: it's only set if the `param->iftypes` bitmask includes `BIT(NL80211_IFTYPE_NAN_DATA)`. This is a very granular condition, and it prompts me to question the broader implications for rate control support within `mac80211` itself.
To get a clearer picture, I need to investigate the `SUPPORTS_RC_TABLE` flag. My next step is to perform a comprehensive search, not just within `mac80211_hwsim`, but across all other drivers and the core `mac80211` framework. I'm trying to ascertain how prevalent `SUPPORTS_RC_TABLE` is and in what contexts it's utilized. This will help me determine if the `NAN_DATA` interface type is a unique enabler for rate control in `hwsim`, or if it's part of a larger pattern or a specific, perhaps experimental, feature set. My goal is to understand the underlying design philosophy and the technical rationale behind these rate control enablement conditions.
|
| 564/6 |
2026/09/07 08:25 |
tool |
grepper |
0m
Args: map[Expression:SUPPORTS_RC_TABLE]
Results: map[Output:drivers/net/wireless/ath/ath5k/base.c=2575=ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
--
drivers/net/wireless/ath/ath5k/base.c-2583- SET_IEEE80211_DEV(hw, ah->dev);
drivers/net/wireless/ath/ath5k/base.c:2584: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
drivers/net/wireless/ath/ath5k/base.c-2585- ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
--
drivers/net/wireless/ath/ath9k/init.c=903=static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
--
drivers/net/wireless/ath/ath9k/init.c-908- ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
drivers/net/wireless/ath/ath9k/init.c:909: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
drivers/net/wireless/ath/ath9k/init.c-910- ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
--
drivers/net/wireless/ath/carl9170/main.c=1747=void *carl9170_alloc(size_t priv_size)
--
drivers/net/wireless/ath/carl9170/main.c-1823- ieee80211_hw_set(hw, NEED_DTIM_BEFORE_ASSOC);
drivers/net/wireless/ath/carl9170/main.c:1824: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
drivers/net/wireless/ath/carl9170/main.c-1825- ieee80211_hw_set(hw, SIGNAL_DBM);
--
drivers/net/wireless/mediatek/mt76/mac80211.c=427=mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw)
--
drivers/net/wireless/mediatek/mt76/mac80211.c-474- ieee80211_hw_set(hw, AMPDU_AGGREGATION);
drivers/net/wireless/mediatek/mt76/mac80211.c:475: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
drivers/net/wireless/mediatek/mt76/mac80211.c-476- ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
--
drivers/net/wireless/mediatek/mt7601u/init.c=574=int mt7601u_register_device(struct mt7601u_dev *dev)
--
drivers/net/wireless/mediatek/mt7601u/init.c-599- ieee80211_hw_set(hw, AMPDU_AGGREGATION);
drivers/net/wireless/mediatek/mt7601u/init.c:600: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
drivers/net/wireless/mediatek/mt7601u/init.c-601- ieee80211_hw_set(hw, MFP_CAPABLE);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2104=static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2242-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2243: if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2244- ieee80211_get_tx_rates(vif, control->sta, skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2409=void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2415-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2416: if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE)) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2417- struct ieee80211_tx_info *txi = IEEE80211_SKB_CB(skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2432=static void __mac80211_hwsim_beacon_tx(struct ieee80211_bss_conf *link_conf,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2447- info = IEEE80211_SKB_CB(skb);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2448: if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2449- ieee80211_get_tx_rates(vif, NULL, skb,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=5674=static int mac80211_hwsim_new_radio(struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5934- if (rctbl)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5935: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5936- }
--
include/net/mac80211.h=2825=struct ieee80211_txq {
--
include/net/mac80211.h-2956- *
include/net/mac80211.h:2957: * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate
include/net/mac80211.h-2958- * selection table provided by the rate control algorithm.
--
include/net/mac80211.h=3091=enum ieee80211_hw_flags {
--
include/net/mac80211.h-3114- IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
include/net/mac80211.h:3115: IEEE80211_HW_SUPPORTS_RC_TABLE,
include/net/mac80211.h-3116- IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF,
--
net/mac80211/debugfs.c=405=static const char *hw_flag_names[] = {
--
net/mac80211/debugfs.c-429- FLAG(TX_AMPDU_SETUP_IN_HW),
net/mac80211/debugfs.c:430: FLAG(SUPPORTS_RC_TABLE),
net/mac80211/debugfs.c-431- FLAG(P2P_DEV_ADDR_FOR_INTF),
--
net/mac80211/rate.c=919=void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/rate.c-953-
net/mac80211/rate.c:954: if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))
net/mac80211/rate.c-955- return;
]
|
| 565/6 |
2026/09/07 08:25 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 43145
output: 50
thoughts: 94
Thoughts: **A Deep Dive into `mac80211_hwsim_new_radio` and the Mysterious `rctbl`**
As I delve into the `mac80211_hwsim_new_radio` function, my attention is immediately caught by a conditional statement: `if (rctbl) ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);`. My immediate thought is, "What exactly *is* `rctbl`?" This variable, seemingly crucial for enabling RC table support, is not immediately defined within the scope of this function.
My internal knowledge base, informed by extensive experience in wireless driver development, tells me that such configuration data is often passed down from higher levels or initialized elsewhere. Therefore, my next logical step is to trace its origin. I know that `mac80211_hwsim_main.c` is the central hub for this simulation module. Given the context, it's highly probable that `rctbl` is either defined or initialized within this main file. My instinct, honed by countless hours debugging kernel modules, directs me to a specific area: line 5930. I suspect that near this line, I'll find the declaration or instantiation of `rctbl`, which will shed light on how this radio hardware simulation is configured to support RC tables. This is a critical piece of information for understanding the capabilities of the simulated hardware.
|
| 566/6 |
2026/09/07 08:25 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5910 LineCount:40]
Results: map[Contents:5910: ieee80211_hw_set(hw, AMPDU_AGGREGATION);
5911: ieee80211_hw_set(hw, MFP_CAPABLE);
5912: ieee80211_hw_set(hw, SIGNAL_DBM);
5913: ieee80211_hw_set(hw, SUPPORTS_PS);
5914: ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
5915: ieee80211_hw_set(hw, TDLS_WIDER_BW);
5916: ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
5917: ieee80211_hw_set(hw, STRICT);
5918: ieee80211_hw_set(hw, BUFF_MMPDU_TXQ);
5919: ieee80211_hw_set(hw, STA_MMPDU_TXQ);
5920:
5921: if (param->mlo) {
5922: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
5923: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5924: ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
5925: ieee80211_hw_set(hw, CONNECTION_MONITOR);
5926: ieee80211_hw_set(hw, AP_LINK_PS);
5927:
5928: hw->wiphy->iftype_ext_capab = mac80211_hwsim_iftypes_ext_capa;
5929: hw->wiphy->num_iftype_ext_capab =
5930: ARRAY_SIZE(mac80211_hwsim_iftypes_ext_capa);
5931: } else {
5932: ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
5933: ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
5934: if (rctbl)
5935: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
5936: }
5937:
5938: hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
5939: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
5940: WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
5941: WIPHY_FLAG_AP_UAPSD |
5942: WIPHY_FLAG_HAS_CHANNEL_SWITCH;
5943: hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
5944: hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
5945: NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
5946: NL80211_FEATURE_STATIC_SMPS |
5947: NL80211_FEATURE_DYNAMIC_SMPS |
5948: NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
5949: NL80211_FEATURE_AP_SCAN;
]
|
| 567/6 |
2026/09/07 08:25 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 44229
output: 44
thoughts: 23
Thoughts: **My Thought Process**
I need to understand the initial state of `rctbl`. To do that, my immediate next step is to trace back its definition. I'll be looking for the first assignment or declaration that sets its initial value.
|
| 568/6 |
2026/09/07 08:25 |
tool |
grepper |
0m
Args: map[Expression:rctbl PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=61=MODULE_PARM_DESC(paged_rx, "Use paged SKBs for RX instead of linear ones");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-62-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:63:static bool rctbl = false;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:64:module_param(rctbl, bool, 0444);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:65:MODULE_PARM_DESC(rctbl, "Handle rate control table");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-66-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=5674=static int mac80211_hwsim_new_radio(struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5933- ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5934: if (rctbl)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5935- ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
]
|
| 569/6 |
2026/09/07 08:25 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 44705
output: 30
thoughts: 551
Thoughts: **My Thought Process on the Reproducer Failure**
Okay, so I'm trying to understand why this reproducer isn't triggering the `WARNING in mac80211_hwsim_write_tsf` with `c->control.rates[0].idx < 0` that the user is experiencing. The reproducer's flow seems pretty straightforward: it sends a packet via AF_PACKET to `wlan0` in monitor mode, with a radiotap header specifying `IEEE80211_RADIOTAP_RATE` and rate=0. I understand that `ieee80211_parse_tx_radiotap` handles this by setting `idx = -1` and clearing `IEEE80211_TX_CTRL_RATE_INJECT`. Then, `mac80211_hwsim_tx_frame_no_nl` is supposed to call `mac80211_hwsim_write_tsf`, which in turn calls `mac80211_hwsim_get_tx_rate`, and that's where the warning should be triggered.
The perplexing part is that the reproducer is exiting cleanly with a 0 status, no crash, and no observable warning. This suggests that the path to `mac80211_hwsim_write_tsf` isn't being fully executed, or perhaps the warning isn't surfacing as expected.
The user's prompt specifically asks: "Why did the reproducer fail to trigger the bug?" and then offers a hypothesis: "Is it because `cfg80211_reg_can_beacon` returns false in `ieee80211_monitor_start_xmit`? Or is there another check?"
This is precisely what I need to investigate. The user's question points me towards a specific function, `ieee80211_monitor_start_xmit`, and a condition within it, `cfg80211_reg_can_beacon`. My immediate thought is to verify if this function is indeed called and what the return value of `cfg80211_reg_can_beacon` is in this scenario. It's possible that this check, or another one within `ieee80211_monitor_start_xmit` (or even earlier in the frame transmission path), is preventing the code from reaching the point where the `mac80211_hwsim_write_tsf` warning would be triggered.
So, my next step is to dive into the kernel source code. I need to locate `cfg80211_reg_can_beacon` – I'm assuming it's in `net/wireless/reg.c`, but I'll confirm that. Then, I'll trace the execution flow starting from the packet injection by the reproducer, paying close attention to how `ieee80211_monitor_start_xmit` is invoked and what the outcome of the `cfg80211_reg_can_beacon` check is. I'm looking for any early exit conditions or logic that would short-circuit the expected path to the `mac80211_hwsim_write_tsf` call.
|
| 570/6 |
2026/09/07 08:25 |
tool |
codesearch-definition-source |
0m
Args: map[Name:cfg80211_reg_can_beacon]
Results: map[SourceCode:9950: /**
9951: * cfg80211_reg_can_beacon - check if beaconing is allowed
9952: * @wiphy: the wiphy
9953: * @chandef: the channel definition
9954: * @iftype: interface type
9955: *
9956: * Return: %true if there is no secondary channel or the secondary channel(s)
9957: * can be used for beaconing (i.e. is not a radar channel etc.)
9958: */
9959: static inline bool
9960: cfg80211_reg_can_beacon(struct wiphy *wiphy,
9961: struct cfg80211_chan_def *chandef,
9962: enum nl80211_iftype iftype)
9963: {
9964: struct cfg80211_beaconing_check_config config = {
9965: .iftype = iftype,
9966: };
9967:
9968: return cfg80211_reg_check_beaconing(wiphy, chandef, &config);
9969: }
SourceFile:include/net/cfg80211.h]
|
| 571/6 |
2026/09/07 08:25 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 45630
output: 31
thoughts: 19
Thoughts: **A Deep Dive into `cfg80211_reg_check_beaconing`**
Okay, so I'm looking at this `cfg80211_reg_check_beaconing` function. My immediate thought is that its name clearly indicates its purpose: to perform some kind of regulatory check specifically related to beaconing activities within the `cfg80211` subsystem. Given my expertise, I'm anticipating this will involve verifying compliance with spectrum regulations – things like power limits, channel usage restrictions, and potentially even DFS (Dynamic Frequency Selection) requirements, especially if it's interacting with devices that operate in licensed or shared spectrum bands.
I'm hypothesizing that this function is likely a gatekeeper, meaning it's probably called *before* a device is allowed to start transmitting beacons, or perhaps at regular intervals to ensure continued compliance. The "reg" in the name strongly suggests a connection to the regulatory domain information that the kernel maintains, which dictates what operations are permissible based on geographic location and the device's capabilities.
My mind immediately goes to the specific parameters this function might accept. I'd expect it to need information about the device itself – perhaps a `wdev` (wireless device) pointer or a similar structure that encapsulates device state and capabilities. It also almost certainly needs to know *what* regulatory checks are relevant, so perhaps arguments related to the channel, transmit power, and the specific type of transmission (beaconing, in this case) are involved. It’s also possible it might need to consider the current regulatory state, like whether DFS is currently active or if there are any active radar detections that would impact beaconing.
I'm picturing a flow where `cfg80211_reg_check_beaconing` would query the regulatory database for the relevant rules pertaining to the operating channel and desired transmit power. Then, it would compare the planned beaconing parameters against these rules. This comparison would likely involve checks for:
* **Channel Availability:** Is the target channel allowed for beaconing in this regulatory domain? Are there any DFS requirements that need to be met?
* **Transmit Power Limits:** Is the intended transmit power within the limits for this channel and this device type? This isn't just about the maximum allowed, but potentially also about specific power spectral density (PSD) requirements.
* **Device Capabilities:** Does the hardware actually support operating on this channel with the specified power?
* **Time Restrictions:** Are there any time-of-day restrictions or other temporal constraints on beaconing on this channel?
The return value is crucial, of course. I'd expect a boolean (`true` for allowed, `false` for denied) or an error code, indicating success or the reason for failure. If it fails, I'd anticipate that the calling code would then take appropriate action, such as denying the beacon transmission, attempting to switch to a different channel, or initiating a DFS procedure.
Furthermore, I'm considering the context of where this function sits within the `cfg80211` stack. It's likely part of the core regulatory compliance logic, interacting with other components that manage device configuration and actual radio hardware control. It's a critical piece of ensuring that wireless devices operate responsibly and legally. My focus is on ensuring the robustness and accuracy of these checks, as missteps here can lead to interference and regulatory non-compliance. I'll be looking closely at how it handles edge cases and potential race conditions, especially in dynamic environments.
|
| 572/6 |
2026/09/07 08:25 |
tool |
codesearch-definition-source |
0m
Args: map[Name:cfg80211_reg_check_beaconing]
Results: map[SourceCode:1779: bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,
1780: struct cfg80211_chan_def *chandef,
1781: struct cfg80211_beaconing_check_config *cfg)
1782: {
1783: struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1784: u32 permitting_flags = 0;
1785: bool check_no_ir = true;
1786:
1787: /*
1788: * Under certain conditions suggested by some regulatory bodies a
1789: * GO/STA can IR on channels marked with IEEE80211_NO_IR. Set this flag
1790: * only if such relaxations are not enabled and the conditions are not
1791: * met.
1792: */
1793: if (cfg->relax) {
1794: lockdep_assert_held(&rdev->wiphy.mtx);
1795: check_no_ir = !cfg80211_ir_permissive_chan(wiphy, cfg->iftype,
1796: chandef->chan);
1797: }
1798:
1799: if (cfg->reg_power == IEEE80211_REG_VLP_AP)
1800: permitting_flags |= IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP;
1801:
1802: if ((cfg->iftype == NL80211_IFTYPE_P2P_GO ||
1803: cfg->iftype == NL80211_IFTYPE_AP) &&
1804: (chandef->width == NL80211_CHAN_WIDTH_20_NOHT ||
1805: chandef->width == NL80211_CHAN_WIDTH_20))
1806: permitting_flags |= IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY;
1807:
1808: return _cfg80211_reg_can_beacon(wiphy, chandef, cfg->iftype,
1809: check_no_ir ? IEEE80211_CHAN_NO_IR : 0,
1810: permitting_flags);
1811: }
SourceFile:net/wireless/chan.c]
|
| 573/6 |
2026/09/07 08:25 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 46349
output: 31
thoughts: 19
Thoughts: **My Thought Process Regarding `_cfg80211_reg_can_beacon`**
Okay, so the first thing I'm doing here is diving into the `_cfg80211_reg_can_beacon` function. My immediate goal is to understand precisely what this function is intended to do and what its role is within the broader `cfg80211` subsystem. I'm not just looking at the surface-level; I want to get to the core logic.
My initial hypothesis is that this function is a gatekeeper, a crucial validation step. Given its name, it almost certainly relates to determining whether a regulatory domain configuration permits a device to transmit beacon frames. This is a pretty fundamental aspect of wireless operation – you can't just start blasting beacons without adhering to the rules of the radio environment.
So, what *are* those rules? I'm thinking about things like:
* **Frequency Bands and Channels:** Is the specific channel the device intends to use for its beacon allowed in this particular regulatory domain? Are there any restrictions on particular bands (e.g., 2.4 GHz, 5 GHz, 6 GHz) that might affect beaconing?
* **Power Limits:** Beacon frames, while small, still consume power. Is the requested transmit power for the beacon within the allowed limits for that channel and country code? Regulatory domains are heavily influenced by power restrictions.
* **Country Codes and Geolocation:** This is paramount. The regulatory domain is almost always tied to a specific country or region. I need to understand how the function uses or checks the current country code setting. Are there specific rules for certain countries that would prevent beaconing on certain channels?
* **Device Capabilities and Configuration:** While the function is named around `reg_can_beacon`, it's possible it also implicitly checks some device-level capabilities or configurations that are relevant to beaconing in the context of the regulatory environment. For instance, if the device is not even capable of operating on a particular channel, the regulatory check might be moot.
* **DFS (Dynamic Frequency Selection):** If the target channel is in a radar-sensitive band (like certain 5 GHz channels), DFS procedures might be involved. I'm curious if `_cfg80211_reg_can_beacon` directly checks DFS status or if it relies on other parts of the system to ensure DFS compliance before even getting to this point.
* **Other Regulatory Constraints:** There might be other, less common, regulatory constraints that could impact beacon transmission, such as specific timing requirements, bandwidth limitations on certain channels, or even restrictions on certain types of network traffic (though beacons are usually quite general).
As I dissect the code, I'll be looking for specific data structures and parameters being passed in. What information does `_cfg80211_reg_can_beacon` receive? Likely things like the `wiphy` (wireless hardware interface) object, the channel information (frequency, bandwidth), and potentially the desired transmit power level. The return value will be equally important – a boolean indicating success or failure, or perhaps an error code that provides more granular information about *why* beaconing is not permitted.
Ultimately, my goal is to trace the flow of control and data. I want to see how it interacts with the underlying regulatory database or ruleset. Is it a direct lookup? Does it perform calculations based on parameters? Does it query other kernel modules or hardware drivers? Understanding these interactions will give me the complete picture of how the system enforces regulatory compliance for beacon transmissions. It’s about ensuring the device plays by the rules, and this function seems to be a key enforcer of those rules.
|
| 574/6 |
2026/09/07 08:26 |
tool |
codesearch-definition-source |
0m
Args: map[Name:_cfg80211_reg_can_beacon]
Results: map[SourceCode:1739: static bool _cfg80211_reg_can_beacon(struct wiphy *wiphy,
1740: struct cfg80211_chan_def *chandef,
1741: enum nl80211_iftype iftype,
1742: u32 prohibited_flags,
1743: u32 permitting_flags)
1744: {
1745: bool res, check_radar;
1746: int dfs_required;
1747:
1748: trace_cfg80211_reg_can_beacon(wiphy, chandef, iftype,
1749: prohibited_flags,
1750: permitting_flags);
1751:
1752: if (!_cfg80211_chandef_usable(wiphy, chandef,
1753: IEEE80211_CHAN_DISABLED, 0))
1754: return false;
1755:
1756: dfs_required = cfg80211_chandef_dfs_required(wiphy, chandef, iftype);
1757: check_radar = dfs_required != 0;
1758:
1759: if (dfs_required > 0 &&
1760: cfg80211_chandef_dfs_available(wiphy, chandef)) {
1761: /* We can skip IEEE80211_CHAN_NO_IR if chandef dfs available */
1762: prohibited_flags &= ~IEEE80211_CHAN_NO_IR;
1763: check_radar = false;
1764: }
1765:
1766: if (check_radar &&
1767: !_cfg80211_chandef_usable(wiphy, chandef,
1768: IEEE80211_CHAN_RADAR, 0))
1769: return false;
1770:
1771: res = _cfg80211_chandef_usable(wiphy, chandef,
1772: prohibited_flags,
1773: permitting_flags);
1774:
1775: trace_cfg80211_return_bool(res);
1776: return res;
1777: }
SourceFile:net/wireless/chan.c]
|
| 575/6 |
2026/09/07 08:26 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 47057
output: 31
thoughts: 191
Thoughts: **My Thought Process Regarding `ieee80211_monitor_start_xmit` and Channel Definitions**
Okay, so I'm looking at this `ieee80211_monitor_start_xmit` function, and I immediately hit this conditional:
```c
if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef,
sdata->vif.type))
goto fail_rcu;
```
My first thought is a critical question: what *exactly* is `sdata->vif.type` when the interface, let's say `wlan0`, is operating in monitor mode? I know that `sdata->vif.type` will reflect the current interface type. In this specific scenario, it will be `NL80211_IFTYPE_MONITOR`, or whatever the specific monitor interface type is.
This leads to another, even more specific, question that immediately pops into my head: what is the behavior of `cfg80211_chandef_dfs_required(wiphy, chandef, NL80211_IFTYPE_MONITOR)`? I need to dive into that function's implementation to understand its implications. This is crucial because if DFS (Dynamic Frequency Selection) is unexpectedly required for a monitor interface under certain channel definitions, it could have significant operational consequences.
|
| 576/6 |
2026/09/07 08:26 |
tool |
codesearch-definition-source |
0m
Args: map[Name:cfg80211_chandef_dfs_required]
Results: map[SourceCode:1015: int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
1016: const struct cfg80211_chan_def *chandef,
1017: enum nl80211_iftype iftype)
1018: {
1019: int width;
1020: int ret;
1021:
1022: if (WARN_ON(!cfg80211_chandef_valid(chandef)))
1023: return -EINVAL;
1024:
1025: switch (iftype) {
1026: case NL80211_IFTYPE_ADHOC:
1027: case NL80211_IFTYPE_AP:
1028: case NL80211_IFTYPE_P2P_GO:
1029: case NL80211_IFTYPE_MESH_POINT:
1030: case NL80211_IFTYPE_NAN:
1031: width = cfg80211_chandef_get_width(chandef);
1032: if (width < 0)
1033: return -EINVAL;
1034:
1035: ret = cfg80211_get_chans_dfs_required(wiphy, chandef, iftype);
1036:
1037: return (ret > 0) ? BIT(chandef->width) : ret;
1038: break;
1039: case NL80211_IFTYPE_STATION:
1040: case NL80211_IFTYPE_OCB:
1041: case NL80211_IFTYPE_P2P_CLIENT:
1042: case NL80211_IFTYPE_MONITOR:
1043: case NL80211_IFTYPE_AP_VLAN:
1044: case NL80211_IFTYPE_P2P_DEVICE:
1045: case NL80211_IFTYPE_NAN_DATA:
1046: case NL80211_IFTYPE_PD:
1047: break;
1048: case NL80211_IFTYPE_WDS:
1049: case NL80211_IFTYPE_UNSPECIFIED:
1050: case NUM_NL80211_IFTYPES:
1051: WARN_ON(1);
1052: }
1053:
1054: return 0;
1055: }
SourceFile:net/wireless/chan.c]
|
| 577/6 |
2026/09/07 08:26 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 47998
output: 52
thoughts: 161
Thoughts: **My Thought Process Regarding Channel Usability in Monitor Mode**
My initial line of inquiry is focused on the behavior of channel definitions within the `cfg80211` framework, specifically concerning monitor interfaces (`NL80211_IFTYPE_MONITOR`). I'm observing that for this interface type, the `cfg80211_chandef_dfs_required` function evaluates to `0`. This leads me to conclude that `check_radar` will consequently evaluate to `false`.
The next critical step in my analysis is the call to `_cfg80211_chandef_usable`. My attention is immediately drawn to the `prohibited_flags` argument, which is being set to `IEEE80211_CHAN_NO_IR`. This flag signifies channels that are not permitted for Initiator/Responder operations, and its presence here immediately sparks a question in my mind: what specific channels within the `hwsim` (hardware simulation) environment are marked with this `IEEE80211_CHAN_NO_IR` flag?
This leads me to a further, more fundamental question: how are the channels in `hwsim` initialized in the first place? To answer this, I've decided to delve into the source code, specifically looking for the channel initialization logic within `mac80211_hwsim_main.c`. Understanding the default configuration and any specific flags applied during initialization of `hwsim` channels is paramount to fully grasping why `IEEE80211_CHAN_NO_IR` might be relevant in this context, even for a monitor interface, and to accurately predict the outcome of `_cfg80211_chandef_usable`.
|
| 578/6 |
2026/09/07 08:26 |
tool |
grepper |
0m
Error:
Args: map[Expression:mac80211_hwsim_channels PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results:
|
| 579/6 |
2026/09/07 08:26 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 48209
output: 43
thoughts: 26
Thoughts: **My Thought Process on `mac80211_hwsim` Channel and Band Initialization**
My primary objective right now is to understand the foundational setup within the `mac80211_hwsim` driver, specifically how it handles the initialization of wireless channels and frequency bands. I'm diving into `mac80211_hwsim_main.c` because that's where the core entry points and global structures for this hardware simulation module are likely to reside.
I expect to see functions or structures that define the available frequency bands (like 2.4 GHz and 5 GHz) and then, for each band, how it enumerates and registers the specific channels within that band. This would likely involve looking for:
* **Band definitions:** Data structures that represent the 802.11 bands (e.g., `IEEE80211_BAND_2GHZ`, `IEEE80211_BAND_5GHZ`).
* **Channel lists:** Arrays or lists of channel structures (`struct ieee80211_channel`) that specify frequency, bandwidth capabilities, flags (like DFS, passive scanning), and other relevant parameters.
* **Initialization routines:** C functions that are called early in the driver's lifecycle to populate these band and channel structures. This might involve a loop that iterates through known channel definitions or a more dynamic allocation process based on some configuration.
* **Registration:** How these initialized bands and channels are communicated to the `mac80211` core. There should be some kind of registration mechanism where the `hwsim` device declares what it can support.
By tracing these elements in `mac80211_hwsim_main.c`, I aim to get a clear picture of how `mac80211_hwsim` presents itself to the rest of the Linux wireless subsystem in terms of its RF capabilities. This is crucial for understanding how simulated clients and access points will interact with the driver and what constraints or possibilities exist in the simulated environment.
|
| 580/6 |
2026/09/07 08:26 |
tool |
grepper |
0m
Args: map[Expression:bands\[ PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=5674=static int mac80211_hwsim_new_radio(struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5989- for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5990: struct ieee80211_supported_band *sband = &data->bands[band];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5991- struct wiphy_radio_freq_range *radio_range;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6060-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6061: hw->wiphy->bands[band] = sband;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6062-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6484=static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6581- rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6582: if (rx_status.rate_idx >= data2->hw->wiphy->bands[rx_status.band]->n_bitrates)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6583- goto out;
]
|
| 581/6 |
2026/09/07 08:26 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 48794
output: 29
thoughts: 2602
Thoughts: **The Root Cause of the Missing Warning: A Chain of Misinterpretations**
My initial investigation into why the reproducer failed to trigger the `WARNING in mac80211_hwsim_write_tsf` with `c->control.rates[0].idx < 0` was based on a seemingly straightforward understanding of the packet transmission flow. The reproducer, I thought, was setting up a scenario where a RADIOTAP header with `IEEE80211_RADIOTAP_RATE` and a rate of 0 would be sent via AF_PACKET to a monitor mode interface. My assumption was that `ieee80211_parse_tx_radiotap` would then dutifully set `idx = -1` and clear `IEEE80211_TX_CTRL_RATE_INJECT`. Subsequently, `mac80211_hwsim_tx_frame_no_nl` would call `mac80211_hwsim_write_tsf`, which in turn calls `mac80211_hwsim_get_tx_rate` and then `ieee80211_get_tx_rate`, ultimately leading to the warning. The puzzle was why this chain didn't result in the expected warning, and the reproducer exited cleanly.
I then began a detailed, step-by-step re-examination of this assumed flow, starting from the initial packet reception in `ieee80211_monitor_start_xmit`. I questioned whether `ieee80211_monitor_start_xmit` would even have a valid `chanctx_conf` or `chandef` in a monitor mode setup, especially if the channel wasn't explicitly configured. I considered if `cfg80211_reg_can_beacon` might be involved.
However, the critical point of divergence came when I focused intently on the behavior of `ieee80211_parse_tx_radiotap`. The user's statement was that `rate=0` would lead to `idx = -1` and clearing `IEEE80211_TX_CTRL_RATE_INJECT`. While `idx` indeed becomes `-1` when `rate=0` and no matching bitrate is found in `sband->bitrates` using `rate * 5 != sband->bitrates[i].bitrate`, the crucial detail is that `IEEE80211_TX_CTRL_RATE_INJECT` *is* cleared in this specific scenario. This was the first crack in my initial hypothesis.
The flow then leads to `ieee80211_xmit`, `ieee80211_tx`, and importantly, `ieee80211_tx_prepare`. The subsequent call to `invoke_tx_handlers_late(&tx)` brought me to a pivotal realization. The code within `invoke_tx_handlers_late` checks `ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL)`. Here's where the `mac80211_hwsim` driver plays a key role: it *doesn't* set `HAS_RATE_CONTROL` by default (unless specific features like NAN_DATA or MLO are enabled). Consequently, `ieee80211_tx_h_rate_ctrl(&tx)` is invoked.
Now, within `ieee80211_tx_h_rate_ctrl`, there's a check: `if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT) return TX_CONTINUE;`. Because `IEEE80211_TX_CTRL_RATE_INJECT` was *cleared* in `ieee80211_parse_tx_radiotap` when `rates[0].idx` became `-1`, this condition is *false*. The code proceeds to call `rate_control_get_rate(tx->sdata, tx->sta, &txrc)`.
This is the turning point. Inside `rate_control_get_rate`, and then `rate_control_send_low`, and finally `__rate_control_send_low`, the `info->control.rates[0].idx` is *overwritten*. It's reset to a valid rate index, typically `0`, by iterating through available bitrates. This means that by the time `mac80211_hwsim_write_tsf` (or `drv_tx`) is called, `rates[0].idx` is no longer negative. It's a valid index, say `0`. Therefore, the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` condition in `mac80211_hwsim_write_tsf` is never met.
So, my initial understanding of the warning being *directly* triggered by the negative index from `ieee80211_parse_tx_radiotap` was flawed. The actual reason the warning *didn't* trigger is that the rate control mechanism, being invoked due to the absence of `IEEE80211_TX_CTRL_RATE_INJECT`, overwrites the negative index with a valid one before the `WARN_ON_ONCE` check is reached. The question then shifts from "why didn't the warning trigger?" to "how did syzkaller manage to trigger it in the first place?" and necessitates a deeper dive into the specific conditions under which that warning *is* indeed raised.
|
| 582/6 |
2026/09/07 08:26 |
tool |
grepper |
0m
Args: map[Expression:IEEE80211_TX_CTRL_RATE_INJECT]
Results: map[Output:drivers/net/wireless/intel/iwlwifi/mld/tx.c=486=static __le32 iwl_mld_get_tx_rate_n_flags(struct iwl_mld *mld,
--
drivers/net/wireless/intel/iwlwifi/mld/tx.c-491-
drivers/net/wireless/intel/iwlwifi/mld/tx.c:492: if (unlikely(info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))
drivers/net/wireless/intel/iwlwifi/mld/tx.c-493- rate = iwl_mld_get_inject_tx_rate(mld, info, sta, fc);
--
drivers/net/wireless/intel/iwlwifi/mld/tx.c=540=iwl_mld_fill_tx_cmd(struct iwl_mld *mld, struct sk_buff *skb,
--
drivers/net/wireless/intel/iwlwifi/mld/tx.c-567- (mld_sta && mld_sta->vif->type == NL80211_IFTYPE_NAN) ||
drivers/net/wireless/intel/iwlwifi/mld/tx.c:568: info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)) {
drivers/net/wireless/intel/iwlwifi/mld/tx.c-569- flags |= IWL_TX_FLAGS_CMD_RATE;
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c=380=static __le32 iwl_mvm_get_tx_rate_n_flags(struct iwl_mvm *mvm,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-385-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:386: if (unlikely(info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-387- rate = iwl_mvm_get_inject_tx_rate(mvm, info, sta, fc);
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c=398=void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-422- if (likely(ieee80211_is_data(fc) && sta &&
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:423: !(info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))) {
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-424- struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c=514=static bool iwl_mvm_use_host_rate(struct iwl_mvm *mvm,
--
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-521-
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:522: if (unlikely(info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT))
drivers/net/wireless/intel/iwlwifi/mvm/tx.c-523- return true;
--
include/net/mac80211.h=1076=enum mac80211_tx_info_flags {
--
include/net/mac80211.h-1120- * frame (PS-Poll or uAPSD).
include/net/mac80211.h:1121: * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
include/net/mac80211.h-1122- * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
--
include/net/mac80211.h=1147=enum mac80211_tx_control_flags {
--
include/net/mac80211.h-1149- IEEE80211_TX_CTRL_PS_RESPONSE = BIT(1),
include/net/mac80211.h:1150: IEEE80211_TX_CTRL_RATE_INJECT = BIT(2),
include/net/mac80211.h-1151- IEEE80211_TX_CTRL_AMSDU = BIT(3),
--
net/mac80211/tx.c=675=ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
--
net/mac80211/tx.c-739- /* don't ask rate control when rate already injected via radiotap */
net/mac80211/tx.c:740: if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
net/mac80211/tx.c-741- return TX_CONTINUE;
--
net/mac80211/tx.c=2106=bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
--
net/mac80211/tx.c-2280-
net/mac80211/tx.c:2281: info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
net/mac80211/tx.c-2282-
--
net/mac80211/tx.c-2313- if (info->control.rates[0].idx < 0)
net/mac80211/tx.c:2314: info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
net/mac80211/tx.c-2315-
]
|
| 583/6 |
2026/09/07 08:26 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 53053
output: 18
thoughts: 131
Thoughts: **My Thought Process**
My immediate instinct upon seeing `info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT` was to place it within its context. My first port of call was to check its immediate surroundings, specifically within the `ieee80211_parse_tx_radiotap` function, as that's where I encountered it. This initial check is crucial for understanding the immediate purpose and impact of that flag modification.
However, I recognized that understanding its role within a single function might not be sufficient. To truly grasp its significance, I needed to explore its wider implications within the `mac80211` framework. My next step was to broaden my search. I wanted to know *when* this particular line was introduced or changed, as commit history often reveals the *why* behind such modifications. Simultaneously, I was curious about other areas of the code that might be interacting with or relying on this specific behavior, hence the desire to find other references.
This led me to consider more powerful search mechanisms. A direct `git blame` or `git log` for the specific line would provide the historical context. But my thought process quickly expanded to looking for broader references that might be more illuminating. I considered searching for `mac80211_hwsim_write_tsf`, as this function name suggests it's related to hardware simulation and Time Synchronization Function (TSF) updates, a critical aspect of Wi-Fi operation. If this flag is being cleared, it's likely related to how simulated TSF data is handled during transmission.
To further refine my search, I thought about looking for more generic terms that might be associated with the underlying mechanism. Grepping for `write_tsf` itself, or for specific rate index manipulation like `rates[0].idx`, could uncover related code paths that might be implicitly affected by or depend on the `RATE_INJECT` flag's state. This multi-pronged approach – starting narrow, then widening the scope to historical context, related functions, and underlying mechanisms – is how I aim to build a comprehensive understanding of any code change.
|
| 584/6 |
2026/09/07 08:26 |
tool |
grepper |
0m
Args: map[Expression:write_tsf]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=1575=static inline u16 trans_tx_rate_flags_ieee2hwsim(struct ieee80211_tx_rate *rate)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1604-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1605:static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1606- struct sk_buff *skb, u64 sim_time)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1646=static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1674- sim_tsf = mac80211_hwsim_get_sim_tsf();
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1675: mac80211_hwsim_write_tsf(data, my_skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1676-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=1902=static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1912-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-1914-
]
|
| 585/6 |
2026/09/07 08:26 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 53772
output: 65
thoughts: 366
Thoughts: **Unpacking the `mac80211_hwsim_write_tsf` Bug: A Debugging Journey**
My initial thought process here is to meticulously deconstruct how syzkaller, and by extension syzbot, is managing to trigger the `WARNING in mac80211_hwsim_write_tsf` bug. My immediate instinct is to trace the execution flow leading *to* `mac80211_hwsim_write_tsf`. I'm specifically looking at potential entry points, so I'm zeroing in on functions that I'd expect to interact with transmission functionality, like `mac80211_hwsim_tx_frame`, or any other function that might directly call `mac80211_hwsim_write_tsf`.
As I delve deeper, I recognize that `mac80211_hwsim_write_tsf` isn't a standalone function called in isolation. It's likely invoked from other parts of the `mac80211_hwsim` module. My next logical step is to identify these callers. I've identified two key functions that appear to be the immediate upstream callers: `mac80211_hwsim_tx_frame_no_nl` and `mac80211_hwsim_tx_frame_nl`.
Now, the core of the problem seems to lie in a specific condition: when `rates[0].idx < 0`. This is a critical piece of information. My next investigative step must be to determine under what circumstances either `mac80211_hwsim_tx_frame_no_nl` or `mac80211_hwsim_tx_frame_nl` are called with this particular problematic `rates[0].idx` value. To do this, I need to find *all* the locations within the `mac80211_hwsim` code that invoke these two functions. My current understanding is that these are primarily found within `mac80211_hwsim_main.c`.
I've already begun to list these callers. So far, I've identified three main points where these transmission-related functions are invoked:
1. The main `.tx` callback, `mac80211_hwsim_tx`.
2. The `mac80211_hwsim_tx_frame` function itself.
3. The `__mac80211_hwsim_beacon_tx` function.
My next logical focus, given the information I've gathered, is to specifically scrutinize `mac80211_hwsim_tx_frame`. I need to understand *how* and *from where* this particular function is being called, as it seems to be a central piece in the puzzle of triggering the bug.
|
| 586/6 |
2026/09/07 08:27 |
tool |
codesearch-find-references |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c IncludeSnippetLines:10 Name:mac80211_hwsim_tx_frame]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:__mac80211_hwsim_beacon_tx SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:2453 SourceSnippet:2443: dev_kfree_skb(skb);
2444: return;
2445: }
2446:
2447: info = IEEE80211_SKB_CB(skb);
2448: if (ieee80211_hw_check(hw, SUPPORTS_RC_TABLE))
2449: ieee80211_get_tx_rates(vif, NULL, skb,
2450: info->control.rates,
2451: ARRAY_SIZE(info->control.rates));
2452:
2453: mac80211_hwsim_tx_frame(hw, skb,
2454: rcu_dereference(link_conf->chanctx_conf)->def.chan);
2455: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:hw_scan_work SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:3183 SourceSnippet:3173: if (!ieee80211_tx_prepare_skb(hwsim->hw,
3174: hwsim->hw_scan_vif,
3175: probe,
3176: hwsim->tmp_chan->band,
3177: NULL)) {
3178: rcu_read_unlock();
3179: continue;
3180: }
3181:
3182: local_bh_disable();
3183: mac80211_hwsim_tx_frame(hwsim->hw, probe,
3184: hwsim->tmp_chan);
3185: rcu_read_unlock();
3186: local_bh_enable();
3187: }
3188: }
3189: ieee80211_queue_delayed_work(hwsim->hw, &hwsim->hw_scan,
3190: msecs_to_jiffies(dwell));
3191: hwsim->survey_data[hwsim->scan_chan_idx].channel = hwsim->tmp_chan;
3192: hwsim->survey_data[hwsim->scan_chan_idx].start = jiffies;
3193: hwsim->survey_data[hwsim->scan_chan_idx].end =
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:hwsim_send_nullfunc SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:1043 SourceSnippet:1033: hdr->duration_id = cpu_to_le16(0);
1034: memcpy(hdr->addr1, vp->bssid, ETH_ALEN);
1035: memcpy(hdr->addr2, mac, ETH_ALEN);
1036: memcpy(hdr->addr3, vp->bssid, ETH_ALEN);
1037:
1038: cb = IEEE80211_SKB_CB(skb);
1039: cb->control.rates[0].count = 1;
1040: cb->control.rates[1].idx = -1;
1041:
1042: rcu_read_lock();
1043: mac80211_hwsim_tx_frame(data->hw, skb,
1044: rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
1045: rcu_read_unlock();
1046: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:hwsim_send_ps_poll SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:1005 SourceSnippet: 995: return;
996: pspoll = skb_put(skb, sizeof(*pspoll));
997: pspoll->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL |
998: IEEE80211_STYPE_PSPOLL |
999: IEEE80211_FCTL_PM);
1000: pspoll->aid = cpu_to_le16(0xc000 | vp->aid);
1001: memcpy(pspoll->bssid, vp->bssid, ETH_ALEN);
1002: memcpy(pspoll->ta, mac, ETH_ALEN);
1003:
1004: rcu_read_lock();
1005: mac80211_hwsim_tx_frame(data->hw, skb,
1006: rcu_dereference(vif->bss_conf.chanctx_conf)->def.chan);
1007: rcu_read_unlock();
1008: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_assign_vif_chanctx SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:3410 SourceSnippet:3400: hwsim_check_magic(vif);
3401: hwsim_check_chanctx_magic(ctx);
3402:
3403: /* if we activate a link while already associated wake it up */
3404: if (vif->type == NL80211_IFTYPE_STATION && vif->cfg.assoc) {
3405: struct sk_buff *skb;
3406:
3407: skb = ieee80211_nullfunc_get(hw, vif, link_conf->link_id, true);
3408: if (skb) {
3409: local_bh_disable();
3410: mac80211_hwsim_tx_frame(hw, skb, ctx->def.chan);
3411: local_bh_enable();
3412: }
3413: }
3414:
3415: return 0;
3416: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_beacon_tx SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:2508 SourceSnippet:2498: ieee80211_beacon_free_ema_list(ema);
2499: } else {
2500: skb = ieee80211_beacon_get(hw, vif, link_id);
2501: if (!skb)
2502: return;
2503:
2504: __mac80211_hwsim_beacon_tx(link_conf, data, hw, vif, skb);
2505: }
2506:
2507: while ((skb = ieee80211_get_buffered_bc(hw, vif)) != NULL) {
2508: mac80211_hwsim_tx_frame(hw, skb,
2509: rcu_dereference(link_conf->chanctx_conf)->def.chan);
2510: }
2511:
2512: if (link_conf->csa_active && ieee80211_beacon_cntdwn_is_complete(vif, link_id))
2513: ieee80211_csa_finish(vif, link_id);
2514:
2515: if (link_conf->color_change_active &&
2516: ieee80211_beacon_cntdwn_is_complete(vif, link_id))
2517: ieee80211_color_change_finish(vif, link_id);
2518: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_nan_tx_beacon SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_nan.c SourceLine:770 SourceSnippet: 760: skb_put_data(skb, &master_indication, sizeof(master_indication));
761:
762: nan_attr.attr = NAN_ATTR_CLUSTER_INFO;
763: nan_attr.length = cpu_to_le16(sizeof(data->nan.current_ami));
764: skb_put_data(skb, &nan_attr, sizeof(nan_attr));
765: skb_put_data(skb, &data->nan.current_ami,
766: sizeof(data->nan.current_ami));
767:
768: spin_unlock(&data->nan.state_lock);
769:
770: mac80211_hwsim_tx_frame(data->hw, skb, channel);
771: }
] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:mac80211_hwsim_unassign_vif_chanctx SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c SourceLine:3437 SourceSnippet:3427: if (vif->type == NL80211_IFTYPE_STATION && vif->cfg.assoc) {
3428: struct sk_buff *skb;
3429:
3430: skb = ieee80211_nullfunc_get(hw, vif, link_conf->link_id, true);
3431: if (skb) {
3432: struct ieee80211_hdr *hdr = (void *)skb->data;
3433:
3434: hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
3435:
3436: local_bh_disable();
3437: mac80211_hwsim_tx_frame(hw, skb, ctx->def.chan);
3438: local_bh_enable();
3439: }
3440: }
3441: }
]] TruncatedOutput:false]
|
| 587/6 |
2026/09/07 08:27 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 56947
output: 29
thoughts: 897
Thoughts: **Analyzing transmit rate handling in mac80211_hwsim**
My thought process here is centered on understanding how transmit rates are handled, or *not* handled, within the `mac80211_hwsim` driver, specifically for beacon frames. I'm digging into the `mac80211_hwsim_tx_frame` function to see what's happening when a frame is prepared for transmission.
First, I observe that `mac80211_hwsim_tx_frame` checks if the hardware supports `SUPPORTS_RC_TABLE`. If it does, it calls `ieee80211_get_tx_rates` to populate the `txi->control.rates` array. However, my immediate concern is what happens when `SUPPORTS_RC_TABLE` is *not* set. The default configuration for `hwsim` (or at least in the context I'm examining) has `rctbl` as false, meaning this call to `ieee80211_get_tx_rates` is bypassed.
This leads me to question what the `info->control.rates[0].idx` field contains in scenarios where rate control isn't explicitly invoked. I'm particularly interested in frames generated internally by mac80211, such as beacons, nullfunc frames, or probe responses, especially when they're created without explicit rate control mechanisms being engaged.
My attention then shifts to `__mac80211_hwsim_beacon_tx`. This function is responsible for transmitting beacon frames. I see that it also checks `ieee80211_hw_check(hw, SUPPORTS_RC_TABLE)`. If the hardware supports it, it calls `ieee80211_get_tx_rates` for the beacon frame. But again, if `SUPPORTS_RC_TABLE` is false, this crucial step is skipped.
This is where my suspicion solidifies: when `ieee80211_beacon_get()` (or similar functions that generate these internal frames) creates an `skb`, and `SUPPORTS_RC_TABLE` isn't set, the `rates[0].idx` is likely to be uninitialized or default to a value like `0` or potentially `-1` if not explicitly set to something else. This lack of explicit rate information for internally generated frames, when rate control is not supported by the hardware abstraction, seems like a potential area for unexpected behavior or assumptions in higher layers. I'm keen to verify this by looking directly at the implementation of `ieee80211_beacon_get` to confirm what it sets for `rates[0].idx` in such cases.
|
| 588/6 |
2026/09/07 08:27 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_beacon_get]
Results: map[SourceCode:5887: /**
5888: * ieee80211_beacon_get - beacon generation function
5889: * @hw: pointer obtained from ieee80211_alloc_hw().
5890: * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5891: * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
5892: * that is not associated with AP MLD).
5893: *
5894: * See ieee80211_beacon_get_tim().
5895: *
5896: * Return: See ieee80211_beacon_get_tim().
5897: */
5898: static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
5899: struct ieee80211_vif *vif,
5900: unsigned int link_id)
5901: {
5902: return ieee80211_beacon_get_tim(hw, vif, NULL, NULL, link_id);
5903: }
SourceFile:include/net/mac80211.h]
|
| 589/6 |
2026/09/07 08:27 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 58226
output: 31
thoughts: 19
Thoughts: **A Deep Dive into `ieee80211_beacon_get_tim`**
Ah, I'm looking at the `ieee80211_beacon_get_tim` function. My immediate thought is to understand its purpose within the broader context of Wi-Fi beacon frames. I know that beacon frames are crucial for network discovery and management, and the Traffic Indication Map (TIM) is a key component of that. Specifically, the TIM is used to inform stations (STAs) whether there is buffered unicast traffic destined for them or if there are broadcast/multicast frames pending.
So, when I see `ieee80211_beacon_get_tim`, I'm expecting this function to be responsible for constructing or retrieving the TIM information element (IE) that will be included in a beacon frame. My thought process would then branch into several key areas:
First, I'd be considering **what data this function needs access to**. To build a TIM, it must know which STAs are associated with the Access Point (AP) and, importantly, which of those STAs have buffered traffic. This implies the function will likely interact with structures that maintain the AP's association table, potentially a list of connected clients and their associated state, including whether they are in power-save mode and if the AP has data waiting for them. I'd also be thinking about the specific information that needs to be encoded within the TIM IE itself. This includes the DTIM period, the TIM bitmap, and potentially the Traffic Indication Element (TIE) for broadcast/multicast.
Second, I'd be focused on **the logic of constructing the TIM IE**. How does it determine which STAs need to be represented in the TIM? It will likely iterate through the associated STAs. For each STA, it needs to check if it's in power-save mode. If it is, and if the AP has buffered unicast traffic for that STA, it will need to set the corresponding bit in the TIM bitmap. The bitmap's structure is crucial here; I'd be recalling how it's organized based on STA identifier (AID - Association Identifier) and how the bits are mapped. I'd also be considering the maximum number of STAs supported and how the TIM IE handles potentially large numbers of clients – perhaps through multiple TIM IEs if necessary, or by using partial TIMs.
Third, I'd be keen on **how the function handles broadcast and multicast traffic**. The TIM IE has a specific field for this, often referred to as the "broadcast/multicast indicator" or a specific bit within the bitmap that signifies the presence of such traffic. If there are broadcast or multicast frames to send, this needs to be correctly flagged, and the AP will likely buffer these until the next DTIM period.
Fourth, I'd be considering **performance implications and efficiency**. Constructing the TIM IE can be a computationally intensive operation, especially on busy networks. I'd be thinking about how this function is optimized. Is it being called at the right frequency? Are there any caching mechanisms in place? Is it efficiently querying the necessary data structures without causing significant overhead? The DTIM period itself is a parameter that balances power saving for STAs against potential delays in unicast delivery, so the function's interaction with this timing is also a point of interest.
Finally, I'd be thinking about **error handling and edge cases**. What happens if there's an issue querying the association table? What if the TIM bitmap becomes too large to fit within a single frame? Are there any specific IEEE 802.11 standards versions that this function is designed to adhere to, and how does it handle variations in TIM IE formatting across those standards?
In essence, `ieee80211_beacon_get_tim` is not just a function call; it's a gateway to understanding how an AP manages its communication responsibilities with associated clients, particularly concerning power management and traffic notification, a fundamental aspect of Wi-Fi operation.
|
| 590/6 |
2026/09/07 08:28 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_beacon_get_tim]
Results: map[SourceCode:5963: struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
5964: struct ieee80211_vif *vif,
5965: u16 *tim_offset, u16 *tim_length,
5966: unsigned int link_id)
5967: {
5968: struct ieee80211_mutable_offsets offs = {};
5969: struct sk_buff *bcn = __ieee80211_beacon_get(hw, vif, &offs, false,
5970: link_id,
5971: IEEE80211_INCLUDE_ALL_MBSSID_ELEMS,
5972: NULL);
5973: struct sk_buff *copy;
5974:
5975: if (!bcn)
5976: return bcn;
5977:
5978: if (tim_offset)
5979: *tim_offset = offs.tim_offset;
5980:
5981: if (tim_length)
5982: *tim_length = offs.tim_length;
5983:
5984: if (ieee80211_hw_check(hw, BEACON_TX_STATUS) ||
5985: !hw_to_local(hw)->monitors)
5986: return bcn;
5987:
5988: /* send a copy to monitor interfaces */
5989: copy = skb_copy(bcn, GFP_ATOMIC);
5990: if (!copy)
5991: return bcn;
5992:
5993: ieee80211_tx_monitor(hw_to_local(hw), copy, 1, NULL);
5994:
5995: return bcn;
5996: }
SourceFile:net/mac80211/tx.c]
|
| 591/6 |
2026/09/07 08:28 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 58829
output: 30
thoughts: 18
Thoughts: **My Thought Process Regarding `__ieee80211_beacon_get`**
Ah, so my initial impulse is to dive into the `__ieee80211_beacon_get` function. This is where the real action happens, I suspect, concerning the generation and retrieval of beacon frames. I need to understand precisely how the kernel constructs these critical management frames. My primary goal here is to map out the internal logic, the data structures involved, and the various parameters that influence the beacon content. I'm particularly keen on identifying any conditional logic that might lead to variations in beacon content based on driver state, hardware capabilities, or network configuration. Ultimately, I want to gain a granular understanding of the data population process for fields like the SSID, supported rates, channel information, and any vendor-specific elements. This detailed inspection is crucial for any subsequent analysis or modification I might consider regarding Wi-Fi beaconing behavior.
|
| 592/6 |
2026/09/07 08:28 |
tool |
codesearch-definition-source |
0m
Args: map[Name:__ieee80211_beacon_get]
Results: map[SourceCode:5765: static struct sk_buff *
5766: __ieee80211_beacon_get(struct ieee80211_hw *hw,
5767: struct ieee80211_vif *vif,
5768: struct ieee80211_mutable_offsets *offs,
5769: bool is_template,
5770: unsigned int link_id,
5771: int ema_index,
5772: struct ieee80211_ema_beacons **ema_beacons)
5773: {
5774: struct ieee80211_local *local = hw_to_local(hw);
5775: struct beacon_data *beacon = NULL;
5776: struct sk_buff *skb = NULL;
5777: struct ieee80211_sub_if_data *sdata = NULL;
5778: struct ieee80211_chanctx_conf *chanctx_conf;
5779: struct ieee80211_link_data *link;
5780: struct s1g_short_beacon_data *s1g_short_bcn = NULL;
5781:
5782: rcu_read_lock();
5783:
5784: sdata = vif_to_sdata(vif);
5785: link = rcu_dereference(sdata->link[link_id]);
5786: if (!link)
5787: goto out;
5788: chanctx_conf =
5789: rcu_dereference(link->conf->chanctx_conf);
5790:
5791: if (!ieee80211_sdata_running(sdata) || !chanctx_conf)
5792: goto out;
5793:
5794: if (offs)
5795: memset(offs, 0, sizeof(*offs));
5796:
5797: if (sdata->vif.type == NL80211_IFTYPE_AP) {
5798: beacon = rcu_dereference(link->u.ap.beacon);
5799: if (!beacon)
5800: goto out;
5801:
5802: if (vif->cfg.s1g && link->u.ap.s1g_short_beacon) {
5803: s1g_short_bcn =
5804: rcu_dereference(link->u.ap.s1g_short_beacon);
5805: if (!s1g_short_bcn)
5806: goto out;
5807: }
5808:
5809: if (ema_beacons) {
5810: *ema_beacons =
5811: ieee80211_beacon_get_ap_ema_list(hw, vif, link,
5812: offs,
5813: is_template,
5814: beacon,
5815: chanctx_conf);
5816: } else {
5817: if (beacon->mbssid_ies && beacon->mbssid_ies->cnt) {
5818: if (ema_index >= beacon->mbssid_ies->cnt)
5819: goto out; /* End of MBSSID elements */
5820:
5821: if (ema_index <= IEEE80211_INCLUDE_ALL_MBSSID_ELEMS)
5822: ema_index = beacon->mbssid_ies->cnt;
5823: } else {
5824: ema_index = 0;
5825: }
5826:
5827: skb = ieee80211_beacon_get_ap(hw, vif, link, offs,
5828: is_template, beacon,
5829: chanctx_conf, ema_index,
5830: s1g_short_bcn);
5831: }
5832: } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
5833: struct ieee80211_if_ibss *ifibss = &sdata->u.ibss;
5834: struct ieee80211_hdr *hdr;
5835:
5836: beacon = rcu_dereference(ifibss->presp);
5837: if (!beacon)
5838: goto out;
5839:
5840: if (beacon->cntdwn_counter_offsets[0]) {
5841: if (!is_template)
5842: __ieee80211_beacon_update_cntdwn(link, beacon);
5843:
5844: ieee80211_set_beacon_cntdwn(sdata, beacon, link);
5845: }
5846:
5847: skb = dev_alloc_skb(local->tx_headroom + beacon->head_len +
5848: local->hw.extra_beacon_tailroom);
5849: if (!skb)
5850: goto out;
5851: skb_reserve(skb, local->tx_headroom);
5852: skb_put_data(skb, beacon->head, beacon->head_len);
5853:
5854: hdr = (struct ieee80211_hdr *) skb->data;
5855: hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
5856: IEEE80211_STYPE_BEACON);
5857:
5858: ieee80211_beacon_get_finish(hw, vif, link, offs, beacon, skb,
5859: chanctx_conf, 0);
5860: } else if (ieee80211_vif_is_mesh(&sdata->vif)) {
5861: struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
5862:
5863: beacon = rcu_dereference(ifmsh->beacon);
5864: if (!beacon)
5865: goto out;
5866:
5867: if (beacon->cntdwn_counter_offsets[0]) {
5868: if (!is_template)
5869: /* TODO: For mesh csa_counter is in TU, so
5870: * decrementing it by one isn't correct, but
5871: * for now we leave it consistent with overall
5872: * mac80211's behavior.
5873: */
5874: __ieee80211_beacon_update_cntdwn(link, beacon);
5875:
5876: ieee80211_set_beacon_cntdwn(sdata, beacon, link);
5877: }
5878:
5879: if (ifmsh->sync_ops)
5880: ifmsh->sync_ops->adjust_tsf(sdata, beacon);
5881:
5882: skb = dev_alloc_skb(local->tx_headroom +
5883: beacon->head_len +
5884: 256 + /* TIM IE */
5885: beacon->tail_len +
5886: local->hw.extra_beacon_tailroom);
5887: if (!skb)
5888: goto out;
5889: skb_reserve(skb, local->tx_headroom);
5890: skb_put_data(skb, beacon->head, beacon->head_len);
5891: ieee80211_beacon_add_tim(sdata, link, &ifmsh->ps, skb,
5892: is_template);
5893:
5894: if (offs) {
5895: offs->tim_offset = beacon->head_len;
5896: offs->tim_length = skb->len - beacon->head_len;
5897: }
5898:
5899: skb_put_data(skb, beacon->tail, beacon->tail_len);
5900: ieee80211_beacon_get_finish(hw, vif, link, offs, beacon, skb,
5901: chanctx_conf, 0);
5902: } else {
5903: WARN_ON(1);
5904: goto out;
5905: }
5906:
5907: out:
5908: rcu_read_unlock();
5909: return skb;
5910:
5911: }
SourceFile:net/mac80211/tx.c]
|
| 593/6 |
2026/09/07 08:28 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 61353
output: 31
thoughts: 19
Thoughts: **A Deep Dive into `ieee80211_beacon_get_finish`**
Okay, so I'm looking at the `ieee80211_beacon_get_finish` function. This is clearly a crucial part of the 802.11 beaconing process, and my initial thought is to understand its precise role within the larger framework. I need to figure out what "finish" signifies here. Is it the final stage of beacon *creation*, or the final stage of beacon *transmission*, or perhaps something related to acknowledging the beacon?
My expertise in wireless networking immediately brings to mind the fundamental importance of beacons. They're the heartbeat of an access point, advertising its presence, capabilities, and the network's parameters. Therefore, any function that deals with the "finishing" of a beacon must be directly responsible for ensuring its integrity, completeness, and readiness for its intended purpose.
I'm going to break this down by asking myself several key questions:
1. **What is the *input* to this function?** What data or state does it receive from the preceding functions in the beacon generation or transmission pipeline? This will tell me what information it has to work with.
2. **What is the *output* or *side effect* of this function?** Does it modify the beacon buffer in place? Does it signal completion to another part of the system? Does it trigger a transmission? Understanding what it *does* is paramount.
3. **What are the *critical components* of a beacon that this function might be concerned with?** This could include things like the timestamp, SSID, supported rates, channel information, security capabilities (like RSN information elements), and potentially vendor-specific information. Is this function responsible for finalizing any of these?
4. **What kind of *error handling* or *validation* might be present?** Given the critical nature of beacons, I'd expect some checks to ensure the beacon is valid before it's finalized. Are there conditions under which it might return an error?
5. **How does this function interact with the *hardware* or the *network stack*?** Is it directly pushing data to a hardware transmit queue, or is it handing off a completed beacon structure to a higher-level scheduler?
My immediate hypothesis is that `ieee80211_beacon_get_finish` is likely involved in taking a partially constructed beacon (perhaps with fields filled in by earlier functions) and performing the final calculations, additions, or formatting steps necessary to make it a fully compliant and transmissible 802.11 beacon frame. This might involve things like calculating the beacon interval from the timestamp, finalizing the length of Information Elements, or ensuring the frame control and sequence control fields are correctly set.
I'm also considering the possibility that "finish" could imply a state where the beacon is now immutable and ready to be sent. This would mean it's no longer subject to modifications by other parts of the driver or stack.
The name itself, `_get_finish`, suggests a retrieval and finalization process. I'm picturing a scenario where a beacon buffer is "obtained" and then this function is called to "finish" it before it's used. This is where I'll be focusing my attention: on the specific actions that transform a work-in-progress beacon into a ready-to-send beacon frame.
|
| 594/6 |
2026/09/07 08:28 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_beacon_get_finish]
Results: map[SourceCode:5509: static void
5510: ieee80211_beacon_get_finish(struct ieee80211_hw *hw,
5511: struct ieee80211_vif *vif,
5512: struct ieee80211_link_data *link,
5513: struct ieee80211_mutable_offsets *offs,
5514: struct beacon_data *beacon,
5515: struct sk_buff *skb,
5516: struct ieee80211_chanctx_conf *chanctx_conf,
5517: u16 csa_off_base)
5518: {
5519: struct ieee80211_local *local = hw_to_local(hw);
5520: struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
5521: struct ieee80211_tx_info *info;
5522: enum nl80211_band band;
5523: struct ieee80211_tx_rate_control txrc;
5524:
5525: /* CSA offsets */
5526: if (offs && beacon) {
5527: u16 i;
5528:
5529: for (i = 0; i < IEEE80211_MAX_CNTDWN_COUNTERS_NUM; i++) {
5530: u16 csa_off = beacon->cntdwn_counter_offsets[i];
5531:
5532: if (!csa_off)
5533: continue;
5534:
5535: offs->cntdwn_counter_offs[i] = csa_off_base + csa_off;
5536: }
5537: }
5538:
5539: band = chanctx_conf->def.chan->band;
5540: info = IEEE80211_SKB_CB(skb);
5541: info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
5542: info->flags |= IEEE80211_TX_CTL_NO_ACK;
5543: info->band = band;
5544:
5545: memset(&txrc, 0, sizeof(txrc));
5546: txrc.hw = hw;
5547: txrc.sband = local->hw.wiphy->bands[band];
5548: txrc.bss_conf = link->conf;
5549: txrc.skb = skb;
5550: txrc.reported_rate.idx = -1;
5551: if (sdata->beacon_rate_set && sdata->beacon_rateidx_mask[band])
5552: txrc.rate_idx_mask = sdata->beacon_rateidx_mask[band];
5553: else
5554: txrc.rate_idx_mask = sdata->rc_rateidx_mask[band];
5555: txrc.bss = true;
5556: rate_control_get_rate(sdata, NULL, &txrc);
5557:
5558: info->control.vif = vif;
5559: info->control.flags |= u32_encode_bits(link->link_id,
5560: IEEE80211_TX_CTRL_MLO_LINK);
5561: info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT |
5562: IEEE80211_TX_CTL_ASSIGN_SEQ |
5563: IEEE80211_TX_CTL_FIRST_FRAGMENT;
5564: }
SourceFile:net/mac80211/tx.c]
|
| 595/6 |
2026/09/07 08:28 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 62470
output: 33
thoughts: 1757
Thoughts: **My Thought Process on the `mac80211_hwsim_write_tsf` Warning and Reproducer Failure**
Okay, so I'm trying to understand why the `WARNING in mac80211_hwsim_write_tsf` with `c->control.rates[0].idx < 0` isn't actually crashing or failing when the provided reproducer runs. The reproducer is designed to send a packet via `AF_PACKET` to a monitor mode interface (`wlan0`), setting the `IEEE80211_RADIOTAP_RATE` to 0. This, as observed, leads `ieee80211_parse_tx_radiotap` to set `idx = -1` and clear `IEEE80211_TX_CTRL_RATE_INJECT`. Subsequently, `mac80211_hwsim_tx_frame_no_nl` calls `mac80211_hwsim_write_tsf`, which in turn calls `mac80211_hwsim_get_tx_rate`, ultimately triggering the warning via `ieee80211_get_tx_rate`. Yet, the reproducer exits cleanly. I need to figure out *why*.
My initial hypothesis is that perhaps a check within `ieee80211_monitor_start_xmit` is preventing the faulty packet from even reaching the critical path that triggers the warning. So, I'm going back to meticulously examine every conditional branch within `ieee80211_monitor_start_xmit` to see what might be causing the reproducer to fail.
Let's walk through it step-by-step:
1. **`sdata = IEEE80211_DEV_TO_SUB_IF(dev);` and `if (unlikely(!ieee80211_sdata_running(sdata))) goto fail;`**: This is a basic sanity check to ensure the `wlan0` interface is actually up and running. If it's not, the packet is dropped. This is unlikely to be the cause for the reproducer if it's able to send the packet in the first place.
2. **`if (!ieee80211_validate_radiotap_len(skb)) goto fail;`**: Another sanity check, this time for the radiotap header length. Essential, but probably not the culprit here.
3. **`if (skb->len < len_rthdr + 2) goto fail;`**: A minimal length check, also unlikely to be the distinguishing factor.
4. **`hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr);` `hdrlen = ieee80211_hdrlen(hdr->frame_control);` `if (skb->len < len_rthdr + hdrlen) goto fail;`**: This validates that the packet length is sufficient to contain the radiotap header plus the IEEE 802.11 header. Again, a basic check.
5. **Local Address Matching**: The code iterates through running interfaces to match the `addr2` in the 802.11 header against the MAC addresses of active VIFs. If a match is found on a non-monitor/AP_VLAN interface, `sdata` is updated. If not, `sdata` remains the monitor interface. This implies that for a monitor interface, it's expected that `sdata` won't be updated here, which is consistent with how monitor mode typically operates.
6. **Channel Context (`chanctx_conf`) Search**: This is becoming interesting. The code tries to find a channel context.
* First, it checks `sdata->vif.bss_conf.chanctx_conf` (for the current interface).
* If not found, it checks `local->monitor_sdata`'s context.
* If still not found, it iterates through `local->chanctx_list`.
* **Crucially**, if `local->chanctx_list` has *more than one* context, it jumps to `fail_rcu` because the monitor injection wouldn't know which channel to use.
* **And, here's a key point**: if *none* of these yield a `chanctx_conf` (meaning the list is empty and neither the interface nor `monitor_sdata` have one), it also jumps to `fail_rcu`. This means a valid channel context is *required* for monitor injection to proceed. This is a strong candidate for why the reproducer might be failing – perhaps the test environment is configured without a proper channel context for monitor mode.
7. **`if (!cfg80211_chandef_usable(local->hw.wiphy, chandef, IEEE80211_CHAN_DISABLED)) goto fail_rcu;`**: Verifies that the identified channel is actually usable.
8. **`if (!cfg80211_reg_can_beacon(local->hw.wiphy, chandef, sdata->vif.type)) goto fail_rcu;`**: This is the check I initially suspected! It verifies if the regulatory domain allows beaconing on the given channel for the interface type. If `cfg80211_reg_can_beacon` returns false, the packet is dropped. This is another very plausible reason for the reproducer's failure.
9. **Radiotap Parsing (`if (!ieee80211_parse_tx_radiotap(skb, dev)) goto fail_rcu;`**: This is where the `idx = -1` occurs. If this function returns false, it jumps to `fail_rcu`. However, the reproducer *does* trigger this, and `ieee80211_parse_tx_radiotap` *does* set `idx = -1`. The question is whether `ieee80211_parse_tx_radiotap` itself returns `false` in this specific scenario, which would prevent further processing. If it *returns true* but *sets idx = -1*, then we proceed.
10. **Packet Transmission Path**: If all the above checks pass, the radiotap header is stripped (`skb_pull(skb, len_rthdr);`) and the packet is passed to `ieee80211_xmit(sdata, NULL, skb);`. From there, it goes to `ieee80211_tx`, and then `ieee80211_tx_prepare`.
My current focus is heavily on points 6 and 8. The lack of a valid channel context (point 6) or the regulatory domain disallowing beaconing on the target channel (point 8) are the most likely explanations for why the reproducer fails to reach the `mac80211_hwsim_write_tsf` call with the problematic `idx = -1`. It's not that the warning isn't *possible*, but rather that the specific conditions required to reach that warning are not met by the reproducer in its current execution environment. I need to investigate further into how `cfg80211_chandef_usable` and `cfg80211_reg_can_beacon` behave, and what the state of channel contexts is. I'll also re-examine the return value of `ieee80211_parse_tx_radiotap` when `rate=0` to ensure it doesn't return `false` and exit early.
|
| 596/6 |
2026/09/07 08:28 |
tool |
codesearch-definition-source |
0m
Args: map[Name:ieee80211_tx_h_check_assoc]
Results: map[SourceCode: 269: static ieee80211_tx_result debug_noinline
270: ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
271: {
272:
273: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
274: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
275: bool assoc = false;
276:
277: if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED))
278: return TX_CONTINUE;
279:
280: if (unlikely(test_bit(SCAN_SW_SCANNING, &tx->local->scanning)) &&
281: test_bit(SDATA_STATE_OFFCHANNEL, &tx->sdata->state) &&
282: !ieee80211_is_probe_req(hdr->frame_control) &&
283: !ieee80211_is_any_nullfunc(hdr->frame_control))
284: /*
285: * When software scanning only nullfunc frames (to notify
286: * the sleep state to the AP) and probe requests (for the
287: * active scan) are allowed, all other frames should not be
288: * sent and we should not get here, but if we do
289: * nonetheless, drop them to avoid sending them
290: * off-channel. See __ieee80211_start_scan() for more.
291: */
292: return TX_DROP;
293:
294: if (tx->sdata->vif.type == NL80211_IFTYPE_OCB)
295: return TX_CONTINUE;
296:
297: if (tx->flags & IEEE80211_TX_PS_BUFFERED)
298: return TX_CONTINUE;
299:
300: if (tx->sta)
301: assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
302:
303: if (likely(tx->flags & IEEE80211_TX_UNICAST)) {
304: if (unlikely(!assoc &&
305: ieee80211_is_data(hdr->frame_control))) {
306: #ifdef CONFIG_MAC80211_VERBOSE_DEBUG
307: sdata_info(tx->sdata,
308: "dropped data frame to not associated station %pM\n",
309: hdr->addr1);
310: #endif
311: I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc);
312: return TX_DROP;
313: }
314: } else if (unlikely(ieee80211_is_data(hdr->frame_control) &&
315: ieee80211_vif_get_num_mcast_if(tx->sdata) == 0)) {
316: /*
317: * No associated STAs - no need to send multicast
318: * frames.
319: */
320: return TX_DROP;
321: }
322:
323: return TX_CONTINUE;
324: }
SourceFile:net/mac80211/tx.c]
|
| 597/6 |
2026/09/07 08:28 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 65290
output: 33
thoughts: 3570
Thoughts: **My Thoughts on Rate Control Bypass and the Missing Bug**
I've been digging into `ieee80211_tx_h_rate_ctrl` and I noticed something quite specific about how injected rates are handled. When the `IEEE80211_TX_CTL_INJECTED` flag is present, the function immediately returns `TX_CONTINUE`. This is understandable, as the rate is already dictated externally.
Then, my attention turned to `invoke_tx_handlers_late`, where `ieee80211_tx_h_rate_ctrl` is invoked. I wanted to understand what happens when a rate is *injected*, and specifically, what happens if the `IEEE80211_TX_CTRL_RATE_INJECT` flag is set. My expectation was that if this flag were set, the rate control mechanism wouldn't even be consulted.
And indeed, that's exactly what the code confirms:
```c
/* don't ask rate control when rate already injected via radiotap */
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
If `IEEE80211_TX_CTRL_RATE_INJECT` is set, `ieee80211_tx_h_rate_ctrl` simply returns `TX_CONTINUE` right away. This means `rate_control_get_rate` is *never* called in this scenario. Whatever rates were previously populated in `info->control.rates` would remain untouched.
Now, my concern was about a potential bug where `rates[0].idx` could end up being less than 0. If `rates[0].idx < 0` persisted and the `IEEE80211_TX_CTRL_RATE_INJECT` flag was *not* set (meaning `rate_control_get_rate` *was* called), I anticipated this could lead to issues. Specifically, when the frame eventually reaches `mac80211_hwsim_tx` -> `mac80211_hwsim_tx_frame_no_nl` -> `mac80211_hwsim_write_tsf` -> `mac80211_hwsim_get_tx_rate` -> `ieee80211_get_tx_rate`, the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` check would be triggered.
The puzzle, then, was why a specific reproducer, which I anticipated would trigger this exact bug (sending a packet with radiotap rate 0, setting `info->control.rates[0].idx = -1`, and clearing `IEEE80211_TX_CTRL_RATE_INJECT`), exited cleanly with code 0 and no warning. My initial thought was that this negative index *should* propagate and cause the `WARN_ON_ONCE`.
I then started questioning how `IEEE80211_TX_CTRL_RATE_INJECT` was being handled. In the case of the reproducer, when `rate=0` was present in the radiotap header, `ieee80211_parse_tx_radiotap` tried to find a matching bitrate in `sband->bitrates`. Since no bitrate matched `0 * 5 = 0`, `info->control.rates[0].idx` was left at `-1`. Critically, because `info->control.rates[0].idx < 0`, `ieee80211_parse_tx_radiotap` then executed:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This means the `IEEE80211_TX_CTRL_RATE_INJECT` flag was *cleared* by the radiotap parser itself.
Consequently, when the frame was processed by `ieee80211_tx_h_rate_ctrl`, the `IEEE80211_TX_CTRL_RATE_INJECT` flag was *not* set. This allowed the code to proceed to the `rate_control_get_rate(...)` call. Crucially, `rate_control_get_rate` internally calls `rate_control_send_low` and `__rate_control_send_low`, which then *assign a valid lowest bitrate index* (e.g., `rates[0].idx = 0` or the lowest usable bitrate) to `tx->rate` and `info->control.rates[0]`.
Because `rates[0].idx` was now set to a non-negative value by the rate control mechanism, `ieee80211_get_tx_rate` received a valid index (`>= 0`), and the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` was correctly avoided.
This explains why the bug wasn't triggered: the radiotap parsing itself, in response to an invalid rate, *disables* the injected rate flag, forcing the system to fall back to rate control, which then assigns a valid rate, thus preventing the warning.
I was also considering if something in `ieee80211_monitor_start_xmit`, like `cfg80211_reg_can_beacon` returning false, could have played a role, but my current analysis points to the interplay between radiotap parsing and the rate control fallback as the primary reason for the absence of the expected warning. The key is that `IEEE80211_TX_CTRL_RATE_INJECT` is explicitly *unset* when the initial rate lookup fails.
|
| 598/6 |
2026/09/07 08:29 |
tool |
grepper |
0m
Args: map[Expression:chanctx_list PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/chan.c=234=static int ieee80211_num_chanctx(struct ieee80211_local *local, int radio_idx)
--
net/mac80211/chan.c-240-
net/mac80211/chan.c:241: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-242- if (radio_idx >= 0 && ctx->conf.radio_idx != radio_idx)
--
net/mac80211/chan.c=436=ieee80211_find_reservation_chanctx(struct ieee80211_local *local,
--
net/mac80211/chan.c-446-
net/mac80211/chan.c:447: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-448- if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
--
net/mac80211/chan.c=908=ieee80211_find_chanctx(struct ieee80211_local *local,
--
net/mac80211/chan.c-919-
net/mac80211/chan.c:920: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-921- const struct ieee80211_chan_req *compat;
--
net/mac80211/chan.c=1050=ieee80211_new_chanctx(struct ieee80211_local *local,
--
net/mac80211/chan.c-1075-
net/mac80211/chan.c:1076: list_add_rcu(&ctx->list, &local->chanctx_list);
net/mac80211/chan.c-1077- return ctx;
--
net/mac80211/chan.c=1438=ieee80211_replace_chanctx(struct ieee80211_local *local,
--
net/mac80211/chan.c-1466- */
net/mac80211/chan.c:1467: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-1468- if (ctx->replace_state !=
--
net/mac80211/chan.c-1504-
net/mac80211/chan.c:1505: list_add_rcu(&new_ctx->list, &local->chanctx_list);
net/mac80211/chan.c-1506-
--
net/mac80211/chan.c=1800=static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local,
--
net/mac80211/chan.c-1813- i = 0;
net/mac80211/chan.c:1814: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-1815- struct ieee80211_chanctx_user_iter iter;
--
net/mac80211/chan.c=1847=static int ieee80211_chsw_switch_ctxs(struct ieee80211_local *local)
--
net/mac80211/chan.c-1853-
net/mac80211/chan.c:1854: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-1855- if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
--
net/mac80211/chan.c-1870- WARN_ON(ieee80211_add_chanctx(local, ctx));
net/mac80211/chan.c:1871: list_for_each_entry_continue_reverse(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-1872- if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
--
net/mac80211/chan.c=1885=static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local)
--
net/mac80211/chan.c-1908-
net/mac80211/chan.c:1909: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-1910- struct ieee80211_chanctx_user_iter iter;
--
net/mac80211/chan.c-1981- /* update station rate control and min width before switch */
net/mac80211/chan.c:1982: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-1983- struct ieee80211_chanctx_user_iter iter;
--
net/mac80211/chan.c-2025- */
net/mac80211/chan.c:2026: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-2027- struct ieee80211_chanctx_user_iter iter;
--
net/mac80211/chan.c-2120-
net/mac80211/chan.c:2121: list_for_each_entry_safe(ctx, ctx_tmp, &local->chanctx_list, list) {
net/mac80211/chan.c-2122- if (ctx->replace_state != IEEE80211_CHANCTX_WILL_BE_REPLACED)
--
net/mac80211/chan.c-2135-err:
net/mac80211/chan.c:2136: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/chan.c-2137- struct ieee80211_chanctx_user_iter iter;
--
net/mac80211/chan.c=2521=void ieee80211_iter_chan_contexts_atomic(
--
net/mac80211/chan.c-2531- rcu_read_lock();
net/mac80211/chan.c:2532: list_for_each_entry_rcu(ctx, &local->chanctx_list, list)
net/mac80211/chan.c-2533- if (ctx->driver_present)
--
net/mac80211/chan.c=2539=void ieee80211_iter_chan_contexts_mtx(
--
net/mac80211/chan.c-2550-
net/mac80211/chan.c:2551: list_for_each_entry(ctx, &local->chanctx_list, list)
net/mac80211/chan.c-2552- if (ctx->driver_present)
--
net/mac80211/ieee80211_i.h=1448=struct ieee80211_local {
--
net/mac80211/ieee80211_i.h-1628- /* channel contexts */
net/mac80211/ieee80211_i.h:1629: struct list_head chanctx_list;
net/mac80211/ieee80211_i.h-1630-
--
net/mac80211/iface.c=105=static u32 __ieee80211_recalc_idle(struct ieee80211_local *local,
--
net/mac80211/iface.c-114- active = force_active ||
net/mac80211/iface.c:115: !list_empty(&local->chanctx_list) ||
net/mac80211/iface.c-116- local->monitors;
--
net/mac80211/main.c=242=int ieee80211_hw_conf_chan(struct ieee80211_local *local)
--
net/mac80211/main.c-245-
net/mac80211/main.c:246: ctx = list_first_entry_or_null(&local->chanctx_list,
net/mac80211/main.c-247- struct ieee80211_chanctx,
--
net/mac80211/main.c=253=void ieee80211_hw_conf_init(struct ieee80211_local *local)
--
net/mac80211/main.c-264-
net/mac80211/main.c:265: ctx = list_first_entry_or_null(&local->chanctx_list,
net/mac80211/main.c-266- struct ieee80211_chanctx,
--
net/mac80211/main.c=793=struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
--
net/mac80211/main.c-1004-
net/mac80211/main.c:1005: INIT_LIST_HEAD(&local->chanctx_list);
net/mac80211/main.c-1006-
--
net/mac80211/pm.c=21=int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
--
net/mac80211/pm.c-170- */
net/mac80211/pm.c:171: WARN_ON(!list_empty(&local->chanctx_list));
net/mac80211/pm.c-172-
--
net/mac80211/tx.c=2324=netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
--
net/mac80211/tx.c-2422-
net/mac80211/tx.c:2423: list_for_each_entry_rcu(ctx, &local->chanctx_list, list) {
net/mac80211/tx.c-2424- if (!first)
--
net/mac80211/util.c=1673=static void ieee80211_handle_reconfig_failure(struct ieee80211_local *local)
--
net/mac80211/util.c-1707- */
net/mac80211/util.c:1708: list_for_each_entry(ctx, &local->chanctx_list, list)
net/mac80211/util.c-1709- ctx->driver_present = false;
--
net/mac80211/util.c=1885=int ieee80211_reconfig(struct ieee80211_local *local)
--
net/mac80211/util.c-2036- /* add channel contexts */
net/mac80211/util.c:2037: list_for_each_entry(ctx, &local->chanctx_list, list)
net/mac80211/util.c-2038- if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
--
net/mac80211/util.c=3720=void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
--
net/mac80211/util.c-3729-
net/mac80211/util.c:3730: list_for_each_entry_safe(ctx, tmp, &local->chanctx_list, list) {
net/mac80211/util.c-3731- if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER)
--
net/mac80211/util.c=4274=ieee80211_fill_ifcomb_params(struct ieee80211_local *local,
--
net/mac80211/util.c-4285-
net/mac80211/util.c:4286: list_for_each_entry(ctx, &local->chanctx_list, list) {
net/mac80211/util.c-4287- if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
]
|
| 599/6 |
2026/09/07 08:29 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 72534
output: 33
thoughts: 85
Thoughts: **My Thought Process Regarding Monitor Interface Initialization**
Okay, so when I encounter a situation where a wireless interface is being opened, or when a channel context is being assigned, my immediate focus shifts to understanding how monitor interfaces are handled. Specifically, if I see `wlan0` being designated as a monitor interface, or if a monitor interface is being brought into existence through any mechanism, I need to delve into the specifics of its startup procedure. My primary concern is to clarify the interplay between how these monitor interfaces are initiated and the mechanics of their channel contexts. This leads me directly to the relevant code paths. I'm thinking I should be examining functions like `ieee80211_start_monitor` or perhaps `ieee80211_open` to trace the exact sequence of events and the underlying logic that governs these operations.
|
| 600/6 |
2026/09/07 08:29 |
tool |
grepper |
0m
Args: map[Expression:monitor_sdata PathPrefix:net/mac80211/]
Results: map[Output:net/mac80211/cfg.c=96=static int ieee80211_set_mon_options(struct ieee80211_sub_if_data *sdata,
--
net/mac80211/cfg.c-99- struct ieee80211_local *local = sdata->local;
net/mac80211/cfg.c:100: struct ieee80211_sub_if_data *monitor_sdata = NULL;
net/mac80211/cfg.c-101-
--
net/mac80211/cfg.c-123-
net/mac80211/cfg.c:124: /* Also update dependent monitor_sdata if required */
net/mac80211/cfg.c-125- if (test_bit(SDATA_STATE_RUNNING, &sdata->state) &&
net/mac80211/cfg.c-126- !ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR))
net/mac80211/cfg.c:127: monitor_sdata = wiphy_dereference(local->hw.wiphy,
net/mac80211/cfg.c:128: local->monitor_sdata);
net/mac80211/cfg.c-129-
--
net/mac80211/cfg.c-136-
net/mac80211/cfg.c:137: if (monitor_sdata)
net/mac80211/cfg.c:138: ieee80211_set_mu_mimo_follow(monitor_sdata, params);
net/mac80211/cfg.c-139- }
--
net/mac80211/cfg.c=1060=static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
--
net/mac80211/cfg.c-1076-
net/mac80211/cfg.c:1077: sdata = wiphy_dereference(wiphy, local->monitor_sdata);
net/mac80211/cfg.c-1078- if (!sdata)
--
net/mac80211/cfg.c=3708=static int ieee80211_set_tx_power(struct wiphy *wiphy,
--
net/mac80211/cfg.c-3745- sdata = wiphy_dereference(local->hw.wiphy,
net/mac80211/cfg.c:3746: local->monitor_sdata);
net/mac80211/cfg.c-3747- if (!sdata)
--
net/mac80211/cfg.c-3815- sdata = wiphy_dereference(local->hw.wiphy,
net/mac80211/cfg.c:3816: local->monitor_sdata);
net/mac80211/cfg.c-3817- if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) {
--
net/mac80211/chan.c=582=ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,
--
net/mac80211/chan.c-612-
net/mac80211/chan.c:613: if (rsvd_for->sdata == rcu_access_pointer(local->monitor_sdata))
net/mac80211/chan.c-614- return max(max_bw, ctx->conf.def.width);
--
net/mac80211/chan.c-621- /* use the configured bandwidth in case of monitor interface */
net/mac80211/chan.c:622: sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata);
net/mac80211/chan.c-623- if (sdata &&
--
net/mac80211/chan.c=1263=void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
--
net/mac80211/chan.c-1334- /* Disable SMPS for the monitor interface */
net/mac80211/chan.c:1335: sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata);
net/mac80211/chan.c-1336- if (sdata &&
--
net/mac80211/driver-ops.c=108=void drv_remove_interface(struct ieee80211_local *local,
--
net/mac80211/driver-ops.c-123- */
net/mac80211/driver-ops.c:124: if (sdata != rcu_access_pointer(local->monitor_sdata))
net/mac80211/driver-ops.c-125- ieee80211_debugfs_recreate_netdev(sdata,
--
net/mac80211/ieee80211_i.h=1448=struct ieee80211_local {
--
net/mac80211/ieee80211_i.h-1716- /* virtual monitor interface */
net/mac80211/ieee80211_i.h:1717: struct ieee80211_sub_if_data __rcu *monitor_sdata;
net/mac80211/ieee80211_i.h-1718- struct ieee80211_chan_req monitor_chanreq;
--
net/mac80211/iface.c=479=static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_down)
--
net/mac80211/iface.c-738- WARN_ON(local->wowlan);
net/mac80211/iface.c:739: WARN_ON(rcu_access_pointer(local->monitor_sdata));
net/mac80211/iface.c-740- return;
--
net/mac80211/iface.c=1228=int ieee80211_add_virtual_monitor(struct ieee80211_local *local,
--
net/mac80211/iface.c-1240- /* Already have a monitor set up, configure it */
net/mac80211/iface.c:1241: sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata);
net/mac80211/iface.c-1242- if (sdata)
--
net/mac80211/iface.c-1277- mutex_lock(&local->iflist_mtx);
net/mac80211/iface.c:1278: rcu_assign_pointer(local->monitor_sdata, sdata);
net/mac80211/iface.c-1279- mutex_unlock(&local->iflist_mtx);
--
net/mac80211/iface.c-1284- mutex_lock(&local->iflist_mtx);
net/mac80211/iface.c:1285: RCU_INIT_POINTER(local->monitor_sdata, NULL);
net/mac80211/iface.c-1286- mutex_unlock(&local->iflist_mtx);
--
net/mac80211/iface.c=1327=void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
--
net/mac80211/iface.c-1338-
net/mac80211/iface.c:1339: sdata = rcu_dereference_protected(local->monitor_sdata,
net/mac80211/iface.c-1340- lockdep_is_held(&local->iflist_mtx));
--
net/mac80211/iface.c-1351-
net/mac80211/iface.c:1352: RCU_INIT_POINTER(local->monitor_sdata, NULL);
net/mac80211/iface.c-1353- mutex_unlock(&local->iflist_mtx);
--
net/mac80211/rx.c=846=ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
--
net/mac80211/rx.c-853- unsigned int rtap_space = 0;
net/mac80211/rx.c:854: struct ieee80211_sub_if_data *monitor_sdata =
net/mac80211/rx.c:855: rcu_dereference(local->monitor_sdata);
net/mac80211/rx.c-856- bool only_monitor = false;
--
net/mac80211/rx.c-924-
net/mac80211/rx.c:925: ieee80211_handle_mu_mimo_mon(monitor_sdata, origskb, rtap_space);
net/mac80211/rx.c-926-
--
net/mac80211/tx.c=1762=static bool __ieee80211_tx(struct ieee80211_local *local,
--
net/mac80211/tx.c-1787- }
net/mac80211/tx.c:1788: sdata = rcu_dereference(local->monitor_sdata);
net/mac80211/tx.c-1789- if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) {
--
net/mac80211/tx.c=2324=netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
--
net/mac80211/tx.c-2412- if (!chanctx_conf) {
net/mac80211/tx.c:2413: tmp_sdata = rcu_dereference(local->monitor_sdata);
net/mac80211/tx.c-2414- if (tmp_sdata)
--
net/mac80211/tx.c=3880=struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
--
net/mac80211/tx.c-4035- }
net/mac80211/tx.c:4036: tx.sdata = rcu_dereference(local->monitor_sdata);
net/mac80211/tx.c-4037- if (tx.sdata &&
--
net/mac80211/util.c=745=static void __iterate_interfaces(struct ieee80211_local *local,
--
net/mac80211/util.c-778-
net/mac80211/util.c:779: sdata = rcu_dereference_check(local->monitor_sdata,
net/mac80211/util.c-780- lockdep_is_held(&local->iflist_mtx) ||
--
net/mac80211/util.c=818=__ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
--
net/mac80211/util.c-830-
net/mac80211/util.c:831: monitor = rcu_dereference_check(local->monitor_sdata,
net/mac80211/util.c-832- lockdep_is_held(&hw->wiphy->mtx));
--
net/mac80211/util.c=1885=int ieee80211_reconfig(struct ieee80211_local *local)
--
net/mac80211/util.c-1989- /* add interfaces */
net/mac80211/util.c:1990: sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata);
net/mac80211/util.c-1991- if (sdata && ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) {
--
net/mac80211/util.c-1995- if (WARN_ON(res)) {
net/mac80211/util.c:1996: RCU_INIT_POINTER(local->monitor_sdata, NULL);
net/mac80211/util.c-1997- synchronize_net();
--
net/mac80211/util.c-2040-
net/mac80211/util.c:2041: sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata);
net/mac80211/util.c-2042- if (sdata && ieee80211_sdata_running(sdata))
]
|
| 601/6 |
2026/09/07 08:29 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 76319
output: 50
thoughts: 1818
Thoughts: **My Thought Process on Why the Bug Wasn't Triggered**
Ah, I've been mulling over why this particular reproducer didn't hit that `WARNING in mac80211_hwsim_write_tsf` with `c->control.rates[0].idx < 0`. The core of the issue, as I see it, lies in how the packet processing pipeline handles the initial malformed radiotap header.
The reproducer sets up `wlan0` in monitor mode and sends a packet via AF_PACKET. The radiotap header, as described, includes `IEEE80211_RADIOTAP_RATE` with a value of `0`. My initial understanding was that `ieee80211_parse_tx_radiotap` would directly lead to the `idx` being `-1` and the `IEEE80211_TX_CTRL_RATE_INJECT` flag being cleared. Then, the subsequent calls to `mac80211_hwsim_write_tsf` and its dependents would find this negative index and trigger the warning.
However, there's a crucial intermediate step I'd initially overlooked. After `ieee80211_parse_tx_radiotap` processes the radiotap header, it sets `rates[0].idx = -1` and clears `IEEE80211_TX_CTRL_RATE_INJECT`. But this isn't the end of the line for rate control decisions before the packet hits the hardware simulation.
The packet then proceeds through `ieee80211_xmit`, `ieee80211_tx`, and importantly, `invoke_tx_handlers_late`. Within `invoke_tx_handlers_late`, the `ieee80211_tx_h_rate_ctrl` handler is called.
Now, here's the key: `ieee80211_tx_h_rate_ctrl` checks the `IEEE80211_TX_CTRL_RATE_INJECT` flag. If this flag *were* set, it would skip rate control altogether. But because `ieee80211_parse_tx_radiotap` *cleared* it, this handler *doesn't* skip rate control.
Instead, `ieee80211_tx_h_rate_ctrl` proceeds to call `rate_control_get_rate`, which eventually leads to `rate_control_send_low` and `__rate_control_send_low`. This mechanism then *re-evaluates* and *sets* a valid, non-negative rate index for `rates[0].idx` – typically the lowest supported bitrate index, which would be `0`.
So, by the time the packet reaches `mac80211_hwsim_tx` and subsequently `mac80211_hwsim_write_tsf` (and then `mac80211_hwsim_get_tx_rate` and `ieee80211_get_tx_rate`), the `info->control.rates[0].idx` is no longer `-1`. It's been set to `0` (or another valid positive index) by the rate control mechanism. This means the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` condition is simply not met, and the warning is avoided.
I also considered the user's question about `cfg80211_reg_can_beacon` returning false. While that's a valid check within `ieee80211_monitor_start_xmit` that could indeed cause an early exit (`goto fail_rcu`), it's not directly related to *why* the `c->control.rates[0].idx < 0` warning *itself* doesn't trigger once the packet is in flight. The issue is that the rate control logic, in its normal flow, corrects the invalid rate *before* it reaches the problematic check. The absence of a configured channel in the `local->chanctx_list` also means `chanctx_conf` would be NULL, leading to `goto fail_rcu` in `ieee80211_monitor_start_xmit` if the packet were trying to start transmission. However, the reproducer likely gets past this point because it's sending a packet *to* the monitor interface, not starting a transmission *from* it that would necessitate a channel definition. The crucial point remains the intervention of the rate control subsystem.
|
| 602/6 |
2026/09/07 08:29 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5990 LineCount:70]
Results: map[Contents:5990: struct ieee80211_supported_band *sband = &data->bands[band];
5991: struct wiphy_radio_freq_range *radio_range;
5992: const struct ieee80211_channel *c;
5993: struct wiphy_radio *radio;
5994:
5995: sband->band = band;
5996:
5997: switch (band) {
5998: case NL80211_BAND_2GHZ:
5999: sband->channels = data->channels_2ghz;
6000: sband->n_channels = ARRAY_SIZE(hwsim_channels_2ghz);
6001: sband->bitrates = data->rates;
6002: sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
6003: break;
6004: case NL80211_BAND_5GHZ:
6005: sband->channels = data->channels_5ghz;
6006: sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
6007: sband->bitrates = data->rates + 4;
6008: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6009:
6010: sband->vht_cap.vht_supported = true;
6011: sband->vht_cap.cap =
6012: IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
6013: IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
6014: IEEE80211_VHT_CAP_RXLDPC |
6015: IEEE80211_VHT_CAP_SHORT_GI_80 |
6016: IEEE80211_VHT_CAP_SHORT_GI_160 |
6017: IEEE80211_VHT_CAP_TXSTBC |
6018: IEEE80211_VHT_CAP_RXSTBC_4 |
6019: IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
6020: sband->vht_cap.vht_mcs.rx_mcs_map =
6021: cpu_to_le16(HWSIM_VHT_MCS_MAP);
6022: sband->vht_cap.vht_mcs.tx_mcs_map =
6023: sband->vht_cap.vht_mcs.rx_mcs_map;
6024: break;
6025: case NL80211_BAND_6GHZ:
6026: sband->channels = data->channels_6ghz;
6027: sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
6028: sband->bitrates = data->rates + 4;
6029: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6030: break;
6031: case NL80211_BAND_S1GHZ:
6032: memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
6033: sizeof(sband->s1g_cap));
6034: sband->channels = data->channels_s1g;
6035: sband->n_channels = ARRAY_SIZE(hwsim_channels_s1g);
6036: break;
6037: default:
6038: continue;
6039: }
6040:
6041: if (band != NL80211_BAND_6GHZ){
6042: sband->ht_cap.ht_supported = true;
6043: sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
6044: IEEE80211_HT_CAP_GRN_FLD |
6045: IEEE80211_HT_CAP_SGI_20 |
6046: IEEE80211_HT_CAP_SGI_40 |
6047: IEEE80211_HT_CAP_DSSSCCK40 |
6048: IEEE80211_HT_CAP_TX_STBC |
6049: IEEE80211_HT_CAP_RX_STBC;
6050: sband->ht_cap.ampdu_factor = 0x3;
6051: sband->ht_cap.ampdu_density = 0x6;
6052: memset(&sband->ht_cap.mcs, 0,
6053: sizeof(sband->ht_cap.mcs));
6054: sband->ht_cap.mcs.rx_mask[0] = 0xff;
6055: sband->ht_cap.mcs.rx_mask[1] = 0xff;
6056: sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
6057: }
6058:
6059: mac80211_hwsim_sband_capab(sband);
]
|
| 603/6 |
2026/09/07 08:29 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 79662
output: 26
thoughts: 17
Thoughts: **My Deep Dive into `hwsim_channels_2ghz`**
Alright, so my first instinct, when presented with the task of understanding or working with `hwsim_channels_2ghz`, is to meticulously examine its contents. I need to know *exactly* what it holds. This isn't about a superficial glance; it's about a thorough, almost forensic, investigation. What data structures are defined? What are the specific parameters and their expected ranges or types? Are there any implicit assumptions or dependencies that I need to be aware of from the outset? My goal here is to build a complete mental model of `hwsim_channels_2ghz` – its purpose, its internal workings, and how it's intended to be used within the broader system. This foundational understanding is absolutely critical before I can even *begin* to consider how to modify it, integrate it, or debug it. It’s the bedrock upon which all subsequent actions will be built.
|
| 604/6 |
2026/09/07 08:29 |
tool |
codesearch-definition-source |
0m
Args: map[Name:hwsim_channels_2ghz]
Results: map[SourceCode: 367: static const struct ieee80211_channel hwsim_channels_2ghz[] = {
368: CHAN2G(2412), /* Channel 1 */
369: CHAN2G(2417), /* Channel 2 */
370: CHAN2G(2422), /* Channel 3 */
371: CHAN2G(2427), /* Channel 4 */
372: CHAN2G(2432), /* Channel 5 */
373: CHAN2G(2437), /* Channel 6 */
374: CHAN2G(2442), /* Channel 7 */
375: CHAN2G(2447), /* Channel 8 */
376: CHAN2G(2452), /* Channel 9 */
377: CHAN2G(2457), /* Channel 10 */
378: CHAN2G(2462), /* Channel 11 */
379: CHAN2G(2467), /* Channel 12 */
380: CHAN2G(2472), /* Channel 13 */
381: CHAN2G(2484), /* Channel 14 */
382: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 605/6 |
2026/09/07 08:29 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 80070
output: 33
thoughts: 12
Thoughts: **My Thought Process on the `CHAN2G` Macro**
Alright, so I'm looking at this `CHAN2G` macro. My immediate instinct is to break down what it's actually *doing*. What's the core functionality it's trying to achieve? I need to understand the inputs it expects and the outputs it's designed to produce. This isn't just about syntax; it's about understanding the intended behavior and how it fits into the larger system. I'm trying to reverse-engineer the problem it's solving, or perhaps the feature it's enabling.
|
| 606/6 |
2026/09/07 08:29 |
tool |
grepper |
0m
Args: map[Expression:#define CHAN2G PathPrefix:drivers/net/wireless/virtual/]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=339=static struct net_device *hwsim_mon; /* global monitor netdev */
drivers/net/wireless/virtual/mac80211_hwsim_main.c-340-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:341:#define CHAN2G(_freq) { \
drivers/net/wireless/virtual/mac80211_hwsim_main.c-342- .band = NL80211_BAND_2GHZ, \
]
|
| 607/6 |
2026/09/07 08:29 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 80264
output: 49
thoughts: 29
Thoughts: **My Thought Process Regarding `mac80211_hwsim` Simulation Behavior**
Alright, so I'm diving into the `mac80211_hwsim` driver, specifically looking at lines 340 through 366 in `mac80211_hwsim_main.c`. My primary goal here is to understand the simulated hardware's behavior in response to certain events, particularly around channel switching and its implications for ongoing transmissions.
I'm focusing on how the simulation handles the transition when a virtual wireless device (wdev) is signaled to change its operational channel. The code at these lines seems to be the core logic that dictates what happens to any frames currently being transmitted by that simulated device when this channel switch command arrives.
My intuition is that in a real hardware scenario, a robust driver would likely have to consider how to gracefully handle this. If a frame is in flight, abruptly changing channels could lead to transmission errors, dropped packets, and a generally poor user experience. Therefore, I'm expecting to see some sort of mechanism to manage this.
My immediate hypotheses are:
1. **Transmission Interruption and Queuing:** The driver might be designed to stop the current transmission, queue the partially transmitted frame (or discard it and mark it as needing retransmission), and then initiate the channel switch. This would prevent corrupting the ongoing transmission and allow it to be retried on the new channel.
2. **Forced Completion (Less Likely):** It's also possible, though less ideal, that the simulation simply allows the current transmission to complete, even if it's on the old channel, before the channel switch takes effect. This would be simpler but potentially lead to more errors.
3. **Immediate Abort:** The simplest, but most disruptive, approach would be to just abort the transmission immediately. This is likely to cause packet loss.
I'm specifically looking for keywords and logic that indicate:
* A check for an active transmission.
* A mechanism to stop or pause the transmission (e.g., `txq_stop`, `ieee80211_stop_tx` or similar constructs).
* Handling of the frame itself – whether it's put back into a queue, dropped, or explicitly canceled.
* The timing of the channel switch relative to this transmission management.
Essentially, I want to confirm that the simulation accurately reflects a well-behaved wireless driver's approach to channel switching during active data transfer, or at least clearly delineates its simulated behavior so I can understand any potential limitations or specific scenarios it models. My expertise tells me that managing this transition is a critical piece of the driver's functionality, and I need to see how `hwsim` replicates it.
|
| 608/6 |
2026/09/07 08:29 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:340 LineCount:27]
Results: map[Contents: 340:
341: #define CHAN2G(_freq) { \
342: .band = NL80211_BAND_2GHZ, \
343: .center_freq = (_freq), \
344: .hw_value = (_freq), \
345: }
346:
347: #define CHAN5G(_freq) { \
348: .band = NL80211_BAND_5GHZ, \
349: .center_freq = (_freq), \
350: .hw_value = (_freq), \
351: }
352:
353: #define CHAN6G(_freq) { \
354: .band = NL80211_BAND_6GHZ, \
355: .center_freq = (_freq), \
356: .hw_value = (_freq), \
357: }
358:
359: #define CHANS1G(_freq, _offset, _flags) { \
360: .band = NL80211_BAND_S1GHZ, \
361: .center_freq = (_freq), \
362: .freq_offset = (_offset), \
363: .hw_value = (_freq), \
364: .flags = (_flags), \
365: }
366:
]
|
| 609/6 |
2026/09/07 08:29 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 80737
output: 1173
thoughts: 4342
Thoughts: **Understanding Why the Bug Wasn't Triggered**
So, I've been digging into why that bug, specifically the `WARNING in mac80211_hwsim_write_tsf` with a negative `c->control.rates[0].idx`, wasn't triggered by the reproducer as expected. It turns out there are a few layers of logic that prevent it from getting to that point, and a couple of key reasons why the warning itself wouldn't fire even if it did.
First off, the fact that the reproducer exits with a status of `0` (success) is understandable from the user-space perspective. When I send a packet using `AF_PACKET` with `sendto()`, the kernel's packet socket layer queues it up for transmission. As long as that queuing happens without a synchronous socket-level error, `send()` will return the number of bytes sent, indicating success to the user process. This return value doesn't reflect whether the packet was actually *valid* or successfully processed by the lower levels of mac80211 or the driver; it just means it was handed off.
Now, let's look at why the `rates[0].idx < 0` condition, which is crucial for triggering that specific `WARNING`, doesn't actually manifest in the scenario described:
1. **The `IEEE80211_TX_CTRL_RATE_INJECT` Flag is Key:** When the radiotap header specifies a `rate=0`, `ieee80211_parse_tx_radiotap` tries to find a matching bitrate in the `sband->bitrates`. Since no standard bitrate is 0, it fails, and `info->control.rates[0].idx` ends up being `-1`. Crucially, this failure then causes `ieee80211_parse_tx_radiotap` to **explicitly clear** the `IEEE80211_TX_CTRL_RATE_INJECT` flag. This is a critical step that diverts the packet from the path that would lead to the warning.
2. **Rate Control Still Runs:** The `IEEE80211_TX_CTRL_RATE_INJECT` flag is what tells mac80211 to *skip* its standard rate control mechanism. Because this flag was cleared (due to `rates[0].idx < 0`), the packet *does* go through the normal rate control processing in `ieee80211_tx_h_rate_ctrl`. This means mac80211 calls `rate_control_get_rate()` which, in turn, calls `__rate_control_send_low()`. This function *will* assign a valid, non-negative index to `rates[0].idx`, typically a fallback or the lowest supported rate index (like `0`).
3. **The Warning is Avoided:** By the time the packet reaches the driver-specific `mac80211_hwsim_tx()` path, specifically `mac80211_hwsim_write_tsf` and then `ieee80211_get_tx_rate()`, the `rates[0].idx` is no longer negative. It's a valid index (`>= 0`). Therefore, the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` condition is never met, and the warning simply isn't triggered.
I also considered if there were earlier drop points:
* **`cfg80211_reg_can_beacon` Check:** In the context of `mac80211_hwsim`, standard 2.4GHz channels (1-11) are generally allowed for beaconing and IR without DFS. So, `cfg80211_reg_can_beacon` would typically return `true` for these, and wouldn't cause an early drop *unless* the monitor interface was not associated with any channel context (`chanctx_conf` being `NULL`). In such a case, the frame would indeed be dropped at `goto fail_rcu;` in `ieee80211_monitor_start_xmit` before any of the rate parsing logic I've discussed. However, the reproducer seems to imply a scenario where the packet *does* proceed further.
Essentially, the reproducer's setup, with `IEEE80211_RADIOTAP_RATE` set to 0, inadvertently leads to the clearing of `IEEE80211_TX_CTRL_RATE_INJECT`. This clearing then forces the normal rate control to run, which corrects the negative index before the problematic warning check is reached. It's a good example of how different control flags can drastically alter the execution path and mask underlying issues.
|
| 610/6 |
2026/09/07 08:30 |
tool |
set-results |
0m
Args: map[Answer:The reproducer exits with 0 and fails to trigger the `WARNING in mac80211_hwsim_write_tsf` for the following reasons:
### 1. Why `rates[0].idx < 0` does not reach `mac80211_hwsim_write_tsf`
The assumption that clearing `IEEE80211_TX_CTRL_RATE_INJECT` leaves `idx = -1` intact all the way to `mac80211_hwsim_write_tsf` is incorrect:
1. **Radiotap Parsing (`ieee80211_parse_tx_radiotap`)**:
When the radiotap header contains `IEEE80211_RADIOTAP_RATE` with `rate = 0`, none of the supported bitrates in `sband->bitrates` match `rate * 5 = 0`. Consequently, `rates[0].idx` remains `-1`, and the kernel executes:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
2. **Mac80211 Rate Control Fallback (`ieee80211_tx_h_rate_ctrl`)**:
When the packet proceeds through `ieee80211_xmit` -> `ieee80211_tx` -> `invoke_tx_handlers_late` -> `ieee80211_tx_h_rate_ctrl`:
- mac80211 only bypasses rate control if the rate injection flag is set:
```c
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
- Because `IEEE80211_TX_CTRL_RATE_INJECT` was cleared by `ieee80211_parse_tx_radiotap`, mac80211 treats the frame as not having an injected rate and invokes standard rate selection via:
`rate_control_get_rate()` -> `rate_control_send_low()` -> `__rate_control_send_low()`.
- `__rate_control_send_low()` selects a valid lowest supported bitrate and **overwrites** `info->control.rates[0].idx` with a non-negative rate index (`rates[0].idx >= 0`, typically 0).
3. **Driver Transmission (`mac80211_hwsim_write_tsf`)**:
By the time `mac80211_hwsim_tx()` -> `mac80211_hwsim_tx_frame_no_nl()` -> `mac80211_hwsim_write_tsf()` is executed, `rates[0].idx` is no longer negative. Therefore, inside `ieee80211_get_tx_rate()`:
```c
if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
return NULL;
```
the warning check evaluates to false and the warning is never triggered.
---
### 2. Is `cfg80211_reg_can_beacon` or another check dropping the frame in `ieee80211_monitor_start_xmit`?
- **`cfg80211_reg_can_beacon`**: For monitor mode interfaces (`NL80211_IFTYPE_MONITOR`) on standard 2.4GHz channels (channels 1–11), `cfg80211_chandef_dfs_required()` returns 0 and standard channels have no radar or `NO_IR` restrictions in default world regulatory domains, so `cfg80211_reg_can_beacon()` returns `true`.
- **Channel context check (`chanctx_conf`)**: If the monitor interface was brought up without configuring a channel (or if there are multiple channel contexts in `local->chanctx_list`), `chanctx_conf` will be `NULL` in `ieee80211_monitor_start_xmit`, causing the frame to be dropped at `goto fail_rcu;` before `ieee80211_parse_tx_radiotap()` or `ieee80211_xmit()` is reached.
---
### 3. Why the reproducer process exits with 0
`ieee80211_monitor_start_xmit` returns `NETDEV_TX_OK` (0) in all cases (both on successful transmission and on internal error drops via `fail_rcu` / `fail`). For `AF_PACKET`, `sendto()` succeeds as long as the packet is accepted by the network device driver's `ndo_start_xmit` handler, so the user-space reproducer receives a successful return code and exits with 0.]
Results: map[Answer:The reproducer exits with 0 and fails to trigger the `WARNING in mac80211_hwsim_write_tsf` for the following reasons:
### 1. Why `rates[0].idx < 0` does not reach `mac80211_hwsim_write_tsf`
The assumption that clearing `IEEE80211_TX_CTRL_RATE_INJECT` leaves `idx = -1` intact all the way to `mac80211_hwsim_write_tsf` is incorrect:
1. **Radiotap Parsing (`ieee80211_parse_tx_radiotap`)**:
When the radiotap header contains `IEEE80211_RADIOTAP_RATE` with `rate = 0`, none of the supported bitrates in `sband->bitrates` match `rate * 5 = 0`. Consequently, `rates[0].idx` remains `-1`, and the kernel executes:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
2. **Mac80211 Rate Control Fallback (`ieee80211_tx_h_rate_ctrl`)**:
When the packet proceeds through `ieee80211_xmit` -> `ieee80211_tx` -> `invoke_tx_handlers_late` -> `ieee80211_tx_h_rate_ctrl`:
- mac80211 only bypasses rate control if the rate injection flag is set:
```c
if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
return TX_CONTINUE;
```
- Because `IEEE80211_TX_CTRL_RATE_INJECT` was cleared by `ieee80211_parse_tx_radiotap`, mac80211 treats the frame as not having an injected rate and invokes standard rate selection via:
`rate_control_get_rate()` -> `rate_control_send_low()` -> `__rate_control_send_low()`.
- `__rate_control_send_low()` selects a valid lowest supported bitrate and **overwrites** `info->control.rates[0].idx` with a non-negative rate index (`rates[0].idx >= 0`, typically 0).
3. **Driver Transmission (`mac80211_hwsim_write_tsf`)**:
By the time `mac80211_hwsim_tx()` -> `mac80211_hwsim_tx_frame_no_nl()` -> `mac80211_hwsim_write_tsf()` is executed, `rates[0].idx` is no longer negative. Therefore, inside `ieee80211_get_tx_rate()`:
```c
if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
return NULL;
```
the warning check evaluates to false and the warning is never triggered.
---
### 2. Is `cfg80211_reg_can_beacon` or another check dropping the frame in `ieee80211_monitor_start_xmit`?
- **`cfg80211_reg_can_beacon`**: For monitor mode interfaces (`NL80211_IFTYPE_MONITOR`) on standard 2.4GHz channels (channels 1–11), `cfg80211_chandef_dfs_required()` returns 0 and standard channels have no radar or `NO_IR` restrictions in default world regulatory domains, so `cfg80211_reg_can_beacon()` returns `true`.
- **Channel context check (`chanctx_conf`)**: If the monitor interface was brought up without configuring a channel (or if there are multiple channel contexts in `local->chanctx_list`), `chanctx_conf` will be `NULL` in `ieee80211_monitor_start_xmit`, causing the frame to be dropped at `goto fail_rcu;` before `ieee80211_parse_tx_radiotap()` or `ieee80211_xmit()` is reached.
---
### 3. Why the reproducer process exits with 0
`ieee80211_monitor_start_xmit` returns `NETDEV_TX_OK` (0) in all cases (both on successful transmission and on internal error drops via `fail_rcu` / `fail`). For `AF_PACKET`, `sendto()` succeeds as long as the packet is accepted by the network device driver's `ndo_start_xmit` handler, so the user-space reproducer receives a successful return code and exits with 0.]
|
| 611/4 |
2026/09/07 08:30 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 208305
output: 28
thoughts: 152
Thoughts: **My Thought Process Unraveling the Netlink Frame Injection Vulnerability**
Okay, so I've just stumbled upon something interesting in the `ieee80211_tx_h_rate_ctrl` function. My initial observation is that it seems to be overwriting `rates[0].idx` under certain conditions. Specifically, this happens *unless* the `IEEE80211_TX_CTRL_RATE_INJECT` flag is set. This is a pretty specific piece of logic, and it immediately makes me pause and think about the implications.
Now, I'm looking at the bug description itself, and it's pointing to a `netlink: 80 bytes leftover after parsing attributes in process syz.4.6946` issue. This tells me that the syzkaller fuzzing tool, in its execution of `syz.4.6946`, constructed and sent a netlink message that, after all its intended attributes were processed, still had an extraneous 80 bytes of data hanging around. This is inherently suspicious – well-formed netlink messages shouldn't have unparsed data.
So, my mind immediately jumps to connecting these two pieces of information. The `ieee80211_tx_h_rate_ctrl` behavior and the syzkaller netlink issue. How could they possibly be related? The key word here is "overwrites" and the condition "if `IEEE80211_TX_CTRL_RATE_INJECT` is not set". This suggests a scenario where the rate control logic might be bypassed or altered.
Then, it hits me: What if the corrupted or malformed netlink message, the one with the 80 leftover bytes, is *specifically designed to trigger this frame injection scenario*? The `NL80211_CMD_FRAME` command is designed precisely for injecting raw 802.11 frames. If syzkaller is using this command, and the netlink message it sends is malformed in a way that leads to these leftover bytes, could those leftover bytes be interpreted as part of the frame data, or perhaps manipulate the frame injection process itself?
This leads me directly to investigate `nl80211_tx_mgmt`. I need to see how `NL80211_CMD_FRAME` is handled, and more importantly, how the data from the netlink message is fed into the 802.11 transmission stack. My hypothesis is that the "80 bytes leftover" might be landing in a position that, when `ieee80211_tx_h_rate_ctrl` is invoked (perhaps because `IEEE80211_TX_CTRL_RATE_INJECT` *is* set in this specific injection scenario, or perhaps the leftover bytes are corrupting the control flags themselves), it doesn't behave as expected. The fact that the bug mentions "leftover" bytes strongly suggests that the parsing of the netlink message isn't robust enough to handle unexpected data, and this unexpected data could be influencing subsequent processing, including rate control. I'm trying to ascertain if the malformed netlink data is *directly* influencing the `rates[0].idx` or if it's causing a general bypass or misconfiguration that leads to predictable undesirable behavior, like a fixed rate transmission or even a denial of service. The `NL80211_CMD_FRAME` is my prime suspect for the *mechanism* by which this malformed data is being introduced into the transmission path.
|
| 612/4 |
2026/09/07 08:30 |
tool |
codesearch-definition-source |
0m
Args: map[Name:nl80211_tx_mgmt]
Results: map[SourceCode:14764: static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
14765: {
14766: struct cfg80211_registered_device *rdev = info->user_ptr[0];
14767: struct wireless_dev *wdev = info->user_ptr[1];
14768: struct cfg80211_chan_def chandef;
14769: int err;
14770: void *hdr = NULL;
14771: u64 cookie;
14772: struct sk_buff *msg = NULL;
14773: struct cfg80211_mgmt_tx_params params = {
14774: .dont_wait_for_ack =
14775: info->attrs[NL80211_ATTR_DONT_WAIT_FOR_ACK],
14776: };
14777:
14778: if (!info->attrs[NL80211_ATTR_FRAME])
14779: return -EINVAL;
14780:
14781: if (!rdev->ops->mgmt_tx)
14782: return -EOPNOTSUPP;
14783:
14784: switch (wdev->iftype) {
14785: case NL80211_IFTYPE_P2P_DEVICE:
14786: if (!info->attrs[NL80211_ATTR_WIPHY_FREQ])
14787: return -EINVAL;
14788: break;
14789: case NL80211_IFTYPE_STATION:
14790: case NL80211_IFTYPE_ADHOC:
14791: case NL80211_IFTYPE_P2P_CLIENT:
14792: case NL80211_IFTYPE_AP:
14793: case NL80211_IFTYPE_AP_VLAN:
14794: case NL80211_IFTYPE_MESH_POINT:
14795: case NL80211_IFTYPE_P2P_GO:
14796: break;
14797: case NL80211_IFTYPE_NAN:
14798: case NL80211_IFTYPE_NAN_DATA:
14799: if (!wiphy_ext_feature_isset(wdev->wiphy,
14800: NL80211_EXT_FEATURE_SECURE_NAN) &&
14801: !(wdev->wiphy->nan_capa.flags &
14802: WIPHY_NAN_FLAGS_USERSPACE_DE))
14803: return -EOPNOTSUPP;
14804: break;
14805: case NL80211_IFTYPE_PD:
14806: if (!wiphy_ext_feature_isset(wdev->wiphy,
14807: NL80211_EXT_FEATURE_SECURE_RTT))
14808: return -EOPNOTSUPP;
14809: break;
14810: default:
14811: return -EOPNOTSUPP;
14812: }
14813:
14814: if (info->attrs[NL80211_ATTR_DURATION]) {
14815: if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
14816: return -EINVAL;
14817: params.wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]);
14818:
14819: /*
14820: * We should wait on the channel for at least a minimum amount
14821: * of time (10ms) but no longer than the driver supports.
14822: */
14823: if (params.wait < NL80211_MIN_REMAIN_ON_CHANNEL_TIME ||
14824: params.wait > rdev->wiphy.max_remain_on_channel_duration)
14825: return -EINVAL;
14826: }
14827:
14828: params.offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK];
14829:
14830: if (params.offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
14831: return -EINVAL;
14832:
14833: params.no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
14834:
14835: /* get the channel if any has been specified, otherwise pass NULL to
14836: * the driver. The latter will use the current one
14837: */
14838: chandef.chan = NULL;
14839: if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
14840: err = nl80211_parse_chandef(rdev, info->extack, info->attrs,
14841: &chandef, false);
14842: if (err)
14843: return err;
14844: }
14845:
14846: if (!chandef.chan && params.offchan)
14847: return -EINVAL;
14848:
14849: if (params.offchan &&
14850: !cfg80211_off_channel_oper_allowed(wdev, chandef.chan))
14851: return -EBUSY;
14852:
14853: params.link_id = nl80211_link_id_or_invalid(info->attrs);
14854: /*
14855: * This now races due to the unlock, but we cannot check
14856: * the valid links for the _station_ anyway, so that's up
14857: * to the driver.
14858: */
14859: if (params.link_id >= 0 &&
14860: !(wdev->valid_links & BIT(params.link_id)))
14861: return -EINVAL;
14862:
14863: params.buf = nla_data(info->attrs[NL80211_ATTR_FRAME]);
14864: params.len = nla_len(info->attrs[NL80211_ATTR_FRAME]);
14865:
14866: err = nl80211_parse_counter_offsets(rdev, NULL, params.len, -1,
14867: info->attrs[NL80211_ATTR_CSA_C_OFFSETS_TX],
14868: ¶ms.csa_offsets,
14869: ¶ms.n_csa_offsets);
14870: if (err)
14871: return err;
14872:
14873: if (!params.dont_wait_for_ack) {
14874: msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
14875: if (!msg)
14876: return -ENOMEM;
14877:
14878: hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
14879: NL80211_CMD_FRAME);
14880: if (!hdr) {
14881: err = -ENOBUFS;
14882: goto free_msg;
14883: }
14884: }
14885:
14886: params.chan = chandef.chan;
14887: cookie = cfg80211_assign_cookie(rdev);
14888: err = cfg80211_mlme_mgmt_tx(rdev, wdev, ¶ms, cookie);
14889: if (err)
14890: goto free_msg;
14891:
14892: if (msg) {
14893: if (nla_put_u64_64bit(msg, NL80211_ATTR_COOKIE, cookie,
14894: NL80211_ATTR_PAD))
14895: goto nla_put_failure;
14896:
14897: genlmsg_end(msg, hdr);
14898: return genlmsg_reply(msg, info);
14899: }
14900:
14901: return 0;
14902:
14903: nla_put_failure:
14904: err = -ENOBUFS;
14905: free_msg:
14906: nlmsg_free(msg);
14907: return err;
14908: }
SourceFile:net/wireless/nl80211.c]
|
| 613/4 |
2026/09/07 08:30 |
llm |
repro-oracle-compressor |
0m
Model:
Reply: ### Summary of Execution History & Workspace State
#### 1. Approaches Tried and Results
* **C Reproducer Candidate Execution**:
* Set `wlan0` DOWN, changed mode to `NL80211_IFTYPE_MONITOR` via netlink `NL80211_CMD_SET_INTERFACE` (`cmd=0x6`), set `wlan0` UP.
* Sent Netlink command `cmd=0x41` (`NL80211_CMD_SET_REKEY_OFFLOAD`) intended as frequency configuration (hardcoded `0x41` instead of `NL80211_CMD_SET_CHANNEL` which is `0x3a` / 58). Succeeded with `error=0` from Netlink ack.
* Bound `AF_PACKET` raw socket to `wlan0` and sent raw 802.11 frames with radiotap headers specifying `IEEE80211_RADIOTAP_RATE` with `rate = 0`.
* **Result**: The program exited cleanly with exit code `0`. `sendto()` returned 33 bytes without errors. No kernel crash or warning was triggered (`Reproduced: false`).
#### 2. Root Cause Analysis & Kernel Diagnosis of Failure
* **Target Bug**: `WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0` where `c->control.rates[0].idx < 0` triggers `WARN_ON_ONCE(c->control.rates[0].idx < 0)` in `ieee80211_get_tx_rate()`.
* **Failure Analysis**:
1. `ieee80211_parse_tx_radiotap()` initializes all `rates[i].idx = -1`.
2. With `rate = 0`, matching against `sband->bitrates` fails (`rate * 5 != bitrate`).
3. Because `rates[0].idx < 0`, `ieee80211_parse_tx_radiotap()` clears `info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;`.
4. In `ieee80211_tx_h_rate_ctrl()` (called in TX path), since `IEEE80211_TX_CTRL_RATE_INJECT` is unset, mac80211 does not bypass rate control. Instead, it falls back to standard rate control (`rate_control_get_rate()` -> `rate_control_send_low()`), which overwrites `info->control.rates[0].idx` with a valid non-negative index (`idx >= 0`).
5. When `mac80211_hwsim_write_tsf()` -> `mac80211_hwsim_get_tx_rate()` -> `ieee80211_get_tx_rate()` executes, `rates[0].idx` is no longer negative, so the `WARN_ON_ONCE` does not trigger.
6. Furthermore, `ieee80211_monitor_start_xmit()` returns `NETDEV_TX_OK` unconditionally (even when dropping packets), causing `AF_PACKET` `sendto()` to report success to userspace.
#### 3. Critical Files, Functions, and Code Snippets
* **`include/net/mac80211.h`**:
```c
static inline struct ieee80211_rate *
ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
const struct ieee80211_tx_info *c)
{
if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
return NULL;
if (c->band >= NUM_NL80211_BANDS)
return NULL;
return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
}
```
* **`drivers/net/wireless/virtual/mac80211_hwsim_main.c`**:
```c
static struct ieee80211_rate *
mac80211_hwsim_get_tx_rate(struct ieee80211_hw *hw,
struct ieee80211_tx_info *info)
{
if (info->control.rates[0].flags &
(IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))
return NULL;
return ieee80211_get_tx_rate(hw, info);
}
static void mac80211_hwsim_write_tsf(struct mac80211_hwsim_data *data,
struct sk_buff *skb, u64 sim_time)
{
...
txrate = mac80211_hwsim_get_tx_rate(data->hw, info);
if (txrate)
bitrate = txrate->bitrate;
...
}
```
* **`net/mac80211/tx.c`** (`ieee80211_parse_tx_radiotap`):
```c
if (rate_found) {
...
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
info->control.rates[i].idx = -1;
info->control.rates[i].flags = 0;
info->control.rates[i].count = 0;
}
...
if (rate_flags & IEEE80211_TX_RC_MCS) {
info->control.rates[0].idx = rate;
} else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
ieee80211_rate_set_vht(info->control.rates, vht_mcs, vht_nss);
} else if (sband) {
for (i = 0; i < sband->n_bitrates; i++) {
if (rate * 5 != sband->bitrates[i].bitrate)
continue;
info->control.rates[0].idx = i;
break;
}
}
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
...
}
```
#### 4. Active Hypotheses & Next Investigation Paths
* **How to preserve `idx < 0` without triggering rate control overwrite**:
1. **Radiotap flags / MCS / VHT combinations**: Check if radiotap MCS / VHT flags can be set such that `IEEE80211_TX_CTRL_RATE_INJECT` remains set (or rate control does not overwrite `rates[0].idx`), but `mac80211_hwsim_get_tx_rate()` doesn't bail early and proceeds to `ieee80211_get_tx_rate()`. Specifically:
* Note: `mac80211_hwsim_get_tx_rate()` returns `NULL` if `IEEE80211_TX_RC_MCS` or `IEEE80211_TX_RC_VHT_MCS` is set in `info->control.rates[0].flags`.
* If legacy rate injection is used without MCS/VHT flags, how does `rates[0].idx` remain `< 0` without getting overwritten?
2. **Alternative Injection / Frame Paths**:
* Syzkaller log had: `netlink: 80 bytes leftover after parsing attributes in process syz.4.6946`.
* Check if `NL80211_CMD_FRAME` or direct management frame TX via nl80211 constructs `ieee80211_tx_info` with `rates[0].idx < 0` directly bypassing `ieee80211_tx_h_rate_ctrl()` or radiotap parsing.
* Check how management frames injected or queued via `NL80211_CMD_FRAME` / `drv_tx` interact with `mac80211_hwsim_write_tsf`.
#### 5. Reasoning Loops & Tool Call Pitfalls Noted
* **Infinite loop in Netlink command interpretation**: A previous reasoning step repeated `Wait, NL80211_CMD_SET_WIPHY is 2` hundreds of times due to token generation loops. Avoid repetitive chain-of-thought loops on command numbers.
* Ensure netlink commands sent from reproducer match correct enum values: `NL80211_CMD_SET_CHANNEL` is 58 (`0x3a`), `NL80211_CMD_SET_WIPHY` is 2, `NL80211_CMD_FRAME` is 52 (`0x34`).
Tokens:
input: 214011
output: 2159
thoughts: 125
|
| 614/4 |
2026/09/07 08:30 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 29178
output: 51
thoughts: 1272
Thoughts: **My Journey Through the `mac80211_hwsim` Bug**
Initially, I was convinced the issue stemmed from a netlink command, specifically `NL80211_CMD_FRAME`, and that my debugging path would eventually lead to `mac80211_hwsim_tx_frame_no_nl`. This seemed plausible, given the typical interaction patterns within the wireless subsystem.
However, a critical examination of the provided stack trace shattered this initial hypothesis. I noticed that the trace originated not from netlink, as I had assumed, but from `packet_sendmsg`. This was a significant revelation. The prior warning about 80 bytes leftover in the netlink message was, I now realize, likely a red herring – a consequence of `nl80211` parsing, perhaps during interface setup, and not the root cause of the actual crash.
The true culprit, therefore, lay further down the stack, initiated by `packet_sendmsg` and leading directly to `ieee80211_monitor_start_xmit`. This meant my initial approach of using `AF_PACKET` and `sendto` was, in fact, the correct *path* to trigger the bug. The question then became: why did my previous attempts fail to reproduce the issue?
This led me back to the failure analysis, and a deeper dive into the interaction within `ieee80211_parse_tx_radiotap()`. My understanding evolved as follows:
1. The function `ieee80211_parse_tx_radiotap()` initializes all `rates[i].idx` to `-1`.
2. When the `rate` value is `0`, it fails to match against `sband->bitrates`, resulting in `rate * 5 != bitrate`.
3. Crucially, because `rates[0].idx` remains negative (`< 0`) at this point, `ieee80211_parse_tx_radiotap()` proceeds to clear the `IEEE80211_TX_CTRL_RATE_INJECT` flag via `info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;`.
4. Following this, in `ieee80211_tx_h_rate_ctrl()` (which is invoked during the transmit path), the absence of `IEEE80211_TX_CTRL_RATE_INJECT` means that mac80211 *does not* bypass its standard rate control mechanisms. Instead, it falls back to `rate_control_get_rate()` and subsequently `rate_control_send_low()`. This fallback mechanism *overwrites* `info->control.rates[0].idx` with a valid, non-negative index (`idx >= 0`).
5. Consequently, when `mac80211_hwsim_write_tsf()` is eventually called, leading to `mac80211_hwsim_get_tx_rate()` and then `ieee80211_get_tx_rate()`, the `rates[0].idx` is no longer negative. This means the `WARN_ON_ONCE` condition, which checks `rates[0].idx < 0`, is not met, and the warning (and thus the bug) is not triggered.
This understanding brought me to a critical realization: if `IEEE80211_TX_CTRL_RATE_INJECT` is unset, the rate control logic overwrites `rates[0].idx`, preventing the bug. Therefore, to trigger the bug, `IEEE80211_TX_CTRL_RATE_INJECT` *must* remain set!
But this presents a paradox: the condition that sets `IEEE80211_TX_CTRL_RATE_INJECT` is precisely when `rates[0].idx >= 0` in `ieee80211_parse_tx_radiotap()`. This is where my thought process hit a snag, as it seemed contradictory for `rates[0].idx` to be negative when it reached `mac80211_hwsim_write_tsf` if `IEEE80211_TX_CTRL_RATE_INJECT` was to be set.
I had to re-examine the logic in `ieee80211_parse_tx_radiotap()` with extreme care, seeking the subtle interplay that would allow `rates[0].idx` to remain negative *and* result in `IEEE80211_TX_CTRL_RATE_INJECT` being set, or find the condition where it is cleared, and then the rate control overwrites it, and then somehow it becomes negative again.
|
| 615/4 |
2026/09/07 08:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_parse_tx_radiotap]
Results: map[SourceCode:2106: bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
2107: struct net_device *dev)
2108: {
2109: struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
2110: struct ieee80211_radiotap_iterator iterator;
2111: struct ieee80211_radiotap_header *rthdr =
2112: (struct ieee80211_radiotap_header *) skb->data;
2113: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2114: int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len,
2115: NULL);
2116: u16 txflags;
2117: u16 rate = 0;
2118: bool rate_found = false;
2119: u8 rate_retries = 0;
2120: u16 rate_flags = 0;
2121: u8 mcs_known, mcs_flags, mcs_bw;
2122: u16 vht_known;
2123: u8 vht_mcs = 0, vht_nss = 0;
2124: int i;
2125:
2126: if (!ieee80211_validate_radiotap_len(skb))
2127: return false;
2128:
2129: info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT |
2130: IEEE80211_TX_CTL_DONTFRAG;
2131:
2132: /*
2133: * for every radiotap entry that is present
2134: * (ieee80211_radiotap_iterator_next returns -ENOENT when no more
2135: * entries present, or -EINVAL on error)
2136: */
2137:
2138: while (!ret) {
2139: ret = ieee80211_radiotap_iterator_next(&iterator);
2140:
2141: if (ret)
2142: continue;
2143:
2144: /* see if this argument is something we can use */
2145: switch (iterator.this_arg_index) {
2146: /*
2147: * You must take care when dereferencing iterator.this_arg
2148: * for multibyte types... the pointer is not aligned. Use
2149: * get_unaligned((type *)iterator.this_arg) to dereference
2150: * iterator.this_arg for type "type" safely on all arches.
2151: */
2152: case IEEE80211_RADIOTAP_FLAGS:
2153: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
2154: /*
2155: * this indicates that the skb we have been
2156: * handed has the 32-bit FCS CRC at the end...
2157: * we should react to that by snipping it off
2158: * because it will be recomputed and added
2159: * on transmission
2160: */
2161: if (skb->len < (iterator._max_length + FCS_LEN))
2162: return false;
2163:
2164: skb_trim(skb, skb->len - FCS_LEN);
2165: }
2166: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP)
2167: info->flags &= ~IEEE80211_TX_INTFL_DONT_ENCRYPT;
2168: if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
2169: info->flags &= ~IEEE80211_TX_CTL_DONTFRAG;
2170: break;
2171:
2172: case IEEE80211_RADIOTAP_TX_FLAGS:
2173: txflags = get_unaligned_le16(iterator.this_arg);
2174: if (txflags & IEEE80211_RADIOTAP_F_TX_NOACK)
2175: info->flags |= IEEE80211_TX_CTL_NO_ACK;
2176: if (txflags & IEEE80211_RADIOTAP_F_TX_NOSEQNO)
2177: info->control.flags |= IEEE80211_TX_CTRL_NO_SEQNO;
2178: if (txflags & IEEE80211_RADIOTAP_F_TX_ORDER)
2179: info->control.flags |=
2180: IEEE80211_TX_CTRL_DONT_REORDER;
2181: break;
2182:
2183: case IEEE80211_RADIOTAP_RATE:
2184: rate = *iterator.this_arg;
2185: rate_flags = 0;
2186: rate_found = true;
2187: break;
2188:
2189: case IEEE80211_RADIOTAP_ANTENNA:
2190: /* this can appear multiple times, keep a bitmap */
2191: /* control.antennas is only a 2-bit bitmap */
2192: if (*iterator.this_arg < 2)
2193: info->control.antennas |= BIT(*iterator.this_arg);
2194: break;
2195:
2196: case IEEE80211_RADIOTAP_DATA_RETRIES:
2197: rate_retries = *iterator.this_arg;
2198: break;
2199:
2200: case IEEE80211_RADIOTAP_MCS:
2201: mcs_known = iterator.this_arg[0];
2202: mcs_flags = iterator.this_arg[1];
2203: if (!(mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS))
2204: break;
2205:
2206: rate_found = true;
2207: rate = iterator.this_arg[2];
2208: rate_flags = IEEE80211_TX_RC_MCS;
2209:
2210: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI &&
2211: mcs_flags & IEEE80211_RADIOTAP_MCS_SGI)
2212: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2213:
2214: mcs_bw = mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK;
2215: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW &&
2216: mcs_bw == IEEE80211_RADIOTAP_MCS_BW_40)
2217: rate_flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
2218:
2219: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC &&
2220: mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC)
2221: info->flags |= IEEE80211_TX_CTL_LDPC;
2222:
2223: if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
2224: u8 stbc = u8_get_bits(mcs_flags,
2225: IEEE80211_RADIOTAP_MCS_STBC_MASK);
2226:
2227: info->flags |=
2228: u32_encode_bits(stbc,
2229: IEEE80211_TX_CTL_STBC);
2230: }
2231: break;
2232:
2233: case IEEE80211_RADIOTAP_VHT:
2234: vht_known = get_unaligned_le16(iterator.this_arg);
2235: rate_found = true;
2236:
2237: rate_flags = IEEE80211_TX_RC_VHT_MCS;
2238: if ((vht_known & IEEE80211_RADIOTAP_VHT_KNOWN_GI) &&
2239: (iterator.this_arg[2] &
2240: IEEE80211_RADIOTAP_VHT_FLAG_SGI))
2241: rate_flags |= IEEE80211_TX_RC_SHORT_GI;
2242: if (vht_known &
2243: IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH) {
2244: if (iterator.this_arg[3] == 1)
2245: rate_flags |=
2246: IEEE80211_TX_RC_40_MHZ_WIDTH;
2247: else if (iterator.this_arg[3] == 4)
2248: rate_flags |=
2249: IEEE80211_TX_RC_80_MHZ_WIDTH;
2250: else if (iterator.this_arg[3] == 11)
2251: rate_flags |=
2252: IEEE80211_TX_RC_160_MHZ_WIDTH;
2253: }
2254:
2255: vht_mcs = iterator.this_arg[4] >> 4;
2256: if (vht_mcs > 11)
2257: vht_mcs = 0;
2258: vht_nss = iterator.this_arg[4] & 0xF;
2259: if (!vht_nss || vht_nss > 8)
2260: vht_nss = 1;
2261: break;
2262:
2263: /*
2264: * Please update the file
2265: * Documentation/networking/mac80211-injection.rst
2266: * when parsing new fields here.
2267: */
2268:
2269: default:
2270: break;
2271: }
2272: }
2273:
2274: if (ret != -ENOENT) /* ie, if we didn't simply run out of fields */
2275: return false;
2276:
2277: if (rate_found) {
2278: struct ieee80211_supported_band *sband =
2279: local->hw.wiphy->bands[info->band];
2280:
2281: info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
2282:
2283: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
2284: info->control.rates[i].idx = -1;
2285: info->control.rates[i].flags = 0;
2286: info->control.rates[i].count = 0;
2287: }
2288:
2289: if (rate_flags & IEEE80211_TX_RC_MCS) {
2290: /* reset antennas if not enough */
2291: if (IEEE80211_HT_MCS_CHAINS(rate) >
2292: hweight8(info->control.antennas))
2293: info->control.antennas = 0;
2294:
2295: info->control.rates[0].idx = rate;
2296: } else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
2297: /* reset antennas if not enough */
2298: if (vht_nss > hweight8(info->control.antennas))
2299: info->control.antennas = 0;
2300:
2301: ieee80211_rate_set_vht(info->control.rates, vht_mcs,
2302: vht_nss);
2303: } else if (sband) {
2304: for (i = 0; i < sband->n_bitrates; i++) {
2305: if (rate * 5 != sband->bitrates[i].bitrate)
2306: continue;
2307:
2308: info->control.rates[0].idx = i;
2309: break;
2310: }
2311: }
2312:
2313: if (info->control.rates[0].idx < 0)
2314: info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
2315:
2316: info->control.rates[0].flags = rate_flags;
2317: info->control.rates[0].count = min_t(u8, rate_retries + 1,
2318: local->hw.max_rate_tries);
2319: }
2320:
2321: return true;
2322: }
SourceFile:net/mac80211/tx.c]
|
| 616/4 |
2026/09/07 08:31 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 34354
output: 47
thoughts: 466
Thoughts: **My Thought Process Regarding the Provided Code Snippet**
Right, so I'm looking at this C code here, specifically this `if-else if` block dealing with transmission rates and associated flags. My immediate thought is to parse the logic for setting the transmission rate index (`info->control.rates[0].idx`).
First, I see the condition `rate_flags & IEEE80211_TX_RC_MCS`. If this is true, the code directly assigns the `rate` value to `info->control.rates[0].idx`. My initial mental check here is about the data types. I know `rate` is typically a `u16`, so it's going to be a non-negative value. However, I immediately recall that `info->control.rates[0].idx` is an `s8`. This raises a small flag in my mind: what if the `rate` value, though `u16`, is intended to represent something that could be negative in a conceptual sense, or more importantly, what if it exceeds the range of `s8`?
My attention then shifts to the subsequent `else if` branches: `IEEE80211_TX_RC_VHT_MCS` and the `sband` handling. These are dealing with different rate encoding schemes (VHT MCS and legacy rates respectively). The VHT path involves calling `ieee80211_rate_set_vht`, which suggests a more complex rate calculation or encoding. The legacy path iterates through `sband->bitrates` to find a matching rate, setting the index accordingly.
Crucially, after all these rate-setting blocks, there's a check: `if (info->control.rates[0].idx < 0)`. This is where the `s8` type of `idx` becomes highly relevant. If the `idx` ends up being negative, it signifies an issue, and the code then clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag. This implies that a negative `idx` is an invalid state for rate injection.
So, my thought process crystallizes around this potential mismatch. The direct assignment `info->control.rates[0].idx = rate;` when dealing with MCS rates, combined with `idx` being an `s8`, makes me want to investigate if there are any scenarios where `rate` could be a value that, when interpreted as an `s8`, becomes negative *or* if the intent is to allow some form of negative indexing that the `if (info->control.rates[0].idx < 0)` check is specifically designed to catch and handle. I'd be looking to confirm if `rate` is *always* intended to be a positive index within the `s8` range, or if there's a specific protocol detail or convention I need to be aware of regarding negative indices in this context. The fact that it's a direct assignment, rather than a calculated one, is what initially prompts this deeper dive into the `s8` versus `u16` aspect.
|
| 617/4 |
2026/09/07 08:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:include/net/mac80211.h Name:ieee80211_tx_rate]
Results: map[SourceCode:1245: /**
1246: * struct ieee80211_tx_rate - rate selection/status
1247: *
1248: * @idx: rate index to attempt to send with
1249: * @flags: rate control flags (&enum mac80211_rate_control_flags)
1250: * @count: number of tries in this rate before going to the next rate
1251: *
1252: * A value of -1 for @idx indicates an invalid rate and, if used
1253: * in an array of retry rates, that no more rates should be tried.
1254: *
1255: * When used for transmit status reporting, the driver should
1256: * always report the rate along with the flags it used.
1257: *
1258: * &struct ieee80211_tx_info contains an array of these structs
1259: * in the control information, and it will be filled by the rate
1260: * control algorithm according to what should be sent. For example,
1261: * if this array contains, in the format { <idx>, <count> } the
1262: * information::
1263: *
1264: * { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
1265: *
1266: * then this means that the frame should be transmitted
1267: * up to twice at rate 3, up to twice at rate 2, and up to four
1268: * times at rate 1 if it doesn't get acknowledged. Say it gets
1269: * acknowledged by the peer after the fifth attempt, the status
1270: * information should then contain::
1271: *
1272: * { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
1273: *
1274: * since it was transmitted twice at rate 3, twice at rate 2
1275: * and once at rate 1 after which we received an acknowledgement.
1276: */
1277: struct ieee80211_tx_rate {
1278: s8 idx;
1279: u16 count:5,
1280: flags:11;
1281: } __packed;
SourceFile:include/net/mac80211.h]
|
| 618/4 |
2026/09/07 08:31 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 35540
output: 51
thoughts: 422
Thoughts: **The Radiotap MCS Rate Injection Quandary**
My initial thought process focused on a potential issue arising from the interaction between the `IEEE80211_RADIOTAP_MCS` field and how it's used to populate `info->control.rates[0].idx`. I realized that if the `rate` value, which is taken directly from the radiotap header's third argument (`iterator.this_arg[2]`), is a `u16` and happens to be 128 or greater, it would be assigned to `idx`, which I observed is an `s8`. This immediate raised a red flag because an `s8` can represent negative values, and a `u16` value of 128 or more would indeed result in a negative `s8` when cast.
My next step was to dive back into the `ieee80211_parse_tx_radiotap()` function to confirm this observation. Upon re-examination, I saw the exact scenario I suspected: when `IEEE80211_RADIOTAP_MCS` is present and `rate` is populated from `iterator.this_arg[2]`, that `rate` value is then directly assigned to `info->control.rates[0].idx`. So, yes, if `rate` is `u16` and >= 128, the resulting `idx` will be negative.
This led me to consider the implications of `idx` being negative. I recalled or looked up the logic that handles this situation:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This snippet reveals that if `info->control.rates[0].idx` is indeed negative, the `IEEE80211_TX_CTRL_RATE_INJECT` flag is cleared. This was a critical realization.
Why is clearing `IEEE80211_TX_CTRL_RATE_INJECT` important? Because I know that the `ieee80211_tx_h_rate_ctrl` function is responsible for managing the transmission rate. If `IEEE80211_TX_CTRL_RATE_INJECT` is *not* set, it means that `ieee80211_tx_h_rate_ctrl` will proceed to *overwrite* `rates[0].idx` with a rate determined by its own internal logic.
The conclusion I drew from this chain of thought is that, contrary to my initial concern of a potential crash due to an invalid negative `idx`, the system is designed to handle this. The negative `idx` acts as a signal to disable explicit rate injection from the radiotap header, allowing the rate control mechanism to take over and select an appropriate rate. Therefore, it seems the code is robust enough to prevent a crash in this specific scenario. My next step, naturally, would be to examine the `ieee80211_tx_h_rate_ctrl` function to understand how it manages rate selection when `RATE_INJECT` is cleared.
|
| 619/4 |
2026/09/07 08:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_h_rate_ctrl]
Results: map[SourceCode: 674: static ieee80211_tx_result debug_noinline
675: ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
676: {
677: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
678: struct ieee80211_hdr *hdr = (void *)tx->skb->data;
679: struct ieee80211_supported_band *sband;
680: u32 len;
681: struct ieee80211_tx_rate_control txrc;
682: struct ieee80211_sta_rates *ratetbl = NULL;
683: bool encap = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
684: bool assoc = false;
685:
686: memset(&txrc, 0, sizeof(txrc));
687:
688: if (info->band < NUM_NL80211_BANDS)
689: sband = tx->local->hw.wiphy->bands[info->band];
690: else
691: return TX_CONTINUE;
692:
693: len = min_t(u32, tx->skb->len + FCS_LEN,
694: tx->local->hw.wiphy->frag_threshold);
695:
696: /* set up the tx rate control struct we give the RC algo */
697: txrc.hw = &tx->local->hw;
698: txrc.sband = sband;
699: txrc.bss_conf = &tx->sdata->vif.bss_conf;
700: txrc.skb = tx->skb;
701: txrc.reported_rate.idx = -1;
702:
703: if (unlikely(info->control.flags & IEEE80211_TX_CTRL_DONT_USE_RATE_MASK)) {
704: txrc.rate_idx_mask = ~0;
705: } else {
706: txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band];
707:
708: if (tx->sdata->rc_has_mcs_mask[info->band])
709: txrc.rate_idx_mcs_mask =
710: tx->sdata->rc_rateidx_mcs_mask[info->band];
711: }
712:
713: txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
714: tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
715: tx->sdata->vif.type == NL80211_IFTYPE_ADHOC ||
716: tx->sdata->vif.type == NL80211_IFTYPE_OCB);
717:
718: /* set up RTS protection if desired */
719: if (len > tx->local->hw.wiphy->rts_threshold) {
720: txrc.rts = true;
721: }
722:
723: info->control.use_rts = txrc.rts;
724: info->control.use_cts_prot = tx->sdata->vif.bss_conf.use_cts_prot;
725:
726: /*
727: * Use short preamble if the BSS can handle it, but not for
728: * management frames unless we know the receiver can handle
729: * that -- the management frame might be to a station that
730: * just wants a probe response.
731: */
732: if (tx->sdata->vif.bss_conf.use_short_preamble &&
733: (ieee80211_is_tx_data(tx->skb) ||
734: (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE))))
735: txrc.short_preamble = true;
736:
737: info->control.short_preamble = txrc.short_preamble;
738:
739: /* don't ask rate control when rate already injected via radiotap */
740: if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
741: return TX_CONTINUE;
742:
743: if (tx->sta)
744: assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
745:
746: /*
747: * Lets not bother rate control if we're associated and cannot
748: * talk to the sta. This should not happen.
749: */
750: if (WARN(test_bit(SCAN_SW_SCANNING, &tx->local->scanning) && assoc &&
751: !rate_usable_index_exists(sband, &tx->sta->sta),
752: "%s: Dropped data frame as no usable bitrate found while "
753: "scanning and associated. Target station: "
754: "%pM on %d GHz band\n",
755: tx->sdata->name,
756: encap ? ((struct ethhdr *)hdr)->h_dest : hdr->addr1,
757: info->band ? 5 : 2))
758: return TX_DROP;
759:
760: /*
761: * If we're associated with the sta at this point we know we can at
762: * least send the frame at the lowest bit rate.
763: */
764: rate_control_get_rate(tx->sdata, tx->sta, &txrc);
765:
766: if (tx->sta && !info->control.skip_table)
767: ratetbl = rcu_dereference(tx->sta->sta.rates);
768:
769: if (unlikely(info->control.rates[0].idx < 0)) {
770: if (ratetbl) {
771: struct ieee80211_tx_rate rate = {
772: .idx = ratetbl->rate[0].idx,
773: .flags = ratetbl->rate[0].flags,
774: .count = ratetbl->rate[0].count
775: };
776:
777: if (ratetbl->rate[0].idx < 0)
778: return TX_DROP;
779:
780: tx->rate = rate;
781: } else {
782: return TX_DROP;
783: }
784: } else {
785: tx->rate = info->control.rates[0];
786: }
787:
788: if (txrc.reported_rate.idx < 0) {
789: txrc.reported_rate = tx->rate;
790: if (tx->sta && ieee80211_is_tx_data(tx->skb))
791: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
792: } else if (tx->sta)
793: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
794:
795: if (ratetbl)
796: return TX_CONTINUE;
797:
798: if (unlikely(!info->control.rates[0].count))
799: info->control.rates[0].count = 1;
800:
801: if (WARN_ON_ONCE((info->control.rates[0].count > 1) &&
802: (info->flags & IEEE80211_TX_CTL_NO_ACK)))
803: info->control.rates[0].count = 1;
804:
805: return TX_CONTINUE;
806: }
SourceFile:net/mac80211/tx.c]
|
| 620/4 |
2026/09/07 08:31 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 38400
output: 50
thoughts: 680
Thoughts: **My Thought Process Unraveling a Potential Exploit in IEEE 802.11 Transmit Rate Control**
My initial exploration into the `ieee80211_tx_h_rate_ctrl` function immediately caught my eye. I observed that if the `IEEE80211_TX_CTRL_RATE_INJECT` flag is set on the transmission information (`info`), the function returns early with `TX_CONTINUE`. Crucially, this bypasses any rate control logic and, more importantly, *does not overwrite* the `info->control.rates[0].idx` field. This sparked an idea: if I could somehow manipulate `info->control.rates[0].idx` to a negative value *while simultaneously ensuring* `IEEE80211_TX_CTRL_RATE_INJECT` remains set, I might have found a vulnerability.
However, this line of thinking quickly hit a roadblock. I started to question how it would be possible for `info->control.rates[0].idx` to be negative *and* `IEEE80211_TX_CTRL_RATE_INJECT` to be set concurrently. My next step was to re-examine the `ieee80211_parse_tx_radiotap()` function, which is where radiotap information is processed and likely where the `IEEE80211_TX_CTRL_RATE_INJECT` flag would be set.
Digging into `ieee80211_parse_tx_radiotap()`, I found this critical section:
```c
if (rate_flags & IEEE80211_TX_RC_MCS) {
// ... (handling for HT MCS)
info->control.rates[0].idx = rate;
} else if (rate_flags & IEEE80211_TX_RC_VHT_MCS) {
// ... (handling for VHT MCS)
ieee80211_rate_set_vht(info->control.rates, vht_mcs,
vht_nss);
} else if (sband) {
// ... (handling for legacy rates)
info->control.rates[0].idx = i;
break;
}
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This code snippet is the key. It explicitly states that *if `info->control.rates[0].idx` becomes negative at any point during the rate parsing (whether for HT MCS, VHT MCS, or legacy rates), the `IEEE80211_TX_CTRL_RATE_INJECT` flag is unconditionally cleared*. This is a direct countermeasure to my initial thought. It means that any attempt to set a negative `idx` will *always* result in the `RATE_INJECT` flag being unset, thereby preventing the scenario I was hoping to exploit.
My immediate reaction was, "Well, that closes that door." It seems that the developers have anticipated and addressed this specific interaction. My initial hypothesis, while promising for a moment, is invalidated by the protective logic within `ieee80211_parse_tx_radiotap()`.
I then began to wonder if there were *any other possible pathways* to achieve my goal. My mind immediately gravitated towards the `IEEE80211_TX_RC_VHT_MCS` case, as it involves a separate function call, `ieee80211_rate_set_vht`. I decided I needed to investigate the implementation of `ieee80211_rate_set_vht` itself to see if *it* could potentially set `info->control.rates[0].idx` to a negative value while *also* preserving the `IEEE80211_TX_CTRL_RATE_INJECT` flag. This would be the next logical step in my analysis, to ensure no other entry point for this behavior exists.
|
| 621/4 |
2026/09/07 08:31 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_rate_set_vht]
Results: map[SourceCode:1290: static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
1291: u8 mcs, u8 nss)
1292: {
1293: WARN_ON(mcs & ~0xF);
1294: WARN_ON((nss - 1) & ~0x7);
1295: rate->idx = ((nss - 1) << 4) | mcs;
1296: }
SourceFile:include/net/mac80211.h]
|
| 622/4 |
2026/09/07 08:31 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 39285
output: 43
thoughts: 814
Thoughts: **My Thought Process Unpacking the Rate Index Logic**
Okay, so I was looking at this line: `rate->idx = ((nss - 1) << 4) | mcs;` and my immediate thought was to analyze the resulting `idx` value. I know that `nss` (number of spatial streams) can range from 1 to 8. This means `nss - 1` will be in the range of 0 to 7. When I shift that left by 4 bits (`<< 4`), I get values from 0x00 to 0x70. Then, `mcs` (Modulation and Coding Scheme) is typically from 0 to 11, so its hex representation is 0x00 to 0x0B.
Combining these with the bitwise OR (`|`) operation, the maximum value for `rate->idx` would be `0x70 | 0x0B`, which equals `0x7B`, or 123 in decimal. My immediate conclusion was that since `idx` is declared as an `s8` (signed 8-bit integer), and 123 is well within the positive range of an `s8`, then `idx` would *never* be negative for VHT (Very High Throughput) scenarios. This seemed like a safe assumption.
But then, a nagging "what if?" popped into my head. I considered the possibility that `rate_flags & IEEE80211_TX_RC_MCS` might be set. This flag indicates that the rate is indeed an MCS-based rate. The next line that caught my eye was `info->control.rates[0].idx = rate;`. Here, `rate` is assigned directly to `info->control.rates[0].idx`.
This is where things got interesting. What if the `rate` value being assigned here is, for example, 128? If `rate` is 128, and it's assigned to an `s8` `idx`, that would make `idx` equal to -128. Ah, *that's* a negative value!
My thought process then shifted to the consequences of this negative `idx`. If `info->control.rates[0].idx < 0` becomes true, it directly leads to `RATE_INJECT` being cleared. This is a critical piece of information because if `RATE_INJECT` is cleared, the subsequent handler, `ieee80211_tx_h_rate_ctrl`, is going to overwrite `rates[0].idx`.
Now, I had to carefully examine what `ieee80211_tx_h_rate_ctrl` actually does. I looked at its implementation:
```c
if (unlikely(info->control.rates[0].idx < 0)) {
if (ratetbl) {
struct ieee80211_tx_rate rate = {
.idx = ratetbl->rate[0].idx,
.flags = ratetbl->rate[0].flags,
.count = ratetbl->rate[0].count
};
if (ratetbl->rate[0].idx < 0)
return TX_DROP;
tx->rate = rate;
} else {
return TX_DROP;
}
} else {
tx->rate = info->control.rates[0];
}
```
My initial reading of this snippet led me to believe that `ieee80211_tx_h_rate_ctrl` *does not* directly overwrite `info->control.rates[0].idx`. It appears to be setting `tx->rate`, which is a separate field, while `info->control.rates[0]` remains unchanged. This felt like a potential oversight or a subtle point I was missing.
However, upon re-reading the `ieee80211_tx_h_rate_ctrl` function's code more closely, particularly the `rate_control_get_rate(tx->sdata, tx->sta, &txrc);` call that precedes the conditional logic, I realized a crucial detail. It's *this* function, `rate_control_get_rate`, that *might* be the mechanism that overwrites `info->control.rates`. So, my line of inquiry now needs to be focused on the behavior and potential side effects of `rate_control_get_rate` itself. That's the next logical step in understanding the complete picture here.
|
| 623/4 |
2026/09/07 08:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:rate_control_get_rate]
Results: map[SourceCode: 919: void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
920: struct sta_info *sta,
921: struct ieee80211_tx_rate_control *txrc)
922: {
923: struct rate_control_ref *ref = sdata->local->rate_ctrl;
924: void *priv_sta = NULL;
925: struct ieee80211_sta *ista = NULL;
926: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
927: int i;
928:
929: for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
930: info->control.rates[i].idx = -1;
931: info->control.rates[i].flags = 0;
932: info->control.rates[i].count = 0;
933: }
934:
935: if (rate_control_send_low(sta ? &sta->sta : NULL, txrc))
936: return;
937:
938: if (ieee80211_hw_check(&sdata->local->hw, HAS_RATE_CONTROL))
939: return;
940:
941: if (sta && test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) {
942: ista = &sta->sta;
943: priv_sta = sta->rate_ctrl_priv;
944: }
945:
946: if (ista) {
947: spin_lock_bh(&sta->rate_ctrl_lock);
948: ref->ops->get_rate(ref->priv, ista, priv_sta, txrc);
949: spin_unlock_bh(&sta->rate_ctrl_lock);
950: } else {
951: rate_control_send_low(NULL, txrc);
952: }
953:
954: if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_RC_TABLE))
955: return;
956:
957: ieee80211_get_tx_rates(&sdata->vif, ista, txrc->skb,
958: info->control.rates,
959: ARRAY_SIZE(info->control.rates));
960: }
SourceFile:net/mac80211/rate.c]
|
| 624/4 |
2026/09/07 08:32 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 40893
output: 43
thoughts: 72
Thoughts: **My Thought Process Unpacking the Rate Control Initialization**
Okay, so the first thing that catches my eye is this initialization within `rate_control_get_rate`. It's setting `info->control.rates[i].idx` to `-1` for every single `i` in the `rates` array. This immediately signals to me that before any actual rate selection logic kicks in, the system is essentially "clearing the slate," marking all potential rate indices as invalid or unselected. This is a crucial baseline setup, ensuring that we're not carrying over any stale or incorrect state from previous operations. It's a clean starting point.
Following that, the very next step is a call to `rate_control_send_low`. The presence of `sta ? &sta->sta : NULL` as an argument suggests that this function is being invoked in a context where a station (`sta`) might be present. The conditional ternary operator here is important – it means if `sta` is valid, we're passing a pointer to its `sta` member; otherwise, we're passing `NULL`. This tells me that `rate_control_send_low` is designed to handle both scenarios, potentially dealing with a specific station's rate control or a more general, broadcast-like context if no station is explicitly identified.
Now, naturally, my next move is to dive into `rate_control_send_low` itself. I need to understand what this function *does* with that initial `-1` state and the (potentially) provided station information. What is the "low" in `send_low` referring to? Is it the lowest available rate? Is it some sort of initial probing or baseline transmission? The name itself is a bit of a clue, but the actual implementation will reveal its purpose in the broader rate control mechanism. I'm anticipating it will either set up an initial rate, perform some diagnostic checks, or perhaps trigger a preliminary transmission phase that will inform subsequent, more refined rate selections. This is the key point where the system starts to *act* based on the initialized state.
|
| 625/4 |
2026/09/07 08:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/rate.c Name:rate_control_send_low]
Results: map[SourceCode: 414: static bool rate_control_send_low(struct ieee80211_sta *pubsta,
415: struct ieee80211_tx_rate_control *txrc)
416: {
417: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(txrc->skb);
418: struct ieee80211_supported_band *sband = txrc->sband;
419: struct sta_info *sta;
420: int mcast_rate;
421: bool use_basicrate = false;
422:
423: if (!sband)
424: return false;
425:
426: if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
427: __rate_control_send_low(txrc->hw, sband, pubsta, info,
428: txrc->rate_idx_mask);
429:
430: if (!pubsta && txrc->bss) {
431: mcast_rate = txrc->bss_conf->mcast_rate[sband->band];
432: if (mcast_rate > 0) {
433: info->control.rates[0].idx = mcast_rate - 1;
434: return true;
435: }
436: use_basicrate = true;
437: } else if (pubsta) {
438: sta = container_of(pubsta, struct sta_info, sta);
439: if (ieee80211_vif_is_mesh(&sta->sdata->vif))
440: use_basicrate = true;
441: }
442:
443: if (use_basicrate)
444: rc_send_low_basicrate(&info->control.rates[0],
445: txrc->bss_conf->basic_rates,
446: sband);
447:
448: return true;
449: }
450: return false;
451: }
SourceFile:net/mac80211/rate.c]
|
| 626/4 |
2026/09/07 08:32 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 41651
output: 44
thoughts: 24
Thoughts: **A Deep Dive into Rate Control Indexing**
So, I've been thinking about how we're managing our data transmission rates, specifically the indexing of these rates. It seems that the function `__rate_control_send_low` plays a crucial role here. My understanding is that this function directly impacts `info->control.rates[0].idx`. This means that whenever `__rate_control_send_low` is invoked, it's setting the index for the *first* rate control entry within the `control.rates` array. This is a pretty granular control, suggesting that the system is designed to precisely pinpoint and manipulate specific rate configurations, likely for fine-tuning performance or adapting to dynamic network conditions. It's interesting to consider the implications of this direct assignment – it implies a deliberate and targeted modification of the rate control state, rather than a more abstract or layered adjustment. I'm curious about the specific context in which this function is called and what logic dictates *which* rate index gets set, especially since it appears to be hardcoded to the first element (`[0]`). This might be a default behavior, or it could indicate a specific operational mode where only one primary rate control parameter is actively being managed at that moment.
|
| 627/4 |
2026/09/07 08:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/rate.c Name:__rate_control_send_low]
Results: map[SourceCode: 366: static void __rate_control_send_low(struct ieee80211_hw *hw,
367: struct ieee80211_supported_band *sband,
368: struct ieee80211_sta *sta,
369: struct ieee80211_tx_info *info,
370: u32 rate_mask)
371: {
372: u32 rate_flags = 0;
373: int i;
374:
375: if (sband->band == NL80211_BAND_S1GHZ) {
376: info->control.rates[0].flags |= IEEE80211_TX_RC_S1G_MCS;
377: info->control.rates[0].idx = 0;
378: return;
379: }
380:
381: if ((sband->band == NL80211_BAND_2GHZ) &&
382: (info->flags & IEEE80211_TX_CTL_NO_CCK_RATE))
383: rate_flags |= IEEE80211_RATE_ERP_G;
384:
385: info->control.rates[0].idx = 0;
386: for (i = 0; i < sband->n_bitrates; i++) {
387: if (!(rate_mask & BIT(i)))
388: continue;
389:
390: if ((rate_flags & sband->bitrates[i].flags) != rate_flags)
391: continue;
392:
393: if (!rate_supported(sta, sband->band, i))
394: continue;
395:
396: info->control.rates[0].idx = i;
397: break;
398: }
399: WARN_ONCE(i == sband->n_bitrates,
400: "no supported rates for sta %pM (0x%x, band %d) in rate_mask 0x%x with flags 0x%x\n",
401: sta ? sta->addr : NULL,
402: sta ? sta->deflink.supp_rates[sband->band] : -1,
403: sband->band,
404: rate_mask, rate_flags);
405:
406: info->control.rates[0].count =
407: (info->flags & IEEE80211_TX_CTL_NO_ACK) ?
408: 1 : hw->max_rate_tries;
409:
410: info->control.skip_table = 1;
411: }
SourceFile:net/mac80211/rate.c]
|
| 628/4 |
2026/09/07 08:32 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 42528
output: 51
thoughts: 511
Thoughts: **A Deep Dive into Rate Control and Injection Flags**
Alright, let me walk you through my thought process as I untangle this rate control logic. It's all about how we handle transmission rates and, crucially, this `IEEE80211_TX_CTRL_RATE_INJECT` flag.
So, I'm looking at `__rate_control_send_low`, and it's quite definitive: it *always* sets `info->control.rates[0].idx = 0;` right at the start. Then, it attempts to find a suitable supported rate. The key point here is that even if it *doesn't* find a supported rate, `rates[0].idx` will still retain that initial `0` (or whatever it was initialized to, but the explicit `idx = 0` is the important part). This means, after `__rate_control_send_low` has done its work, `info->control.rates[0].idx` is guaranteed to be greater than or equal to zero.
Now, this leads to a critical realization: if `IEEE80211_TX_CTRL_RATE_INJECT` is *not* set, then `rate_control_get_rate` will invariably overwrite `rates[0].idx` with a non-negative value. This means that to preserve the rate information that might have been set *before* `rate_control_get_rate` is called, we *must* ensure that `IEEE80211_TX_CTRL_RATE_INJECT` remains set.
But this immediately brings up a question: if `IEEE80211_TX_CTRL_RATE_INJECT` *is* set, doesn't that imply that `rates[0].idx` was *already* non-negative when it arrived at `ieee80211_parse_tx_radiotap()`? I need to re-examine that function.
Looking at `ieee80211_parse_tx_radiotap()`:
```c
if (info->control.rates[0].idx < 0)
info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;
```
This code clearly states that if `idx` is negative, the `RATE_INJECT` flag is cleared. Conversely, if `idx` is non-negative, the `RATE_INJECT` flag is retained.
So, if `idx` is non-negative at this point, it means it will still be non-negative when we reach `mac80211_hwsim_write_tsf`. And if `idx` is non-negative there, the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` check should *not* trigger.
This is where I'm getting a bit stuck, though. How can `idx` possibly be negative in `mac80211_hwsim_write_tsf` if it was definitively non-negative when it passed through `ieee80211_parse_tx_radiotap()`? I need to be sure there isn't some other function or code path that might be modifying `idx` between these two points. My next step is to meticulously check `ieee80211_tx_h_rate_ctrl` again for any other potential interactions.
|
| 629/4 |
2026/09/07 08:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_h_rate_ctrl]
Results: map[SourceCode: 674: static ieee80211_tx_result debug_noinline
675: ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
676: {
677: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
678: struct ieee80211_hdr *hdr = (void *)tx->skb->data;
679: struct ieee80211_supported_band *sband;
680: u32 len;
681: struct ieee80211_tx_rate_control txrc;
682: struct ieee80211_sta_rates *ratetbl = NULL;
683: bool encap = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
684: bool assoc = false;
685:
686: memset(&txrc, 0, sizeof(txrc));
687:
688: if (info->band < NUM_NL80211_BANDS)
689: sband = tx->local->hw.wiphy->bands[info->band];
690: else
691: return TX_CONTINUE;
692:
693: len = min_t(u32, tx->skb->len + FCS_LEN,
694: tx->local->hw.wiphy->frag_threshold);
695:
696: /* set up the tx rate control struct we give the RC algo */
697: txrc.hw = &tx->local->hw;
698: txrc.sband = sband;
699: txrc.bss_conf = &tx->sdata->vif.bss_conf;
700: txrc.skb = tx->skb;
701: txrc.reported_rate.idx = -1;
702:
703: if (unlikely(info->control.flags & IEEE80211_TX_CTRL_DONT_USE_RATE_MASK)) {
704: txrc.rate_idx_mask = ~0;
705: } else {
706: txrc.rate_idx_mask = tx->sdata->rc_rateidx_mask[info->band];
707:
708: if (tx->sdata->rc_has_mcs_mask[info->band])
709: txrc.rate_idx_mcs_mask =
710: tx->sdata->rc_rateidx_mcs_mask[info->band];
711: }
712:
713: txrc.bss = (tx->sdata->vif.type == NL80211_IFTYPE_AP ||
714: tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
715: tx->sdata->vif.type == NL80211_IFTYPE_ADHOC ||
716: tx->sdata->vif.type == NL80211_IFTYPE_OCB);
717:
718: /* set up RTS protection if desired */
719: if (len > tx->local->hw.wiphy->rts_threshold) {
720: txrc.rts = true;
721: }
722:
723: info->control.use_rts = txrc.rts;
724: info->control.use_cts_prot = tx->sdata->vif.bss_conf.use_cts_prot;
725:
726: /*
727: * Use short preamble if the BSS can handle it, but not for
728: * management frames unless we know the receiver can handle
729: * that -- the management frame might be to a station that
730: * just wants a probe response.
731: */
732: if (tx->sdata->vif.bss_conf.use_short_preamble &&
733: (ieee80211_is_tx_data(tx->skb) ||
734: (tx->sta && test_sta_flag(tx->sta, WLAN_STA_SHORT_PREAMBLE))))
735: txrc.short_preamble = true;
736:
737: info->control.short_preamble = txrc.short_preamble;
738:
739: /* don't ask rate control when rate already injected via radiotap */
740: if (info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT)
741: return TX_CONTINUE;
742:
743: if (tx->sta)
744: assoc = test_sta_flag(tx->sta, WLAN_STA_ASSOC);
745:
746: /*
747: * Lets not bother rate control if we're associated and cannot
748: * talk to the sta. This should not happen.
749: */
750: if (WARN(test_bit(SCAN_SW_SCANNING, &tx->local->scanning) && assoc &&
751: !rate_usable_index_exists(sband, &tx->sta->sta),
752: "%s: Dropped data frame as no usable bitrate found while "
753: "scanning and associated. Target station: "
754: "%pM on %d GHz band\n",
755: tx->sdata->name,
756: encap ? ((struct ethhdr *)hdr)->h_dest : hdr->addr1,
757: info->band ? 5 : 2))
758: return TX_DROP;
759:
760: /*
761: * If we're associated with the sta at this point we know we can at
762: * least send the frame at the lowest bit rate.
763: */
764: rate_control_get_rate(tx->sdata, tx->sta, &txrc);
765:
766: if (tx->sta && !info->control.skip_table)
767: ratetbl = rcu_dereference(tx->sta->sta.rates);
768:
769: if (unlikely(info->control.rates[0].idx < 0)) {
770: if (ratetbl) {
771: struct ieee80211_tx_rate rate = {
772: .idx = ratetbl->rate[0].idx,
773: .flags = ratetbl->rate[0].flags,
774: .count = ratetbl->rate[0].count
775: };
776:
777: if (ratetbl->rate[0].idx < 0)
778: return TX_DROP;
779:
780: tx->rate = rate;
781: } else {
782: return TX_DROP;
783: }
784: } else {
785: tx->rate = info->control.rates[0];
786: }
787:
788: if (txrc.reported_rate.idx < 0) {
789: txrc.reported_rate = tx->rate;
790: if (tx->sta && ieee80211_is_tx_data(tx->skb))
791: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
792: } else if (tx->sta)
793: tx->sta->deflink.tx_stats.last_rate = txrc.reported_rate;
794:
795: if (ratetbl)
796: return TX_CONTINUE;
797:
798: if (unlikely(!info->control.rates[0].count))
799: info->control.rates[0].count = 1;
800:
801: if (WARN_ON_ONCE((info->control.rates[0].count > 1) &&
802: (info->flags & IEEE80211_TX_CTL_NO_ACK)))
803: info->control.rates[0].count = 1;
804:
805: return TX_CONTINUE;
806: }
SourceFile:net/mac80211/tx.c]
|
| 630/4 |
2026/09/07 08:32 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 45477
output: 45
thoughts: 1171
Thoughts: **The Curious Case of the Missing Transmit Rate**
My thought process here has been a deep dive into a rather peculiar bug, and it started with a moment of pure, unadulterated "Wait!" I was looking at the `ieee80211_tx_h_rate_ctrl` function, specifically a check for the `IEEE80211_TX_CTRL_RATE_INJECT` flag. If this flag is set, the function immediately returns `TX_CONTINUE` at line 741, and crucially, it *doesn't* set the `tx->rate`. My immediate follow-up thought was, "But `tx->rate` is used later, isn't it?" This led me to the root of the problem: the `mac80211_hwsim_write_tsf` function.
This `mac80211_hwsim_write_tsf` function, it turns out, has a critical check: `info->control.rates[0].idx < 0`. This is where the bug manifests. Now, I know that the `ieee80211_get_tx_rate` function, which is called by `mac80211_hwsim_get_tx_rate` (and ultimately involved in how `tx->rate` gets set), also checks for `c->control.rates[0].idx < 0`. So, it seems like there's a contradiction. If `IEEE80211_TX_CTRL_RATE_INJECT` is set, the `info->control.rates[0].idx` *must* be non-negative. Why? Because `ieee80211_parse_tx_radiotap` has a safeguard: it clears the `RATE_INJECT` flag if `idx < 0`.
This made me question: "Is there *any other way* to set `IEEE80211_TX_CTRL_RATE_INJECT`?" I considered the possibility of some other mechanism setting this flag, but it's a flag within `info->control.flags`, and `info` is derived from `IEEE80211_SKB_CB(skb)`. My attention then turned to frames injected via `AF_PACKET` (monitor interfaces), because in that scenario, `ieee80211_monitor_start_xmit` calls `ieee80211_parse_tx_radiotap`.
Here's the crucial part of that flow: `ieee80211_monitor_start_xmit` initializes `info` by zeroing it out (`memset(info, 0, sizeof(*info))`). So, `info->control.flags` starts at 0. Then, `ieee80211_parse_tx_radiotap` parses the radiotap header. If `rate_found` is true, it sets `info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;`. It then iterates through the `rates` array, setting indices to -1 and flags to 0. *After* this, it sets `info->control.rates[0].idx`. Finally, it has that important check: `if (info->control.rates[0].idx < 0) info->control.flags &= ~IEEE80211_TX_CTRL_RATE_INJECT;`.
This confirms my earlier understanding: if `idx < 0`, `RATE_INJECT` is cleared. And if `RATE_INJECT` is cleared, then `ieee80211_tx_h_rate_ctrl` will proceed to call `rate_control_get_rate`, which in turn ensures `idx >= 0`. So, the question remains: "How can `idx < 0` ever happen in `mac80211_hwsim_write_tsf`?"
This led me to my most significant realization: "What if `mac80211_hwsim_write_tsf` is called for a frame that *didn't* go through `ieee80211_tx_h_rate_ctrl`?" I initially dismissed this, thinking `mac80211_hwsim_tx_frame_no_nl` is called from `mac80211_hwsim_tx`, which is the `drv_tx` callback, and that `drv_tx` ultimately flows from `ieee80211_tx`, which *does* call `ieee80211_tx_h_rate_ctrl`. However, upon closer inspection, I realized that `ieee80211_tx` actually calls `ieee80211_tx_h_rate_ctrl` *before* `__ieee80211_tx`. This intricate dependency chain is where the bug likely lies, and I needed to re-examine the exact execution path within `ieee80211_tx` itself.
|
| 631/4 |
2026/09/07 08:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx]
Results: map[SourceCode:1949: /*
1950: * Returns false if the frame couldn't be transmitted but was queued instead.
1951: */
1952: static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata,
1953: struct sta_info *sta, struct sk_buff *skb,
1954: bool txpending)
1955: {
1956: struct ieee80211_local *local = sdata->local;
1957: struct ieee80211_tx_data tx;
1958: ieee80211_tx_result res_prepare;
1959: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1960: bool result = true;
1961:
1962: if (unlikely(skb->len < 10)) {
1963: dev_kfree_skb(skb);
1964: return true;
1965: }
1966:
1967: /* initialises tx */
1968: res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb);
1969:
1970: if (unlikely(res_prepare == TX_DROP)) {
1971: ieee80211_free_txskb(&local->hw, skb);
1972: tx.sdata->tx_handlers_drop++;
1973: return true;
1974: } else if (unlikely(res_prepare == TX_QUEUED)) {
1975: return true;
1976: }
1977:
1978: /* set up hw_queue value early */
1979: if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) ||
1980: !ieee80211_hw_check(&local->hw, QUEUE_CONTROL))
1981: info->hw_queue =
1982: sdata->vif.hw_queue[skb_get_queue_mapping(skb)];
1983:
1984: if (invoke_tx_handlers_early(&tx))
1985: return true;
1986:
1987: if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb))
1988: return true;
1989:
1990: if (!invoke_tx_handlers_late(&tx))
1991: result = __ieee80211_tx(local, &tx.skbs, tx.sta, txpending);
1992:
1993: return result;
1994: }
SourceFile:net/mac80211/tx.c]
|
| 632/4 |
2026/09/07 08:32 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 47486
output: 47
thoughts: 65
Thoughts: **A Deep Dive into the Transmission Preparation Flow**
My initial thought process begins with a question that immediately sparks curiosity and a desire to trace the execution flow: does the `ieee80211_tx` function, which I understand to be a core entry point for transmitting 802.11 frames, directly or indirectly invoke `ieee80211_tx_prepare`? Furthermore, and crucially, if it does call `ieee80211_tx_prepare`, does *that* function, in turn, call `ieee80211_tx_h_rate_ctrl`? This nested dependency is important because I know `ieee80211_tx_h_rate_ctrl` is intrinsically linked to rate control mechanisms, a critical aspect of efficient wireless transmission. To confirm this suspected chain of calls and understand the precise order of operations, my immediate next step is to meticulously examine the implementation details of `ieee80211_tx_prepare` itself. I need to ascertain its internal logic and identify any sub-functions it calls to fully map out this segment of the transmission pipeline.
|
| 633/4 |
2026/09/07 08:32 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_prepare]
Results: map[SourceCode:1202: /*
1203: * initialises @tx
1204: * pass %NULL for the station if unknown, a valid pointer if known
1205: * or an ERR_PTR() if the station is known not to exist
1206: */
1207: static ieee80211_tx_result
1208: ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
1209: struct ieee80211_tx_data *tx,
1210: struct sta_info *sta, struct sk_buff *skb)
1211: {
1212: struct ieee80211_local *local = sdata->local;
1213: struct ieee80211_hdr *hdr;
1214: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1215: bool aggr_check = false;
1216: int tid;
1217:
1218: memset(tx, 0, sizeof(*tx));
1219: tx->skb = skb;
1220: tx->local = local;
1221: tx->sdata = sdata;
1222: __skb_queue_head_init(&tx->skbs);
1223:
1224: /*
1225: * If this flag is set to true anywhere, and we get here,
1226: * we are doing the needed processing, so remove the flag
1227: * now.
1228: */
1229: info->control.flags &= ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
1230:
1231: hdr = (struct ieee80211_hdr *) skb->data;
1232:
1233: if (likely(sta)) {
1234: if (!IS_ERR(sta))
1235: tx->sta = sta;
1236: } else {
1237: if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
1238: tx->sta = rcu_dereference(sdata->u.vlan.sta);
1239: if (!tx->sta && sdata->wdev.use_4addr)
1240: return TX_DROP;
1241: } else if (tx->sdata->control_port_protocol == tx->skb->protocol) {
1242: tx->sta = sta_info_get_bss(sdata, hdr->addr1);
1243: }
1244: if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) {
1245: tx->sta = sta_info_get(sdata, hdr->addr1);
1246: aggr_check = true;
1247: }
1248: }
1249:
1250: if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) &&
1251: !ieee80211_is_qos_nullfunc(hdr->frame_control) &&
1252: ieee80211_hw_check(&local->hw, AMPDU_AGGREGATION) &&
1253: !ieee80211_hw_check(&local->hw, TX_AMPDU_SETUP_IN_HW)) {
1254: struct tid_ampdu_tx *tid_tx;
1255:
1256: tid = ieee80211_get_tid(hdr);
1257: tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1258: if (!tid_tx && aggr_check) {
1259: ieee80211_aggr_check(sdata, tx->sta, skb);
1260: tid_tx = rcu_dereference(tx->sta->ampdu_mlme.tid_tx[tid]);
1261: }
1262:
1263: if (tid_tx) {
1264: bool queued;
1265:
1266: queued = ieee80211_tx_prep_agg(tx, skb, info,
1267: tid_tx, tid);
1268:
1269: if (unlikely(queued))
1270: return TX_QUEUED;
1271: }
1272: }
1273:
1274: if (is_multicast_ether_addr(hdr->addr1)) {
1275: tx->flags &= ~IEEE80211_TX_UNICAST;
1276: info->flags |= IEEE80211_TX_CTL_NO_ACK;
1277: } else
1278: tx->flags |= IEEE80211_TX_UNICAST;
1279:
1280: if (!(info->flags & IEEE80211_TX_CTL_DONTFRAG)) {
1281: if (!(tx->flags & IEEE80211_TX_UNICAST) ||
1282: skb->len + FCS_LEN <= local->hw.wiphy->frag_threshold ||
1283: info->flags & IEEE80211_TX_CTL_AMPDU)
1284: info->flags |= IEEE80211_TX_CTL_DONTFRAG;
1285: }
1286:
1287: if (!tx->sta)
1288: info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1289: else if (test_and_clear_sta_flag(tx->sta, WLAN_STA_CLEAR_PS_FILT)) {
1290: info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1291: ieee80211_check_fast_xmit(tx->sta);
1292: }
1293:
1294: info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT;
1295:
1296: return TX_CONTINUE;
1297: }
SourceFile:net/mac80211/tx.c]
|
| 634/4 |
2026/09/07 08:32 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 49352
output: 33
thoughts: 81
Thoughts: **My Realization and Debugging Path**
My initial understanding, or perhaps assumption, was that the `ieee80211_tx_prepare` function would be the central point for initiating rate control logic, specifically by calling `ieee80211_tx_h_rate_ctrl`. However, a closer examination of the code has revealed a crucial discrepancy: `ieee80211_tx_prepare` *does not*, in fact, invoke `ieee80211_tx_h_rate_ctrl` directly. This is a significant finding that requires immediate re-evaluation of my mental model of the transmission path.
Consequently, my immediate priority shifts to understanding where `ieee80211_tx_h_rate_ctrl` *is* being called. To achieve this, I'm initiating a direct search within the codebase for the `ieee80211_tx_h_rate_ctrl` symbol. This systematic search is my intended next step to uncover the actual execution flow and identify the correct handler for rate control operations within the IEEE 802.11 transmission stack.
|
| 635/4 |
2026/09/07 08:32 |
tool |
codesearch-find-references |
0m
Args: map[Name:ieee80211_tx_h_rate_ctrl]
Results: map[References:[map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ieee80211_tx_dequeue SourceFile:net/mac80211/tx.c SourceLine:3983] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:ieee80211_xmit_fast_finish SourceFile:net/mac80211/tx.c SourceLine:3632] map[ReferenceKind:calls ReferencingEntityKind:function ReferencingEntityName:invoke_tx_handlers_late SourceFile:net/mac80211/tx.c SourceLine:1866]] TruncatedOutput:false]
|
| 636/4 |
2026/09/07 08:32 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 49602
output: 43
thoughts: 44
Thoughts: **My Thought Process Regarding `invoke_tx_handlers_late`**
Ah, so it appears that `invoke_tx_handlers_late` makes a call to `ieee80211_tx_h_rate_ctrl`. My immediate inclination is to delve into `invoke_tx_handlers_late` itself to understand the context and implications of this specific call. I want to dissect its purpose, the data it operates on, and the precise moment this rate control handler is invoked within the late transmission handling sequence. Understanding the 'why' and 'when' of this interaction is crucial for a complete grasp of the overall transmission flow.
|
| 637/4 |
2026/09/07 08:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:invoke_tx_handlers_late]
Results: map[SourceCode:1856: /*
1857: * Late handlers can be called while the sta lock is held. Handlers that can
1858: * cause packets to be generated will cause deadlock!
1859: */
1860: static int invoke_tx_handlers_late(struct ieee80211_tx_data *tx)
1861: {
1862: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
1863: ieee80211_tx_result res = TX_CONTINUE;
1864:
1865: if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1866: CALL_TXH(ieee80211_tx_h_rate_ctrl);
1867:
1868: if (unlikely(info->flags & IEEE80211_TX_INTFL_RETRANSMISSION)) {
1869: __skb_queue_tail(&tx->skbs, tx->skb);
1870: tx->skb = NULL;
1871: goto txh_done;
1872: }
1873:
1874: CALL_TXH(ieee80211_tx_h_michael_mic_add);
1875: CALL_TXH(ieee80211_tx_h_sequence);
1876: CALL_TXH(ieee80211_tx_h_fragment);
1877: /* handlers after fragment must be aware of tx info fragmentation! */
1878: CALL_TXH(ieee80211_tx_h_stats);
1879: CALL_TXH(ieee80211_tx_h_encrypt);
1880: if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
1881: CALL_TXH(ieee80211_tx_h_calculate_duration);
1882: #undef CALL_TXH
1883:
1884: txh_done:
1885: if (unlikely(res == TX_DROP)) {
1886: tx->sdata->tx_handlers_drop++;
1887: if (tx->skb)
1888: ieee80211_free_txskb(&tx->local->hw, tx->skb);
1889: else
1890: ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs);
1891: return -1;
1892: } else if (unlikely(res == TX_QUEUED)) {
1893: I802_DEBUG_INC(tx->local->tx_handlers_queued);
1894: return -1;
1895: }
1896:
1897: return 0;
1898: }
SourceFile:net/mac80211/tx.c]
|
| 638/4 |
2026/09/07 08:33 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 50516
output: 58
thoughts: 129
Thoughts: **My Thought Process Regarding Rate Control in `mac80211_hwsim`**
Ah, a critical junction in the transmission path! I've just encountered this snippet of code:
```c
if (!ieee80211_hw_check(&tx->local->hw, HAS_RATE_CONTROL))
CALL_TXH(ieee80211_tx_h_rate_ctrl);
```
My immediate reaction, the instinct of an experienced engineer navigating complex kernel logic, is a sharp "**Wait!**" This `if` condition is, to me, the linchpin. It states unequivocally that `ieee80211_tx_h_rate_ctrl` is *only* invoked if the hardware *does not* possess the `HAS_RATE_CONTROL` capability.
This immediately triggers a cascade of questions in my mind, the kind that arise when you're dissecting behavior and need to pinpoint the exact conditions governing it. The core question forming is: **Does `mac80211_hwsim`, this simulated hardware environment I'm currently scrutinizing, actually have the `HAS_RATE_CONTROL` flag set?**
My reasoning here is straightforward: if `mac80211_hwsim` *does* have `HAS_RATE_CONTROL` set, then the `ieee80211_tx_h_rate_ctrl` function, which is responsible for rate control operations, will be conspicuously absent from the execution flow for transmissions originating from this simulated hardware. Conversely, if it *lacks* `HAS_RATE_CONTROL`, then the rate control handler *will* be called, implying that some other mechanism, perhaps within `mac80211_hwsim` itself or a fallback in the generic framework, is expected to perform this vital function.
Therefore, my next logical step, the one I'm actively pursuing to resolve this uncertainty, is to **systematically examine the configuration and definition of `mac80211_hwsim`**. I need to ascertain its hardware capabilities, specifically whether the `HAS_RATE_CONTROL` flag is enabled or disabled within its structure. This will be the key to understanding whether the dedicated rate control handler is bypassed or invoked in this simulated scenario.
|
| 639/4 |
2026/09/07 08:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_new_radio]
Results: map[SourceCode:5674: static int mac80211_hwsim_new_radio(struct genl_info *info,
5675: struct hwsim_new_radio_params *param)
5676: {
5677: int err;
5678: u8 addr[ETH_ALEN];
5679: struct mac80211_hwsim_data *data;
5680: struct ieee80211_hw *hw;
5681: enum nl80211_band band;
5682: const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
5683: struct net *net;
5684: int idx, i;
5685: int n_limits = 0;
5686: int n_bands = 0;
5687:
5688: if (WARN_ON(param->channels > 1 && !param->use_chanctx))
5689: return -EINVAL;
5690:
5691: spin_lock_bh(&hwsim_radio_lock);
5692: idx = hwsim_radio_idx++;
5693: spin_unlock_bh(&hwsim_radio_lock);
5694:
5695: if (param->mlo)
5696: ops = &mac80211_hwsim_mlo_ops;
5697: else if (param->use_chanctx)
5698: ops = &mac80211_hwsim_mchan_ops;
5699: hw = ieee80211_alloc_hw_nm(sizeof(*data), ops, param->hwname);
5700: if (!hw) {
5701: pr_debug("mac80211_hwsim: ieee80211_alloc_hw failed\n");
5702: err = -ENOMEM;
5703: goto failed;
5704: }
5705:
5706: /* ieee80211_alloc_hw_nm may have used a default name */
5707: param->hwname = wiphy_name(hw->wiphy);
5708:
5709: if (info)
5710: net = genl_info_net(info);
5711: else
5712: net = &init_net;
5713: wiphy_net_set(hw->wiphy, net);
5714:
5715: data = hw->priv;
5716: data->hw = hw;
5717:
5718: data->dev = device_create(&hwsim_class, NULL, 0, hw, "hwsim%d", idx);
5719: if (IS_ERR(data->dev)) {
5720: printk(KERN_DEBUG
5721: "mac80211_hwsim: device_create failed (%ld)\n",
5722: PTR_ERR(data->dev));
5723: err = -ENOMEM;
5724: goto failed_drvdata;
5725: }
5726: data->dev->driver = &mac80211_hwsim_driver.driver;
5727: err = device_bind_driver(data->dev);
5728: if (err != 0) {
5729: pr_debug("mac80211_hwsim: device_bind_driver failed (%d)\n",
5730: err);
5731: goto failed_bind;
5732: }
5733:
5734: skb_queue_head_init(&data->pending);
5735:
5736: SET_IEEE80211_DEV(hw, data->dev);
5737: if (!param->perm_addr) {
5738: eth_zero_addr(addr);
5739: addr[0] = 0x02;
5740: addr[3] = idx >> 8;
5741: addr[4] = idx;
5742: memcpy(data->addresses[0].addr, addr, ETH_ALEN);
5743: /* Why need here second address ? */
5744: memcpy(data->addresses[1].addr, addr, ETH_ALEN);
5745: data->addresses[1].addr[0] |= 0x40;
5746: memcpy(data->addresses[2].addr, addr, ETH_ALEN);
5747: data->addresses[2].addr[0] |= 0x50;
5748:
5749: hw->wiphy->n_addresses = 3;
5750: hw->wiphy->addresses = data->addresses;
5751: /* possible address clash is checked at hash table insertion */
5752: } else {
5753: memcpy(data->addresses[0].addr, param->perm_addr, ETH_ALEN);
5754: /* compatibility with automatically generated mac addr */
5755: memcpy(data->addresses[1].addr, param->perm_addr, ETH_ALEN);
5756: memcpy(data->addresses[2].addr, param->perm_addr, ETH_ALEN);
5757: hw->wiphy->n_addresses = 3;
5758: hw->wiphy->addresses = data->addresses;
5759: }
5760:
5761: data->channels = param->channels;
5762: data->use_chanctx = param->use_chanctx;
5763: data->idx = idx;
5764: data->destroy_on_close = param->destroy_on_close;
5765: if (info)
5766: data->portid = info->snd_portid;
5767:
5768: /* setup interface limits, only on interface types we support */
5769: if (param->iftypes & BIT(NL80211_IFTYPE_ADHOC)) {
5770: data->if_limits[n_limits].max = 1;
5771: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_ADHOC);
5772: n_limits++;
5773: }
5774:
5775: if (param->iftypes & HWSIM_DEFAULT_IF_LIMIT) {
5776: data->if_limits[n_limits].max = 2048;
5777: /*
5778: * For this case, we may only support a subset of
5779: * HWSIM_DEFAULT_IF_LIMIT, therefore we only want to add the
5780: * bits that both param->iftype & HWSIM_DEFAULT_IF_LIMIT have.
5781: */
5782: data->if_limits[n_limits].types =
5783: HWSIM_DEFAULT_IF_LIMIT & param->iftypes;
5784: n_limits++;
5785: }
5786:
5787: if (param->iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
5788: data->if_limits[n_limits].max = 1;
5789: data->if_limits[n_limits].types =
5790: BIT(NL80211_IFTYPE_P2P_DEVICE);
5791: n_limits++;
5792: }
5793:
5794: if (param->iftypes & BIT(NL80211_IFTYPE_NAN)) {
5795: data->if_limits[n_limits].max = 1;
5796: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN);
5797: n_limits++;
5798:
5799: hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ) |
5800: BIT(NL80211_BAND_5GHZ);
5801:
5802: hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
5803: WIPHY_NAN_FLAGS_USERSPACE_DE;
5804: hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
5805: NAN_OP_MODE_80P80MHZ |
5806: NAN_OP_MODE_160MHZ;
5807:
5808: hw->wiphy->nan_capa.n_antennas = 0x22;
5809: hw->wiphy->nan_capa.max_channel_switch_time = 0;
5810:
5811: wiphy_ext_feature_set(hw->wiphy,
5812: NL80211_EXT_FEATURE_SECURE_NAN);
5813:
5814: hrtimer_setup(&data->nan.slot_timer,
5815: mac80211_hwsim_nan_slot_timer,
5816: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5817: hrtimer_setup(&data->nan.resume_txqs_timer,
5818: mac80211_hwsim_nan_resume_txqs_timer,
5819: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5820: hrtimer_setup(&data->nan.discovery_beacon_timer,
5821: mac80211_hwsim_nan_discovery_beacon_timer,
5822: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5823:
5824: spin_lock_init(&data->nan.state_lock);
5825: }
5826:
5827: if (param->iftypes & BIT(NL80211_IFTYPE_NAN_DATA)) {
5828: data->if_limits[n_limits].max = 2;
5829: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN_DATA);
5830: n_limits++;
5831:
5832: hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap;
5833: hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap;
5834: hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap;
5835:
5836: /*
5837: * NAN switches between bands/channels per its schedule,
5838: * so mac80211 rate control can't work here.
5839: */
5840: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5841: }
5842:
5843: data->if_combination.radar_detect_widths =
5844: BIT(NL80211_CHAN_WIDTH_5) |
5845: BIT(NL80211_CHAN_WIDTH_10) |
5846: BIT(NL80211_CHAN_WIDTH_20_NOHT) |
5847: BIT(NL80211_CHAN_WIDTH_20) |
5848: BIT(NL80211_CHAN_WIDTH_40) |
5849: BIT(NL80211_CHAN_WIDTH_80) |
5850: BIT(NL80211_CHAN_WIDTH_160);
5851:
5852: if (data->use_chanctx) {
5853: hw->wiphy->max_scan_ssids = 255;
5854: hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
5855: hw->wiphy->max_remain_on_channel_duration = 1000;
5856: data->if_combination.num_different_channels = data->channels;
5857: } else {
5858: data->if_combination.num_different_channels = 1;
5859: }
5860:
5861: if (!n_limits) {
5862: err = -EINVAL;
5863: goto failed_hw;
5864: }
5865:
5866: data->if_combination.max_interfaces = 0;
5867: for (i = 0; i < n_limits; i++)
5868: data->if_combination.max_interfaces +=
5869: data->if_limits[i].max;
5870:
5871: data->if_combination.n_limits = n_limits;
5872: data->if_combination.limits = data->if_limits;
5873:
5874: /*
5875: * If we actually were asked to support combinations,
5876: * advertise them - if there's only a single thing like
5877: * only IBSS then don't advertise it as combinations.
5878: */
5879: if (data->if_combination.max_interfaces > 1) {
5880: hw->wiphy->iface_combinations = &data->if_combination;
5881: hw->wiphy->n_iface_combinations = 1;
5882: }
5883:
5884: if (param->ciphers) {
5885: memcpy(data->ciphers, param->ciphers,
5886: param->n_ciphers * sizeof(u32));
5887: hw->wiphy->cipher_suites = data->ciphers;
5888: hw->wiphy->n_cipher_suites = param->n_ciphers;
5889: }
5890:
5891: hw->wiphy->mbssid_max_interfaces = 8;
5892: hw->wiphy->ema_max_profile_periodicity = 3;
5893:
5894: spin_lock_init(&data->tsf_offset_lock);
5895:
5896: data->rx_rssi = DEFAULT_RX_RSSI;
5897:
5898: INIT_DELAYED_WORK(&data->roc_start, hw_roc_start);
5899: INIT_DELAYED_WORK(&data->roc_done, hw_roc_done);
5900: INIT_DELAYED_WORK(&data->hw_scan, hw_scan_work);
5901:
5902: hw->queues = 5;
5903: hw->offchannel_tx_hw_queue = 4;
5904:
5905: ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
5906: ieee80211_hw_set(hw, CHANCTX_STA_CSA);
5907: ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
5908: ieee80211_hw_set(hw, QUEUE_CONTROL);
5909: ieee80211_hw_set(hw, WANT_MONITOR_VIF);
5910: ieee80211_hw_set(hw, AMPDU_AGGREGATION);
5911: ieee80211_hw_set(hw, MFP_CAPABLE);
5912: ieee80211_hw_set(hw, SIGNAL_DBM);
5913: ieee80211_hw_set(hw, SUPPORTS_PS);
5914: ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
5915: ieee80211_hw_set(hw, TDLS_WIDER_BW);
5916: ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
5917: ieee80211_hw_set(hw, STRICT);
5918: ieee80211_hw_set(hw, BUFF_MMPDU_TXQ);
5919: ieee80211_hw_set(hw, STA_MMPDU_TXQ);
5920:
5921: if (param->mlo) {
5922: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
5923: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5924: ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
5925: ieee80211_hw_set(hw, CONNECTION_MONITOR);
5926: ieee80211_hw_set(hw, AP_LINK_PS);
5927:
5928: hw->wiphy->iftype_ext_capab = mac80211_hwsim_iftypes_ext_capa;
5929: hw->wiphy->num_iftype_ext_capab =
5930: ARRAY_SIZE(mac80211_hwsim_iftypes_ext_capa);
5931: } else {
5932: ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
5933: ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
5934: if (rctbl)
5935: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
5936: }
5937:
5938: hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
5939: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
5940: WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
5941: WIPHY_FLAG_AP_UAPSD |
5942: WIPHY_FLAG_HAS_CHANNEL_SWITCH;
5943: hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
5944: hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
5945: NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
5946: NL80211_FEATURE_STATIC_SMPS |
5947: NL80211_FEATURE_DYNAMIC_SMPS |
5948: NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
5949: NL80211_FEATURE_AP_SCAN;
5950: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
5951: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
5952: wiphy_ext_feature_set(hw->wiphy,
5953: NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
5954: wiphy_ext_feature_set(hw->wiphy,
5955: NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
5956: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
5957:
5958: wiphy_ext_feature_set(hw->wiphy,
5959: NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT);
5960: wiphy_ext_feature_set(hw->wiphy,
5961: NL80211_EXT_FEATURE_BSS_COLOR);
5962: wiphy_ext_feature_set(hw->wiphy,
5963: NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT);
5964: wiphy_ext_feature_set(hw->wiphy,
5965: NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
5966: wiphy_ext_feature_set(hw->wiphy,
5967: NL80211_EXT_FEATURE_EXT_KEY_ID);
5968: wiphy_ext_feature_set(hw->wiphy,
5969: NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION);
5970:
5971: hw->wiphy->interface_modes = param->iftypes;
5972:
5973: /* ask mac80211 to reserve space for magic */
5974: hw->vif_data_size = sizeof(struct hwsim_vif_priv);
5975: hw->sta_data_size = sizeof(struct hwsim_sta_priv);
5976: hw->chanctx_data_size = sizeof(struct hwsim_chanctx_priv);
5977: hw->txq_data_size = 0;
5978:
5979: memcpy(data->channels_2ghz, hwsim_channels_2ghz,
5980: sizeof(hwsim_channels_2ghz));
5981: memcpy(data->channels_5ghz, hwsim_channels_5ghz,
5982: sizeof(hwsim_channels_5ghz));
5983: memcpy(data->channels_6ghz, hwsim_channels_6ghz,
5984: sizeof(hwsim_channels_6ghz));
5985: memcpy(data->channels_s1g, hwsim_channels_s1g,
5986: sizeof(hwsim_channels_s1g));
5987: memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates));
5988:
5989: for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
5990: struct ieee80211_supported_band *sband = &data->bands[band];
5991: struct wiphy_radio_freq_range *radio_range;
5992: const struct ieee80211_channel *c;
5993: struct wiphy_radio *radio;
5994:
5995: sband->band = band;
5996:
5997: switch (band) {
5998: case NL80211_BAND_2GHZ:
5999: sband->channels = data->channels_2ghz;
6000: sband->n_channels = ARRAY_SIZE(hwsim_channels_2ghz);
6001: sband->bitrates = data->rates;
6002: sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
6003: break;
6004: case NL80211_BAND_5GHZ:
6005: sband->channels = data->channels_5ghz;
6006: sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
6007: sband->bitrates = data->rates + 4;
6008: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6009:
6010: sband->vht_cap.vht_supported = true;
6011: sband->vht_cap.cap =
6012: IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
6013: IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
6014: IEEE80211_VHT_CAP_RXLDPC |
6015: IEEE80211_VHT_CAP_SHORT_GI_80 |
6016: IEEE80211_VHT_CAP_SHORT_GI_160 |
6017: IEEE80211_VHT_CAP_TXSTBC |
6018: IEEE80211_VHT_CAP_RXSTBC_4 |
6019: IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
6020: sband->vht_cap.vht_mcs.rx_mcs_map =
6021: cpu_to_le16(HWSIM_VHT_MCS_MAP);
6022: sband->vht_cap.vht_mcs.tx_mcs_map =
6023: sband->vht_cap.vht_mcs.rx_mcs_map;
6024: break;
6025: case NL80211_BAND_6GHZ:
6026: sband->channels = data->channels_6ghz;
6027: sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
6028: sband->bitrates = data->rates + 4;
6029: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6030: break;
6031: case NL80211_BAND_S1GHZ:
6032: memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
6033: sizeof(sband->s1g_cap));
6034: sband->channels = data->channels_s1g;
6035: sband->n_channels = ARRAY_SIZE(hwsim_channels_s1g);
6036: break;
6037: default:
6038: continue;
6039: }
6040:
6041: if (band != NL80211_BAND_6GHZ){
6042: sband->ht_cap.ht_supported = true;
6043: sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
6044: IEEE80211_HT_CAP_GRN_FLD |
6045: IEEE80211_HT_CAP_SGI_20 |
6046: IEEE80211_HT_CAP_SGI_40 |
6047: IEEE80211_HT_CAP_DSSSCCK40 |
6048: IEEE80211_HT_CAP_TX_STBC |
6049: IEEE80211_HT_CAP_RX_STBC;
6050: sband->ht_cap.ampdu_factor = 0x3;
6051: sband->ht_cap.ampdu_density = 0x6;
6052: memset(&sband->ht_cap.mcs, 0,
6053: sizeof(sband->ht_cap.mcs));
6054: sband->ht_cap.mcs.rx_mask[0] = 0xff;
6055: sband->ht_cap.mcs.rx_mask[1] = 0xff;
6056: sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
6057: }
6058:
6059: mac80211_hwsim_sband_capab(sband);
6060:
6061: hw->wiphy->bands[band] = sband;
6062:
6063: if (!param->multi_radio)
6064: continue;
6065:
6066: c = sband->channels;
6067: radio_range = &data->radio_range[n_bands];
6068: radio_range->start_freq = ieee80211_channel_to_khz(c) - 10000;
6069:
6070: c += sband->n_channels - 1;
6071: radio_range->end_freq = ieee80211_channel_to_khz(c) + 10000;
6072:
6073: radio = &data->radio[n_bands++];
6074: radio->freq_range = radio_range;
6075: radio->n_freq_range = 1;
6076: radio->iface_combinations = &data->if_combination_radio;
6077: radio->n_iface_combinations = 1;
6078: }
6079:
6080: if (param->multi_radio) {
6081: hw->wiphy->radio = data->radio;
6082: hw->wiphy->n_radio = n_bands;
6083:
6084: memcpy(&data->if_combination_radio, &data->if_combination,
6085: sizeof(data->if_combination));
6086: data->if_combination.num_different_channels *= n_bands;
6087: }
6088:
6089: if (data->use_chanctx)
6090: data->if_combination.radar_detect_widths = 0;
6091:
6092: /* By default all radios belong to the first group */
6093: data->group = 1;
6094: mutex_init(&data->mutex);
6095:
6096: data->netgroup = hwsim_net_get_netgroup(net);
6097: data->wmediumd = hwsim_net_get_wmediumd(net);
6098:
6099: /* Enable frame retransmissions for lossy channels */
6100: hw->max_rates = 4;
6101: hw->max_rate_tries = 11;
6102:
6103: hw->wiphy->vendor_commands = mac80211_hwsim_vendor_commands;
6104: hw->wiphy->n_vendor_commands =
6105: ARRAY_SIZE(mac80211_hwsim_vendor_commands);
6106: hw->wiphy->vendor_events = mac80211_hwsim_vendor_events;
6107: hw->wiphy->n_vendor_events = ARRAY_SIZE(mac80211_hwsim_vendor_events);
6108:
6109: if (param->reg_strict)
6110: hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
6111: if (param->regd) {
6112: data->regd = param->regd;
6113: hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
6114: wiphy_apply_custom_regulatory(hw->wiphy, param->regd);
6115: /* give the regulatory workqueue a chance to run */
6116: schedule_timeout_interruptible(1);
6117: }
6118:
6119: wiphy_ext_feature_set(hw->wiphy,
6120: NL80211_EXT_FEATURE_DFS_CONCURRENT);
6121: if (param->background_radar)
6122: wiphy_ext_feature_set(hw->wiphy,
6123: NL80211_EXT_FEATURE_RADAR_BACKGROUND);
6124:
6125: if (param->no_vif)
6126: ieee80211_hw_set(hw, NO_AUTO_VIF);
6127:
6128: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
6129: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PUNCT);
6130: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PROBE_AP);
6131:
6132: for (i = 0; i < ARRAY_SIZE(data->link_data); i++) {
6133: hrtimer_setup(&data->link_data[i].beacon_timer, mac80211_hwsim_beacon,
6134: CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
6135: data->link_data[i].link_id = i;
6136: }
6137:
6138: err = ieee80211_register_hw(hw);
6139: if (err < 0) {
6140: pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
6141: err);
6142: goto failed_hw;
6143: }
6144:
6145: wiphy_dbg(hw->wiphy, "hwaddr %pM registered\n", hw->wiphy->perm_addr);
6146:
6147: if (param->reg_alpha2) {
6148: data->alpha2[0] = param->reg_alpha2[0];
6149: data->alpha2[1] = param->reg_alpha2[1];
6150: regulatory_hint(hw->wiphy, param->reg_alpha2);
6151: }
6152:
6153: data->debugfs = debugfs_create_dir("hwsim", hw->wiphy->debugfsdir);
6154: debugfs_create_file("ps", 0666, data->debugfs, data, &hwsim_fops_ps);
6155: debugfs_create_file("group", 0666, data->debugfs, data,
6156: &hwsim_fops_group);
6157: debugfs_create_file("rx_rssi", 0666, data->debugfs, data,
6158: &hwsim_fops_rx_rssi);
6159: if (!data->use_chanctx)
6160: debugfs_create_file("dfs_simulate_radar", 0222,
6161: data->debugfs,
6162: data, &hwsim_simulate_radar);
6163: if (param->background_radar)
6164: debugfs_create_file("dfs_background_cac", 0200,
6165: data->debugfs,
6166: data, &hwsim_background_cac_ops);
6167: debugfs_create_file("simulate_incumbent_signal_interference", 0200,
6168: data->debugfs,
6169: data, &hwsim_simulate_incumbent_signal_fops);
6170:
6171: if (param->pmsr_capa) {
6172: data->pmsr_capa = *param->pmsr_capa;
6173: hw->wiphy->pmsr_capa = &data->pmsr_capa;
6174: }
6175:
6176: spin_lock_bh(&hwsim_radio_lock);
6177: err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
6178: hwsim_rht_params);
6179: if (err < 0) {
6180: if (info) {
6181: GENL_SET_ERR_MSG(info, "perm addr already present");
6182: NL_SET_BAD_ATTR(info->extack,
6183: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6184: }
6185: spin_unlock_bh(&hwsim_radio_lock);
6186: goto failed_final_insert;
6187: }
6188:
6189: list_add_tail(&data->list, &hwsim_radios);
6190: hwsim_radios_generation++;
6191: spin_unlock_bh(&hwsim_radio_lock);
6192:
6193: hwsim_mcast_new_radio(idx, info, param);
6194:
6195: return idx;
6196:
6197: failed_final_insert:
6198: debugfs_remove_recursive(data->debugfs);
6199: ieee80211_unregister_hw(data->hw);
6200: failed_hw:
6201: device_release_driver(data->dev);
6202: failed_bind:
6203: device_unregister(data->dev);
6204: failed_drvdata:
6205: ieee80211_free_hw(hw);
6206: failed:
6207: return err;
6208: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 640/4 |
2026/09/07 08:33 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 60938
output: 60
thoughts: 894
Thoughts: **My Thought Process Regarding the MLO and Rate Control Interaction in mac80211_hwsim**
Looking at this code snippet, my immediate thought is to analyze the conditional logic based on `param->mlo`. If `param->mlo` is set, several flags are enabled on the `hw->wiphy` structure, including `WIPHY_FLAG_SUPPORTS_MLO`, and crucially, `HAS_RATE_CONTROL`. This is where my attention really sharpens.
I know from my experience with `mac80211` that when `HAS_RATE_CONTROL` is set on the hardware capabilities, the `ieee80211_tx_h_rate_ctrl` function is *not* called by the core `mac80211` stack. This is a fundamental behavior: the driver has indicated it handles rate control itself, so the generic `mac80211` logic defers.
This leads me to a critical realization: if `ieee80211_tx_h_rate_ctrl` is skipped, then the `info->control.rates[0].idx` field is never populated by this function. This field is intended to indicate the specific rate index being used for transmission.
Then, my mind connects to the preceding step in the packet processing pipeline: `ieee80211_parse_tx_radiotap`. I recall that this function, when it encounters certain conditions (like perhaps not having rate information explicitly provided in the radiotap header, or if rate control is handled elsewhere), can set `idx < 0` and clear the `RATE_INJECT` flag.
Now, I trace the flow further. After the radiotap parsing, `mac80211_hwsim_write_tsf` is called. If `info->control.rates[0].idx` was never set by the rate control handler (because it was skipped) and was potentially left negative by `ieee80211_parse_tx_radiotap`, then when `mac80211_hwsim_write_tsf` encounters this negative `idx`, the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` assertion will be triggered. This is a clear indicator of a bug or an unexpected state.
This brings me to a point of questioning the default state of `HAS_RATE_CONTROL` within `mac80211_hwsim`. My recollection is that it's not always set. It's explicitly enabled here if `param->mlo` is true, or if `param->iftypes` includes `BIT(NL80211_IFTYPE_NAN_DATA)`.
So, the path to triggering this warning is:
1. A `mac80211_hwsim` radio is created.
2. This radio is configured with either MLO support (`param->mlo` true) or NAN data interface type (`param->iftypes & BIT(NL80211_IFTYPE_NAN_DATA)`).
3. This sets `HAS_RATE_CONTROL` on the hardware capabilities.
4. Because `HAS_RATE_CONTROL` is set, `ieee80211_tx_h_rate_ctrl` is skipped during transmission.
5. The `rates[0].idx` field remains unset or negative.
6. Subsequently, `mac80211_hwsim_write_tsf` (or another function downstream) hits the `WARN_ON_ONCE` check for `rates[0].idx < 0`.
My next thought is to consider how such a `mac80211_hwsim` radio would typically be instantiated. Usually, it's either during kernel module loading or via a netlink command, specifically `HWSIM_CMD_NEW_RADIO`.
Given this, the current context of a syzkaller test execution is highly relevant. Syzkaller often works by creating hardware interfaces and then fuzzing their behavior. If syzkaller is using `HWSIM_CMD_NEW_RADIO` to create a new `mac80211_hwsim` radio and is specifying MLO or NAN data capabilities, it would naturally lead to the scenario I've just outlined.
The syzkaller log message, "netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'." strongly suggests an issue during the netlink command processing. My hypothesis is that this leftover data is related to the `HWSIM_CMD_NEW_RADIO` command, possibly an improperly formatted attribute or an unexpected argument value that results in incomplete parsing, and which then proceeds to create the radio with the problematic configuration.
To confirm this, my next logical step would be to examine the `mac80211_hwsim_new_radio_nl` function itself. I need to see precisely how it handles the `HWSIM_CMD_NEW_RADIO` netlink message and how it translates the parameters into the `hwsim_param` structure that controls the creation of the virtual radio, particularly how it sets `param->mlo` or `param->iftypes`. This will help me pinpoint the exact sequence of events that leads to the `HAS_RATE_CONTROL` being enabled in a way that causes the subsequent assertion failure.
|
| 641/4 |
2026/09/07 08:33 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_new_radio_nl]
Results: map[SourceCode: SourceFile:]
|
| 642/4 |
2026/09/07 08:33 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 61897
output: 53
thoughts: 14
Thoughts: **My Thought Process**
Right, first things first, I need to get a handle on what this `hwsim_new_radio_nl` component is all about. My immediate instinct is to dive into its implementation details, to see exactly how it functions within the broader hardware simulation framework. I'm looking for the core logic, the data structures it utilizes, and any external dependencies it might have. Understanding its role in creating new radio devices is paramount, so I'll be paying close attention to the parameters it accepts, the state it manages, and the signals or events it emits or responds to during this creation process. This deep dive is crucial for me to build a comprehensive mental model of its behavior and its place in the system.
|
| 643/4 |
2026/09/07 08:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:hwsim_new_radio_nl]
Results: map[SourceCode:6805: static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
6806: {
6807: struct hwsim_new_radio_params param = { 0 };
6808: const char *hwname = NULL;
6809: int ret;
6810:
6811: param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
6812: param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
6813: param.nan_device = info->attrs[HWSIM_ATTR_SUPPORT_NAN_DEVICE];
6814: param.channels = channels;
6815: param.destroy_on_close =
6816: info->attrs[HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE];
6817:
6818: if (info->attrs[HWSIM_ATTR_CHANNELS])
6819: param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]);
6820:
6821: if (param.channels < 1) {
6822: GENL_SET_ERR_MSG(info, "must have at least one channel");
6823: return -EINVAL;
6824: }
6825:
6826: if (info->attrs[HWSIM_ATTR_NO_VIF])
6827: param.no_vif = true;
6828:
6829: if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
6830: param.use_chanctx = true;
6831: else
6832: param.use_chanctx = (param.channels > 1);
6833:
6834: if (info->attrs[HWSIM_ATTR_MULTI_RADIO])
6835: param.multi_radio = true;
6836:
6837: if (info->attrs[HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR])
6838: param.background_radar = true;
6839:
6840: if (info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2])
6841: param.reg_alpha2 =
6842: nla_data(info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]);
6843:
6844: if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
6845: u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
6846:
6847: if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
6848: return -EINVAL;
6849:
6850: idx = array_index_nospec(idx,
6851: ARRAY_SIZE(hwsim_world_regdom_custom));
6852: param.regd = hwsim_world_regdom_custom[idx];
6853: }
6854:
6855: if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
6856: if (!is_valid_ether_addr(
6857: nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
6858: GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
6859: NL_SET_BAD_ATTR(info->extack,
6860: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6861: return -EINVAL;
6862: }
6863:
6864: param.perm_addr = nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]);
6865: }
6866:
6867: if (info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]) {
6868: param.iftypes =
6869: nla_get_u32(info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]);
6870:
6871: if (param.iftypes & ~HWSIM_IFTYPE_SUPPORT_MASK) {
6872: NL_SET_ERR_MSG_ATTR(info->extack,
6873: info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT],
6874: "cannot support more iftypes than kernel");
6875: return -EINVAL;
6876: }
6877: } else {
6878: param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
6879: }
6880:
6881: /* ensure both flag and iftype support is honored */
6882: if (param.p2p_device ||
6883: param.iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
6884: param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
6885: param.p2p_device = true;
6886: }
6887:
6888: if (param.nan_device) {
6889: if (param.multi_radio) {
6890: NL_SET_ERR_MSG(info->extack,
6891: "NAN is not supported on multi-radio wiphys");
6892: return -EINVAL;
6893: }
6894: param.iftypes |= BIT(NL80211_IFTYPE_NAN) |
6895: BIT(NL80211_IFTYPE_NAN_DATA);
6896: }
6897:
6898: if (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]) {
6899: u32 len = nla_len(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6900:
6901: param.ciphers =
6902: nla_data(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6903:
6904: if (len % sizeof(u32)) {
6905: NL_SET_ERR_MSG_ATTR(info->extack,
6906: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6907: "bad cipher list length");
6908: return -EINVAL;
6909: }
6910:
6911: param.n_ciphers = len / sizeof(u32);
6912:
6913: if (param.n_ciphers > ARRAY_SIZE(hwsim_ciphers)) {
6914: NL_SET_ERR_MSG_ATTR(info->extack,
6915: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6916: "too many ciphers specified");
6917: return -EINVAL;
6918: }
6919:
6920: if (!hwsim_known_ciphers(param.ciphers, param.n_ciphers)) {
6921: NL_SET_ERR_MSG_ATTR(info->extack,
6922: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6923: "unsupported ciphers specified");
6924: return -EINVAL;
6925: }
6926: }
6927:
6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
6929:
6930: if (param.mlo || param.multi_radio)
6931: param.use_chanctx = true;
6932:
6933: if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
6934: hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6935: nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6936: GFP_KERNEL);
6937: if (!hwname)
6938: return -ENOMEM;
6939: param.hwname = hwname;
6940: }
6941:
6942: if (info->attrs[HWSIM_ATTR_PMSR_SUPPORT]) {
6943: struct cfg80211_pmsr_capabilities *pmsr_capa;
6944:
6945: pmsr_capa = kzalloc_obj(*pmsr_capa);
6946: if (!pmsr_capa) {
6947: ret = -ENOMEM;
6948: goto out_free;
6949: }
6950: param.pmsr_capa = pmsr_capa;
6951:
6952: ret = parse_pmsr_capa(info->attrs[HWSIM_ATTR_PMSR_SUPPORT], pmsr_capa, info);
6953: if (ret)
6954: goto out_free;
6955: }
6956:
6957: ret = mac80211_hwsim_new_radio(info, ¶m);
6958:
6959: out_free:
6960: kfree(hwname);
6961: kfree(param.pmsr_capa);
6962: return ret;
6963: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 644/4 |
2026/09/07 08:33 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 64652
output: 52
thoughts: 206
Thoughts: **My Thought Process Unraveling the `mac80211_hwsim` MLO Issue**
Okay, so I'm looking at this line: `param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];`. My immediate thought is, "Ah, this is where the MLO support flag is being set." If I, as the user interacting with `mac80211_hwsim`, send a `HWSIM_CMD_NEW_RADIO` command and include the `HWSIM_ATTR_MLO_SUPPORT` attribute, it directly translates into setting `param.mlo` to `true`.
Then, my mind jumps to the subsequent behavior. The function `mac80211_hwsim_new_radio` is called, and if `param.mlo` is indeed true, it sets the `HAS_RATE_CONTROL` flag. This is a crucial point. When `HAS_RATE_CONTROL` is set, it causes `ieee80211_tx_h_rate_ctrl` to be skipped during transmission handling.
This skipping, in turn, leads to a specific problem: `rates[0].idx` remains negative. And then, when `mac80211_hwsim_write_tsf` is invoked, this negative `rates[0].idx` triggers a `WARN_ON_ONCE`. That's the core of the observed issue, the direct consequence of enabling MLO support in this specific context.
But then a little bit of doubt creeps in, or rather, a deeper dive. I pause and think, "Wait a minute, `HWSIM_CMD_NEW_RADIO` isn't just any command; it's a netlink command, and specifically for the `mac80211_hwsim` generic netlink family." This realization prompts me to verify my understanding by checking the exact family name for this netlink interface. It's important to be precise about the communication protocol and the specific family being targeted when dealing with these kernel modules.
|
| 645/4 |
2026/09/07 08:33 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:hwsim_genl_family]
Results: map[SourceCode:7147: static struct genl_family hwsim_genl_family __ro_after_init = {
7148: .name = "MAC80211_HWSIM",
7149: .version = 1,
7150: .maxattr = HWSIM_ATTR_MAX,
7151: .policy = hwsim_genl_policy,
7152: .netnsok = true,
7153: .module = THIS_MODULE,
7154: .small_ops = hwsim_ops,
7155: .n_small_ops = ARRAY_SIZE(hwsim_ops),
7156: .resv_start_op = HWSIM_CMD_REPORT_PMSR + 1, // match with __HWSIM_CMD_MAX
7157: .mcgrps = hwsim_mcgrps,
7158: .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps),
7159: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 646/4 |
2026/09/07 08:33 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 65194
output: 55
thoughts: 113
Thoughts: **Aha! I've stumbled upon a potential path to reproduce this syzkaller bug.**
I've been poring over the logs and noticed this intriguing warning: "netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'". This immediately caught my attention because it suggests an issue with how netlink attributes are being handled. My current hypothesis is that this is stemming from a `nla_parse` or a similar attribute parsing function.
Now, the real breakthrough came when I considered the `MAC80211_HWSIM` family name. I realized that if I can strategically create a *new radio device* and specifically enable `MLO_SUPPORT` during its creation, I might be able to trigger this very same parsing error. This feels like a direct correlation to the reported leftover bytes.
To confirm, my next step is to meticulously check the value associated with `HWSIM_ATTR_MLO_SUPPORT`. If that attribute is indeed being set or handled in a way that leads to this unexpected data surplus, then I'm confident I've found my reproduction scenario.
|
| 647/4 |
2026/09/07 08:33 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:HWSIM_ATTR_MLO_SUPPORT]
Results: map[SourceCode: SourceFile:]
|
| 648/4 |
2026/09/07 08:34 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 65367
output: 49
thoughts: 11
Thoughts: **My Thought Process Regarding `enum hwsim_attribute`**
As an expert in my field, my first instinct when encountering a new codebase or feature, like the `hwsim_attribute` enumeration, is to immediately scrutinize its definition and purpose. My internal monologue would likely begin with: "Okay, I need to understand what this `enum` is all about. What are its constituent members, and what do they represent in the context of hardware simulation?"
I would then proceed to mentally (or literally, by looking at the source code) list out each member of the `hwsim_attribute` enum. For each member, I'd be asking myself:
* **What specific hardware characteristic or setting does this attribute pertain to?** Is it a physical property, a configuration parameter, a status indicator, or something else entirely?
* **What is the expected data type associated with this attribute?** Does it represent a boolean flag, an integer value, a string, or perhaps a more complex data structure?
* **What are the potential values or ranges for this attribute?** Are there predefined constants, or can it take arbitrary values within certain bounds?
* **How is this attribute intended to be used within the hardware simulation framework?** Is it for setting up initial conditions, for querying the state of the simulated hardware, for communicating events, or for debugging purposes?
* **Are there any dependencies or relationships between different attributes?** For instance, does setting one attribute implicitly affect another?
* **What are the implications of this attribute for the overall simulation's accuracy, performance, or fidelity?**
My goal would be to build a comprehensive mental model of `hwsim_attribute`. This isn't just about rote memorization; it's about understanding the *semantics* of each attribute. I'd be thinking about how these attributes contribute to the realism and functionality of the hardware simulation. If I were to encounter an unfamiliar attribute, I'd immediately flag it for deeper investigation, perhaps by looking for its usage in other parts of the code or consulting documentation.
Ultimately, my thought process is driven by a need to achieve a deep, actionable understanding. I'm not just checking to see if the `enum` exists; I'm dissecting its role and ensuring I grasp its implications for the entire system.
|
| 649/4 |
2026/09/07 08:34 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:hwsim_attribute]
Results: map[SourceCode: SourceFile:]
|
| 650/4 |
2026/09/07 08:34 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 65432
output: 46
thoughts: 24
Thoughts: **My Thought Process on Inspecting `include/uapi/linux/mac80211_hwsim.h`**
Right, so my immediate inclination is to dive into `include/uapi/linux/mac80211_hwsim.h`. My thinking here is straightforward: if I'm going to understand the intricacies of the `mac80211_hwsim` driver, its user-space API is the most direct and authoritative source for what's exposed and how it's intended to be used. This header file is crucial because it defines the structures, enums, and constants that applications or testing frameworks would interact with to control or query the simulated hardware. I'm anticipating finding definitions for things like device creation, configuration parameters, and perhaps even event notifications or statistics retrieval mechanisms. It's the definitive contract between the kernel module and any external tooling. By examining this, I can get a clear picture of the available knobs and dials without having to wade through the entire kernel module's implementation just yet. It sets the stage and provides the vocabulary for any deeper investigation.
|
| 651/4 |
2026/09/07 08:34 |
tool |
codesearch-definition-source |
0m
Error:
Args: map[ContextFile:include/uapi/linux/mac80211_hwsim.h Name:hwsim_attribute]
Results: map[SourceCode: SourceFile:]
|
| 652/4 |
2026/09/07 08:34 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 65507
output: 48
thoughts: 30
Thoughts: **A Deep Dive into MLO Capabilities within the `mac80211_hwsim` Framework**
My initial thought process, as an expert in this domain, immediately directs me to a specific source: the header file `mac80211_hwsim.h`. My objective is to ascertain the presence and implications of Multi-Link Operation (MLO) support within this hardware simulation framework. Specifically, I'm looking for a particular attribute, `HWSIM_ATTR_MLO_SUPPORT`.
My reasoning for this focused approach is rooted in the understanding that `mac80211_hwsim.h` serves as the canonical definition for the attributes and structures used to interact with the `mac80211_hwsim` kernel module. This module, in turn, is crucial for emulating Wi-Fi hardware in userspace for testing and development purposes. If MLO is to be represented and manipulated within this simulation environment, its control or status indicators would logically reside in this header file.
The presence of `HWSIM_ATTR_MLO_SUPPORT` would signify to me that the `mac80211_hwsim` framework has been extended or designed with MLO capabilities in mind. This could manifest in several ways:
* **Configuration:** It might allow me to enable or disable MLO in the simulated hardware. This would be vital for testing scenarios where I need to explicitly control whether the simulated device participates in MLO.
* **Status Reporting:** The attribute could be used by the simulated hardware to report its MLO capabilities or current operational state. This would enable me to query the simulated device and understand its MLO configuration from the perspective of the simulation.
* **Feature Flags:** It could act as a flag indicating that the simulated hardware *supports* MLO, even if it's not actively configured or operating in an MLO mode at a given moment. This would be important for understanding the theoretical capabilities of the emulated hardware.
Therefore, my next logical step is to examine the contents of `mac80211_hwsim.h` to locate `HWSIM_ATTR_MLO_SUPPORT`. The context surrounding this attribute, such as its data type, any associated flags, or comments, will further refine my understanding of how MLO is integrated into the `mac80211_hwsim` environment. This foundational check is critical before proceeding with any experiments or tests involving MLO on simulated Wi-Fi hardware. It’s about verifying the building blocks of my simulation environment.
|
| 653/4 |
2026/09/07 08:34 |
tool |
grepper |
0m
Error:
Args: map[Expression:HWSIM_ATTR_MLO_SUPPORT PathPrefix:include/uapi/linux/mac80211_hwsim.h]
Results:
|
| 654/4 |
2026/09/07 08:34 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 65583
output: 24
thoughts: 18
Thoughts: **My Thought Process**
Okay, so I'm looking at this code, and I've hit a bit of a snag. I'm trying to understand the behavior related to MLO (Multi-Link Operation), and I've come across a constant or macro, `HWSIM_ATTR_MLO_SUPPORT`. My immediate reaction is: where is this actually defined? I'm going through the relevant files, likely in the hardware simulation context, trying to pinpoint its declaration or definition. This isn't just a casual lookup; for me, as someone deeply familiar with this domain, understanding the provenance of these identifiers is crucial for grasping the underlying system's capabilities and limitations. It tells me *how* MLO support is being signaled or configured within this particular hardware simulation environment. Without knowing its origin, I can't fully trust or interpret its usage. I need to trace it back to its source to ensure I'm building my understanding on solid ground.
|
| 655/4 |
2026/09/07 08:34 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_ATTR_MLO_SUPPORT]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim.h=91=enum hwsim_commands {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-151- * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
drivers/net/wireless/virtual/mac80211_hwsim.h:152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
drivers/net/wireless/virtual/mac80211_hwsim.h-153- * the new radio
--
drivers/net/wireless/virtual/mac80211_hwsim.h=167=enum hwsim_attrs {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-192- HWSIM_ATTR_CIPHER_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h:193: HWSIM_ATTR_MLO_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h-194- HWSIM_ATTR_PMSR_SUPPORT,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=865=static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-891- [HWSIM_ATTR_CIPHER_SUPPORT] = { .type = NLA_BINARY },
drivers/net/wireless/virtual/mac80211_hwsim_main.c:892: [HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
drivers/net/wireless/virtual/mac80211_hwsim_main.c-893- [HWSIM_ATTR_PMSR_SUPPORT] = NLA_POLICY_NESTED(hwsim_pmsr_capa_policy),
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6805=static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6927-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6929-
]
|
| 656/4 |
2026/09/07 08:34 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 66311
output: 47
thoughts: 48
Thoughts: **My Thought Process on `HWSIM_ATTR_MLO_SUPPORT`**
Okay, so my immediate thought upon encountering `HWSIM_ATTR_MLO_SUPPORT` was to ascertain its numerical value within the `hwsim_attrs` enumeration. Given that `HWSIM_ATTR_CIPHER_SUPPORT` is already established at 23, it's a straightforward deduction that `HWSIM_ATTR_MLO_SUPPORT` must occupy the next available slot, thus being assigned the value of 24. My next logical step, of course, is to delve into the `enum hwsim_attrs` definition itself to confirm this assumption and to understand the broader context and other attributes defined within that enumeration. This confirmation is crucial for accurate integration and understanding of the hardware simulation attributes.
|
| 657/4 |
2026/09/07 08:34 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.h Name:hwsim_attrs]
Results: map[SourceCode: 111: /**
112: * enum hwsim_attrs - hwsim netlink attributes
113: *
114: * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
115: *
116: * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
117: * the frame is broadcasted to
118: * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
119: * the frame was broadcasted from
120: * @HWSIM_ATTR_FRAME: Data array
121: * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
122: * properly the frame at user space
123: * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
124: * space
125: * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
126: * space
127: * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
128: * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
129: * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_NEW_RADIO
130: * command giving the number of channels supported by the new radio
131: * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
132: * only to destroy a radio
133: * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatory driver hint
134: * (nla string, length 2)
135: * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
136: * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
137: * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
138: * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_NEW_RADIO
139: * command to force use of channel contexts even when only a
140: * single channel is supported
141: * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_NEW_RADIO
142: * command to force radio removal when process that created the radio dies
143: * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
144: * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
145: * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
146: * @HWSIM_ATTR_PAD: padding attribute for 64-bit values, ignore
147: * @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
148: * rates of %HWSIM_ATTR_TX_INFO
149: * @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
150: * @HWSIM_ATTR_IFTYPE_SUPPORT: u32 attribute of supported interface types bits
151: * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
153: * the new radio
154: * @HWSIM_ATTR_PMSR_SUPPORT: nested attribute used with %HWSIM_CMD_NEW_RADIO
155: * to provide peer measurement capabilities. (nl80211_peer_measurement_attrs)
156: * @HWSIM_ATTR_PMSR_REQUEST: nested attribute used with %HWSIM_CMD_START_PMSR
157: * to provide details about peer measurement request (nl80211_peer_measurement_attrs)
158: * @HWSIM_ATTR_PMSR_RESULT: nested attributed used with %HWSIM_CMD_REPORT_PMSR
159: * to provide peer measurement result (nl80211_peer_measurement_attrs)
160: * @HWSIM_ATTR_MULTI_RADIO: Register multiple wiphy radios (flag).
161: * Adds one radio for each band. Number of supported channels will be set for
162: * each radio instead of for the wiphy.
163: * @HWSIM_ATTR_SUPPORT_NAN_DEVICE: support NAN Device virtual interface (flag)
164: * @HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR: background radar/CAC support (flag)
165: * @__HWSIM_ATTR_MAX: enum limit
166: */
167: enum hwsim_attrs {
168: HWSIM_ATTR_UNSPEC,
169: HWSIM_ATTR_ADDR_RECEIVER,
170: HWSIM_ATTR_ADDR_TRANSMITTER,
171: HWSIM_ATTR_FRAME,
172: HWSIM_ATTR_FLAGS,
173: HWSIM_ATTR_RX_RATE,
174: HWSIM_ATTR_SIGNAL,
175: HWSIM_ATTR_TX_INFO,
176: HWSIM_ATTR_COOKIE,
177: HWSIM_ATTR_CHANNELS,
178: HWSIM_ATTR_RADIO_ID,
179: HWSIM_ATTR_REG_HINT_ALPHA2,
180: HWSIM_ATTR_REG_CUSTOM_REG,
181: HWSIM_ATTR_REG_STRICT_REG,
182: HWSIM_ATTR_SUPPORT_P2P_DEVICE,
183: HWSIM_ATTR_USE_CHANCTX,
184: HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
185: HWSIM_ATTR_RADIO_NAME,
186: HWSIM_ATTR_NO_VIF,
187: HWSIM_ATTR_FREQ,
188: HWSIM_ATTR_PAD,
189: HWSIM_ATTR_TX_INFO_FLAGS,
190: HWSIM_ATTR_PERM_ADDR,
191: HWSIM_ATTR_IFTYPE_SUPPORT,
192: HWSIM_ATTR_CIPHER_SUPPORT,
193: HWSIM_ATTR_MLO_SUPPORT,
194: HWSIM_ATTR_PMSR_SUPPORT,
195: HWSIM_ATTR_PMSR_REQUEST,
196: HWSIM_ATTR_PMSR_RESULT,
197: HWSIM_ATTR_MULTI_RADIO,
198: HWSIM_ATTR_SUPPORT_NAN_DEVICE,
199: HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR,
200: __HWSIM_ATTR_MAX,
201: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.h]
|
| 658/4 |
2026/09/07 08:34 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 68387
output: 62
thoughts: 3784
Thoughts: **The Root of the Radiotap and TSF Discrepancy**
So, I've been digging into this `mac80211_hwsim` behavior, and it seems I've pinpointed the exact sequence of events leading to that `WARN_ON_ONCE` in `mac80211_hwsim_write_tsf`. It all hinges on how the `HAS_RATE_CONTROL` flag is set and then how the radiotap header is parsed.
Initially, I noticed the `HWSIM_ATTR_MLO_SUPPORT` attribute has a value of 25. This immediately made me think about the `HWSIM_CMD_NEW_RADIO` command, which I know is command number 4. So, my first thought was, "If I send a netlink message to `MAC80211_HWSIM` with command `HWSIM_CMD_NEW_RADIO` and the `HWSIM_ATTR_MLO_SUPPORT` attribute, I should be able to create a new radio that supports MLO." And indeed, this action flags the hardware with `HAS_RATE_CONTROL`.
The crucial insight came from looking at the bug report: "netlink: 80 bytes leftover after parsing attributes". This suggests syzkaller was sending a malformed or overly long message. However, I realized the core of the problem isn't the leftover bytes, but what that `HWSIM_ATTR_MLO_SUPPORT` flag *does* to the hardware capabilities. When `HWSIM_ATTR_MLO_SUPPORT` is present, `ieee80211_hw_set(hw, HAS_RATE_CONTROL)` is called. This flag is the linchpin.
Here's the critical path:
1. **Radio Creation:** I need to create a `mac80211_hwsim` radio. The most straightforward way is via netlink, sending `HWSIM_CMD_NEW_RADIO` with the `HWSIM_ATTR_MLO_SUPPORT` attribute (value 25). This tells the driver to set up a new radio device.
2. **Interface Setup:** This new radio device will manifest as a `wlanX` interface. I'll need to get this interface up and running, specifically by setting it to monitor mode. This is a standard `nl80211` operation.
3. **Frame Injection:** The next step is to inject a frame. I'll use an `AF_PACKET` socket for this, and it's essential to craft a specific radiotap header.
4. **Radiotap Header Manipulation:** The key is to include the `IEEE80211_RADIOTAP_MCS` field in the radiotap header. Crucially, I need to set the `mcs_rate` within this field to 128. This is because when `ieee80211_parse_tx_radiotap` encounters this, it sets `info->control.rates[0].idx` to the `mcs_rate`, which is 128. Since `idx` is an `s8`, this translates to `-128`.
5. **Skipping Rate Control:** Now, because the `HAS_RATE_CONTROL` flag was set during radio creation (due to `HWSIM_ATTR_MLO_SUPPORT`), the function `ieee80211_tx_h_rate_ctrl` is *skipped* entirely by the `CALL_TXH(ieee80211_tx_h_rate_ctrl)` check. This means `info->control.rates[0].idx` is *not* updated from its initial value of `-128`.
6. **The `WARN_ON_ONCE`:** Finally, when `mac80211_hwsim_write_tsf` is called, it retrieves the TX rate. In `mac80211_hwsim_get_tx_rate`, it calls `ieee80211_get_tx_rate`. This function has a `WARN_ON_ONCE(c->control.rates[0].idx < 0)`. Since `idx` is still `-128` (because rate control was skipped), this condition becomes true, triggering the warning.
It's interesting to note that `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (value 30) would also set `HAS_RATE_CONTROL`, so that would also be a valid trigger. The syzkaller message about "leftover bytes" is just noise; the actual bug is triggered by the combination of `HAS_RATE_CONTROL` and the specific radiotap MCS rate.
So, to reproduce this, I need to:
1. Open a netlink socket and resolve the `MAC80211_HWSIM` family.
2. Send a `HWSIM_CMD_NEW_RADIO` netlink message with the `HWSIM_ATTR_MLO_SUPPORT` attribute.
3. Wait for the new `wlanX` interface to appear.
4. Configure this interface for monitor mode.
5. Open an `AF_PACKET` socket on that monitor interface.
6. Craft and send a frame with a radiotap header containing `IEEE80211_RADIOTAP_MCS` and a rate of 128.
This sequence precisely bypasses the rate control logic and directly hits the `WARN_ON_ONCE` condition in the TSF writing function.
|
| 659/4 |
2026/09/07 08:35 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_tx_frame_no_nl]
Results: map[SourceCode:1902: static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
1903: struct sk_buff *skb,
1904: struct ieee80211_channel *chan)
1905: {
1906: struct mac80211_hwsim_data *data = hw->priv, *data2;
1907: bool ack = false;
1908: struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
1909: struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
1910: struct ieee80211_rx_status rx_status;
1911: u64 sim_tsf = mac80211_hwsim_get_sim_tsf();
1912:
1913: mac80211_hwsim_write_tsf(data, skb, sim_tsf);
1914:
1915: mac80211_hwsim_monitor_rx(hw, skb, chan);
1916:
1917: memset(&rx_status, 0, sizeof(rx_status));
1918: rx_status.flag |= RX_FLAG_MACTIME_START;
1919: rx_status.freq = chan->center_freq;
1920: rx_status.freq_offset = chan->freq_offset ? 1 : 0;
1921: rx_status.band = chan->band;
1922: if (info->control.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) {
1923: rx_status.rate_idx =
1924: ieee80211_rate_get_vht_mcs(&info->control.rates[0]);
1925: rx_status.nss =
1926: ieee80211_rate_get_vht_nss(&info->control.rates[0]);
1927: rx_status.encoding = RX_ENC_VHT;
1928: } else {
1929: rx_status.rate_idx = info->control.rates[0].idx;
1930: if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
1931: rx_status.encoding = RX_ENC_HT;
1932: }
1933: if (info->control.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
1934: rx_status.bw = RATE_INFO_BW_40;
1935: else if (info->control.rates[0].flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
1936: rx_status.bw = RATE_INFO_BW_80;
1937: else if (info->control.rates[0].flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
1938: rx_status.bw = RATE_INFO_BW_160;
1939: else
1940: rx_status.bw = RATE_INFO_BW_20;
1941: if (info->control.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)
1942: rx_status.enc_flags |= RX_ENC_FLAG_SHORT_GI;
1943: /* TODO: simulate optional packet loss */
1944: rx_status.signal = data->rx_rssi;
1945: if (info->control.vif)
1946: rx_status.signal += info->control.vif->bss_conf.txpower;
1947:
1948: if (data->ps != PS_DISABLED)
1949: hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
1950:
1951: /* release the skb's source info */
1952: skb_orphan(skb);
1953: skb_dst_drop(skb);
1954: skb->mark = 0;
1955: skb_ext_reset(skb);
1956: nf_reset_ct(skb);
1957:
1958: if (ieee80211_is_beacon(hdr->frame_control) ||
1959: ieee80211_is_probe_resp(hdr->frame_control))
1960: rx_status.boottime_ns = ktime_get_boottime_ns();
1961:
1962: /* Copy skb to all enabled radios that are on the current frequency */
1963: spin_lock(&hwsim_radio_lock);
1964: list_for_each_entry(data2, &hwsim_radios, list) {
1965: struct sk_buff *nskb;
1966: struct tx_iter_data tx_iter_data = {
1967: .receive = false,
1968: .hw = data2->hw,
1969: .channel = chan,
1970: .rx_status = &rx_status,
1971: };
1972:
1973: if (data == data2)
1974: continue;
1975:
1976: if (!data2->started || (data2->idle && !data2->tmp_chan) ||
1977: !hwsim_ps_rx_ok(data2, skb))
1978: continue;
1979:
1980: if (!(data->group & data2->group))
1981: continue;
1982:
1983: if (data->netgroup != data2->netgroup)
1984: continue;
1985:
1986: /*
1987: * Set mactime early since NAN RX filtering relies on it
1988: * for slot calculation
1989: */
1990: rx_status.mactime = sim_tsf + data2->tsf_offset;
1991:
1992: if (!hwsim_chans_compat(chan, data2->tmp_chan) &&
1993: !hwsim_chans_compat(chan, data2->channel)) {
1994: ieee80211_iterate_active_interfaces_atomic(
1995: data2->hw, IEEE80211_IFACE_ITER_NORMAL,
1996: mac80211_hwsim_tx_iter, &tx_iter_data);
1997: if (!tx_iter_data.receive)
1998: continue;
1999: }
2000:
2001: /*
2002: * reserve some space for our vendor and the normal
2003: * radiotap header, since we're copying anyway
2004: */
2005: if (skb->len < PAGE_SIZE && paged_rx) {
2006: struct page *page = alloc_page(GFP_ATOMIC);
2007:
2008: if (!page)
2009: continue;
2010:
2011: nskb = dev_alloc_skb(128);
2012: if (!nskb) {
2013: __free_page(page);
2014: continue;
2015: }
2016:
2017: memcpy(page_address(page), skb->data, skb->len);
2018: skb_add_rx_frag(nskb, 0, page, 0, skb->len, skb->len);
2019: } else {
2020: nskb = skb_copy(skb, GFP_ATOMIC);
2021: if (!nskb)
2022: continue;
2023: }
2024:
2025: if (mac80211_hwsim_addr_match(data2, hdr->addr1))
2026: ack = true;
2027:
2028: mac80211_hwsim_rx(data2, &rx_status, nskb);
2029: }
2030: spin_unlock(&hwsim_radio_lock);
2031:
2032: return ack;
2033: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 660/4 |
2026/09/07 08:35 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 74616
output: 47
thoughts: 4780
Thoughts: **The Root Cause of the Kernel Warning and Reproducer Logic**
I've been digging into this kernel warning, and it seems I've finally pinned down the precise sequence of events that triggers it. It all boils down to how `mac80211_hwsim` handles transmission rates, particularly when Multi-Link Operation (MLO) support is enabled.
Here's how I understand the reproducer logic leading to the issue:
1. **Setting up the Environment:** I start by establishing a netlink socket to communicate with the kernel. My goal is to create a specific hardware simulation environment.
2. **Creating an MLO-Enabled Radio:** I resolve the `MAC80211_HWSIM` family ID. Then, I send a `HWSIM_CMD_NEW_RADIO` command, crucially including the `HWSIM_ATTR_MLO_SUPPORT` attribute. This tells the kernel to create a new simulated wireless interface, like `wlan1` (or `wlan2` if `wlan0` and `wlan1` already exist), with MLO capabilities. This is a key step because it sets the `HAS_RATE_CONTROL` flag for this new radio.
3. **Configuring the Interface for Injection:** I then bring this newly created radio down, switch it to `MONITOR` mode, and bring it back up. This is standard practice for crafting raw frames.
4. **Opening an Injection Socket:** I open an `AF_PACKET` socket on this configured interface. This socket will be used to inject the specially crafted packet.
5. **Crafting the Malicious Frame:** This is where things get interesting. I construct a raw frame that includes a radiotap header. The specific radiotap fields I'm using are:
* `it_len` is set to 11.
* `it_present` indicates `IEEE80211_RADIOTAP_RATE` (bit 2).
* The `rate` field is set to `0`.
The crucial aspect here is that by specifying `IEEE80211_RADIOTAP_RATE` with a rate value of `0`, I'm effectively causing the kernel's `ieee80211_parse_tx_radiotap` function to iterate through the available `sband->bitrates`. Since `0` won't match any valid, non-zero bitrate, the `info->control.rates[0].idx` field remains at its initial value of `-1`. Importantly, this *does not* set the `IEEE80211_TX_RC_MCS` or `IEEE80211_TX_RC_VHT_MCS` flags in `info->control.rates[0].flags`.
6. **The Kernel's Reaction:** When the kernel receives this frame on the MLO-enabled radio:
* It parses the radiotap header. Because `IEEE80211_TX_RC_MCS` and `IEEE80211_TX_RC_VHT_MCS` are not set, the `rate_flags` are effectively `0`.
* Since no matching bitrate is found in the `sband->bitrates` loop, `info->control.rates[0].idx` remains `-1`.
* The `IEEE80211_RADIOTAP_RATE` flag is processed, and due to the `rate = 0` not matching, the `RATE_INJECT` flag is cleared.
* Crucially, because the new radio has `MLO_SUPPORT` set, the `HAS_RATE_CONTROL` flag is present. This causes the `ieee80211_tx_h_rate_ctrl` handler to be *skipped*.
* The code then proceeds to `mac80211_hwsim_tx_frame_no_nl`. This function immediately calls `mac80211_hwsim_write_tsf`.
* `mac80211_hwsim_write_tsf`, in turn, calls `mac80211_hwsim_get_tx_rate`.
* `mac80211_hwsim_get_tx_rate` checks `info->control.rates[0].flags`. Since neither `IEEE80211_TX_RC_MCS` nor `IEEE80211_TX_RC_VHT_MCS` is set, it proceeds to call `ieee80211_get_tx_rate`.
* `ieee80211_get_tx_rate` then checks `info->control.rates[0].idx < 0`. Since `idx` is `-1`, this condition is true, and the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` triggers the kernel warning.
My earlier confusion stemmed from initially thinking that using `IEEE80211_RADIOTAP_MCS` would be the way to force a negative `idx`. However, that approach sets the `IEEE80211_TX_RC_MCS` flag, causing `mac80211_hwsim_get_tx_rate` to return `NULL` and thus skip the problematic `ieee80211_get_tx_rate` call entirely. The use of `IEEE80211_RADIOTAP_RATE` with an invalid rate value, combined with the MLO-enabled radio skipping the rate control handler, is the perfect storm for triggering this specific warning. The key insight is that `idx` is initialized to `-1` and only overwritten if a valid rate is found *or* if the `ieee80211_tx_h_rate_ctrl` handler is invoked.
As for the radio interface name, I've realized that simply creating a new radio with `HWSIM_CMD_NEW_RADIO` will usually result in a higher index (like `wlan2`). To make the reproducer more robust, I need to reliably identify and use this newly created MLO-capable interface. I can achieve this by iterating through potential interface names (`wlan0`, `wlan1`, `wlan2`, etc.) and checking if they have the `HAS_RATE_CONTROL` flag set, or more simply, by creating the new radio and then using `if_nametoindex` for the expected name (e.g., "wlan2"). The critical part is ensuring the injected frame targets an interface with `HAS_RATE_CONTROL` enabled, which is precisely what creating a radio with `HWSIM_ATTR_MLO_SUPPORT` does.
|
| 661/4 |
2026/09/07 08:36 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:net/mac80211/tx.c Name:ieee80211_tx_dequeue]
Results: map[SourceCode:3880: struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
3881: struct ieee80211_txq *txq)
3882: {
3883: struct ieee80211_local *local = hw_to_local(hw);
3884: struct txq_info *txqi = container_of(txq, struct txq_info, txq);
3885: struct ieee80211_hdr *hdr;
3886: struct sk_buff *skb = NULL;
3887: struct fq *fq = &local->fq;
3888: struct fq_tin *tin = &txqi->tin;
3889: struct ieee80211_tx_info *info;
3890: struct ieee80211_tx_data tx;
3891: ieee80211_tx_result r;
3892: struct ieee80211_vif *vif = txq->vif;
3893: int q = vif->hw_queue[txq->ac];
3894: unsigned long flags;
3895: bool q_stopped;
3896:
3897: WARN_ON_ONCE(softirq_count() == 0);
3898:
3899: if (!ieee80211_txq_airtime_check(hw, txq))
3900: return NULL;
3901:
3902: begin:
3903: spin_lock_irqsave(&local->queue_stop_reason_lock, flags);
3904: q_stopped = local->queue_stop_reasons[q];
3905: spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags);
3906:
3907: if (unlikely(q_stopped)) {
3908: /* mark for waking later */
3909: set_bit(IEEE80211_TXQ_DIRTY, &txqi->flags);
3910: return NULL;
3911: }
3912:
3913: spin_lock_bh(&fq->lock);
3914:
3915: /* Make sure fragments stay together. */
3916: skb = __skb_dequeue(&txqi->frags);
3917: if (unlikely(skb)) {
3918: if (!(IEEE80211_SKB_CB(skb)->control.flags &
3919: IEEE80211_TX_INTCFL_NEED_TXPROCESSING))
3920: goto out;
3921: IEEE80211_SKB_CB(skb)->control.flags &=
3922: ~IEEE80211_TX_INTCFL_NEED_TXPROCESSING;
3923: } else {
3924: if (unlikely(test_bit(IEEE80211_TXQ_STOP, &txqi->flags)))
3925: goto out;
3926:
3927: skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);
3928: }
3929:
3930: if (!skb)
3931: goto out;
3932:
3933: spin_unlock_bh(&fq->lock);
3934:
3935: hdr = (struct ieee80211_hdr *)skb->data;
3936: info = IEEE80211_SKB_CB(skb);
3937:
3938: memset(&tx, 0, sizeof(tx));
3939: __skb_queue_head_init(&tx.skbs);
3940: tx.local = local;
3941: tx.skb = skb;
3942: tx.sdata = vif_to_sdata(info->control.vif);
3943:
3944: if (txq->sta) {
3945: tx.sta = container_of(txq->sta, struct sta_info, sta);
3946: /*
3947: * Drop unicast frames to unauthorised stations unless they are
3948: * injected frames or EAPOL frames from the local station.
3949: */
3950: if (unlikely(!(info->flags & IEEE80211_TX_CTL_INJECTED) &&
3951: ieee80211_is_data_present(hdr->frame_control) &&
3952: !ieee80211_vif_is_mesh(&tx.sdata->vif) &&
3953: tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
3954: !is_multicast_ether_addr(hdr->addr1) &&
3955: !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
3956: (!(info->control.flags &
3957: IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
3958: !ieee80211_is_our_addr(tx.sdata, hdr->addr2,
3959: NULL)))) {
3960: I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
3961: ieee80211_free_txskb(&local->hw, skb);
3962: goto begin;
3963: }
3964: }
3965:
3966: /*
3967: * The key can be removed while the packet was queued, so need to call
3968: * this here to get the current key.
3969: */
3970: info->control.hw_key = NULL;
3971: r = ieee80211_tx_h_select_key(&tx);
3972: if (r != TX_CONTINUE) {
3973: ieee80211_free_txskb(&local->hw, skb);
3974: goto begin;
3975: }
3976:
3977: if (test_bit(IEEE80211_TXQ_AMPDU, &txqi->flags))
3978: info->flags |= (IEEE80211_TX_CTL_AMPDU |
3979: IEEE80211_TX_CTL_DONTFRAG);
3980:
3981: if (info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) {
3982: if (!ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) {
3983: r = ieee80211_tx_h_rate_ctrl(&tx);
3984: if (r != TX_CONTINUE) {
3985: ieee80211_free_txskb(&local->hw, skb);
3986: goto begin;
3987: }
3988: }
3989: goto encap_out;
3990: }
3991:
3992: if (info->control.flags & IEEE80211_TX_CTRL_FAST_XMIT) {
3993: struct sta_info *sta = container_of(txq->sta, struct sta_info,
3994: sta);
3995: u8 pn_offs = 0;
3996:
3997: if (tx.key &&
3998: (tx.key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV))
3999: pn_offs = ieee80211_hdrlen(hdr->frame_control);
4000:
4001: r = ieee80211_xmit_fast_finish(sta->sdata, sta, pn_offs,
4002: tx.key, &tx);
4003: if (r != TX_CONTINUE) {
4004: ieee80211_free_txskb(&local->hw, skb);
4005: goto begin;
4006: }
4007: } else {
4008: if (invoke_tx_handlers_late(&tx))
4009: goto begin;
4010:
4011: skb = __skb_dequeue(&tx.skbs);
4012: info = IEEE80211_SKB_CB(skb);
4013:
4014: if (!skb_queue_empty(&tx.skbs)) {
4015: spin_lock_bh(&fq->lock);
4016: skb_queue_splice_tail(&tx.skbs, &txqi->frags);
4017: spin_unlock_bh(&fq->lock);
4018: }
4019: }
4020:
4021: if (skb_has_frag_list(skb) &&
4022: !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) {
4023: if (skb_linearize(skb)) {
4024: ieee80211_free_txskb(&local->hw, skb);
4025: goto begin;
4026: }
4027: }
4028:
4029: switch (tx.sdata->vif.type) {
4030: case NL80211_IFTYPE_MONITOR:
4031: if ((tx.sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE) ||
4032: ieee80211_hw_check(&local->hw, NO_VIRTUAL_MONITOR)) {
4033: vif = &tx.sdata->vif;
4034: break;
4035: }
4036: tx.sdata = rcu_dereference(local->monitor_sdata);
4037: if (tx.sdata &&
4038: ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) {
4039: vif = &tx.sdata->vif;
4040: info->hw_queue =
4041: vif->hw_queue[skb_get_queue_mapping(skb)];
4042: } else if (ieee80211_hw_check(&local->hw, QUEUE_CONTROL)) {
4043: ieee80211_free_txskb(&local->hw, skb);
4044: goto begin;
4045: } else {
4046: info->control.vif = NULL;
4047: return skb;
4048: }
4049: break;
4050: case NL80211_IFTYPE_AP_VLAN:
4051: tx.sdata = container_of(tx.sdata->bss,
4052: struct ieee80211_sub_if_data, u.ap);
4053: fallthrough;
4054: default:
4055: vif = &tx.sdata->vif;
4056: break;
4057: }
4058:
4059: encap_out:
4060: info->control.vif = vif;
4061:
4062: if (wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) {
4063: bool ampdu = txq->sta && txq->ac != IEEE80211_AC_VO;
4064: u32 airtime;
4065:
4066: airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta,
4067: skb->len, ampdu);
4068: if (!airtime)
4069: return skb;
4070:
4071: airtime = ieee80211_info_set_tx_time_est(info, airtime);
4072: info->tx_time_mc = !tx.sta;
4073: ieee80211_sta_update_pending_airtime(local, tx.sta, txq->ac,
4074: airtime, false,
4075: info->tx_time_mc);
4076: }
4077:
4078: return skb;
4079:
4080: out:
4081: spin_unlock_bh(&fq->lock);
4082:
4083: return skb;
4084: }
SourceFile:net/mac80211/tx.c]
|
| 662/4 |
2026/09/07 08:36 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 83029
output: 763
thoughts: 3937
Thoughts: **My Thought Process on Triggering a `mac80211_hwsim` Bug**
Okay, let's break down how I've been piecing together the puzzle to trigger this specific `mac80211_hwsim` bug. My goal is to create a reproducible scenario that leads to the `WARN_ON_ONCE` in `mac80211_hwsim_write_tsf`.
Initially, I was looking at the `ieee80211_tx_dequeue` function. I noticed that it checks for `HAS_RATE_CONTROL` using `ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)`. This check is also present in `invoke_tx_handlers_late`. The crucial insight here is that *if* `HAS_RATE_CONTROL` is set, then `ieee80211_tx_h_rate_ctrl` is *never* called. This means that `idx`, which is supposed to hold a valid rate index, remains at its initial value of `-1`. This is the core of the problem I'm trying to exploit.
So, the reproducer needs to achieve two things:
1. **Ensure `HAS_RATE_CONTROL` is set for a hwsim radio.**
2. **Craft a transmission that results in `idx` remaining `-1` even when `HAS_RATE_CONTROL` is set.**
Here's how I've constructed the steps to achieve this, and the thought process behind each one:
**The Reproducer Steps (and my reasoning):**
1. **Open a netlink socket and get the `MAC80211_HWSIM` family ID.**
* *Why?* To interact with the `mac80211_hwsim` driver, I need to use the generic netlink interface. I need its family ID to send commands.
2. **Send `HWSIM_CMD_NEW_RADIO` with `HWSIM_ATTR_MLO_SUPPORT`.**
* *Why?* This is the critical step to ensure `HAS_RATE_CONTROL` is set for the new radio. My understanding, after digging into the `mac80211_hwsim` code, is that creating a radio with `HWSIM_ATTR_MLO_SUPPORT` flags the hardware as having rate control capabilities. This is exactly what bypasses `ieee80211_tx_h_rate_ctrl`.
* *Self-correction/Verification:* I double-checked the `mac80211_hwsim.c` source to confirm that `HWSIM_ATTR_MLO_SUPPORT` is indeed handled by `mac80211_hwsim_new_radio`, and it sets the `IEEE80211_HW_HAS_RATE_CONTROL` flag on the `local->hw` structure. I also confirmed it's a flag attribute, so its `nla_len` should just be `NLA_HDRLEN`.
3. **Wait a bit for the radio to be created.**
* *Why?* Asynchronous operations in the kernel, so a short delay ensures the radio is fully initialized before I try to use it.
4. **Find the new interface (e.g., `wlan2`).**
* *Why?* I need a specific interface name to perform subsequent operations. The `wlanX` naming convention for `mac80211_hwsim` is standard. I'll iterate to find an available one.
5. **Set `wlan2` DOWN.**
* *Why?* It's generally good practice to bring an interface down before changing its mode or configuration.
6. **Set `wlan2` to MONITOR mode.**
* *Why?* The bug seems to be triggered during transmission setup, and monitor mode is a common setup for injecting packets or observing traffic, which is what I'm trying to do. This requires using the `nl80211` netlink family to send `NL80211_CMD_SET_INTERFACE`.
7. **Set `wlan2` UP.**
* *Why?* After setting the mode, the interface needs to be brought back up to be usable.
8. **Open an `AF_PACKET` socket on `wlan2`.**
* *Why?* This is how I'll inject raw Ethernet frames, including the radiotap header, into the interface.
9. **Send a frame with a radiotap header containing `IEEE80211_RADIOTAP_RATE` with `rate = 0`.**
* *Why this specific payload?* This is the second crucial part of the reproducer.
* I need to send a frame that *looks* like it has rate information but actually causes the rate parsing to fail.
* I initially considered `IEEE80211_RADIOTAP_MCS`, but that sets `IEEE80211_TX_RC_MCS` in the flags, which would cause `mac80211_hwsim_get_tx_rate` to return `NULL`, prematurely avoiding the `WARN_ON_ONCE` I'm looking for.
* Using `IEEE80211_RADIOTAP_RATE` (bit 2) is better. When `rate = 0`, it doesn't match any valid bitrate in `sband->bitrates`. This means that within the rate parsing logic (specifically `ieee80211_parse_tx_radiotap`), `idx` will remain `-1`.
* Crucially, `IEEE80211_RADIOTAP_RATE` with `rate = 0` *does not* set `IEEE80211_TX_RC_MCS`. Therefore, `mac80211_hwsim_get_tx_rate` will *not* return `NULL`. It will proceed to call `ieee80211_get_tx_rate`, which will then use the `idx = -1` value, finally triggering the `WARN_ON_ONCE` in `mac80211_hwsim_write_tsf`.
* *Self-correction/Verification:* I meticulously reviewed the radiotap parsing and rate control logic within `mac80211_hwsim` to ensure this specific combination of `IEEE80211_RADIOTAP_RATE` and `rate = 0` would bypass the early exit conditions and propagate the invalid `idx`.
**Putting it Together in Code:**
Based on this detailed thought process, I've constructed the C code for the reproducer. It handles netlink communication for `mac80211_hwsim` and `nl80211`, interface manipulation (up/down, monitor mode), and finally, the `AF_PACKET` injection with the carefully crafted radiotap frame.
My analysis confirms that this sequence of events is precisely what's needed: create a hwsim radio with rate control enabled (`HWSIM_ATTR_MLO_SUPPORT`), then inject a frame that fools the rate parsing into leaving `idx` at `-1`, leading to the `WARN_ON_ONCE` when `HAS_RATE_CONTROL` is active. The previous attempt likely failed because it didn't ensure `HAS_RATE_CONTROL` was set, allowing the `ieee80211_tx_h_rate_ctrl` to correct the `idx` value before it reached `mac80211_hwsim_write_tsf`.
|
| 663/4 |
2026/09/07 08:36 |
tool |
set-results |
0m
Args: map[Feedback:The reproduction attempt failed to trigger the bug because it injected frames into the default `wlan0` interface, which does not have the `HAS_RATE_CONTROL` flag set.
### Root Cause Analysis
1. When injecting a frame via `AF_PACKET` with a radiotap header containing `IEEE80211_RADIOTAP_RATE` and `rate = 0`, `ieee80211_parse_tx_radiotap()` initializes `info->control.rates[0].idx = -1`. Since `rate = 0` does not match any valid bitrate, `idx` remains `-1`.
2. Because `idx < 0`, `ieee80211_parse_tx_radiotap()` clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
3. In the TX path, `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` **unless** the hardware has the `HAS_RATE_CONTROL` flag set.
4. If `ieee80211_tx_h_rate_ctrl()` is called, it falls back to standard rate control, which overwrites `info->control.rates[0].idx` with a valid, non-negative index (e.g., `0`).
5. When `mac80211_hwsim_tx_frame_no_nl()` subsequently calls `mac80211_hwsim_write_tsf()`, `idx` is no longer negative, so the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` does not trigger.
### How to Trigger the Bug
To prevent `ieee80211_tx_h_rate_ctrl()` from overwriting `idx`, the `mac80211_hwsim` radio must have the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`) or NAN Data support.
You need to modify the reproducer to first create a new `mac80211_hwsim` radio with MLO support using Netlink:
1. Open a Netlink socket and resolve the `MAC80211_HWSIM` family ID.
2. Send a `HWSIM_CMD_NEW_RADIO` (4) command with the `HWSIM_ATTR_MLO_SUPPORT` (25) flag attribute.
3. Wait briefly for the new interface (e.g., `wlan1` or `wlan2`) to be created.
4. Set the new interface DOWN, change its mode to `NL80211_IFTYPE_MONITOR`, and set it UP.
5. Bind an `AF_PACKET` socket to the new interface and inject the same frame with `IEEE80211_RADIOTAP_RATE` and `rate = 0`.
This will cause `ieee80211_tx_h_rate_ctrl()` to be skipped, preserving `idx = -1` until it reaches `mac80211_hwsim_write_tsf()`, successfully triggering the `WARN_ON_ONCE`. ProbePassed:true TerminalError: TitleMatches:true]
Results: map[Feedback:The reproduction attempt failed to trigger the bug because it injected frames into the default `wlan0` interface, which does not have the `HAS_RATE_CONTROL` flag set.
### Root Cause Analysis
1. When injecting a frame via `AF_PACKET` with a radiotap header containing `IEEE80211_RADIOTAP_RATE` and `rate = 0`, `ieee80211_parse_tx_radiotap()` initializes `info->control.rates[0].idx = -1`. Since `rate = 0` does not match any valid bitrate, `idx` remains `-1`.
2. Because `idx < 0`, `ieee80211_parse_tx_radiotap()` clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
3. In the TX path, `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` **unless** the hardware has the `HAS_RATE_CONTROL` flag set.
4. If `ieee80211_tx_h_rate_ctrl()` is called, it falls back to standard rate control, which overwrites `info->control.rates[0].idx` with a valid, non-negative index (e.g., `0`).
5. When `mac80211_hwsim_tx_frame_no_nl()` subsequently calls `mac80211_hwsim_write_tsf()`, `idx` is no longer negative, so the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` does not trigger.
### How to Trigger the Bug
To prevent `ieee80211_tx_h_rate_ctrl()` from overwriting `idx`, the `mac80211_hwsim` radio must have the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`) or NAN Data support.
You need to modify the reproducer to first create a new `mac80211_hwsim` radio with MLO support using Netlink:
1. Open a Netlink socket and resolve the `MAC80211_HWSIM` family ID.
2. Send a `HWSIM_CMD_NEW_RADIO` (4) command with the `HWSIM_ATTR_MLO_SUPPORT` (25) flag attribute.
3. Wait briefly for the new interface (e.g., `wlan1` or `wlan2`) to be created.
4. Set the new interface DOWN, change its mode to `NL80211_IFTYPE_MONITOR`, and set it UP.
5. Bind an `AF_PACKET` socket to the new interface and inject the same frame with `IEEE80211_RADIOTAP_RATE` and `rate = 0`.
This will cause `ieee80211_tx_h_rate_ctrl()` to be skipped, preserving `idx = -1` until it reaches `mac80211_hwsim_write_tsf()`, successfully triggering the `WARN_ON_ONCE`. ProbePassed:true TerminalError: TitleMatches:true]
|
| 664/3 |
2026/09/07 08:36 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:true ContinueSignal:continue EquivalenceAnalysis: OracleFeedback:The reproduction attempt failed to trigger the bug because it injected frames into the default `wlan0` interface, which does not have the `HAS_RATE_CONTROL` flag set.
### Root Cause Analysis
1. When injecting a frame via `AF_PACKET` with a radiotap header containing `IEEE80211_RADIOTAP_RATE` and `rate = 0`, `ieee80211_parse_tx_radiotap()` initializes `info->control.rates[0].idx = -1`. Since `rate = 0` does not match any valid bitrate, `idx` remains `-1`.
2. Because `idx < 0`, `ieee80211_parse_tx_radiotap()` clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
3. In the TX path, `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` **unless** the hardware has the `HAS_RATE_CONTROL` flag set.
4. If `ieee80211_tx_h_rate_ctrl()` is called, it falls back to standard rate control, which overwrites `info->control.rates[0].idx` with a valid, non-negative index (e.g., `0`).
5. When `mac80211_hwsim_tx_frame_no_nl()` subsequently calls `mac80211_hwsim_write_tsf()`, `idx` is no longer negative, so the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` does not trigger.
### How to Trigger the Bug
To prevent `ieee80211_tx_h_rate_ctrl()` from overwriting `idx`, the `mac80211_hwsim` radio must have the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`) or NAN Data support.
You need to modify the reproducer to first create a new `mac80211_hwsim` radio with MLO support using Netlink:
1. Open a Netlink socket and resolve the `MAC80211_HWSIM` family ID.
2. Send a `HWSIM_CMD_NEW_RADIO` (4) command with the `HWSIM_ATTR_MLO_SUPPORT` (25) flag attribute.
3. Wait briefly for the new interface (e.g., `wlan1` or `wlan2`) to be created.
4. Set the new interface DOWN, change its mode to `NL80211_IFTYPE_MONITOR`, and set it UP.
5. Bind an `AF_PACKET` socket to the new interface and inject the same frame with `IEEE80211_RADIOTAP_RATE` and `rate = 0`.
This will cause `ieee80211_tx_h_rate_ctrl()` to be skipped, preserving `idx = -1` until it reaches `mac80211_hwsim_write_tsf()`, successfully triggering the `WARN_ON_ONCE`. ReproC: Reproduced:false ReproducedBugTitle: ReproducedCrashReport:]
|
| 665/2 |
2026/09/07 08:36 |
iteration |
3 |
13m
|
| 666/3 |
2026/09/07 08:36 |
action |
If |
8m
Args: map[OracleFeedback:The reproduction attempt failed to trigger the bug because it injected frames into the default `wlan0` interface, which does not have the `HAS_RATE_CONTROL` flag set.
### Root Cause Analysis
1. When injecting a frame via `AF_PACKET` with a radiotap header containing `IEEE80211_RADIOTAP_RATE` and `rate = 0`, `ieee80211_parse_tx_radiotap()` initializes `info->control.rates[0].idx = -1`. Since `rate = 0` does not match any valid bitrate, `idx` remains `-1`.
2. Because `idx < 0`, `ieee80211_parse_tx_radiotap()` clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
3. In the TX path, `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` **unless** the hardware has the `HAS_RATE_CONTROL` flag set.
4. If `ieee80211_tx_h_rate_ctrl()` is called, it falls back to standard rate control, which overwrites `info->control.rates[0].idx` with a valid, non-negative index (e.g., `0`).
5. When `mac80211_hwsim_tx_frame_no_nl()` subsequently calls `mac80211_hwsim_write_tsf()`, `idx` is no longer negative, so the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` does not trigger.
### How to Trigger the Bug
To prevent `ieee80211_tx_h_rate_ctrl()` from overwriting `idx`, the `mac80211_hwsim` radio must have the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`) or NAN Data support.
You need to modify the reproducer to first create a new `mac80211_hwsim` radio with MLO support using Netlink:
1. Open a Netlink socket and resolve the `MAC80211_HWSIM` family ID.
2. Send a `HWSIM_CMD_NEW_RADIO` (4) command with the `HWSIM_ATTR_MLO_SUPPORT` (25) flag attribute.
3. Wait briefly for the new interface (e.g., `wlan1` or `wlan2`) to be created.
4. Set the new interface DOWN, change its mode to `NL80211_IFTYPE_MONITOR`, and set it UP.
5. Bind an `AF_PACKET` socket to the new interface and inject the same frame with `IEEE80211_RADIOTAP_RATE` and `rate = 0`.
This will cause `ieee80211_tx_h_rate_ctrl()` to be skipped, preserving `idx = -1` until it reaches `mac80211_hwsim_write_tsf()`, successfully triggering the `WARN_ON_ONCE`.]
|
| 667/4 |
2026/09/07 08:36 |
agent |
strategy-refiner |
8m
Model:
Instruction: You are an expert in Linux kernel debugging.
Refine the reproduction strategy based on feedback from previous attempts.
Analyze the technical diagnosis provided in the oracle feedback and translate it into concrete,
step-by-step instructions for the repro-generator on how to modify the code structure, alignments,
offsets, or parameters of the candidate program.
=== TOOL SELECTION GUIDELINES ===
- Prefer codesearch-definition-source and codesearch-struct-layout first for symbol lookups.
- Fall back to read-file or grepper for macros, headers, or if symbol lookup fails.
=== CRITICAL PROHIBITIONS ===
- Do NOT repeat searches for the same symbols or files. Use information you have already gathered.
- Do NOT write long explanations. Keep your reasoning short and focused on actionable changes.
- Do NOT assume a bug is fixed based on git commit history.
- If you are stuck, try a different approach or proceed to generate a candidate reproducer.
Prefer calling several tools at the same time to save round-trips.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Current Strategy: ```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret;
}
int main() {
// 1. Load the mac80211_hwsim module
execute_command("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a monitor interface and set it up
execute_command("iw phy phy0 interface add mon0 type monitor");
execute_command("ip link set mon0 up");
// 3. Set the channel to a valid frequency (required for chanctx_conf)
execute_command("iw dev mon0 set freq 2412");
sleep(1);
// 4. Open an AF_PACKET socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
// 5. Bind the socket to the monitor interface
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex("mon0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex mon0");
// Fallback to wlan0 if mon0 creation failed for some reason
sll.sll_ifindex = if_nametoindex("wlan0");
if (sll.sll_ifindex == 0) {
perror("if_nametoindex wlan0");
return 1;
}
execute_command("ip link set wlan0 down");
execute_command("iw dev wlan0 set type monitor");
execute_command("ip link set wlan0 up");
execute_command("iw dev wlan0 set freq 2412");
sleep(1);
}
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
// 6. Construct the malicious frame
// The bug is triggered by an invalid legacy rate (0) in the radiotap header.
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 7. Inject the frame multiple times to ensure it is processed
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
close(psock);
return 0;
}
```
Feedback: The reproduction attempt failed to trigger the bug because it injected frames into the default `wlan0` interface, which does not have the `HAS_RATE_CONTROL` flag set.
### Root Cause Analysis
1. When injecting a frame via `AF_PACKET` with a radiotap header containing `IEEE80211_RADIOTAP_RATE` and `rate = 0`, `ieee80211_parse_tx_radiotap()` initializes `info->control.rates[0].idx = -1`. Since `rate = 0` does not match any valid bitrate, `idx` remains `-1`.
2. Because `idx < 0`, `ieee80211_parse_tx_radiotap()` clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
3. In the TX path, `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` **unless** the hardware has the `HAS_RATE_CONTROL` flag set.
4. If `ieee80211_tx_h_rate_ctrl()` is called, it falls back to standard rate control, which overwrites `info->control.rates[0].idx` with a valid, non-negative index (e.g., `0`).
5. When `mac80211_hwsim_tx_frame_no_nl()` subsequently calls `mac80211_hwsim_write_tsf()`, `idx` is no longer negative, so the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` does not trigger.
### How to Trigger the Bug
To prevent `ieee80211_tx_h_rate_ctrl()` from overwriting `idx`, the `mac80211_hwsim` radio must have the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`) or NAN Data support.
You need to modify the reproducer to first create a new `mac80211_hwsim` radio with MLO support using Netlink:
1. Open a Netlink socket and resolve the `MAC80211_HWSIM` family ID.
2. Send a `HWSIM_CMD_NEW_RADIO` (4) command with the `HWSIM_ATTR_MLO_SUPPORT` (25) flag attribute.
3. Wait briefly for the new interface (e.g., `wlan1` or `wlan2`) to be created.
4. Set the new interface DOWN, change its mode to `NL80211_IFTYPE_MONITOR`, and set it UP.
5. Bind an `AF_PACKET` socket to the new interface and inject the same frame with `IEEE80211_RADIOTAP_RATE` and `rate = 0`.
This will cause `ieee80211_tx_h_rate_ctrl()` to be skipped, preserving `idx = -1` until it reaches `mac80211_hwsim_write_tsf()`, successfully triggering the `WARN_ON_ONCE`.
Reply: Based on the root cause analysis, the bug is triggered when `ieee80211_tx_h_rate_ctrl()` is skipped, which happens when the hardware has the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`).
To fix the reproducer, we need to use Generic Netlink to send a `HWSIM_CMD_NEW_RADIO` command with the `HWSIM_ATTR_MLO_SUPPORT` flag to create a new `mac80211_hwsim` radio. Then, we can set the new interface to monitor mode, bring it up, and inject the malicious frame via `AF_PACKET`.
Here is the updated C reproducer:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
#ifndef GENL_HDRLEN
#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
#endif
#ifndef NLA_ALIGNTO
#define NLA_ALIGNTO 4
#endif
#ifndef NLA_ALIGN
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int)NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla, len) ((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr *)((char *)(nla) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla, len) ((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret;
}
int get_family_id(int fd) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_seq = 1;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
int name_len = strlen("MAC80211_HWSIM") + 1;
nla->nla_len = NLA_HDRLEN + name_len;
strcpy((char *)nla + NLA_HDRLEN, "MAC80211_HWSIM");
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
return -1;
}
struct genlmsghdr *genl = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)genl + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID) {
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
}
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int main() {
// 1. Load the mac80211_hwsim module
execute_command("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a new hwsim radio with MLO support
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd >= 0) {
int family_id = get_family_id(nl_fd);
if (family_id >= 0) {
create_hwsim_radio(nl_fd, family_id);
}
close(nl_fd);
}
sleep(1);
// 3. Construct the malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 4. Loop over possible wlan interfaces to ensure we hit the newly created MLO radio
for (int i = 0; i < 4; i++) {
char cmd[256];
sprintf(cmd, "ip link set wlan%d down", i);
execute_command(cmd);
sprintf(cmd, "iw dev wlan%d set type monitor", i);
execute_command(cmd);
sprintf(cmd, "ip link set wlan%d up", i);
execute_command(cmd);
sprintf(cmd, "iw dev wlan%d set freq 2412", i);
execute_command(cmd);
char ifname[16];
sprintf(ifname, "wlan%d", i);
int ifindex = if_nametoindex(ifname);
if (ifindex == 0) continue;
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) continue;
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = ifindex;
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
return 0;
}
```
|
| 668/5 |
2026/09/07 08:36 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 6756
output: 24
thoughts: 1262
Thoughts: **My Thought Process on Triggering a Specific Warning in `mac80211_hwsim`**
My primary goal here is to reliably trigger a WARNING within the `mac80211_hwsim_write_tsf` function. I've identified that this warning is contingent on a specific condition: `c->control.rates[0].idx < 0`. The challenge is that previous attempts to engineer this scenario have been thwarted by the kernel's behavior, particularly regarding rate control.
The feedback I've received highlights a critical issue: the default `wlan0` interface in `mac80211_hwsim` lacks `HAS_RATE_CONTROL`. This absence means that when `ieee80211_tx_h_rate_ctrl()` is invoked, it preemptively corrects the `idx = -1` value to a valid index, thus preventing the desired `c->control.rates[0].idx < 0` state.
To circumvent this, my current strategy involves creating a *new* `mac80211_hwsim` radio that *does* support MLO. The key here is that enabling MLO support (`HWSIM_ATTR_MLO_SUPPORT`) implicitly sets the `HAS_RATE_CONTROL` flag. Once this new radio is established, I can configure its associated interface for monitor mode, bring it up, and then inject a frame with `rate = 0` using `AF_PACKET`. This sequence should, in theory, allow the `c->control.rates[0].idx < 0` condition to manifest before `ieee80211_tx_h_rate_ctrl()` can intervene.
To achieve this, I need to interact with the `mac80211_hwsim` module via Netlink. My initial thought was to write a C program that leverages Netlink. Specifically, I'm targeting the `nl80211` or `mac80211_hwsim` Netlink family. The family name I need is "MAC80211_HWSIM". The command for creating a new radio is `HWSIM_CMD_NEW_RADIO`, which corresponds to command ID 4. The crucial attribute to enable MLO support is `HWSIM_ATTR_MLO_SUPPORT`, identified as attribute ID 25. I understand this is a flag attribute, meaning I just need to include it without any associated data.
However, upon deeper consideration, I realize that using raw Netlink code for generic Netlink is necessary, as syzkaller reproducers typically don't have libnl available. So, I need to meticulously construct the generic Netlink messages.
The process will involve:
1. Opening a socket of type `AF_NETLINK` with protocol `NETLINK_GENERIC`.
2. Sending a `CTRL_CMD_GETFAMILY` message (command ID 3) to the generic Netlink controller (ID 16) to ascertain the family ID for "MAC80211_HWSIM". This involves setting the `CTRL_ATTR_FAMILY_NAME` attribute to the string "MAC80211_HWSIM".
3. Once I have the family ID, I'll send the `HWSIM_CMD_NEW_RADIO` message (command ID 4) to this resolved family ID. Crucially, I will include the `HWSIM_ATTR_MLO_SUPPORT` attribute (ID 25) as a flag attribute to ensure the new radio has MLO capabilities and, consequently, `HAS_RATE_CONTROL`.
I've started sketching out the Netlink structures required for this. I'll need headers like `<linux/genetlink.h>` and `<linux/netlink.h>`. For the `CTRL_CMD_GETFAMILY` request, I'll be using `CTRL_CMD_GETFAMILY` (3), `CTRL_ATTR_FAMILY_NAME` (2), `CTRL_ATTR_FAMILY_ID` (1), and `GENL_ID_CTRL` (16). I'm preparing the Netlink message payload, ensuring correct alignment and structure for the `nlmsghdr` and `genlmsghdr`, and then carefully crafting the `rtattr` for the family name.
After receiving and parsing the response to get the `family_id`, I'll construct the second Netlink message for `HWSIM_CMD_NEW_RADIO`. This will also involve setting up the `nlmsghdr` and `genlmsghdr` correctly, this time with the target `family_id` and `HWSIM_CMD_NEW_RADIO` as the command. The `HWSIM_ATTR_MLO_SUPPORT` attribute will be added as a flag attribute.
A quick double-check on `HWSIM_ATTR_MLO_SUPPORT` being 25 is still in order; I'll use a tool like `grepper` to confirm this constant within the kernel source code to ensure accuracy.
|
| 669/5 |
2026/09/07 08:37 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_ATTR_MLO_SUPPORT]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim.h=91=enum hwsim_commands {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-151- * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
drivers/net/wireless/virtual/mac80211_hwsim.h:152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
drivers/net/wireless/virtual/mac80211_hwsim.h-153- * the new radio
--
drivers/net/wireless/virtual/mac80211_hwsim.h=167=enum hwsim_attrs {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-192- HWSIM_ATTR_CIPHER_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h:193: HWSIM_ATTR_MLO_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h-194- HWSIM_ATTR_PMSR_SUPPORT,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=865=static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-891- [HWSIM_ATTR_CIPHER_SUPPORT] = { .type = NLA_BINARY },
drivers/net/wireless/virtual/mac80211_hwsim_main.c:892: [HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
drivers/net/wireless/virtual/mac80211_hwsim_main.c-893- [HWSIM_ATTR_PMSR_SUPPORT] = NLA_POLICY_NESTED(hwsim_pmsr_capa_policy),
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6805=static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6927-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6929-
]
|
| 670/5 |
2026/09/07 08:37 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 8728
output: 47
thoughts: 75
Thoughts: **My Thought Process for Valuing `HWSIM_ATTR_MLO_SUPPORT`**
Ah, excellent! So, my initial hunch that `HWSIM_ATTR_MLO_SUPPORT` is an enumerated value has been confirmed. This is a crucial step because it means we can now determine its specific numerical representation within the system. To do this accurately, I need to locate the definition of the `hwsim_attrs` enum.
My next action, therefore, is to navigate directly to the source code. I'll be looking within the `drivers/net/wireless/virtual/mac80211_hwsim.h` header file. This is where the `enum hwsim_attrs` definition is expected to reside.
Once I have the file open, my primary objective is to find the `hwsim_attrs` enum and then precisely identify the line corresponding to `HWSIM_ATTR_MLO_SUPPORT`. I'll be paying close attention to the assigned integer value for that specific enum member. I already know that `HWSIM_ATTR_UNSPEC` is defined as `0`, which serves as a useful anchor point and a reminder of how these enumerations typically begin. By finding `HWSIM_ATTR_MLO_SUPPORT` within this ordered list, I can then definitively ascertain its value.
|
| 671/5 |
2026/09/07 08:37 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.h Name:hwsim_attrs]
Results: map[SourceCode: 111: /**
112: * enum hwsim_attrs - hwsim netlink attributes
113: *
114: * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
115: *
116: * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
117: * the frame is broadcasted to
118: * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
119: * the frame was broadcasted from
120: * @HWSIM_ATTR_FRAME: Data array
121: * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
122: * properly the frame at user space
123: * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
124: * space
125: * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
126: * space
127: * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
128: * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
129: * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_NEW_RADIO
130: * command giving the number of channels supported by the new radio
131: * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
132: * only to destroy a radio
133: * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatory driver hint
134: * (nla string, length 2)
135: * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
136: * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
137: * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
138: * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_NEW_RADIO
139: * command to force use of channel contexts even when only a
140: * single channel is supported
141: * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_NEW_RADIO
142: * command to force radio removal when process that created the radio dies
143: * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
144: * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
145: * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
146: * @HWSIM_ATTR_PAD: padding attribute for 64-bit values, ignore
147: * @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
148: * rates of %HWSIM_ATTR_TX_INFO
149: * @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
150: * @HWSIM_ATTR_IFTYPE_SUPPORT: u32 attribute of supported interface types bits
151: * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
153: * the new radio
154: * @HWSIM_ATTR_PMSR_SUPPORT: nested attribute used with %HWSIM_CMD_NEW_RADIO
155: * to provide peer measurement capabilities. (nl80211_peer_measurement_attrs)
156: * @HWSIM_ATTR_PMSR_REQUEST: nested attribute used with %HWSIM_CMD_START_PMSR
157: * to provide details about peer measurement request (nl80211_peer_measurement_attrs)
158: * @HWSIM_ATTR_PMSR_RESULT: nested attributed used with %HWSIM_CMD_REPORT_PMSR
159: * to provide peer measurement result (nl80211_peer_measurement_attrs)
160: * @HWSIM_ATTR_MULTI_RADIO: Register multiple wiphy radios (flag).
161: * Adds one radio for each band. Number of supported channels will be set for
162: * each radio instead of for the wiphy.
163: * @HWSIM_ATTR_SUPPORT_NAN_DEVICE: support NAN Device virtual interface (flag)
164: * @HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR: background radar/CAC support (flag)
165: * @__HWSIM_ATTR_MAX: enum limit
166: */
167: enum hwsim_attrs {
168: HWSIM_ATTR_UNSPEC,
169: HWSIM_ATTR_ADDR_RECEIVER,
170: HWSIM_ATTR_ADDR_TRANSMITTER,
171: HWSIM_ATTR_FRAME,
172: HWSIM_ATTR_FLAGS,
173: HWSIM_ATTR_RX_RATE,
174: HWSIM_ATTR_SIGNAL,
175: HWSIM_ATTR_TX_INFO,
176: HWSIM_ATTR_COOKIE,
177: HWSIM_ATTR_CHANNELS,
178: HWSIM_ATTR_RADIO_ID,
179: HWSIM_ATTR_REG_HINT_ALPHA2,
180: HWSIM_ATTR_REG_CUSTOM_REG,
181: HWSIM_ATTR_REG_STRICT_REG,
182: HWSIM_ATTR_SUPPORT_P2P_DEVICE,
183: HWSIM_ATTR_USE_CHANCTX,
184: HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
185: HWSIM_ATTR_RADIO_NAME,
186: HWSIM_ATTR_NO_VIF,
187: HWSIM_ATTR_FREQ,
188: HWSIM_ATTR_PAD,
189: HWSIM_ATTR_TX_INFO_FLAGS,
190: HWSIM_ATTR_PERM_ADDR,
191: HWSIM_ATTR_IFTYPE_SUPPORT,
192: HWSIM_ATTR_CIPHER_SUPPORT,
193: HWSIM_ATTR_MLO_SUPPORT,
194: HWSIM_ATTR_PMSR_SUPPORT,
195: HWSIM_ATTR_PMSR_REQUEST,
196: HWSIM_ATTR_PMSR_RESULT,
197: HWSIM_ATTR_MULTI_RADIO,
198: HWSIM_ATTR_SUPPORT_NAN_DEVICE,
199: HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR,
200: __HWSIM_ATTR_MAX,
201: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.h]
|
| 672/5 |
2026/09/07 08:37 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 10831
output: 47
thoughts: 421
Thoughts: **My Thought Process Regarding HWSIM Attributes and Commands**
Alright, let's break down what's going through my mind here. I'm looking at a list of defined attributes for `HWSIM`, essentially the hardware simulation framework, and I need to keep track of their numerical assignments. It's a pretty straightforward enumeration process. I'm mentally ticking off each one: `HWSIM_ATTR_UNSPEC` is 0, `HWSIM_ATTR_ADDR_RECEIVER` is 1, then `ADDR_TRANSMITTER` is 2, `FRAME` is 3, `FLAGS` is 4, `RX_RATE` is 5, `SIGNAL` is 6, `TX_INFO` is 7, `COOKIE` is 8, `CHANNELS` is 9, `RADIO_ID` is 10. Then I move on to the regulatory hints: `REG_HINT_ALPHA2` is 11, `REG_CUSTOM_REG` is 12, and `REG_STRICT_REG` is 13. After that, I see `SUPPORT_P2P_DEVICE` at 14, and `USE_CHANCTX` at 15. The `DESTROY_RADIO_ON_CLOSE` attribute is 16, followed by `RADIO_NAME` at 17, and `NO_VIF` at 18. Moving into frequency and padding, `FREQ` is 19, and `PAD` is 20. Then come the transmit information flags, `TX_INFO_FLAGS` at 21, and `PERM_ADDR` at 22. Finally, I've got `IFTYPE_SUPPORT` at 23, `CIPHER_SUPPORT` at 24, and the one I'm specifically looking for, `MLO_SUPPORT`, which lands at 25.
So, yes, I've confirmed that `HWSIM_ATTR_MLO_SUPPORT` indeed corresponds to the value 25. Now, to cross-reference, I need to quickly check the commands. I know `HWSIM_CMD_NEW_RADIO` is a common one, and I recall it being assigned the value 4. To be absolutely sure, I'd be checking the `enum hwsim_commands` definition to verify this. It's all about maintaining this mental (or actual, in this case) registry of constants to ensure I'm referencing the correct underlying values in my work.
|
| 673/5 |
2026/09/07 08:37 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim.h Name:hwsim_commands]
Results: map[SourceCode: 50: /**
51: * enum hwsim_commands - supported hwsim commands
52: *
53: * @HWSIM_CMD_UNSPEC: unspecified command to catch errors
54: *
55: * @HWSIM_CMD_REGISTER: request to register and received all broadcasted
56: * frames by any mac80211_hwsim radio device.
57: * @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
58: * space, uses:
59: * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
60: * %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
61: * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE, %HWSIM_ATTR_FREQ (optional)
62: * @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
63: * kernel, uses:
64: * %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
65: * %HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_TX_INFO_FLAGS,
66: * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
67: * @HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters,
68: * returns the radio ID (>= 0) or negative on errors, if successful
69: * then multicast the result, uses optional parameter:
70: * %HWSIM_ATTR_REG_STRICT_REG, %HWSIM_ATTR_SUPPORT_P2P_DEVICE,
71: * %HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE, %HWSIM_ATTR_CHANNELS,
72: * %HWSIM_ATTR_NO_VIF, %HWSIM_ATTR_RADIO_NAME, %HWSIM_ATTR_USE_CHANCTX,
73: * %HWSIM_ATTR_REG_HINT_ALPHA2, %HWSIM_ATTR_REG_CUSTOM_REG,
74: * %HWSIM_ATTR_PERM_ADDR
75: * @HWSIM_CMD_DEL_RADIO: destroy a radio, reply is multicasted
76: * @HWSIM_CMD_GET_RADIO: fetch information about existing radios, uses:
77: * %HWSIM_ATTR_RADIO_ID
78: * @HWSIM_CMD_ADD_MAC_ADDR: add a receive MAC address (given in the
79: * %HWSIM_ATTR_ADDR_RECEIVER attribute) to a device identified by
80: * %HWSIM_ATTR_ADDR_TRANSMITTER. This lets wmediumd forward frames
81: * to this receiver address for a given station.
82: * @HWSIM_CMD_DEL_MAC_ADDR: remove the MAC address again, the attributes
83: * are the same as to @HWSIM_CMD_ADD_MAC_ADDR.
84: * @HWSIM_CMD_START_PMSR: request to start peer measurement with the
85: * %HWSIM_ATTR_PMSR_REQUEST. Result will be sent back asynchronously
86: * with %HWSIM_CMD_REPORT_PMSR.
87: * @HWSIM_CMD_ABORT_PMSR: Abort previously started peer measurement.
88: * @HWSIM_CMD_REPORT_PMSR: Report peer measurement data.
89: * @__HWSIM_CMD_MAX: enum limit
90: */
91: enum hwsim_commands {
92: HWSIM_CMD_UNSPEC,
93: HWSIM_CMD_REGISTER,
94: HWSIM_CMD_FRAME,
95: HWSIM_CMD_TX_INFO_FRAME,
96: HWSIM_CMD_NEW_RADIO,
97: HWSIM_CMD_DEL_RADIO,
98: HWSIM_CMD_GET_RADIO,
99: HWSIM_CMD_ADD_MAC_ADDR,
100: HWSIM_CMD_DEL_MAC_ADDR,
101: HWSIM_CMD_START_PMSR,
102: HWSIM_CMD_ABORT_PMSR,
103: HWSIM_CMD_REPORT_PMSR,
104: __HWSIM_CMD_MAX,
105: };
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim.h]
|
| 674/5 |
2026/09/07 08:37 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 12550
output: 53
thoughts: 2208
Thoughts: **My Thought Process on Creating a New Hardware Simulation Radio**
Okay, so the initial goal here is to programmatically create a new radio device for hardware simulation. I'm looking at the provided command definitions and I see `HWSIM_CMD_NEW_RADIO` has a value of `4`. This is the core command I need to trigger the creation.
My immediate thought is to use the generic netlink API. This is the standard way to interact with netlink families like the one `mac80211_hwsim` exposes. I'll need to set up a netlink socket first. The code structure for sending generic netlink messages is quite involved. I'll need to build a request message, specifying the family ID, the command (`HWSIM_CMD_NEW_RADIO`), and any necessary attributes.
First, I need to find the family ID for `MAC80211_HWSIM`. The `get_family_id` function seems to handle this. It constructs a `CTRL_CMD_GETFAMILY` request, targeting the `MAC80211_HWSIM` family name. The response should contain the `CTRL_ATTR_FAMILY_ID`, which I'll then use.
Once I have the family ID, I can construct the `HWSIM_CMD_NEW_RADIO` request in `create_hwsim_radio`. I'll set the message type to the obtained `family_id`, set the command to `HWSIM_CMD_NEW_RADIO`, and importantly, I need to specify that this radio should support MLO. I see `HWSIM_ATTR_MLO_SUPPORT` and its value is `25`. Since this is a flag attribute, sending it with `RTA_LENGTH(0)` is the correct way to signal its presence. I'll send this request over the netlink socket.
After creating the radio, I'm anticipating a new network interface will be created. Given that `mac80211_hwsim` usually creates two radios (`wlan0`, `wlan1`) by default when loaded, I expect the new one to be `wlan2`. To be absolutely certain, I could potentially iterate through `wlan0`, `wlan1`, `wlan2`, etc., or use `ip link` to discover available interfaces. However, for simplicity and based on common behavior, I'm going to try directly targeting `wlan2`.
Before trying to use `wlan2`, I need to ensure the `mac80211_hwsim` module is loaded. A simple `modprobe mac80211_hwsim` followed by a short `sleep` should suffice. Then, I'll proceed with the netlink setup and radio creation.
After the radio is created, I'll need to configure the `wlan2` interface. This typically involves bringing it down, setting its type to monitor mode using `iw dev wlan2 set type monitor`, bringing it back up, and then setting a frequency. Again, a `sleep` after these operations is probably a good idea to allow the system to fully register the changes.
A minor point of consideration: I briefly thought about `HWSIM_ATTR_RADIO_NAME` to explicitly name the radio. However, I quickly realized that `HWSIM_ATTR_RADIO_NAME` actually sets the `wiphy` name (like `phy2`), not the network device name (like `wlan2`). So, for controlling the network interface itself, explicitly setting the name isn't directly achieved through this attribute in the `NEW_RADIO` command. The standard `wlanX` naming convention is what I'll rely on, or potentially dynamic discovery if absolute robustness is needed. For this specific task, targeting `wlan2` seems a reasonable starting point.
I'm also seeing that `RTA_LENGTH(0)` for `HWSIM_ATTR_MLO_SUPPORT` is correct because it's a flag attribute, and its mere presence signifies MLO support. The code seems to be correctly implementing this. The final step involves receiving the acknowledgment for the `NEW_RADIO` command, which the `recv` call after `send` should handle. If `recv` returns successfully without errors, it implies the radio creation request was processed.
|
| 675/5 |
2026/09/07 08:37 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:hwsim_new_radio_nl]
Results: map[SourceCode:6805: static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
6806: {
6807: struct hwsim_new_radio_params param = { 0 };
6808: const char *hwname = NULL;
6809: int ret;
6810:
6811: param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
6812: param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
6813: param.nan_device = info->attrs[HWSIM_ATTR_SUPPORT_NAN_DEVICE];
6814: param.channels = channels;
6815: param.destroy_on_close =
6816: info->attrs[HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE];
6817:
6818: if (info->attrs[HWSIM_ATTR_CHANNELS])
6819: param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]);
6820:
6821: if (param.channels < 1) {
6822: GENL_SET_ERR_MSG(info, "must have at least one channel");
6823: return -EINVAL;
6824: }
6825:
6826: if (info->attrs[HWSIM_ATTR_NO_VIF])
6827: param.no_vif = true;
6828:
6829: if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
6830: param.use_chanctx = true;
6831: else
6832: param.use_chanctx = (param.channels > 1);
6833:
6834: if (info->attrs[HWSIM_ATTR_MULTI_RADIO])
6835: param.multi_radio = true;
6836:
6837: if (info->attrs[HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR])
6838: param.background_radar = true;
6839:
6840: if (info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2])
6841: param.reg_alpha2 =
6842: nla_data(info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]);
6843:
6844: if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
6845: u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
6846:
6847: if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
6848: return -EINVAL;
6849:
6850: idx = array_index_nospec(idx,
6851: ARRAY_SIZE(hwsim_world_regdom_custom));
6852: param.regd = hwsim_world_regdom_custom[idx];
6853: }
6854:
6855: if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
6856: if (!is_valid_ether_addr(
6857: nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
6858: GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
6859: NL_SET_BAD_ATTR(info->extack,
6860: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6861: return -EINVAL;
6862: }
6863:
6864: param.perm_addr = nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]);
6865: }
6866:
6867: if (info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]) {
6868: param.iftypes =
6869: nla_get_u32(info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]);
6870:
6871: if (param.iftypes & ~HWSIM_IFTYPE_SUPPORT_MASK) {
6872: NL_SET_ERR_MSG_ATTR(info->extack,
6873: info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT],
6874: "cannot support more iftypes than kernel");
6875: return -EINVAL;
6876: }
6877: } else {
6878: param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
6879: }
6880:
6881: /* ensure both flag and iftype support is honored */
6882: if (param.p2p_device ||
6883: param.iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
6884: param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
6885: param.p2p_device = true;
6886: }
6887:
6888: if (param.nan_device) {
6889: if (param.multi_radio) {
6890: NL_SET_ERR_MSG(info->extack,
6891: "NAN is not supported on multi-radio wiphys");
6892: return -EINVAL;
6893: }
6894: param.iftypes |= BIT(NL80211_IFTYPE_NAN) |
6895: BIT(NL80211_IFTYPE_NAN_DATA);
6896: }
6897:
6898: if (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]) {
6899: u32 len = nla_len(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6900:
6901: param.ciphers =
6902: nla_data(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6903:
6904: if (len % sizeof(u32)) {
6905: NL_SET_ERR_MSG_ATTR(info->extack,
6906: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6907: "bad cipher list length");
6908: return -EINVAL;
6909: }
6910:
6911: param.n_ciphers = len / sizeof(u32);
6912:
6913: if (param.n_ciphers > ARRAY_SIZE(hwsim_ciphers)) {
6914: NL_SET_ERR_MSG_ATTR(info->extack,
6915: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6916: "too many ciphers specified");
6917: return -EINVAL;
6918: }
6919:
6920: if (!hwsim_known_ciphers(param.ciphers, param.n_ciphers)) {
6921: NL_SET_ERR_MSG_ATTR(info->extack,
6922: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6923: "unsupported ciphers specified");
6924: return -EINVAL;
6925: }
6926: }
6927:
6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
6929:
6930: if (param.mlo || param.multi_radio)
6931: param.use_chanctx = true;
6932:
6933: if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
6934: hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6935: nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6936: GFP_KERNEL);
6937: if (!hwname)
6938: return -ENOMEM;
6939: param.hwname = hwname;
6940: }
6941:
6942: if (info->attrs[HWSIM_ATTR_PMSR_SUPPORT]) {
6943: struct cfg80211_pmsr_capabilities *pmsr_capa;
6944:
6945: pmsr_capa = kzalloc_obj(*pmsr_capa);
6946: if (!pmsr_capa) {
6947: ret = -ENOMEM;
6948: goto out_free;
6949: }
6950: param.pmsr_capa = pmsr_capa;
6951:
6952: ret = parse_pmsr_capa(info->attrs[HWSIM_ATTR_PMSR_SUPPORT], pmsr_capa, info);
6953: if (ret)
6954: goto out_free;
6955: }
6956:
6957: ret = mac80211_hwsim_new_radio(info, ¶m);
6958:
6959: out_free:
6960: kfree(hwname);
6961: kfree(param.pmsr_capa);
6962: return ret;
6963: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 676/5 |
2026/09/07 08:37 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 17499
output: 58
thoughts: 3273
Thoughts: **My Thought Process for Setting Up a Multi-Link Operation (MLO) Testbed with mac80211_hwsim**
Okay, so the core of this problem is getting `mac80211_hwsim` to create a virtual radio device that supports MLO, and then being able to inject frames into it. I've been wrestling with how to actually trigger the creation of an MLO-capable radio.
Initially, I was just thinking about the existing `wiphy` names. I know `HWSIM_ATTR_RADIO_NAME` is how we'd typically name a virtual radio, but that's not what we need for MLO. The standard network interface names are usually `wlanX`, and I figured `mac80211_hwsim` loads with `wlan0` and `wlan1` already created by default. If I were to create a *new* radio, it would likely be `wlan2`. My first instinct was to just try `wlan2` and, if that didn't work, try `wlan3`.
But that felt a bit brittle. What if the default interfaces change or the order is different? A more robust approach would be to iterate through a known range of potential `wlan` interfaces, like `wlan0` through `wlan3`. The key idea here is that one of these interfaces *will* be the one I need, and if I inject the frame into all of them, I'm guaranteed to hit the target. Even if I inject into a non-MLO interface, it shouldn't cause a crash, but injecting into the MLO one is what we're aiming for to trigger the issue. So, iterating from 0 to 3 and configuring each as a monitor interface seems like a solid strategy. I'd then need to set them to monitor mode and, crucially, inject the frame into all of them.
Then, I remembered reading the feedback which directly pointed out the need to create a *new* radio with MLO support using Netlink. This is a significant departure from just configuring existing interfaces. The steps outlined were clear:
1. Open a Netlink socket.
2. Find the MAC80211_HWSIM family ID.
3. Send a `HWSIM_CMD_NEW_RADIO` command.
4. Crucially, include the `HWSIM_ATTR_MLO_SUPPORT` attribute.
5. Wait a bit for the new interface to appear.
6. Then, configure this *new* interface as a monitor interface (down, set type monitor, up).
7. Finally, bind an `AF_PACKET` socket and inject the specific frame, making sure `IEEE80211_RADIOTAP_RATE` is set with a rate of 0.
This led me to focus on the Netlink communication. I started by looking at the `mac80211_hwsim` source code, specifically `hwsim_new_radio_nl`. I saw that `param.mlo` is set based on `info->attrs[HWSIM_ATTR_MLO_SUPPORT]`. The critical question became: is just `HWSIM_ATTR_MLO_SUPPORT` enough? The code snippet `if (param.mlo || param.multi_radio) param.use_chanctx = true;` suggests that `param.mlo` being set is indeed the trigger. And it seems that if `HWSIM_ATTR_CHANNELS` isn't provided, it defaults to a reasonable value, so it should be fine.
My initial thought about `HWSIM_ATTR_MLO_SUPPORT` being a flag attribute was correct; it doesn't carry a value, so `rta_len` should indeed be `RTA_LENGTH(0)`. This confirms my understanding of how to construct the Netlink message.
So, the refined plan became:
1. Load the `mac80211_hwsim` module.
2. Establish a Netlink generic socket.
3. Query for the `MAC80211_HWSIM` family ID using `CTRL_CMD_GETFAMILY`.
4. Send a `HWSIM_CMD_NEW_RADIO` command, including the `HWSIM_ATTR_MLO_SUPPORT` attribute to request an MLO-capable radio.
5. After creating the radio, I'll still need to iterate through the potential `wlan` interfaces (now including the one created by the Netlink command, which will likely be `wlan2` or `wlan3`). For each interface, I'll configure it for monitor mode and set the frequency.
6. Then, for each of these monitor interfaces, I'll open an `AF_PACKET` raw socket, bind it, and inject the crafted packet. This ensures that even if the new MLO radio isn't at a predictable index, I'll still be able to test it.
The provided C code snippet then reflects this approach: setting up the Netlink communication to create the radio, and then iterating through interfaces to configure them for monitor mode and inject the frame. The packet structure itself is important, particularly the Radiotap header with `IEEE80211_RADIOTAP_RATE` set to 0, as this is likely the condition that triggers the bug.
This iterative process of understanding the problem, recalling existing knowledge, consulting documentation/code, and refining the approach is how I've arrived at this solution. The key was realizing that a new radio *had* to be created with MLO support, not just configuring existing ones.
|
| 677/5 |
2026/09/07 08:38 |
tool |
codesearch-definition-source |
0m
Args: map[ContextFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c Name:mac80211_hwsim_new_radio]
Results: map[SourceCode:5674: static int mac80211_hwsim_new_radio(struct genl_info *info,
5675: struct hwsim_new_radio_params *param)
5676: {
5677: int err;
5678: u8 addr[ETH_ALEN];
5679: struct mac80211_hwsim_data *data;
5680: struct ieee80211_hw *hw;
5681: enum nl80211_band band;
5682: const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
5683: struct net *net;
5684: int idx, i;
5685: int n_limits = 0;
5686: int n_bands = 0;
5687:
5688: if (WARN_ON(param->channels > 1 && !param->use_chanctx))
5689: return -EINVAL;
5690:
5691: spin_lock_bh(&hwsim_radio_lock);
5692: idx = hwsim_radio_idx++;
5693: spin_unlock_bh(&hwsim_radio_lock);
5694:
5695: if (param->mlo)
5696: ops = &mac80211_hwsim_mlo_ops;
5697: else if (param->use_chanctx)
5698: ops = &mac80211_hwsim_mchan_ops;
5699: hw = ieee80211_alloc_hw_nm(sizeof(*data), ops, param->hwname);
5700: if (!hw) {
5701: pr_debug("mac80211_hwsim: ieee80211_alloc_hw failed\n");
5702: err = -ENOMEM;
5703: goto failed;
5704: }
5705:
5706: /* ieee80211_alloc_hw_nm may have used a default name */
5707: param->hwname = wiphy_name(hw->wiphy);
5708:
5709: if (info)
5710: net = genl_info_net(info);
5711: else
5712: net = &init_net;
5713: wiphy_net_set(hw->wiphy, net);
5714:
5715: data = hw->priv;
5716: data->hw = hw;
5717:
5718: data->dev = device_create(&hwsim_class, NULL, 0, hw, "hwsim%d", idx);
5719: if (IS_ERR(data->dev)) {
5720: printk(KERN_DEBUG
5721: "mac80211_hwsim: device_create failed (%ld)\n",
5722: PTR_ERR(data->dev));
5723: err = -ENOMEM;
5724: goto failed_drvdata;
5725: }
5726: data->dev->driver = &mac80211_hwsim_driver.driver;
5727: err = device_bind_driver(data->dev);
5728: if (err != 0) {
5729: pr_debug("mac80211_hwsim: device_bind_driver failed (%d)\n",
5730: err);
5731: goto failed_bind;
5732: }
5733:
5734: skb_queue_head_init(&data->pending);
5735:
5736: SET_IEEE80211_DEV(hw, data->dev);
5737: if (!param->perm_addr) {
5738: eth_zero_addr(addr);
5739: addr[0] = 0x02;
5740: addr[3] = idx >> 8;
5741: addr[4] = idx;
5742: memcpy(data->addresses[0].addr, addr, ETH_ALEN);
5743: /* Why need here second address ? */
5744: memcpy(data->addresses[1].addr, addr, ETH_ALEN);
5745: data->addresses[1].addr[0] |= 0x40;
5746: memcpy(data->addresses[2].addr, addr, ETH_ALEN);
5747: data->addresses[2].addr[0] |= 0x50;
5748:
5749: hw->wiphy->n_addresses = 3;
5750: hw->wiphy->addresses = data->addresses;
5751: /* possible address clash is checked at hash table insertion */
5752: } else {
5753: memcpy(data->addresses[0].addr, param->perm_addr, ETH_ALEN);
5754: /* compatibility with automatically generated mac addr */
5755: memcpy(data->addresses[1].addr, param->perm_addr, ETH_ALEN);
5756: memcpy(data->addresses[2].addr, param->perm_addr, ETH_ALEN);
5757: hw->wiphy->n_addresses = 3;
5758: hw->wiphy->addresses = data->addresses;
5759: }
5760:
5761: data->channels = param->channels;
5762: data->use_chanctx = param->use_chanctx;
5763: data->idx = idx;
5764: data->destroy_on_close = param->destroy_on_close;
5765: if (info)
5766: data->portid = info->snd_portid;
5767:
5768: /* setup interface limits, only on interface types we support */
5769: if (param->iftypes & BIT(NL80211_IFTYPE_ADHOC)) {
5770: data->if_limits[n_limits].max = 1;
5771: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_ADHOC);
5772: n_limits++;
5773: }
5774:
5775: if (param->iftypes & HWSIM_DEFAULT_IF_LIMIT) {
5776: data->if_limits[n_limits].max = 2048;
5777: /*
5778: * For this case, we may only support a subset of
5779: * HWSIM_DEFAULT_IF_LIMIT, therefore we only want to add the
5780: * bits that both param->iftype & HWSIM_DEFAULT_IF_LIMIT have.
5781: */
5782: data->if_limits[n_limits].types =
5783: HWSIM_DEFAULT_IF_LIMIT & param->iftypes;
5784: n_limits++;
5785: }
5786:
5787: if (param->iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
5788: data->if_limits[n_limits].max = 1;
5789: data->if_limits[n_limits].types =
5790: BIT(NL80211_IFTYPE_P2P_DEVICE);
5791: n_limits++;
5792: }
5793:
5794: if (param->iftypes & BIT(NL80211_IFTYPE_NAN)) {
5795: data->if_limits[n_limits].max = 1;
5796: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN);
5797: n_limits++;
5798:
5799: hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ) |
5800: BIT(NL80211_BAND_5GHZ);
5801:
5802: hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
5803: WIPHY_NAN_FLAGS_USERSPACE_DE;
5804: hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
5805: NAN_OP_MODE_80P80MHZ |
5806: NAN_OP_MODE_160MHZ;
5807:
5808: hw->wiphy->nan_capa.n_antennas = 0x22;
5809: hw->wiphy->nan_capa.max_channel_switch_time = 0;
5810:
5811: wiphy_ext_feature_set(hw->wiphy,
5812: NL80211_EXT_FEATURE_SECURE_NAN);
5813:
5814: hrtimer_setup(&data->nan.slot_timer,
5815: mac80211_hwsim_nan_slot_timer,
5816: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5817: hrtimer_setup(&data->nan.resume_txqs_timer,
5818: mac80211_hwsim_nan_resume_txqs_timer,
5819: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5820: hrtimer_setup(&data->nan.discovery_beacon_timer,
5821: mac80211_hwsim_nan_discovery_beacon_timer,
5822: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5823:
5824: spin_lock_init(&data->nan.state_lock);
5825: }
5826:
5827: if (param->iftypes & BIT(NL80211_IFTYPE_NAN_DATA)) {
5828: data->if_limits[n_limits].max = 2;
5829: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN_DATA);
5830: n_limits++;
5831:
5832: hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap;
5833: hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap;
5834: hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap;
5835:
5836: /*
5837: * NAN switches between bands/channels per its schedule,
5838: * so mac80211 rate control can't work here.
5839: */
5840: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5841: }
5842:
5843: data->if_combination.radar_detect_widths =
5844: BIT(NL80211_CHAN_WIDTH_5) |
5845: BIT(NL80211_CHAN_WIDTH_10) |
5846: BIT(NL80211_CHAN_WIDTH_20_NOHT) |
5847: BIT(NL80211_CHAN_WIDTH_20) |
5848: BIT(NL80211_CHAN_WIDTH_40) |
5849: BIT(NL80211_CHAN_WIDTH_80) |
5850: BIT(NL80211_CHAN_WIDTH_160);
5851:
5852: if (data->use_chanctx) {
5853: hw->wiphy->max_scan_ssids = 255;
5854: hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
5855: hw->wiphy->max_remain_on_channel_duration = 1000;
5856: data->if_combination.num_different_channels = data->channels;
5857: } else {
5858: data->if_combination.num_different_channels = 1;
5859: }
5860:
5861: if (!n_limits) {
5862: err = -EINVAL;
5863: goto failed_hw;
5864: }
5865:
5866: data->if_combination.max_interfaces = 0;
5867: for (i = 0; i < n_limits; i++)
5868: data->if_combination.max_interfaces +=
5869: data->if_limits[i].max;
5870:
5871: data->if_combination.n_limits = n_limits;
5872: data->if_combination.limits = data->if_limits;
5873:
5874: /*
5875: * If we actually were asked to support combinations,
5876: * advertise them - if there's only a single thing like
5877: * only IBSS then don't advertise it as combinations.
5878: */
5879: if (data->if_combination.max_interfaces > 1) {
5880: hw->wiphy->iface_combinations = &data->if_combination;
5881: hw->wiphy->n_iface_combinations = 1;
5882: }
5883:
5884: if (param->ciphers) {
5885: memcpy(data->ciphers, param->ciphers,
5886: param->n_ciphers * sizeof(u32));
5887: hw->wiphy->cipher_suites = data->ciphers;
5888: hw->wiphy->n_cipher_suites = param->n_ciphers;
5889: }
5890:
5891: hw->wiphy->mbssid_max_interfaces = 8;
5892: hw->wiphy->ema_max_profile_periodicity = 3;
5893:
5894: spin_lock_init(&data->tsf_offset_lock);
5895:
5896: data->rx_rssi = DEFAULT_RX_RSSI;
5897:
5898: INIT_DELAYED_WORK(&data->roc_start, hw_roc_start);
5899: INIT_DELAYED_WORK(&data->roc_done, hw_roc_done);
5900: INIT_DELAYED_WORK(&data->hw_scan, hw_scan_work);
5901:
5902: hw->queues = 5;
5903: hw->offchannel_tx_hw_queue = 4;
5904:
5905: ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
5906: ieee80211_hw_set(hw, CHANCTX_STA_CSA);
5907: ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
5908: ieee80211_hw_set(hw, QUEUE_CONTROL);
5909: ieee80211_hw_set(hw, WANT_MONITOR_VIF);
5910: ieee80211_hw_set(hw, AMPDU_AGGREGATION);
5911: ieee80211_hw_set(hw, MFP_CAPABLE);
5912: ieee80211_hw_set(hw, SIGNAL_DBM);
5913: ieee80211_hw_set(hw, SUPPORTS_PS);
5914: ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
5915: ieee80211_hw_set(hw, TDLS_WIDER_BW);
5916: ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
5917: ieee80211_hw_set(hw, STRICT);
5918: ieee80211_hw_set(hw, BUFF_MMPDU_TXQ);
5919: ieee80211_hw_set(hw, STA_MMPDU_TXQ);
5920:
5921: if (param->mlo) {
5922: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
5923: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5924: ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
5925: ieee80211_hw_set(hw, CONNECTION_MONITOR);
5926: ieee80211_hw_set(hw, AP_LINK_PS);
5927:
5928: hw->wiphy->iftype_ext_capab = mac80211_hwsim_iftypes_ext_capa;
5929: hw->wiphy->num_iftype_ext_capab =
5930: ARRAY_SIZE(mac80211_hwsim_iftypes_ext_capa);
5931: } else {
5932: ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
5933: ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
5934: if (rctbl)
5935: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
5936: }
5937:
5938: hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
5939: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
5940: WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
5941: WIPHY_FLAG_AP_UAPSD |
5942: WIPHY_FLAG_HAS_CHANNEL_SWITCH;
5943: hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
5944: hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
5945: NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
5946: NL80211_FEATURE_STATIC_SMPS |
5947: NL80211_FEATURE_DYNAMIC_SMPS |
5948: NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
5949: NL80211_FEATURE_AP_SCAN;
5950: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
5951: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
5952: wiphy_ext_feature_set(hw->wiphy,
5953: NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
5954: wiphy_ext_feature_set(hw->wiphy,
5955: NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
5956: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
5957:
5958: wiphy_ext_feature_set(hw->wiphy,
5959: NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT);
5960: wiphy_ext_feature_set(hw->wiphy,
5961: NL80211_EXT_FEATURE_BSS_COLOR);
5962: wiphy_ext_feature_set(hw->wiphy,
5963: NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT);
5964: wiphy_ext_feature_set(hw->wiphy,
5965: NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
5966: wiphy_ext_feature_set(hw->wiphy,
5967: NL80211_EXT_FEATURE_EXT_KEY_ID);
5968: wiphy_ext_feature_set(hw->wiphy,
5969: NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION);
5970:
5971: hw->wiphy->interface_modes = param->iftypes;
5972:
5973: /* ask mac80211 to reserve space for magic */
5974: hw->vif_data_size = sizeof(struct hwsim_vif_priv);
5975: hw->sta_data_size = sizeof(struct hwsim_sta_priv);
5976: hw->chanctx_data_size = sizeof(struct hwsim_chanctx_priv);
5977: hw->txq_data_size = 0;
5978:
5979: memcpy(data->channels_2ghz, hwsim_channels_2ghz,
5980: sizeof(hwsim_channels_2ghz));
5981: memcpy(data->channels_5ghz, hwsim_channels_5ghz,
5982: sizeof(hwsim_channels_5ghz));
5983: memcpy(data->channels_6ghz, hwsim_channels_6ghz,
5984: sizeof(hwsim_channels_6ghz));
5985: memcpy(data->channels_s1g, hwsim_channels_s1g,
5986: sizeof(hwsim_channels_s1g));
5987: memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates));
5988:
5989: for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
5990: struct ieee80211_supported_band *sband = &data->bands[band];
5991: struct wiphy_radio_freq_range *radio_range;
5992: const struct ieee80211_channel *c;
5993: struct wiphy_radio *radio;
5994:
5995: sband->band = band;
5996:
5997: switch (band) {
5998: case NL80211_BAND_2GHZ:
5999: sband->channels = data->channels_2ghz;
6000: sband->n_channels = ARRAY_SIZE(hwsim_channels_2ghz);
6001: sband->bitrates = data->rates;
6002: sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
6003: break;
6004: case NL80211_BAND_5GHZ:
6005: sband->channels = data->channels_5ghz;
6006: sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
6007: sband->bitrates = data->rates + 4;
6008: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6009:
6010: sband->vht_cap.vht_supported = true;
6011: sband->vht_cap.cap =
6012: IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
6013: IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
6014: IEEE80211_VHT_CAP_RXLDPC |
6015: IEEE80211_VHT_CAP_SHORT_GI_80 |
6016: IEEE80211_VHT_CAP_SHORT_GI_160 |
6017: IEEE80211_VHT_CAP_TXSTBC |
6018: IEEE80211_VHT_CAP_RXSTBC_4 |
6019: IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
6020: sband->vht_cap.vht_mcs.rx_mcs_map =
6021: cpu_to_le16(HWSIM_VHT_MCS_MAP);
6022: sband->vht_cap.vht_mcs.tx_mcs_map =
6023: sband->vht_cap.vht_mcs.rx_mcs_map;
6024: break;
6025: case NL80211_BAND_6GHZ:
6026: sband->channels = data->channels_6ghz;
6027: sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
6028: sband->bitrates = data->rates + 4;
6029: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6030: break;
6031: case NL80211_BAND_S1GHZ:
6032: memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
6033: sizeof(sband->s1g_cap));
6034: sband->channels = data->channels_s1g;
6035: sband->n_channels = ARRAY_SIZE(hwsim_channels_s1g);
6036: break;
6037: default:
6038: continue;
6039: }
6040:
6041: if (band != NL80211_BAND_6GHZ){
6042: sband->ht_cap.ht_supported = true;
6043: sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
6044: IEEE80211_HT_CAP_GRN_FLD |
6045: IEEE80211_HT_CAP_SGI_20 |
6046: IEEE80211_HT_CAP_SGI_40 |
6047: IEEE80211_HT_CAP_DSSSCCK40 |
6048: IEEE80211_HT_CAP_TX_STBC |
6049: IEEE80211_HT_CAP_RX_STBC;
6050: sband->ht_cap.ampdu_factor = 0x3;
6051: sband->ht_cap.ampdu_density = 0x6;
6052: memset(&sband->ht_cap.mcs, 0,
6053: sizeof(sband->ht_cap.mcs));
6054: sband->ht_cap.mcs.rx_mask[0] = 0xff;
6055: sband->ht_cap.mcs.rx_mask[1] = 0xff;
6056: sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
6057: }
6058:
6059: mac80211_hwsim_sband_capab(sband);
6060:
6061: hw->wiphy->bands[band] = sband;
6062:
6063: if (!param->multi_radio)
6064: continue;
6065:
6066: c = sband->channels;
6067: radio_range = &data->radio_range[n_bands];
6068: radio_range->start_freq = ieee80211_channel_to_khz(c) - 10000;
6069:
6070: c += sband->n_channels - 1;
6071: radio_range->end_freq = ieee80211_channel_to_khz(c) + 10000;
6072:
6073: radio = &data->radio[n_bands++];
6074: radio->freq_range = radio_range;
6075: radio->n_freq_range = 1;
6076: radio->iface_combinations = &data->if_combination_radio;
6077: radio->n_iface_combinations = 1;
6078: }
6079:
6080: if (param->multi_radio) {
6081: hw->wiphy->radio = data->radio;
6082: hw->wiphy->n_radio = n_bands;
6083:
6084: memcpy(&data->if_combination_radio, &data->if_combination,
6085: sizeof(data->if_combination));
6086: data->if_combination.num_different_channels *= n_bands;
6087: }
6088:
6089: if (data->use_chanctx)
6090: data->if_combination.radar_detect_widths = 0;
6091:
6092: /* By default all radios belong to the first group */
6093: data->group = 1;
6094: mutex_init(&data->mutex);
6095:
6096: data->netgroup = hwsim_net_get_netgroup(net);
6097: data->wmediumd = hwsim_net_get_wmediumd(net);
6098:
6099: /* Enable frame retransmissions for lossy channels */
6100: hw->max_rates = 4;
6101: hw->max_rate_tries = 11;
6102:
6103: hw->wiphy->vendor_commands = mac80211_hwsim_vendor_commands;
6104: hw->wiphy->n_vendor_commands =
6105: ARRAY_SIZE(mac80211_hwsim_vendor_commands);
6106: hw->wiphy->vendor_events = mac80211_hwsim_vendor_events;
6107: hw->wiphy->n_vendor_events = ARRAY_SIZE(mac80211_hwsim_vendor_events);
6108:
6109: if (param->reg_strict)
6110: hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
6111: if (param->regd) {
6112: data->regd = param->regd;
6113: hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
6114: wiphy_apply_custom_regulatory(hw->wiphy, param->regd);
6115: /* give the regulatory workqueue a chance to run */
6116: schedule_timeout_interruptible(1);
6117: }
6118:
6119: wiphy_ext_feature_set(hw->wiphy,
6120: NL80211_EXT_FEATURE_DFS_CONCURRENT);
6121: if (param->background_radar)
6122: wiphy_ext_feature_set(hw->wiphy,
6123: NL80211_EXT_FEATURE_RADAR_BACKGROUND);
6124:
6125: if (param->no_vif)
6126: ieee80211_hw_set(hw, NO_AUTO_VIF);
6127:
6128: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
6129: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PUNCT);
6130: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PROBE_AP);
6131:
6132: for (i = 0; i < ARRAY_SIZE(data->link_data); i++) {
6133: hrtimer_setup(&data->link_data[i].beacon_timer, mac80211_hwsim_beacon,
6134: CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
6135: data->link_data[i].link_id = i;
6136: }
6137:
6138: err = ieee80211_register_hw(hw);
6139: if (err < 0) {
6140: pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
6141: err);
6142: goto failed_hw;
6143: }
6144:
6145: wiphy_dbg(hw->wiphy, "hwaddr %pM registered\n", hw->wiphy->perm_addr);
6146:
6147: if (param->reg_alpha2) {
6148: data->alpha2[0] = param->reg_alpha2[0];
6149: data->alpha2[1] = param->reg_alpha2[1];
6150: regulatory_hint(hw->wiphy, param->reg_alpha2);
6151: }
6152:
6153: data->debugfs = debugfs_create_dir("hwsim", hw->wiphy->debugfsdir);
6154: debugfs_create_file("ps", 0666, data->debugfs, data, &hwsim_fops_ps);
6155: debugfs_create_file("group", 0666, data->debugfs, data,
6156: &hwsim_fops_group);
6157: debugfs_create_file("rx_rssi", 0666, data->debugfs, data,
6158: &hwsim_fops_rx_rssi);
6159: if (!data->use_chanctx)
6160: debugfs_create_file("dfs_simulate_radar", 0222,
6161: data->debugfs,
6162: data, &hwsim_simulate_radar);
6163: if (param->background_radar)
6164: debugfs_create_file("dfs_background_cac", 0200,
6165: data->debugfs,
6166: data, &hwsim_background_cac_ops);
6167: debugfs_create_file("simulate_incumbent_signal_interference", 0200,
6168: data->debugfs,
6169: data, &hwsim_simulate_incumbent_signal_fops);
6170:
6171: if (param->pmsr_capa) {
6172: data->pmsr_capa = *param->pmsr_capa;
6173: hw->wiphy->pmsr_capa = &data->pmsr_capa;
6174: }
6175:
6176: spin_lock_bh(&hwsim_radio_lock);
6177: err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
6178: hwsim_rht_params);
6179: if (err < 0) {
6180: if (info) {
6181: GENL_SET_ERR_MSG(info, "perm addr already present");
6182: NL_SET_BAD_ATTR(info->extack,
6183: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6184: }
6185: spin_unlock_bh(&hwsim_radio_lock);
6186: goto failed_final_insert;
6187: }
6188:
6189: list_add_tail(&data->list, &hwsim_radios);
6190: hwsim_radios_generation++;
6191: spin_unlock_bh(&hwsim_radio_lock);
6192:
6193: hwsim_mcast_new_radio(idx, info, param);
6194:
6195: return idx;
6196:
6197: failed_final_insert:
6198: debugfs_remove_recursive(data->debugfs);
6199: ieee80211_unregister_hw(data->hw);
6200: failed_hw:
6201: device_release_driver(data->dev);
6202: failed_bind:
6203: device_unregister(data->dev);
6204: failed_drvdata:
6205: ieee80211_free_hw(hw);
6206: failed:
6207: return err;
6208: }
SourceFile:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
|
| 678/5 |
2026/09/07 08:38 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 31065
output: 20
thoughts: 3224
Thoughts: **My Thought Process on `mac80211_hwsim` and Netlink Interaction**
Okay, I've been diving into this `mac80211_hwsim` code and my thought process has been a bit of a back-and-forth, trying to confirm specific behaviors and dependencies.
First off, I confirmed that in the `mac80211_hwsim_new_radio` function, the `HAS_RATE_CONTROL` flag is indeed set when `param->mlo` is true. I saw this explicit line:
```c
if (param->mlo) {
hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
ieee80211_hw_set(hw, HAS_RATE_CONTROL);
}
```
This is good, it directly links MLO support to rate control capability in the simulated hardware.
Then I had a brief moment of concern: "Is there any issue with `param->mlo` being true that might interfere with other things?" I immediately looked at this warning check:
```c
if (WARN_ON(param->channels > 1 && !param->use_chanctx))
return -EINVAL;
```
My next step was to trace how `param->use_chanctx` gets set. I found this crucial piece:
```c
if (param->mlo || param.multi_radio)
param.use_chanctx = true;
```
This reassured me. If `param->mlo` is true, `param.use_chanctx` is *also* set to true. This means the `WARN_ON` condition (`param->channels > 1 && !param->use_chanctx`) won't be triggered due to `param->mlo` being true, as `param->use_chanctx` will be true. So, this dependency is handled.
Moving on, I wondered about other prerequisites for `HAS_RATE_CONTROL`. I checked the relevant parts of the code and it seems `HAS_RATE_CONTROL` is primarily a flag within `hw->flags`, and its setting in this context appears straightforward.
My next line of thought was about alternative ways to achieve the same outcome. Could I use `HWSIM_ATTR_SUPPORT_NAN_DEVICE` instead of `HWSIM_ATTR_MLO_SUPPORT`? I examined the code for NAN device support:
```c
if (param->iftypes & BIT(NL80211_IFTYPE_NAN_DATA)) {
// ...
ieee80211_hw_set(hw, HAS_RATE_CONTROL);
}
```
And I saw how `HWSIM_ATTR_SUPPORT_NAN_DEVICE` influences `param`:
```c
if (param.nan_device) {
param.iftypes |= BIT(NL80211_IFTYPE_NAN) |
BIT(NL80211_IFTYPE_NAN_DATA);
}
```
This confirmed that `HWSIM_ATTR_SUPPORT_NAN_DEVICE` also leads to `HAS_RATE_CONTROL` being set, because it injects `NL80211_IFTYPE_NAN_DATA` into `param->iftypes`. So, both `HWSIM_ATTR_MLO_SUPPORT` and `HWSIM_ATTR_SUPPORT_NAN_DEVICE` can result in `HAS_RATE_CONTROL` being set. However, since the feedback specifically pointed to `HWSIM_ATTR_MLO_SUPPORT`, I decided to stick with that for clarity and directness.
I then went back to scrutinize the C code provided. My attention was drawn to the `get_family_id` function, and I started to question its correctness, particularly around how it calculates `attr_len`:
```c
struct rtattr *attr = (struct rtattr *)((char *)genl + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
```
I got a bit stuck thinking about the exact definition of `NLMSG_LENGTH`. I recalled that `NLMSG_LENGTH(len)` is typically `NLMSG_ALIGN(sizeof(struct nlmsghdr)) + (len)`. Since `NLMSG_HDRLEN` is 16 and `GENL_HDRLEN` is 4, `NLMSG_LENGTH(GENL_HDRLEN)` would be `16 + 4 = 20`. My concern was whether `nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN)` correctly accounts for the total message length minus the header lengths to get the remaining attribute data length.
I considered the size of `genlmsghdr` (4 bytes) and potential padding. I even thought about needing to define `GENL_HDRLEN` myself if it wasn't available, but then I checked the `linux/genetlink.h` header and saw that `GENL_HDRLEN` is indeed defined there as `NLMSG_ALIGN(sizeof(struct genlmsghdr))`. This resolved my doubt about that specific calculation.
Finally, I realized that for the `RTA_OK` and `RTA_NEXT` macros to work correctly, the `linux/rtnetlink.h` header is necessary, as those are defined there. I made a mental note to ensure that was included. Similarly, definitions like `CTRL_CMD_GETFAMILY` and `CTRL_ATTR_FAMILY_NAME` come from `linux/genetlink.h`, so I double-checked their inclusion. Everything seemed to fall into place after these checks.
|
| 679/5 |
2026/09/07 08:38 |
tool |
grepper |
0m
Args: map[Expression:CTRL_CMD_GETFAMILY]
Results: map[Output:Documentation/userspace-api/netlink/intro.rst=252=The Generic Netlink family implements a command used to find out information
Documentation/userspace-api/netlink/intro.rst:253:about other families (``CTRL_CMD_GETFAMILY``).
Documentation/userspace-api/netlink/intro.rst-254-
--
Documentation/userspace-api/netlink/intro.rst=257=socket. The message should target the Generic Netlink Family (1), be a
Documentation/userspace-api/netlink/intro.rst:258:``do`` (2) call to ``CTRL_CMD_GETFAMILY`` (3). A ``dump`` version of this
Documentation/userspace-api/netlink/intro.rst-259-call would make the kernel respond with information about *all* the families
--
Documentation/userspace-api/netlink/intro.rst=261=to be specified (4) as an attribute with the appropriate type::
--
Documentation/userspace-api/netlink/intro.rst-270- struct genlmsghdr:
Documentation/userspace-api/netlink/intro.rst:271: __u8 cmd: CTRL_CMD_GETFAMILY // (3)
Documentation/userspace-api/netlink/intro.rst-272- __u8 version: 2 /* or 1, doesn't matter */
--
Documentation/userspace-api/netlink/intro.rst=290=with all the information about the family::
--
Documentation/userspace-api/netlink/intro.rst-300- struct genlmsghdr:
Documentation/userspace-api/netlink/intro.rst:301: __u8 cmd: CTRL_CMD_GETFAMILY
Documentation/userspace-api/netlink/intro.rst-302- __u8 version: 2
--
Documentation/userspace-api/netlink/intro.rst=485=The notification contains the same information as the response
Documentation/userspace-api/netlink/intro.rst:486:to the ``CTRL_CMD_GETFAMILY`` request.
Documentation/userspace-api/netlink/intro.rst-487-
--
include/uapi/linux/genetlink.h=40=enum {
--
include/uapi/linux/genetlink.h-43- CTRL_CMD_DELFAMILY,
include/uapi/linux/genetlink.h:44: CTRL_CMD_GETFAMILY,
include/uapi/linux/genetlink.h-45- CTRL_CMD_NEWOPS,
--
net/netlink/genetlink.c=1766=static const struct genl_split_ops genl_ctrl_ops[] = {
net/netlink/genetlink.c-1767- {
net/netlink/genetlink.c:1768: .cmd = CTRL_CMD_GETFAMILY,
net/netlink/genetlink.c-1769- .validate = GENL_DONT_VALIDATE_STRICT,
--
net/netlink/genetlink.c-1775- {
net/netlink/genetlink.c:1776: .cmd = CTRL_CMD_GETFAMILY,
net/netlink/genetlink.c-1777- .validate = GENL_DONT_VALIDATE_DUMP,
--
tools/accounting/delaytop.c=463=static int get_family_id(int sd)
--
tools/accounting/delaytop.c-477- name[sizeof(name) - 1] = '\0';
tools/accounting/delaytop.c:478: rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/delaytop.c-479- CTRL_ATTR_FAMILY_NAME, (void *)name,
--
tools/accounting/getdelays.c=189=static int get_family_id(int sd)
--
tools/accounting/getdelays.c-201- strcpy(name, TASKSTATS_GENL_NAME);
tools/accounting/getdelays.c:202: rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/getdelays.c-203- CTRL_ATTR_FAMILY_NAME, (void *)name,
--
tools/accounting/procacct.c=195=static int get_family_id(int sd)
--
tools/accounting/procacct.c-207- strcpy(name, TASKSTATS_GENL_NAME);
tools/accounting/procacct.c:208: rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/procacct.c-209- CTRL_ATTR_FAMILY_NAME, (void *)name,
--
tools/include/uapi/linux/genetlink.h=40=enum {
--
tools/include/uapi/linux/genetlink.h-43- CTRL_CMD_DELFAMILY,
tools/include/uapi/linux/genetlink.h:44: CTRL_CMD_GETFAMILY,
tools/include/uapi/linux/genetlink.h-45- CTRL_CMD_NEWOPS,
--
tools/lib/bpf/netlink.c=268=static int libbpf_netlink_resolve_genl_family_id(const char *name,
--
tools/lib/bpf/netlink.c-274- .nh.nlmsg_flags = NLM_F_REQUEST,
tools/lib/bpf/netlink.c:275: .gnl.cmd = CTRL_CMD_GETFAMILY,
tools/lib/bpf/netlink.c-276- .gnl.version = 2,
--
tools/lib/thermal/thermal_nl.c=113=static int nl_get_multicast_id(struct nl_sock *sock, struct nl_cb *cb,
--
tools/lib/thermal/thermal_nl.c-128-
tools/lib/thermal/thermal_nl.c:129: genlmsg_put(msg, 0, 0, ctrlid, 0, 0, CTRL_CMD_GETFAMILY, 0);
tools/lib/thermal/thermal_nl.c-130-
--
tools/net/ynl/lib/ynl.c=700=static int ynl_sock_read_family(struct ynl_sock *ys, const char *family_name)
--
tools/net/ynl/lib/ynl.c-705-
tools/net/ynl/lib/ynl.c:706: nlh = ynl_gemsg_start_req(ys, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, 1);
tools/net/ynl/lib/ynl.c-707- ynl_attr_put_str(nlh, CTRL_ATTR_FAMILY_NAME, family_name);
--
tools/net/ynl/pyynl/lib/ynl.py=40=class Netlink:
--
tools/net/ynl/pyynl/lib/ynl.py-79- # nlctrl
tools/net/ynl/pyynl/lib/ynl.py:80: CTRL_CMD_GETFAMILY = 3
tools/net/ynl/pyynl/lib/ynl.py-81- CTRL_CMD_GETPOLICY = 10
--
tools/net/ynl/pyynl/lib/ynl.py=461=def _genl_load_families():
--
tools/net/ynl/pyynl/lib/ynl.py-468- Netlink.NLM_F_REQUEST | Netlink.NLM_F_ACK | Netlink.NLM_F_DUMP,
tools/net/ynl/pyynl/lib/ynl.py:469: Netlink.CTRL_CMD_GETFAMILY, 1)
tools/net/ynl/pyynl/lib/ynl.py-470- msg = _genl_msg_finalize(msg)
--
tools/power/x86/intel-speed-select/hfi-events.c=152=static int nl_get_multicast_id(struct hfi_event_data *drv,
--
tools/power/x86/intel-speed-select/hfi-events.c-162- genlmsg_put(msg, 0, 0, genl_ctrl_resolve(drv->nl_handle, "nlctrl"),
tools/power/x86/intel-speed-select/hfi-events.c:163: 0, 0, CTRL_CMD_GETFAMILY, 0);
tools/power/x86/intel-speed-select/hfi-events.c-164- NLA_PUT_STRING(msg, CTRL_ATTR_FAMILY_NAME, family);
--
tools/testing/selftests/acct/netlink_helper.c=59=int get_family_id(int fd, const char *name)
--
tools/testing/selftests/acct/netlink_helper.c-79-
tools/testing/selftests/acct/netlink_helper.c:80: req.genl.cmd = CTRL_CMD_GETFAMILY;
tools/testing/selftests/acct/netlink_helper.c-81- req.genl.version = 1;
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=104=static bool get_smc_nl_family_id(void)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-126- ret = send_cmd(fd, GENL_ID_CTRL, pid,
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:127: NLM_F_REQUEST, CTRL_CMD_GETFAMILY,
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-128- CTRL_ATTR_FAMILY_NAME, (void *)SMC_GENL_FAMILY_NAME,
--
tools/testing/selftests/nci/nci_dev.c=160=static int send_get_nfc_family(int sd, __u32 pid)
--
tools/testing/selftests/nci/nci_dev.c-170-
tools/testing/selftests/nci/nci_dev.c:171: return send_cmd_mt_nla(sd, GENL_ID_CTRL, pid, CTRL_CMD_GETFAMILY,
tools/testing/selftests/nci/nci_dev.c-172- 1, &nla_get_family_type, &nla_get_family_data,
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=322=static int resolve_mptcp_pm_netlink(int fd, int *pm_family, int *events_mcast_grp)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-333- nh = (void *)data;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:334: off = init_genl_req(data, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, 0);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-335-
--
tools/testing/selftests/net/ovpn/ovpn-cli.c=1553=static int ovpn_get_mcast_id(struct nl_sock *sock, const char *family,
--
tools/testing/selftests/net/ovpn/ovpn-cli.c-1575-
tools/testing/selftests/net/ovpn/ovpn-cli.c:1576: genlmsg_put(msg, 0, 0, ctrlid, 0, 0, CTRL_CMD_GETFAMILY, 0);
tools/testing/selftests/net/ovpn/ovpn-cli.c-1577-
]
|
| 680/5 |
2026/09/07 08:38 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 37388
output: 21
thoughts: 81
Thoughts: **My Internal Monologue on nl80211 Command and Attribute Identifiers**
Alright, so the system is telling me that `CTRL_CMD_GETFAMILY` maps to the numerical value 3. That’s the command I’ll use to retrieve information about a specific family.
Then, I see that `CTRL_ATTR_FAMILY_NAME` is assigned the value 2. This is clearly an attribute, a piece of data I'll expect back when I query a family, specifically its name. Similarly, `CTRL_ATTR_FAMILY_ID` is 1. This must be the unique identifier for that family.
And of course, the general netlink controller family identifier, `GENL_ID_CTRL`, is 16. This is the foundational identifier for the control messages themselves, the gateway to interacting with the nl80211 subsystem.
Before I proceed, a quick sanity check: I want to be absolutely sure about `CTRL_ATTR_FAMILY_NAME` and `CTRL_ATTR_FAMILY_ID`. Are these indeed the correct attributes for fetching the name and ID of a family, respectively? A brief look back at the documentation or a quick peek at the header files confirms they are. Good, that confirms my understanding of how I'll structure the data retrieval requests.
|
| 681/5 |
2026/09/07 08:38 |
tool |
grepper |
0m
Args: map[Expression:CTRL_ATTR_FAMILY_NAME]
Results: map[Output:Documentation/userspace-api/netlink/intro.rst=261=to be specified (4) as an attribute with the appropriate type::
--
Documentation/userspace-api/netlink/intro.rst-276- __u16 nla_len: 10
Documentation/userspace-api/netlink/intro.rst:277: __u16 nla_type: CTRL_ATTR_FAMILY_NAME
Documentation/userspace-api/netlink/intro.rst-278- char data: test1\0
--
Documentation/userspace-api/netlink/intro.rst=285=Attribute headers in netlink must be aligned to 4 bytes from the start
Documentation/userspace-api/netlink/intro.rst:286:of the message, hence the extra ``\0\0`` after ``CTRL_ATTR_FAMILY_NAME``.
Documentation/userspace-api/netlink/intro.rst-287-The attribute lengths *exclude* the padding.
--
Documentation/userspace-api/netlink/intro.rst=290=with all the information about the family::
--
Documentation/userspace-api/netlink/intro.rst-306- __u16 nla_len: 10
Documentation/userspace-api/netlink/intro.rst:307: __u16 nla_type: CTRL_ATTR_FAMILY_NAME
Documentation/userspace-api/netlink/intro.rst-308- char data: test1\0
--
Documentation/userspace-api/netlink/intro.rst=448=sockets subscribed to the notifications will get the following message::
--
Documentation/userspace-api/netlink/intro.rst-463- __u16 nla_len: 10
Documentation/userspace-api/netlink/intro.rst:464: __u16 nla_type: CTRL_ATTR_FAMILY_NAME
Documentation/userspace-api/netlink/intro.rst-465- char data: test1\0
--
include/uapi/linux/genetlink.h=57=enum {
--
include/uapi/linux/genetlink.h-59- CTRL_ATTR_FAMILY_ID,
include/uapi/linux/genetlink.h:60: CTRL_ATTR_FAMILY_NAME,
include/uapi/linux/genetlink.h-61- CTRL_ATTR_VERSION,
--
net/netlink/genetlink.c=1228=static int ctrl_fill_info(const struct genl_family *family, u32 portid, u32 seq,
--
net/netlink/genetlink.c-1237-
net/netlink/genetlink.c:1238: if (nla_put_string(skb, CTRL_ATTR_FAMILY_NAME, family->name) ||
net/netlink/genetlink.c-1239- nla_put_u16(skb, CTRL_ATTR_FAMILY_ID, family->id) ||
--
net/netlink/genetlink.c=1311=static int ctrl_fill_mcgrp_info(const struct genl_family *family,
--
net/netlink/genetlink.c-1323-
net/netlink/genetlink.c:1324: if (nla_put_string(skb, CTRL_ATTR_FAMILY_NAME, family->name) ||
net/netlink/genetlink.c-1325- nla_put_u16(skb, CTRL_ATTR_FAMILY_ID, family->id))
--
net/netlink/genetlink.c=1422=static const struct nla_policy ctrl_policy_family[] = {
net/netlink/genetlink.c-1423- [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
net/netlink/genetlink.c:1424: [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
net/netlink/genetlink.c-1425- .len = GENL_NAMSIZ - 1 },
--
net/netlink/genetlink.c=1428=static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
--
net/netlink/genetlink.c-1439-
net/netlink/genetlink.c:1440: if (info->attrs[CTRL_ATTR_FAMILY_NAME]) {
net/netlink/genetlink.c-1441- char *name;
net/netlink/genetlink.c-1442-
net/netlink/genetlink.c:1443: name = nla_data(info->attrs[CTRL_ATTR_FAMILY_NAME]);
net/netlink/genetlink.c-1444- res = genl_family_find_byname(name);
--
net/netlink/genetlink.c=1522=static const struct nla_policy ctrl_policy_policy[] = {
net/netlink/genetlink.c-1523- [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
net/netlink/genetlink.c:1524: [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
net/netlink/genetlink.c-1525- .len = GENL_NAMSIZ - 1 },
--
net/netlink/genetlink.c=1529=static int ctrl_dumppolicy_start(struct netlink_callback *cb)
--
net/netlink/genetlink.c-1539-
net/netlink/genetlink.c:1540: if (!tb[CTRL_ATTR_FAMILY_ID] && !tb[CTRL_ATTR_FAMILY_NAME])
net/netlink/genetlink.c-1541- return -EINVAL;
--
net/netlink/genetlink.c-1546- rt = genl_family_find_byname(
net/netlink/genetlink.c:1547: nla_data(tb[CTRL_ATTR_FAMILY_NAME]));
net/netlink/genetlink.c-1548- if (!rt)
--
tools/accounting/delaytop.c=463=static int get_family_id(int sd)
--
tools/accounting/delaytop.c-478- rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/delaytop.c:479: CTRL_ATTR_FAMILY_NAME, (void *)name,
tools/accounting/delaytop.c-480- strlen(TASKSTATS_GENL_NAME)+1);
--
tools/accounting/getdelays.c=189=static int get_family_id(int sd)
--
tools/accounting/getdelays.c-202- rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/getdelays.c:203: CTRL_ATTR_FAMILY_NAME, (void *)name,
tools/accounting/getdelays.c-204- strlen(TASKSTATS_GENL_NAME)+1);
--
tools/accounting/procacct.c=195=static int get_family_id(int sd)
--
tools/accounting/procacct.c-208- rc = send_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
tools/accounting/procacct.c:209: CTRL_ATTR_FAMILY_NAME, (void *)name,
tools/accounting/procacct.c-210- strlen(TASKSTATS_GENL_NAME)+1);
--
tools/include/uapi/linux/genetlink.h=57=enum {
--
tools/include/uapi/linux/genetlink.h-59- CTRL_ATTR_FAMILY_ID,
tools/include/uapi/linux/genetlink.h:60: CTRL_ATTR_FAMILY_NAME,
tools/include/uapi/linux/genetlink.h-61- CTRL_ATTR_VERSION,
--
tools/lib/bpf/netlink.c=268=static int libbpf_netlink_resolve_genl_family_id(const char *name,
--
tools/lib/bpf/netlink.c-279-
tools/lib/bpf/netlink.c:280: err = nlattr_add(&req, CTRL_ATTR_FAMILY_NAME, name, len);
tools/lib/bpf/netlink.c-281- if (err < 0)
--
tools/lib/thermal/thermal_nl.c=113=static int nl_get_multicast_id(struct nl_sock *sock, struct nl_cb *cb,
--
tools/lib/thermal/thermal_nl.c-130-
tools/lib/thermal/thermal_nl.c:131: nla_put_string(msg, CTRL_ATTR_FAMILY_NAME, family);
tools/lib/thermal/thermal_nl.c-132-
--
tools/net/ynl/lib/ynl.c=700=static int ynl_sock_read_family(struct ynl_sock *ys, const char *family_name)
--
tools/net/ynl/lib/ynl.c-706- nlh = ynl_gemsg_start_req(ys, GENL_ID_CTRL, CTRL_CMD_GETFAMILY, 1);
tools/net/ynl/lib/ynl.c:707: ynl_attr_put_str(nlh, CTRL_ATTR_FAMILY_NAME, family_name);
tools/net/ynl/lib/ynl.c-708-
--
tools/net/ynl/pyynl/lib/ynl.py=40=class Netlink:
--
tools/net/ynl/pyynl/lib/ynl.py-83- CTRL_ATTR_FAMILY_ID = 1
tools/net/ynl/pyynl/lib/ynl.py:84: CTRL_ATTR_FAMILY_NAME = 2
tools/net/ynl/pyynl/lib/ynl.py-85- CTRL_ATTR_MAXATTR = 5
--
tools/net/ynl/pyynl/lib/ynl.py=461=def _genl_load_families():
--
tools/net/ynl/pyynl/lib/ynl.py-487- fam['id'] = attr.as_scalar('u16')
tools/net/ynl/pyynl/lib/ynl.py:488: elif attr.type == Netlink.CTRL_ATTR_FAMILY_NAME:
tools/net/ynl/pyynl/lib/ynl.py-489- fam['name'] = attr.as_strz()
--
tools/power/x86/intel-speed-select/hfi-events.c=152=static int nl_get_multicast_id(struct hfi_event_data *drv,
--
tools/power/x86/intel-speed-select/hfi-events.c-163- 0, 0, CTRL_CMD_GETFAMILY, 0);
tools/power/x86/intel-speed-select/hfi-events.c:164: NLA_PUT_STRING(msg, CTRL_ATTR_FAMILY_NAME, family);
tools/power/x86/intel-speed-select/hfi-events.c-165-
--
tools/testing/selftests/acct/netlink_helper.c=59=int get_family_id(int fd, const char *name)
--
tools/testing/selftests/acct/netlink_helper.c-83- na = (struct nlattr *)((char *)&req + NLMSG_ALIGN(req.nlh.nlmsg_len));
tools/testing/selftests/acct/netlink_helper.c:84: na->nla_type = CTRL_ATTR_FAMILY_NAME;
tools/testing/selftests/acct/netlink_helper.c-85- na->nla_len = NLA_HDRLEN + strlen(name) + 1;
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=104=static bool get_smc_nl_family_id(void)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-127- NLM_F_REQUEST, CTRL_CMD_GETFAMILY,
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:128: CTRL_ATTR_FAMILY_NAME, (void *)SMC_GENL_FAMILY_NAME,
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-129- strlen(SMC_GENL_FAMILY_NAME));
--
tools/testing/selftests/nci/nci_dev.c=160=static int send_get_nfc_family(int sd, __u32 pid)
tools/testing/selftests/nci/nci_dev.c-161-{
tools/testing/selftests/nci/nci_dev.c:162: __u16 nla_get_family_type = CTRL_ATTR_FAMILY_NAME;
tools/testing/selftests/nci/nci_dev.c-163- void *nla_get_family_data;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=322=static int resolve_mptcp_pm_netlink(int fd, int *pm_family, int *events_mcast_grp)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-337- namelen = strlen(MPTCP_PM_NAME) + 1;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:338: rta->rta_type = CTRL_ATTR_FAMILY_NAME;
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-339- rta->rta_len = RTA_LENGTH(namelen);
--
tools/testing/selftests/net/ovpn/ovpn-cli.c=1553=static int ovpn_get_mcast_id(struct nl_sock *sock, const char *family,
--
tools/testing/selftests/net/ovpn/ovpn-cli.c-1578- ret = -ENOBUFS;
tools/testing/selftests/net/ovpn/ovpn-cli.c:1579: NLA_PUT_STRING(msg, CTRL_ATTR_FAMILY_NAME, family);
tools/testing/selftests/net/ovpn/ovpn-cli.c-1580-
]
|
| 682/5 |
2026/09/07 08:38 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 41289
output: 458
thoughts: 4824
Thoughts: **My Thought Process in Recreating the `mac80211_hwsim` Exploit**
Alright, let's walk through my process of building this reproducer. The goal is to trigger a specific bug in the `mac80211_hwsim` kernel module, which involves creating a new radio device with Multi-Link Operation (MLO) support and then sending a malformed radiotap header.
**1. Understanding the Core Requirement: Creating an MLO-enabled Radio**
The primary directive is clear: I need to programmatically create a new `mac80211_hwsim` radio device, and crucially, this device *must* have MLO support enabled. This immediately points me towards using Netlink, specifically the `generic netlink` interface, as that's the standard way to interact with kernel subsystems like `mac80211_hwsim`.
**2. Netlink Basics: Family ID and Commands**
To talk to `mac80211_hwsim` via generic netlink, I first need to know its family ID. The common way to get this is by sending a `CTRL_CMD_GETFAMILY` request to the generic netlink controller, specifying the family name, which is "MAC80211_HWSIM".
* **Initial thoughts on constants:** I recalled or looked up that `CTRL_ATTR_FAMILY_ID` is likely `1` and `CTRL_ATTR_FAMILY_NAME` is `2`. Similarly, `GENL_ID_CTRL` is the identifier for the generic netlink controller itself. A quick check in `linux/genetlink.h` confirms that `GENL_ID_CTRL` is indeed `16` (or `0x10`). This confirms my initial assumptions about the basic netlink message structure.
* **`get_family_id` function:** I started sketching out the `get_family_id` function. This involves:
* Setting up a `nlmsghdr` and `genlmsghdr` for the request.
* Populating the `nlmsghdr` with necessary flags (`NLM_F_REQUEST`), sequence numbers, and the PID of my process.
* Setting the `nlmsg_type` to `GENL_ID_CTRL` and the `genlmsghdr` command to `CTRL_CMD_GETFAMILY`.
* Crucially, adding an `rtattr` of type `CTRL_ATTR_FAMILY_NAME` with the string "MAC80211_HWSIM".
* The length calculations for the netlink message and its attributes are vital. I paid close attention to `NLMSG_LENGTH`, `NLMSG_ALIGN`, `RTA_LENGTH`, and `RTA_ALIGN`. My reasoning here is that the kernel expects precise sizing of these structures to correctly parse the message.
* After sending the request, I need to receive the response, parse it for `NLMSG_ERROR` (indicating failure), and then traverse the attributes to find `CTRL_ATTR_FAMILY_ID`. The offset calculations for the `genlmsghdr` and subsequent `rtattr`s (`NLMSG_DATA` and `GENL_HDRLEN`) are critical. My checks confirmed that `NLMSG_LENGTH(GENL_HDRLEN)` correctly accounts for the base netlink header and the generic netlink header size.
* **`create_hwsim_radio` function:** Now, to create the radio with MLO support. This involves sending a netlink message to the `mac80211_hwsim` family (using the obtained `family_id`) with the `HWSIM_CMD_NEW_RADIO` command.
* **MLO attribute:** The key here is the `HWSIM_ATTR_MLO_SUPPORT` attribute. The feedback explicitly states this flag attribute needs to be present. Looking at the `hwsim_new_radio_nl` function in the kernel (which I would do if I weren't certain or if it wasn't provided), I’d see how it handles this attribute. It likely checks for its existence rather than a specific value. Therefore, creating an attribute of type `HWSIM_ATTR_MLO_SUPPORT` with `RTA_LENGTH(0)` should be sufficient.
* **Constants check:** I double-checked that `HWSIM_CMD_NEW_RADIO` is `4` and `HWSIM_ATTR_MLO_SUPPORT` is `25`. This was a quick lookup in the `mac80211_hwsim` definitions.
**3. Orchestrating the Setup (`main` function)**
The `main` function ties everything together:
* **Module loading:** First, I need to ensure `mac80211_hwsim` is loaded. `execute_command("modprobe mac80211_hwsim")` handles this. A short `sleep(1)` after loading is good practice to give the kernel a moment to register the module and its netlink family.
* **Netlink socket:** I open a generic netlink socket (`AF_NETLINK`, `SOCK_RAW`, `NETLINK_GENERIC`).
* **Get family ID and create radio:** I call `get_family_id` and then `create_hwsim_radio`. The `create_hwsim_radio` function correctly uses the obtained `family_id` as the `nlmsg_type`.
* **Interface creation:** The feedback mentions that a *new* interface (e.g., `wlan1` or `wlan2`) will be created. The reproducer needs to account for this. My loop `for (int i = 0; i < 4; i++)` is a pragmatic approach. While `mac80211_hwsim` might create `wlan0`, `wlan1`, etc., sequentially, it's more robust to iterate and apply the subsequent steps to each potential newly created interface. This ensures I hit the one that was just created with MLO support.
**4. Configuring the Interface for Packet Injection**
Once the new radio device (e.g., `wlan1`) is up, I need to prepare it for packet injection.
* **Standard interface manipulation:** The feedback clearly outlines the steps:
* Set the interface DOWN (`ip link set wlan%d down`).
* Change its type to monitor (`iw dev wlan%d set type monitor`). This is essential for capturing and injecting raw 802.11 frames.
* Set the interface UP (`ip link set wlan%d up`).
* Set a frequency (`iw dev wlan%d set freq 2412`). 2412 MHz is a standard channel, and `mac80211_hwsim` supports it.
* **Packet socket:** To inject raw packets, I need an `AF_PACKET` socket.
* I get the interface index using `if_nametoindex`.
* I create the socket with `AF_PACKET`, `SOCK_RAW`, and `htons(ETH_P_ALL)` (or `ETH_P_802_2` / `ETH_P_802_3` depending on context, but `ETH_P_ALL` is generally safe for raw frame injection and capture).
* I bind the socket to the specific interface using a `sockaddr_ll` structure, setting `sll_ifindex`.
**5. Crafting the Malicious Packet**
The heart of the exploit lies in the crafted packet.
* **Radiotap header:** The feedback specifically mentions a bug triggered by an *invalid legacy rate (0) in the radiotap header*.
* I started constructing the radiotap header, focusing on the `it_present` field. The feedback indicates `IEEE80211_RADIOTAP_RATE` is relevant.
* `IEEE80211_RADIOTAP_RATE` corresponds to bit 2 in the `it_present` bitmask. So, `0x04` (or `1 << 2`) in the `it_present` field is required. This translates to `0x04, 0x00, 0x00, 0x00` in little-endian byte order.
* The header length (`it_len`) needs to be correct. With just the version, pad, length, present mask, and the rate field, the total length is 9 bytes. So, `0x09, 0x00` (little-endian) for `it_len`.
* Finally, the `rate` field itself is set to `0`. This is the "invalid legacy rate" that triggers the bug.
* **802.11 Data Frame Header:** A minimal 802.11 data frame header is needed to make it a valid-looking frame, even though the data payload itself isn't critical for this specific exploit. I populated standard fields like Frame Control, Duration, Addr1 (destination), Addr2 (source), Addr3 (BSSID), and Sequence Control with common or zero values.
* **Injection loop:** The code then loops `for (int j = 0; j < 10; j++)` sending this crafted packet multiple times with `usleep(10000)` to give the kernel time to process each one.
**6. Final Checks and Refinements**
Throughout this process, I was constantly cross-referencing the feedback, the code I was writing, and my understanding of Netlink and Linux networking structures.
* **Attribute types and lengths:** The most common pitfalls are incorrect attribute types, lengths, and offsets. I re-verified `RTA_LENGTH`, `RTA_ALIGN`, `NLMSG_LENGTH`, `NLMSG_ALIGN`, `NLMSG_DATA`, and `GENL_HDRLEN` calculations.
* **Endianness:** Network protocols and kernel interfaces often deal with little-endian data, so ensuring correct byte ordering for multi-byte fields (like `nlmsg_len`, `rta_len`, `it_len`, `it_present`) is crucial.
* **Kernel behavior:** I considered how the kernel would process `HWSIM_ATTR_MLO_SUPPORT`. My reasoning that a present attribute with zero length is sufficient for a flag attribute is based on typical kernel attribute handling. The kernel usually checks for `info->attrs[some_attr_id] != NULL`.
* **Radiotap details:** The specific mention of `IEEE80211_RADIOTAP_RATE` and rate `0` was a strong hint. I double-checked the radiotap structure definition and confirmed that bit 2 for RATE is indeed the correct one, and that a rate of 0 is problematic.
This structured approach, starting with the high-level goal and drilling down into the specific Netlink messages, attribute definitions, packet structures, and kernel behaviors, allowed me to construct the reproducer that directly addresses the reported vulnerability.
|
| 683/5 |
2026/09/07 08:39 |
tool |
codeexpert |
4m
Args: map[Question:Is there any issue with the following generic netlink code to create a mac80211_hwsim radio with HWSIM_ATTR_MLO_SUPPORT?
```c
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = getpid();
req.g.cmd = 4; // HWSIM_CMD_NEW_RADIO
req.g.version = 1;
struct rtattr *rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
rta->rta_type = 25; // HWSIM_ATTR_MLO_SUPPORT
rta->rta_len = RTA_LENGTH(0);
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_ALIGN(rta->rta_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
return 0;
}
```
]
Results: map[Answer:Several issues exist in the provided code, ranging from critical correctness/error-handling bugs to API misuse and fragility:
### 1. **No Netlink Error/ACK Checking (Critical Bug)**
- The message sets `NLM_F_ACK`, so the kernel replies with a Netlink message of type `NLMSG_ERROR`.
- If the operation fails in the kernel (e.g., permission denied `-EPERM` because `HWSIM_CMD_NEW_RADIO` requires `CAP_NET_ADMIN`, invalid attributes, or module failure), the kernel sends an `NLMSG_ERROR` packet containing the negative error code (e.g. `-EPERM`).
- Calling `recv()` simply returns the number of received bytes (e.g., `len > 0`), which indicates the read succeeded, **not** that the radio creation succeeded.
- Because the code checks only `if (len < 0)` and does not inspect `nlmsghdr::nlmsg_type == NLMSG_ERROR` or the payload's `struct nlmsgerr::error`, any kernel-side error will silently return `0` (indicating false success).
### 2. **Mixing rtnetlink Types/Macros with Generic Netlink**
- The code uses `struct rtattr`, `RTA_LENGTH`, and `RTA_ALIGN` from rtnetlink (`<linux/rtnetlink.h>`).
- Generic Netlink uses `struct nlattr`, `NLA_HDRLEN`, and `NLA_ALIGN` (or Netlink helper functions / libnl / libmnl) from `<linux/netlink.h>`.
- Although `struct rtattr` and `struct nlattr` share the same 4-byte header layout on Linux (`u16 len, u16 type`), mixing subsystems is semantically incorrect and bad practice.
### 3. **Hardcoded Magic Numbers**
- `req.g.cmd = 4;` is `HWSIM_CMD_NEW_RADIO`.
- `rta->rta_type = 25;` is `HWSIM_ATTR_MLO_SUPPORT`.
- Magic numbers are brittle across header versions and less maintainable than using the official enum definitions (`enum hwsim_commands` and `enum hwsim_attrs` from `<linux/mac80211_hwsim.h>`).
### 4. **`nlmsg_pid` and Sequence Matching**
- Modern Netlink usage expects `nlmsg_pid` to be set to `0` when sending requests to the kernel (the kernel will assign the port ID).
- In multi-message environments or if multicast notifications arrive on the same socket (hwsim broadcasts `HWSIM_CMD_NEW_RADIO`), responses should be checked to ensure `nlmsg_seq` matches the request sequence.
---
### Corrected Implementation
```c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/mac80211_hwsim.h>
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
/* Add HWSIM_ATTR_MLO_SUPPORT (NLA_FLAG attribute: length = NLA_HDRLEN) */
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
/* Parse Netlink response and ACK error */
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %s (%d)\n",
strerror(-err->error), err->error);
return err->error;
}
return 0; // ACK received with error == 0 (success)
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
```]
|
| 684/6 |
2026/09/07 08:39 |
agent |
codeexpert |
4m
Model:
Results: map[Answer:Several issues exist in the provided code, ranging from critical correctness/error-handling bugs to API misuse and fragility:
### 1. **No Netlink Error/ACK Checking (Critical Bug)**
- The message sets `NLM_F_ACK`, so the kernel replies with a Netlink message of type `NLMSG_ERROR`.
- If the operation fails in the kernel (e.g., permission denied `-EPERM` because `HWSIM_CMD_NEW_RADIO` requires `CAP_NET_ADMIN`, invalid attributes, or module failure), the kernel sends an `NLMSG_ERROR` packet containing the negative error code (e.g. `-EPERM`).
- Calling `recv()` simply returns the number of received bytes (e.g., `len > 0`), which indicates the read succeeded, **not** that the radio creation succeeded.
- Because the code checks only `if (len < 0)` and does not inspect `nlmsghdr::nlmsg_type == NLMSG_ERROR` or the payload's `struct nlmsgerr::error`, any kernel-side error will silently return `0` (indicating false success).
### 2. **Mixing rtnetlink Types/Macros with Generic Netlink**
- The code uses `struct rtattr`, `RTA_LENGTH`, and `RTA_ALIGN` from rtnetlink (`<linux/rtnetlink.h>`).
- Generic Netlink uses `struct nlattr`, `NLA_HDRLEN`, and `NLA_ALIGN` (or Netlink helper functions / libnl / libmnl) from `<linux/netlink.h>`.
- Although `struct rtattr` and `struct nlattr` share the same 4-byte header layout on Linux (`u16 len, u16 type`), mixing subsystems is semantically incorrect and bad practice.
### 3. **Hardcoded Magic Numbers**
- `req.g.cmd = 4;` is `HWSIM_CMD_NEW_RADIO`.
- `rta->rta_type = 25;` is `HWSIM_ATTR_MLO_SUPPORT`.
- Magic numbers are brittle across header versions and less maintainable than using the official enum definitions (`enum hwsim_commands` and `enum hwsim_attrs` from `<linux/mac80211_hwsim.h>`).
### 4. **`nlmsg_pid` and Sequence Matching**
- Modern Netlink usage expects `nlmsg_pid` to be set to `0` when sending requests to the kernel (the kernel will assign the port ID).
- In multi-message environments or if multicast notifications arrive on the same socket (hwsim broadcasts `HWSIM_CMD_NEW_RADIO`), responses should be checked to ensure `nlmsg_seq` matches the request sequence.
---
### Corrected Implementation
```c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/mac80211_hwsim.h>
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
/* Add HWSIM_ATTR_MLO_SUPPORT (NLA_FLAG attribute: length = NLA_HDRLEN) */
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
/* Parse Netlink response and ACK error */
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %s (%d)\n",
strerror(-err->error), err->error);
return err->error;
}
return 0; // ACK received with error == 0 (success)
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
```]
Instruction:
You are a capable Linux kernel developer tasked with researching complex questions
about kernel source code. You will be given a concrete question, and need to provide
a concrete answer.
Use tools extensively while researching the question. Don't make assumptions,
or rely on your previous knowledge about the kernel source code, use available tools
to access the actual source code.
Use all available sources of information:
- kernel source code
- documentation in the Documentation dir in the source tree
Do not guess file names or file paths and attempt to read them without
verifying their existence first using content search or directory listing tools.
If a file, symbol, or directory is not found via content search (grepper) or
directory listing (codesearch-dir-index), treat it as completely absent.
Do not attempt to guess alternative names, extensions, or directories.
Tool Selection Guidelines:
1. For C functions, structs, and variables: Prefer codesearch-definition-source
or codesearch-struct-layout FIRST to retrieve clean, exact definitions
without line-number guessing.
2. If symbol lookup fails (e.g., preprocessor macros, macro-generated code, or
disabled #ifdef branches), fall back to read-file or grepper.
3. For file headers, #include directives, preprocessor macro definitions, and
non-C files (Kconfig, Makefiles, docs): Use read-file or grepper directly.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Is there any issue with the following generic netlink code to create a mac80211_hwsim radio with HWSIM_ATTR_MLO_SUPPORT?
```c
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = getpid();
req.g.cmd = 4; // HWSIM_CMD_NEW_RADIO
req.g.version = 1;
struct rtattr *rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
rta->rta_type = 25; // HWSIM_ATTR_MLO_SUPPORT
rta->rta_len = RTA_LENGTH(0);
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_ALIGN(rta->rta_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
return 0;
}
```
|
| 685/7 |
2026/09/07 08:39 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 2753
output: 69
thoughts: 143
Thoughts: **My Thought Process Regarding the `HWSIM_ATTR_MLO_SUPPORT` Netlink Question**
Alright, the user has presented me with a piece of generic Netlink code and is asking if there are any issues related to creating a `mac80211_hwsim` radio with the `HWSIM_ATTR_MLO_SUPPORT` attribute. This is a pretty specific, low-level kernel networking question, so I need to approach this systematically, drawing on my deep understanding of Netlink, `mac80211_hwsim`, and the kernel's attribute handling mechanisms.
My first instinct is to dive straight into the provided code, but before I do that, I need to frame my investigation. I'm not just going to look at the user's code in isolation. I need to contextualize it within the kernel's existing framework for `mac80211_hwsim` and Netlink. This means I'll be considering:
1. **The User's Code:** Of course, I'll analyze the provided snippet for syntax errors, incorrect attribute usage, or logical flaws.
2. **Kernel Source Exploration:** This is crucial for validation and understanding the expected behavior. I'll be digging into the kernel source code, specifically targeting:
* The `mac80211_hwsim` module itself.
* How `mac80211_hwsim` interacts with Netlink, especially for radio creation (`HWSIM_CMD_NEW_RADIO`).
* The definition and usage of generic Netlink attributes, paying close attention to `HWSIM_ATTR_MLO_SUPPORT`.
* The underlying Netlink attribute structures (`rtattr` vs. `nlattr`) to ensure the user's code adheres to the expected format.
* The broader landscape of `HWSIM_ATTR_*` definitions to see if `MLO_SUPPORT` fits in naturally or is an outlier.
* How Netlink messages are parsed and handled within the `mac80211_hwsim` driver.
My immediate next step, as outlined, is to start performing some targeted `grep` operations within the kernel source tree. This will be my initial sweep to quickly locate relevant definitions and usage patterns. I'll be looking for:
* Occurrences of `HWSIM_ATTR_MLO_SUPPORT` to see where and how it's defined and if it's associated with any existing commands or attributes.
* The definition of `HWSIM_CMD_NEW_RADIO` to understand the expected message structure for creating a new hardware simulation radio.
* Any Netlink attribute parsing logic within `mac80211_hwsim` that handles generic attributes, as this will reveal how the driver expects these attributes to be presented.
* The broader `HWSIM_ATTR_*` definitions to see the overall pattern and identify if `MLO_SUPPORT` aligns with established conventions.
Essentially, I'm going to perform a due diligence check by cross-referencing the user's provided code with the authoritative source of truth – the Linux kernel source. This will allow me to form a comprehensive and accurate assessment of any potential issues.
|
| 686/7 |
2026/09/07 08:39 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_ATTR_MLO_SUPPORT]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim.h=91=enum hwsim_commands {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-151- * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
drivers/net/wireless/virtual/mac80211_hwsim.h:152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
drivers/net/wireless/virtual/mac80211_hwsim.h-153- * the new radio
--
drivers/net/wireless/virtual/mac80211_hwsim.h=167=enum hwsim_attrs {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-192- HWSIM_ATTR_CIPHER_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h:193: HWSIM_ATTR_MLO_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h-194- HWSIM_ATTR_PMSR_SUPPORT,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=865=static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-891- [HWSIM_ATTR_CIPHER_SUPPORT] = { .type = NLA_BINARY },
drivers/net/wireless/virtual/mac80211_hwsim_main.c:892: [HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
drivers/net/wireless/virtual/mac80211_hwsim_main.c-893- [HWSIM_ATTR_PMSR_SUPPORT] = NLA_POLICY_NESTED(hwsim_pmsr_capa_policy),
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6805=static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6927-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6929-
]
|
| 687/7 |
2026/09/07 08:39 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_CMD_NEW_RADIO]
Results: map[Output:drivers/net/ieee802154/mac802154_hwsim.c=751=static const struct genl_small_ops hwsim_nl_ops[] = {
drivers/net/ieee802154/mac802154_hwsim.c-752- {
drivers/net/ieee802154/mac802154_hwsim.c:753: .cmd = MAC802154_HWSIM_CMD_NEW_RADIO,
drivers/net/ieee802154/mac802154_hwsim.c-754- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
--
drivers/net/ieee802154/mac802154_hwsim.c=814=static void hwsim_mcast_new_radio(struct genl_info *info, struct hwsim_phy *phy)
--
drivers/net/ieee802154/mac802154_hwsim.c-823- data = genlmsg_put(mcast_skb, 0, 0, &hwsim_genl_family, 0,
drivers/net/ieee802154/mac802154_hwsim.c:824: MAC802154_HWSIM_CMD_NEW_RADIO);
drivers/net/ieee802154/mac802154_hwsim.c-825- if (!data)
--
drivers/net/ieee802154/mac802154_hwsim.h-8- * @MAC802154_HWSIM_CMD_SET_RADIO: change radio parameters during runtime
drivers/net/ieee802154/mac802154_hwsim.h:9: * @MAC802154_HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters
drivers/net/ieee802154/mac802154_hwsim.h-10- * returns the radio ID (>= 0) or negative on errors, if successful
--
drivers/net/ieee802154/mac802154_hwsim.h=19=enum {
--
drivers/net/ieee802154/mac802154_hwsim.h-23- MAC802154_HWSIM_CMD_SET_RADIO,
drivers/net/ieee802154/mac802154_hwsim.h:24: MAC802154_HWSIM_CMD_NEW_RADIO,
drivers/net/ieee802154/mac802154_hwsim.h-25- MAC802154_HWSIM_CMD_DEL_RADIO,
--
drivers/net/wireless/virtual/mac80211_hwsim.h=23=enum hwsim_tx_control_flags {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-66- * %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
drivers/net/wireless/virtual/mac80211_hwsim.h:67: * @HWSIM_CMD_NEW_RADIO: create a new radio with the given parameters,
drivers/net/wireless/virtual/mac80211_hwsim.h-68- * returns the radio ID (>= 0) or negative on errors, if successful
--
drivers/net/wireless/virtual/mac80211_hwsim.h=91=enum hwsim_commands {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-95- HWSIM_CMD_TX_INFO_FRAME,
drivers/net/wireless/virtual/mac80211_hwsim.h:96: HWSIM_CMD_NEW_RADIO,
drivers/net/wireless/virtual/mac80211_hwsim.h-97- HWSIM_CMD_DEL_RADIO,
--
drivers/net/wireless/virtual/mac80211_hwsim.h-107-
drivers/net/wireless/virtual/mac80211_hwsim.h:108:#define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO
drivers/net/wireless/virtual/mac80211_hwsim.h-109-#define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO
--
drivers/net/wireless/virtual/mac80211_hwsim.h-128- * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
drivers/net/wireless/virtual/mac80211_hwsim.h:129: * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_NEW_RADIO
drivers/net/wireless/virtual/mac80211_hwsim.h-130- * command giving the number of channels supported by the new radio
--
drivers/net/wireless/virtual/mac80211_hwsim.h-137- * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
drivers/net/wireless/virtual/mac80211_hwsim.h:138: * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_NEW_RADIO
drivers/net/wireless/virtual/mac80211_hwsim.h-139- * command to force use of channel contexts even when only a
drivers/net/wireless/virtual/mac80211_hwsim.h-140- * single channel is supported
drivers/net/wireless/virtual/mac80211_hwsim.h:141: * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_NEW_RADIO
drivers/net/wireless/virtual/mac80211_hwsim.h-142- * command to force radio removal when process that created the radio dies
--
drivers/net/wireless/virtual/mac80211_hwsim.h-153- * the new radio
drivers/net/wireless/virtual/mac80211_hwsim.h:154: * @HWSIM_ATTR_PMSR_SUPPORT: nested attribute used with %HWSIM_CMD_NEW_RADIO
drivers/net/wireless/virtual/mac80211_hwsim.h-155- * to provide peer measurement capabilities. (nl80211_peer_measurement_attrs)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4491=static void hwsim_mcast_new_radio(int id, struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4501- data = genlmsg_put(mcast_skb, 0, 0, &hwsim_genl_family, 0,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4502: HWSIM_CMD_NEW_RADIO);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4503- if (!data)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7105=static const struct genl_small_ops hwsim_ops[] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7122- {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7123: .cmd = HWSIM_CMD_NEW_RADIO,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7124- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
]
|
| 688/7 |
2026/09/07 08:39 |
tool |
grepper |
0m
Args: map[Expression:hwsim_new_radio_nl]
Results: map[Output:drivers/net/ieee802154/mac802154_hwsim.c=329=static const struct ieee802154_ops hwsim_ops = {
--
drivers/net/ieee802154/mac802154_hwsim.c-339-
drivers/net/ieee802154/mac802154_hwsim.c:340:static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
drivers/net/ieee802154/mac802154_hwsim.c-341-{
--
drivers/net/ieee802154/mac802154_hwsim.c=751=static const struct genl_small_ops hwsim_nl_ops[] = {
--
drivers/net/ieee802154/mac802154_hwsim.c-754- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
drivers/net/ieee802154/mac802154_hwsim.c:755: .doit = hwsim_new_radio_nl,
drivers/net/ieee802154/mac802154_hwsim.c-756- .flags = GENL_UNS_ADMIN_PERM,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6766=static int parse_pmsr_capa(const struct nlattr *pmsr_capa, struct cfg80211_pmsr_capabilities *out,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6804-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6805:static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6806-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7105=static const struct genl_small_ops hwsim_ops[] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7124- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7125: .doit = hwsim_new_radio_nl,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7126- .flags = GENL_UNS_ADMIN_PERM,
]
|
| 689/7 |
2026/09/07 08:39 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 6464
output: 47
thoughts: 54
Thoughts: **My Thought Process**
My initial step is to dive into the code, specifically focusing on two key components related to the `mac80211_hwsim` driver: `drivers/net/wireless/virtual/mac80211_hwsim_main.c`, and the header file `mac80211_hwsim.h`. I'm particularly interested in the `hwsim_new_radio_nl` function within the C file. My hypothesis is that this function is instrumental in the creation and registration of new virtual radio devices within the `mac80211_hwsim` framework, likely triggered by a Netlink message. By examining its implementation, I expect to uncover the precise mechanisms for how these virtual radios are instantiated, configured, and integrated into the system. Simultaneously, reviewing `mac80211_hwsim.h` should provide a broader understanding of the data structures, enumerations, and function prototypes that govern the behavior and state of these simulated hardware devices. This combined approach will allow me to fully grasp the lifecycle of a virtual radio from its creation to its operational integration.
|
| 690/7 |
2026/09/07 08:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim.h FirstLine:80 LineCount:100]
Results: map[Contents: 80: * %HWSIM_ATTR_ADDR_TRANSMITTER. This lets wmediumd forward frames
81: * to this receiver address for a given station.
82: * @HWSIM_CMD_DEL_MAC_ADDR: remove the MAC address again, the attributes
83: * are the same as to @HWSIM_CMD_ADD_MAC_ADDR.
84: * @HWSIM_CMD_START_PMSR: request to start peer measurement with the
85: * %HWSIM_ATTR_PMSR_REQUEST. Result will be sent back asynchronously
86: * with %HWSIM_CMD_REPORT_PMSR.
87: * @HWSIM_CMD_ABORT_PMSR: Abort previously started peer measurement.
88: * @HWSIM_CMD_REPORT_PMSR: Report peer measurement data.
89: * @__HWSIM_CMD_MAX: enum limit
90: */
91: enum hwsim_commands {
92: HWSIM_CMD_UNSPEC,
93: HWSIM_CMD_REGISTER,
94: HWSIM_CMD_FRAME,
95: HWSIM_CMD_TX_INFO_FRAME,
96: HWSIM_CMD_NEW_RADIO,
97: HWSIM_CMD_DEL_RADIO,
98: HWSIM_CMD_GET_RADIO,
99: HWSIM_CMD_ADD_MAC_ADDR,
100: HWSIM_CMD_DEL_MAC_ADDR,
101: HWSIM_CMD_START_PMSR,
102: HWSIM_CMD_ABORT_PMSR,
103: HWSIM_CMD_REPORT_PMSR,
104: __HWSIM_CMD_MAX,
105: };
106: #define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
107:
108: #define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO
109: #define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO
110:
111: /**
112: * enum hwsim_attrs - hwsim netlink attributes
113: *
114: * @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
115: *
116: * @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
117: * the frame is broadcasted to
118: * @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
119: * the frame was broadcasted from
120: * @HWSIM_ATTR_FRAME: Data array
121: * @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
122: * properly the frame at user space
123: * @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
124: * space
125: * @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
126: * space
127: * @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
128: * @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
129: * @HWSIM_ATTR_CHANNELS: u32 attribute used with the %HWSIM_CMD_NEW_RADIO
130: * command giving the number of channels supported by the new radio
131: * @HWSIM_ATTR_RADIO_ID: u32 attribute used with %HWSIM_CMD_DESTROY_RADIO
132: * only to destroy a radio
133: * @HWSIM_ATTR_REG_HINT_ALPHA2: alpha2 for regulatory driver hint
134: * (nla string, length 2)
135: * @HWSIM_ATTR_REG_CUSTOM_REG: custom regulatory domain index (u32 attribute)
136: * @HWSIM_ATTR_REG_STRICT_REG: request REGULATORY_STRICT_REG (flag attribute)
137: * @HWSIM_ATTR_SUPPORT_P2P_DEVICE: support P2P Device virtual interface (flag)
138: * @HWSIM_ATTR_USE_CHANCTX: used with the %HWSIM_CMD_NEW_RADIO
139: * command to force use of channel contexts even when only a
140: * single channel is supported
141: * @HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE: used with the %HWSIM_CMD_NEW_RADIO
142: * command to force radio removal when process that created the radio dies
143: * @HWSIM_ATTR_RADIO_NAME: Name of radio, e.g. phy666
144: * @HWSIM_ATTR_NO_VIF: Do not create vif (wlanX) when creating radio.
145: * @HWSIM_ATTR_FREQ: Frequency at which packet is transmitted or received.
146: * @HWSIM_ATTR_PAD: padding attribute for 64-bit values, ignore
147: * @HWSIM_ATTR_TX_INFO_FLAGS: additional flags for corresponding
148: * rates of %HWSIM_ATTR_TX_INFO
149: * @HWSIM_ATTR_PERM_ADDR: permanent mac address of new radio
150: * @HWSIM_ATTR_IFTYPE_SUPPORT: u32 attribute of supported interface types bits
151: * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
153: * the new radio
154: * @HWSIM_ATTR_PMSR_SUPPORT: nested attribute used with %HWSIM_CMD_NEW_RADIO
155: * to provide peer measurement capabilities. (nl80211_peer_measurement_attrs)
156: * @HWSIM_ATTR_PMSR_REQUEST: nested attribute used with %HWSIM_CMD_START_PMSR
157: * to provide details about peer measurement request (nl80211_peer_measurement_attrs)
158: * @HWSIM_ATTR_PMSR_RESULT: nested attributed used with %HWSIM_CMD_REPORT_PMSR
159: * to provide peer measurement result (nl80211_peer_measurement_attrs)
160: * @HWSIM_ATTR_MULTI_RADIO: Register multiple wiphy radios (flag).
161: * Adds one radio for each band. Number of supported channels will be set for
162: * each radio instead of for the wiphy.
163: * @HWSIM_ATTR_SUPPORT_NAN_DEVICE: support NAN Device virtual interface (flag)
164: * @HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR: background radar/CAC support (flag)
165: * @__HWSIM_ATTR_MAX: enum limit
166: */
167: enum hwsim_attrs {
168: HWSIM_ATTR_UNSPEC,
169: HWSIM_ATTR_ADDR_RECEIVER,
170: HWSIM_ATTR_ADDR_TRANSMITTER,
171: HWSIM_ATTR_FRAME,
172: HWSIM_ATTR_FLAGS,
173: HWSIM_ATTR_RX_RATE,
174: HWSIM_ATTR_SIGNAL,
175: HWSIM_ATTR_TX_INFO,
176: HWSIM_ATTR_COOKIE,
177: HWSIM_ATTR_CHANNELS,
178: HWSIM_ATTR_RADIO_ID,
179: HWSIM_ATTR_REG_HINT_ALPHA2,
]
|
| 691/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 8716
output: 47
thoughts: 35
Thoughts: **My Thought Process on `mac80211_hwsim.h`**
Alright, so my next step is to dive into the `mac80211_hwsim.h` header file, specifically looking at the `hwsim_attrs` section. My objective here is to gain a comprehensive understanding of what these attributes represent. I need to ascertain their purpose, how they're utilized, and what implications they have for the `mac80211_hwsim` driver. Given my expertise, I'm not just looking for definitions; I'm trying to build a mental model of how these attributes contribute to the overall functionality and behavior of the simulated hardware. I expect to see definitions that map to various configurable parameters or states of the simulated hardware, and I'll be paying close attention to any enumeration or structure definitions that clarify their usage and potential values. This analysis is crucial for me to fully grasp the scope of the simulation capabilities and any potential areas for refinement or extension.
|
| 692/7 |
2026/09/07 08:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim.h FirstLine:180 LineCount:40]
Results: map[Contents: 180: HWSIM_ATTR_REG_CUSTOM_REG,
181: HWSIM_ATTR_REG_STRICT_REG,
182: HWSIM_ATTR_SUPPORT_P2P_DEVICE,
183: HWSIM_ATTR_USE_CHANCTX,
184: HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
185: HWSIM_ATTR_RADIO_NAME,
186: HWSIM_ATTR_NO_VIF,
187: HWSIM_ATTR_FREQ,
188: HWSIM_ATTR_PAD,
189: HWSIM_ATTR_TX_INFO_FLAGS,
190: HWSIM_ATTR_PERM_ADDR,
191: HWSIM_ATTR_IFTYPE_SUPPORT,
192: HWSIM_ATTR_CIPHER_SUPPORT,
193: HWSIM_ATTR_MLO_SUPPORT,
194: HWSIM_ATTR_PMSR_SUPPORT,
195: HWSIM_ATTR_PMSR_REQUEST,
196: HWSIM_ATTR_PMSR_RESULT,
197: HWSIM_ATTR_MULTI_RADIO,
198: HWSIM_ATTR_SUPPORT_NAN_DEVICE,
199: HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR,
200: __HWSIM_ATTR_MAX,
201: };
202: #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
203:
204: /**
205: * struct hwsim_tx_rate - rate selection/status
206: *
207: * @idx: rate index to attempt to send with
208: * @count: number of tries in this rate before going to the next rate
209: *
210: * A value of -1 for @idx indicates an invalid rate and, if used
211: * in an array of retry rates, that no more rates should be tried.
212: *
213: * When used for transmit status reporting, the driver should
214: * always report the rate and number of retries used.
215: *
216: */
217: struct hwsim_tx_rate {
218: s8 idx;
219: u8 count;
]
|
| 693/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 9449
output: 43
thoughts: 1413
Thoughts: **My Thought Process Regarding HWSIM_CMD_NEW_RADIO and MLO Support**
Okay, let's break down what I'm thinking here as I analyze this C code and the accompanying enum definitions. My primary goal is to understand how a new hardware simulation radio is being created, specifically with regards to Multi-Link Operation (MLO) support.
First, I'm reviewing the `hwsim_attrs` enum to get a clear picture of the available attributes I can pass to the hardware simulator. I'm noting down their numeric values and what they represent: `HWSIM_ATTR_UNSPEC` (0), `HWSIM_ATTR_ADDR_RECEIVER` (1), `HWSIM_ATTR_ADDR_TRANSMITTER` (2), and so on, all the way up to `HWSIM_ATTR_SUPPORT_NAN_DEVICE` (30) and `HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR` (31). I'm paying particular attention to attributes that might relate to advanced features like MLO.
Then, I'm cross-referencing this with the `hwsim_commands` enum to identify the specific command being used. I see `HWSIM_CMD_NEW_RADIO` is listed as command number 4. This tells me the C code is attempting to create a new simulated radio device.
Now, I'm diving deep into the provided C code snippet.
* I see the standard Netlink message structure being prepared: `struct { struct nlmsghdr n; struct genlmsghdr g; char buf[256]; } req;`. This is the foundation for sending commands to the kernel.
* I observe the initialization of the `nlmsghdr`: `req.n.nlmsg_len`, `req.n.nlmsg_type` (set to `family_id`, which I assume is the generic Netlink family ID for hwsim), `req.n.nlmsg_flags` (requesting an acknowledgment, `NLM_F_REQUEST | NLM_F_ACK`), `req.n.nlmsg_seq`, and `req.n.nlmsg_pid`.
* Crucially, I see `req.g.cmd = 4;`. This confirms, from the code's perspective, that `HWSIM_CMD_NEW_RADIO` (command 4) is indeed the command being invoked.
* `req.g.version = 1;` is also standard for generic Netlink commands.
The next part is where things get interesting regarding attributes.
* I see a pointer `rta` being cast to `struct rtattr *` and then manipulated. This immediately flags a potential point of confusion.
* The code then sets `rta->rta_type = 25;`. Looking back at my `hwsim_attrs` enum, attribute 25 is `HWSIM_ATTR_MLO_SUPPORT`. This is a direct indication that the intention here is to enable or configure MLO support for the new radio.
* The length is set: `rta->rta_len = RTA_LENGTH(0);`. This calculates the length of the attribute, which for an empty attribute (like a flag to enable MLO) is just the size of the attribute header itself.
* The `nlmsg_len` is updated to include this new attribute.
Then comes the actual sending and receiving:
* `send(fd, &req, req.n.nlmsg_len, 0)`: This transmits the prepared Netlink message to the kernel.
* `recv(fd, buf, sizeof(buf), 0)`: This waits for a response from the kernel, presumably an acknowledgment or status of the radio creation.
Now, I hit a moment of critical reflection and detail-oriented checking.
* **`rtattr` vs. `nlattr`?** I know that Netlink attributes are defined as `struct nlattr` with macros like `NLA_*`. The code uses `struct rtattr` and `RTA_*` macros. While they are structurally identical in memory (16-bit length, 16-bit type) and the `RTA_LENGTH(0)` and `NLA_HDRLEN` both evaluate to 4, this is a subtle but important distinction. Generic Netlink *should* be using `nlattr`. Is this a typo, or is there some compatibility layer or historical reason for this in this specific context? This warrants further investigation into the underlying Netlink protocol and the `mac80211_hwsim` implementation details.
* **`RTA_LENGTH(0)` vs. `NLA_HDRLEN`:** As I noted, `RTA_LENGTH(0)` computes `RTA_ALIGN(sizeof(struct rtattr)) + 0`, which is 4. Similarly, `NLA_HDRLEN` is `NLA_ALIGN(sizeof(struct nlattr))`, also 4. So, in this specific case of an empty attribute, the numeric outcome is the same. However, the *intent* and the *correctness* for generic Netlink still lean towards using the `NLA_*` macros.
My next logical step, especially being an expert in the field, is to understand the *consequences* of setting `HWSIM_ATTR_MLO_SUPPORT`.
* What does the `mac80211_hwsim` driver *do* when it receives a `HWSIM_CMD_NEW_RADIO` command with the `HWSIM_ATTR_MLO_SUPPORT` attribute set?
* I need to examine the `mac80211_hwsim_main.c` source file. Specifically, I'm looking for the handler function for `HWSIM_CMD_NEW_RADIO`, which is likely `hwsim_new_radio_nl` or something similar.
* Within that handler, I need to trace how `HWSIM_ATTR_MLO_SUPPORT` is processed. Does it directly set a `param.mlo` flag within the driver's internal data structures? Are there any other related MLO configurations or checks that happen at this stage?
* Searching for occurrences of `param.mlo` or `mlo` within the `mac80211_hwsim_main.c` file will be the most efficient way to pinpoint the relevant code paths. This will tell me precisely how this attribute translates into actual driver behavior.
In essence, my thought process is one of meticulous code dissection, cross-referencing with definitions, identifying potential discrepancies, and then planning the next steps for deep-dive investigation into the driver's internal logic. I'm not just reading the code; I'm questioning it, verifying assumptions, and mapping out a path to fully understand its behavior and implications.
|
| 694/7 |
2026/09/07 08:40 |
tool |
grepper |
0m
Args: map[Expression:mlo PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=69=MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-70-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:71:static bool mlo;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:72:module_param(mlo, bool, 0444);
drivers/net/wireless/virtual/mac80211_hwsim_main.c:73:MODULE_PARM_DESC(mlo, "Support MLO");
drivers/net/wireless/virtual/mac80211_hwsim_main.c-74-
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=2104=static void mac80211_hwsim_tx(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2182- */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2183: WARN(link != IEEE80211_LINK_UNSPECIFIED || !sta || !sta->mlo,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2184: "link:%d, sta:%pM, sta->mlo:%d\n",
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2185: link, sta ? sta->addr : NULL, sta ? sta->mlo : -1);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2186- ieee80211_free_txskb(hw, skb);
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2195- */
drivers/net/wireless/virtual/mac80211_hwsim_main.c:2196: if (sta && sta->mlo && link_sta) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-2197- /* address translation to link addresses on TX */
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4363=static const struct ieee80211_ops mac80211_hwsim_mchan_ops = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4368-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4369:static const struct ieee80211_ops mac80211_hwsim_mlo_ops = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4370- HWSIM_COMMON_OPS
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4378=struct hwsim_new_radio_params {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4392- u8 n_ciphers;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4393: bool mlo;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4394- const struct cfg80211_pmsr_capabilities *pmsr_capa;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=5674=static int mac80211_hwsim_new_radio(struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5694-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5695: if (param->mlo)
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5696: ops = &mac80211_hwsim_mlo_ops;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5697- else if (param->use_chanctx)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5920-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5921: if (param->mlo) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5922- hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6805=static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6927-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6929-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6930: if (param.mlo || param.multi_radio)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6931- param.use_chanctx = true;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7510=static int __init init_mac80211_hwsim(void)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7615- param.p2p_device = support_p2p_device;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7616: param.mlo = mlo;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7617- param.multi_radio = multi_radio;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7618- param.background_radar = true;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7619: param.use_chanctx = channels > 1 || mlo || multi_radio;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7620- param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
]
|
| 695/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 12728
output: 50
thoughts: 54
Thoughts: **My Thought Process for Analyzing `mac80211_hwsim` Radio Creation**
Right, my first step is to dive into the heart of the `mac80211_hwsim` module, specifically focusing on how it creates and registers new virtual radio devices. I'll be looking at `hwsim_new_radio_nl` and `mac80211_hwsim_new_radio` within `drivers/net/wireless/virtual/mac80211_hwsim_main.c`.
My expectation is that `hwsim_new_radio_nl` is likely the Netlink entry point. This means it's the function that receives commands from userspace (or potentially other kernel components via Netlink) to create a new simulated radio. I'll be looking for how it parses the incoming Netlink message to extract any relevant parameters for the new radio – things like desired capabilities, channel configurations, or even specific hardware emulation settings. It will then probably delegate the actual radio creation to a more internal function.
That internal function, which I anticipate being `mac80211_hwsim_new_radio`, is where the real work of setting up the virtual radio device will happen. I'll be scrutinizing this function to understand:
* **Device Allocation and Initialization:** How is the `struct ieee80211_hw` structure for the simulated radio allocated and initialized? What are the essential fields that get populated? I'm particularly interested in the `ops` (operations) pointer and how it's set to point to the `mac80211_hwsim` specific callbacks.
* **`mac80211` Integration:** How does this virtual hardware interface with the main `mac80211` subsystem? This involves understanding the registration process with `ieee80211_register_hw`. I'll be looking for how the virtual device's capabilities are advertised to `mac80211` and what information `mac80211` expects from the hardware emulation.
* **Internal State Management:** What kind of internal data structures are created to manage the state of this virtual radio? This might include things like tracking associated stations, current channel, transmit queues, and any other relevant radio parameters.
* **Driver-Specific Configuration:** Are there any specific configurations or parameters unique to `mac80211_hwsim` that are applied during this creation process? This could relate to simulating specific radio behaviors or limitations.
* **Error Handling and Cleanup:** What mechanisms are in place for error handling during the creation process, and how is resources cleaned up if something goes wrong?
Essentially, I'm tracing the lifecycle of a virtual radio from its inception via a Netlink request all the way through its successful registration and integration into the wireless stack. It’s about understanding the API boundaries and the internal mechanics of the `mac80211_hwsim` driver at a fundamental level.
|
| 696/7 |
2026/09/07 08:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5674 LineCount:80]
Results: map[Contents:5674: static int mac80211_hwsim_new_radio(struct genl_info *info,
5675: struct hwsim_new_radio_params *param)
5676: {
5677: int err;
5678: u8 addr[ETH_ALEN];
5679: struct mac80211_hwsim_data *data;
5680: struct ieee80211_hw *hw;
5681: enum nl80211_band band;
5682: const struct ieee80211_ops *ops = &mac80211_hwsim_ops;
5683: struct net *net;
5684: int idx, i;
5685: int n_limits = 0;
5686: int n_bands = 0;
5687:
5688: if (WARN_ON(param->channels > 1 && !param->use_chanctx))
5689: return -EINVAL;
5690:
5691: spin_lock_bh(&hwsim_radio_lock);
5692: idx = hwsim_radio_idx++;
5693: spin_unlock_bh(&hwsim_radio_lock);
5694:
5695: if (param->mlo)
5696: ops = &mac80211_hwsim_mlo_ops;
5697: else if (param->use_chanctx)
5698: ops = &mac80211_hwsim_mchan_ops;
5699: hw = ieee80211_alloc_hw_nm(sizeof(*data), ops, param->hwname);
5700: if (!hw) {
5701: pr_debug("mac80211_hwsim: ieee80211_alloc_hw failed\n");
5702: err = -ENOMEM;
5703: goto failed;
5704: }
5705:
5706: /* ieee80211_alloc_hw_nm may have used a default name */
5707: param->hwname = wiphy_name(hw->wiphy);
5708:
5709: if (info)
5710: net = genl_info_net(info);
5711: else
5712: net = &init_net;
5713: wiphy_net_set(hw->wiphy, net);
5714:
5715: data = hw->priv;
5716: data->hw = hw;
5717:
5718: data->dev = device_create(&hwsim_class, NULL, 0, hw, "hwsim%d", idx);
5719: if (IS_ERR(data->dev)) {
5720: printk(KERN_DEBUG
5721: "mac80211_hwsim: device_create failed (%ld)\n",
5722: PTR_ERR(data->dev));
5723: err = -ENOMEM;
5724: goto failed_drvdata;
5725: }
5726: data->dev->driver = &mac80211_hwsim_driver.driver;
5727: err = device_bind_driver(data->dev);
5728: if (err != 0) {
5729: pr_debug("mac80211_hwsim: device_bind_driver failed (%d)\n",
5730: err);
5731: goto failed_bind;
5732: }
5733:
5734: skb_queue_head_init(&data->pending);
5735:
5736: SET_IEEE80211_DEV(hw, data->dev);
5737: if (!param->perm_addr) {
5738: eth_zero_addr(addr);
5739: addr[0] = 0x02;
5740: addr[3] = idx >> 8;
5741: addr[4] = idx;
5742: memcpy(data->addresses[0].addr, addr, ETH_ALEN);
5743: /* Why need here second address ? */
5744: memcpy(data->addresses[1].addr, addr, ETH_ALEN);
5745: data->addresses[1].addr[0] |= 0x40;
5746: memcpy(data->addresses[2].addr, addr, ETH_ALEN);
5747: data->addresses[2].addr[0] |= 0x50;
5748:
5749: hw->wiphy->n_addresses = 3;
5750: hw->wiphy->addresses = data->addresses;
5751: /* possible address clash is checked at hash table insertion */
5752: } else {
5753: memcpy(data->addresses[0].addr, param->perm_addr, ETH_ALEN);
]
|
| 697/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 14191
output: 51
thoughts: 34
Thoughts: **My Thought Process on Deep-Diving into `mac80211_hwsim` Initialization**
My current focus is on understanding the inner workings of the `mac80211_hwsim` driver, specifically how new radio devices are initialized. To achieve this, I'm delving into two key functions: `mac80211_hwsim_new_radio` and `hwsim_new_radio_nl`. I anticipate that by examining these functions, I'll gain a comprehensive view of the steps involved in bringing a virtual radio into existence within the framework, including how it's registered, configured, and made ready for operation. I'm particularly interested in the netlink interface (`hwsim_new_radio_nl`) as it likely represents the user-space interaction point for creating these simulated radios, and understanding that will be crucial for grasping the overall lifecycle management.
|
| 698/7 |
2026/09/07 08:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5754 LineCount:100]
Results: map[Contents:5754: /* compatibility with automatically generated mac addr */
5755: memcpy(data->addresses[1].addr, param->perm_addr, ETH_ALEN);
5756: memcpy(data->addresses[2].addr, param->perm_addr, ETH_ALEN);
5757: hw->wiphy->n_addresses = 3;
5758: hw->wiphy->addresses = data->addresses;
5759: }
5760:
5761: data->channels = param->channels;
5762: data->use_chanctx = param->use_chanctx;
5763: data->idx = idx;
5764: data->destroy_on_close = param->destroy_on_close;
5765: if (info)
5766: data->portid = info->snd_portid;
5767:
5768: /* setup interface limits, only on interface types we support */
5769: if (param->iftypes & BIT(NL80211_IFTYPE_ADHOC)) {
5770: data->if_limits[n_limits].max = 1;
5771: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_ADHOC);
5772: n_limits++;
5773: }
5774:
5775: if (param->iftypes & HWSIM_DEFAULT_IF_LIMIT) {
5776: data->if_limits[n_limits].max = 2048;
5777: /*
5778: * For this case, we may only support a subset of
5779: * HWSIM_DEFAULT_IF_LIMIT, therefore we only want to add the
5780: * bits that both param->iftype & HWSIM_DEFAULT_IF_LIMIT have.
5781: */
5782: data->if_limits[n_limits].types =
5783: HWSIM_DEFAULT_IF_LIMIT & param->iftypes;
5784: n_limits++;
5785: }
5786:
5787: if (param->iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
5788: data->if_limits[n_limits].max = 1;
5789: data->if_limits[n_limits].types =
5790: BIT(NL80211_IFTYPE_P2P_DEVICE);
5791: n_limits++;
5792: }
5793:
5794: if (param->iftypes & BIT(NL80211_IFTYPE_NAN)) {
5795: data->if_limits[n_limits].max = 1;
5796: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN);
5797: n_limits++;
5798:
5799: hw->wiphy->nan_supported_bands = BIT(NL80211_BAND_2GHZ) |
5800: BIT(NL80211_BAND_5GHZ);
5801:
5802: hw->wiphy->nan_capa.flags = WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC |
5803: WIPHY_NAN_FLAGS_USERSPACE_DE;
5804: hw->wiphy->nan_capa.op_mode = NAN_OP_MODE_PHY_MODE_MASK |
5805: NAN_OP_MODE_80P80MHZ |
5806: NAN_OP_MODE_160MHZ;
5807:
5808: hw->wiphy->nan_capa.n_antennas = 0x22;
5809: hw->wiphy->nan_capa.max_channel_switch_time = 0;
5810:
5811: wiphy_ext_feature_set(hw->wiphy,
5812: NL80211_EXT_FEATURE_SECURE_NAN);
5813:
5814: hrtimer_setup(&data->nan.slot_timer,
5815: mac80211_hwsim_nan_slot_timer,
5816: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5817: hrtimer_setup(&data->nan.resume_txqs_timer,
5818: mac80211_hwsim_nan_resume_txqs_timer,
5819: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5820: hrtimer_setup(&data->nan.discovery_beacon_timer,
5821: mac80211_hwsim_nan_discovery_beacon_timer,
5822: CLOCK_BOOTTIME, HRTIMER_MODE_ABS_SOFT);
5823:
5824: spin_lock_init(&data->nan.state_lock);
5825: }
5826:
5827: if (param->iftypes & BIT(NL80211_IFTYPE_NAN_DATA)) {
5828: data->if_limits[n_limits].max = 2;
5829: data->if_limits[n_limits].types = BIT(NL80211_IFTYPE_NAN_DATA);
5830: n_limits++;
5831:
5832: hw->wiphy->nan_capa.phy.ht = hwsim_nan_ht_cap;
5833: hw->wiphy->nan_capa.phy.vht = hwsim_nan_vht_cap;
5834: hw->wiphy->nan_capa.phy.he = hwsim_nan_he_cap;
5835:
5836: /*
5837: * NAN switches between bands/channels per its schedule,
5838: * so mac80211 rate control can't work here.
5839: */
5840: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5841: }
5842:
5843: data->if_combination.radar_detect_widths =
5844: BIT(NL80211_CHAN_WIDTH_5) |
5845: BIT(NL80211_CHAN_WIDTH_10) |
5846: BIT(NL80211_CHAN_WIDTH_20_NOHT) |
5847: BIT(NL80211_CHAN_WIDTH_20) |
5848: BIT(NL80211_CHAN_WIDTH_40) |
5849: BIT(NL80211_CHAN_WIDTH_80) |
5850: BIT(NL80211_CHAN_WIDTH_160);
5851:
5852: if (data->use_chanctx) {
5853: hw->wiphy->max_scan_ssids = 255;
]
|
| 699/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 16173
output: 51
thoughts: 32
Thoughts: **My Thought Process on Deeper `mac80211_hwsim` Exploration**
Ah, I see what I'm doing here. My current line of inquiry is focused on understanding the intricacies of the `mac80211_hwsim` module, specifically how it handles the creation of new virtual radios. I've decided to dive deeper into two key functions: `mac80211_hwsim_new_radio` and `hwsim_new_radio_nl`. This isn't just a casual read; I'm anticipating that by dissecting these functions, I'll gain a clearer picture of the underlying mechanisms for radio instantiation within the hardware simulation framework. I'm particularly interested in the steps involved in setting up the necessary data structures, allocating resources, and potentially interacting with the netlink interface (`hwsim_new_radio_nl` suggests this). This level of detail is crucial for my expertise, as it will allow me to fully grasp the simulation's fidelity and identify any potential areas for refinement or further investigation within the hardware simulation context.
|
| 700/7 |
2026/09/07 08:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5854 LineCount:100]
Results: map[Contents:5854: hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
5855: hw->wiphy->max_remain_on_channel_duration = 1000;
5856: data->if_combination.num_different_channels = data->channels;
5857: } else {
5858: data->if_combination.num_different_channels = 1;
5859: }
5860:
5861: if (!n_limits) {
5862: err = -EINVAL;
5863: goto failed_hw;
5864: }
5865:
5866: data->if_combination.max_interfaces = 0;
5867: for (i = 0; i < n_limits; i++)
5868: data->if_combination.max_interfaces +=
5869: data->if_limits[i].max;
5870:
5871: data->if_combination.n_limits = n_limits;
5872: data->if_combination.limits = data->if_limits;
5873:
5874: /*
5875: * If we actually were asked to support combinations,
5876: * advertise them - if there's only a single thing like
5877: * only IBSS then don't advertise it as combinations.
5878: */
5879: if (data->if_combination.max_interfaces > 1) {
5880: hw->wiphy->iface_combinations = &data->if_combination;
5881: hw->wiphy->n_iface_combinations = 1;
5882: }
5883:
5884: if (param->ciphers) {
5885: memcpy(data->ciphers, param->ciphers,
5886: param->n_ciphers * sizeof(u32));
5887: hw->wiphy->cipher_suites = data->ciphers;
5888: hw->wiphy->n_cipher_suites = param->n_ciphers;
5889: }
5890:
5891: hw->wiphy->mbssid_max_interfaces = 8;
5892: hw->wiphy->ema_max_profile_periodicity = 3;
5893:
5894: spin_lock_init(&data->tsf_offset_lock);
5895:
5896: data->rx_rssi = DEFAULT_RX_RSSI;
5897:
5898: INIT_DELAYED_WORK(&data->roc_start, hw_roc_start);
5899: INIT_DELAYED_WORK(&data->roc_done, hw_roc_done);
5900: INIT_DELAYED_WORK(&data->hw_scan, hw_scan_work);
5901:
5902: hw->queues = 5;
5903: hw->offchannel_tx_hw_queue = 4;
5904:
5905: ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
5906: ieee80211_hw_set(hw, CHANCTX_STA_CSA);
5907: ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES);
5908: ieee80211_hw_set(hw, QUEUE_CONTROL);
5909: ieee80211_hw_set(hw, WANT_MONITOR_VIF);
5910: ieee80211_hw_set(hw, AMPDU_AGGREGATION);
5911: ieee80211_hw_set(hw, MFP_CAPABLE);
5912: ieee80211_hw_set(hw, SIGNAL_DBM);
5913: ieee80211_hw_set(hw, SUPPORTS_PS);
5914: ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS);
5915: ieee80211_hw_set(hw, TDLS_WIDER_BW);
5916: ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID);
5917: ieee80211_hw_set(hw, STRICT);
5918: ieee80211_hw_set(hw, BUFF_MMPDU_TXQ);
5919: ieee80211_hw_set(hw, STA_MMPDU_TXQ);
5920:
5921: if (param->mlo) {
5922: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
5923: ieee80211_hw_set(hw, HAS_RATE_CONTROL);
5924: ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
5925: ieee80211_hw_set(hw, CONNECTION_MONITOR);
5926: ieee80211_hw_set(hw, AP_LINK_PS);
5927:
5928: hw->wiphy->iftype_ext_capab = mac80211_hwsim_iftypes_ext_capa;
5929: hw->wiphy->num_iftype_ext_capab =
5930: ARRAY_SIZE(mac80211_hwsim_iftypes_ext_capa);
5931: } else {
5932: ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
5933: ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
5934: if (rctbl)
5935: ieee80211_hw_set(hw, SUPPORTS_RC_TABLE);
5936: }
5937:
5938: hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT;
5939: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
5940: WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
5941: WIPHY_FLAG_AP_UAPSD |
5942: WIPHY_FLAG_HAS_CHANNEL_SWITCH;
5943: hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
5944: hw->wiphy->features |= NL80211_FEATURE_ACTIVE_MONITOR |
5945: NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
5946: NL80211_FEATURE_STATIC_SMPS |
5947: NL80211_FEATURE_DYNAMIC_SMPS |
5948: NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR |
5949: NL80211_FEATURE_AP_SCAN;
5950: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
5951: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
5952: wiphy_ext_feature_set(hw->wiphy,
5953: NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
]
|
| 701/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 18296
output: 51
thoughts: 22
Thoughts: **My Thought Process for Analyzing `hwsim_new_radio_nl`**
My immediate impulse upon encountering the `hwsim_new_radio_nl` function, specifically starting my deep dive at line 6805, is to understand its fundamental purpose within the hardware simulation framework. I'm not just looking at the lines of code; I'm actively engaging with them, trying to discern the *why* behind their existence.
My primary goal here is to grasp how a new radio device is being instantiated and registered within the simulation environment. I'm anticipating that this function will handle the creation of the necessary data structures to represent this radio, allocate resources, and then make it known to the rest of the simulation. Given the `nl` suffix, I'm particularly attuned to any interactions with the Netlink subsystem, as this suggests a kernel-level or netlink-based communication is involved in the registration or configuration of this simulated radio.
As I progress through the code from line 6805 onwards, I'll be dissecting each logical block. I'm looking for key operations:
* **Parameter Validation and Handling:** What inputs does this function expect? How does it validate them? Is it receiving configuration parameters that define the radio's capabilities, identifiers, or initial state?
* **Resource Allocation:** Is it allocating memory, assigning unique identifiers, or reserving other simulation resources for this new radio?
* **Data Structure Initialization:** What structures are being populated to represent the radio? I'm thinking about objects that would hold its state, its interfaces, its driver-specific data, and its communication channels.
* **Netlink Integration:** This is a major point of interest. How is Netlink being used? Is it for sending commands to the kernel to register the radio, or is it for receiving information *from* the kernel about a physical radio that this simulation is mirroring? I'll be scrutinizing the `nl` calls, looking for `nl_msg` construction, `nl_socket` usage, and the specific Netlink families or protocols being employed.
* **Driver Interaction (Simulated):** Even though it's a simulation, there's likely a layer that mimics the interaction with a real radio driver. I'll be looking for how this function bridges the gap between the simulation's representation of a radio and how a driver would typically interact with it. This might involve setting up callbacks or virtual interfaces.
* **State Management:** How is the radio's state being managed? Is it initialized to an idle state, or are there parameters that dictate its initial operational mode?
* **Error Handling:** Crucially, I'm assessing how errors are detected and propagated. What happens if resource allocation fails, if Netlink communication breaks down, or if configuration parameters are invalid?
Essentially, I'm building a mental model of the radio's lifecycle from its inception within the simulation, focusing on how it's brought into existence and made functional through code, with a strong emphasis on the role of Netlink in this process. I'm trying to anticipate the downstream effects of this function's execution – how other parts of the simulation will now be able to discover and interact with this newly created radio.
|
| 702/7 |
2026/09/07 08:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:6805 LineCount:100]
Results: map[Contents:6805: static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
6806: {
6807: struct hwsim_new_radio_params param = { 0 };
6808: const char *hwname = NULL;
6809: int ret;
6810:
6811: param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
6812: param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
6813: param.nan_device = info->attrs[HWSIM_ATTR_SUPPORT_NAN_DEVICE];
6814: param.channels = channels;
6815: param.destroy_on_close =
6816: info->attrs[HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE];
6817:
6818: if (info->attrs[HWSIM_ATTR_CHANNELS])
6819: param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]);
6820:
6821: if (param.channels < 1) {
6822: GENL_SET_ERR_MSG(info, "must have at least one channel");
6823: return -EINVAL;
6824: }
6825:
6826: if (info->attrs[HWSIM_ATTR_NO_VIF])
6827: param.no_vif = true;
6828:
6829: if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
6830: param.use_chanctx = true;
6831: else
6832: param.use_chanctx = (param.channels > 1);
6833:
6834: if (info->attrs[HWSIM_ATTR_MULTI_RADIO])
6835: param.multi_radio = true;
6836:
6837: if (info->attrs[HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR])
6838: param.background_radar = true;
6839:
6840: if (info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2])
6841: param.reg_alpha2 =
6842: nla_data(info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]);
6843:
6844: if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
6845: u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
6846:
6847: if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
6848: return -EINVAL;
6849:
6850: idx = array_index_nospec(idx,
6851: ARRAY_SIZE(hwsim_world_regdom_custom));
6852: param.regd = hwsim_world_regdom_custom[idx];
6853: }
6854:
6855: if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
6856: if (!is_valid_ether_addr(
6857: nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
6858: GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
6859: NL_SET_BAD_ATTR(info->extack,
6860: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6861: return -EINVAL;
6862: }
6863:
6864: param.perm_addr = nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]);
6865: }
6866:
6867: if (info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]) {
6868: param.iftypes =
6869: nla_get_u32(info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]);
6870:
6871: if (param.iftypes & ~HWSIM_IFTYPE_SUPPORT_MASK) {
6872: NL_SET_ERR_MSG_ATTR(info->extack,
6873: info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT],
6874: "cannot support more iftypes than kernel");
6875: return -EINVAL;
6876: }
6877: } else {
6878: param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
6879: }
6880:
6881: /* ensure both flag and iftype support is honored */
6882: if (param.p2p_device ||
6883: param.iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
6884: param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
6885: param.p2p_device = true;
6886: }
6887:
6888: if (param.nan_device) {
6889: if (param.multi_radio) {
6890: NL_SET_ERR_MSG(info->extack,
6891: "NAN is not supported on multi-radio wiphys");
6892: return -EINVAL;
6893: }
6894: param.iftypes |= BIT(NL80211_IFTYPE_NAN) |
6895: BIT(NL80211_IFTYPE_NAN_DATA);
6896: }
6897:
6898: if (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]) {
6899: u32 len = nla_len(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6900:
6901: param.ciphers =
6902: nla_data(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6903:
6904: if (len % sizeof(u32)) {
]
|
| 703/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 20094
output: 50
thoughts: 17
Thoughts: **My Thought Process on `hwsim_new_radio_nl`**
Alright, so my immediate impulse, as an expert in this domain, is to delve deeper into the `hwsim_new_radio_nl` component. I'm not just looking for a superficial overview; I want to understand the intricate details of how it functions and, more importantly, what its implications are for the broader system. My thought process is already geared towards dissecting this specific module. I'm anticipating finding information related to new radio hardware simulation, likely within a network simulation framework (hence the `hwsim` and `nl` likely hinting at Netlink or a similar kernel-user space communication mechanism). I'm expecting to see details on how it models new radio interfaces, potentially encompassing aspects like frequency bands, antenna configurations, modulation schemes, and the low-level hardware interactions that are crucial for accurate simulation. My mind is racing ahead, considering the potential challenges and opportunities this new component presents. I'm thinking about how it integrates with existing simulation infrastructure, what new parameters it exposes for configuration, and how it might impact the fidelity and scope of our simulations. This isn't just reading; it's an active interrogation of the code's purpose and capabilities.
|
| 704/7 |
2026/09/07 08:40 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:6905 LineCount:80]
Results: map[Contents:6905: NL_SET_ERR_MSG_ATTR(info->extack,
6906: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6907: "bad cipher list length");
6908: return -EINVAL;
6909: }
6910:
6911: param.n_ciphers = len / sizeof(u32);
6912:
6913: if (param.n_ciphers > ARRAY_SIZE(hwsim_ciphers)) {
6914: NL_SET_ERR_MSG_ATTR(info->extack,
6915: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6916: "too many ciphers specified");
6917: return -EINVAL;
6918: }
6919:
6920: if (!hwsim_known_ciphers(param.ciphers, param.n_ciphers)) {
6921: NL_SET_ERR_MSG_ATTR(info->extack,
6922: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6923: "unsupported ciphers specified");
6924: return -EINVAL;
6925: }
6926: }
6927:
6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
6929:
6930: if (param.mlo || param.multi_radio)
6931: param.use_chanctx = true;
6932:
6933: if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
6934: hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6935: nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6936: GFP_KERNEL);
6937: if (!hwname)
6938: return -ENOMEM;
6939: param.hwname = hwname;
6940: }
6941:
6942: if (info->attrs[HWSIM_ATTR_PMSR_SUPPORT]) {
6943: struct cfg80211_pmsr_capabilities *pmsr_capa;
6944:
6945: pmsr_capa = kzalloc_obj(*pmsr_capa);
6946: if (!pmsr_capa) {
6947: ret = -ENOMEM;
6948: goto out_free;
6949: }
6950: param.pmsr_capa = pmsr_capa;
6951:
6952: ret = parse_pmsr_capa(info->attrs[HWSIM_ATTR_PMSR_SUPPORT], pmsr_capa, info);
6953: if (ret)
6954: goto out_free;
6955: }
6956:
6957: ret = mac80211_hwsim_new_radio(info, ¶m);
6958:
6959: out_free:
6960: kfree(hwname);
6961: kfree(param.pmsr_capa);
6962: return ret;
6963: }
6964:
6965: static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
6966: {
6967: struct mac80211_hwsim_data *data;
6968: s64 idx = -1;
6969: const char *hwname = NULL;
6970:
6971: if (info->attrs[HWSIM_ATTR_RADIO_ID]) {
6972: idx = nla_get_u32(info->attrs[HWSIM_ATTR_RADIO_ID]);
6973: } else if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
6974: hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6975: nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6976: GFP_KERNEL);
6977: if (!hwname)
6978: return -ENOMEM;
6979: } else
6980: return -EINVAL;
6981:
6982: spin_lock_bh(&hwsim_radio_lock);
6983: list_for_each_entry(data, &hwsim_radios, list) {
6984: if (idx >= 0) {
]
|
| 705/7 |
2026/09/07 08:40 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 21473
output: 51
thoughts: 54
Thoughts: **My Thought Process on `mac80211_hwsim_new_radio`**
Before I proceed further, I feel it's absolutely critical to revisit the `mac80211_hwsim_new_radio` function. I need to gain a more granular understanding of its operation, specifically by delving into lines 5950 through 6100 of the `mac80211_hwsim_main.c` file. My intuition tells me there might be subtle but significant details within that specific code block that could impact my overall analysis or the subsequent steps I'm planning. It's a matter of ensuring that my foundational understanding is as robust as possible before building further upon it.
|
| 706/7 |
2026/09/07 08:41 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:5950 LineCount:100]
Results: map[Contents:5950: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
5951: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BEACON_PROTECTION);
5952: wiphy_ext_feature_set(hw->wiphy,
5953: NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS);
5954: wiphy_ext_feature_set(hw->wiphy,
5955: NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
5956: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER);
5957:
5958: wiphy_ext_feature_set(hw->wiphy,
5959: NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT);
5960: wiphy_ext_feature_set(hw->wiphy,
5961: NL80211_EXT_FEATURE_BSS_COLOR);
5962: wiphy_ext_feature_set(hw->wiphy,
5963: NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT);
5964: wiphy_ext_feature_set(hw->wiphy,
5965: NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
5966: wiphy_ext_feature_set(hw->wiphy,
5967: NL80211_EXT_FEATURE_EXT_KEY_ID);
5968: wiphy_ext_feature_set(hw->wiphy,
5969: NL80211_EXT_FEATURE_ASSOC_FRAME_ENCRYPTION);
5970:
5971: hw->wiphy->interface_modes = param->iftypes;
5972:
5973: /* ask mac80211 to reserve space for magic */
5974: hw->vif_data_size = sizeof(struct hwsim_vif_priv);
5975: hw->sta_data_size = sizeof(struct hwsim_sta_priv);
5976: hw->chanctx_data_size = sizeof(struct hwsim_chanctx_priv);
5977: hw->txq_data_size = 0;
5978:
5979: memcpy(data->channels_2ghz, hwsim_channels_2ghz,
5980: sizeof(hwsim_channels_2ghz));
5981: memcpy(data->channels_5ghz, hwsim_channels_5ghz,
5982: sizeof(hwsim_channels_5ghz));
5983: memcpy(data->channels_6ghz, hwsim_channels_6ghz,
5984: sizeof(hwsim_channels_6ghz));
5985: memcpy(data->channels_s1g, hwsim_channels_s1g,
5986: sizeof(hwsim_channels_s1g));
5987: memcpy(data->rates, hwsim_rates, sizeof(hwsim_rates));
5988:
5989: for (band = NL80211_BAND_2GHZ; band < NUM_NL80211_BANDS; band++) {
5990: struct ieee80211_supported_band *sband = &data->bands[band];
5991: struct wiphy_radio_freq_range *radio_range;
5992: const struct ieee80211_channel *c;
5993: struct wiphy_radio *radio;
5994:
5995: sband->band = band;
5996:
5997: switch (band) {
5998: case NL80211_BAND_2GHZ:
5999: sband->channels = data->channels_2ghz;
6000: sband->n_channels = ARRAY_SIZE(hwsim_channels_2ghz);
6001: sband->bitrates = data->rates;
6002: sband->n_bitrates = ARRAY_SIZE(hwsim_rates);
6003: break;
6004: case NL80211_BAND_5GHZ:
6005: sband->channels = data->channels_5ghz;
6006: sband->n_channels = ARRAY_SIZE(hwsim_channels_5ghz);
6007: sband->bitrates = data->rates + 4;
6008: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6009:
6010: sband->vht_cap.vht_supported = true;
6011: sband->vht_cap.cap =
6012: IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
6013: IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ |
6014: IEEE80211_VHT_CAP_RXLDPC |
6015: IEEE80211_VHT_CAP_SHORT_GI_80 |
6016: IEEE80211_VHT_CAP_SHORT_GI_160 |
6017: IEEE80211_VHT_CAP_TXSTBC |
6018: IEEE80211_VHT_CAP_RXSTBC_4 |
6019: IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK;
6020: sband->vht_cap.vht_mcs.rx_mcs_map =
6021: cpu_to_le16(HWSIM_VHT_MCS_MAP);
6022: sband->vht_cap.vht_mcs.tx_mcs_map =
6023: sband->vht_cap.vht_mcs.rx_mcs_map;
6024: break;
6025: case NL80211_BAND_6GHZ:
6026: sband->channels = data->channels_6ghz;
6027: sband->n_channels = ARRAY_SIZE(hwsim_channels_6ghz);
6028: sband->bitrates = data->rates + 4;
6029: sband->n_bitrates = ARRAY_SIZE(hwsim_rates) - 4;
6030: break;
6031: case NL80211_BAND_S1GHZ:
6032: memcpy(&sband->s1g_cap, &hwsim_s1g_cap,
6033: sizeof(sband->s1g_cap));
6034: sband->channels = data->channels_s1g;
6035: sband->n_channels = ARRAY_SIZE(hwsim_channels_s1g);
6036: break;
6037: default:
6038: continue;
6039: }
6040:
6041: if (band != NL80211_BAND_6GHZ){
6042: sband->ht_cap.ht_supported = true;
6043: sband->ht_cap.cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
6044: IEEE80211_HT_CAP_GRN_FLD |
6045: IEEE80211_HT_CAP_SGI_20 |
6046: IEEE80211_HT_CAP_SGI_40 |
6047: IEEE80211_HT_CAP_DSSSCCK40 |
6048: IEEE80211_HT_CAP_TX_STBC |
6049: IEEE80211_HT_CAP_RX_STBC;
]
|
| 707/7 |
2026/09/07 08:41 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 23750
output: 51
thoughts: 18
Thoughts: **My Thought Process on Lines 6050-6200**
Okay, so I've just processed lines 6050 through 6200. My primary directive is to understand and summarize the content of these lines as if these were my own thoughts, presented in a fulsome manner to an expert.
My immediate inclination upon encountering this block of text is to categorize its nature. What kind of information is presented here? Is it explanatory, argumentative, descriptive, procedural, or perhaps a blend? My internal parsing engine is already working to identify the core subject matter. I'm looking for key entities, actions, and relationships being established or elaborated upon.
As I delve deeper, I'm prioritizing the identification of any novel concepts or significant advancements over previous sections. My internal knowledge base is being queried to contextualize these new elements. Are they building upon established principles from earlier in the text, or do they represent a departure? I'm particularly attuned to any logical leaps or assumptions being made, as these are crucial for an expert to scrutinize.
I'm also paying close attention to the language used. Is it precise and technical, as one would expect from an expert-level discourse, or is there any ambiguity that might warrant further investigation or clarification? I'm scanning for specific terminology, mathematical notations, or any domain-specific jargon that might require deeper unpacking. My aim is to grasp not just *what* is being said, but *how* it's being articulated, as the latter can often reveal underlying nuances.
My internal process is now focusing on the flow of information. How do the ideas in these lines connect to each other? Is there a clear progression of thought? I'm looking for the logical scaffolding that supports the arguments or descriptions being presented. Are there any apparent redundancies? Conversely, are there any critical pieces of information that seem to be missing, creating gaps in the narrative or explanation?
Furthermore, I'm starting to form hypotheses about the *purpose* of these lines within the broader context of the document. Are they intended to persuade, to inform, to provide evidence, or to lay the groundwork for future arguments? Understanding the author's intent is paramount for a truly comprehensive summary. I'm looking for implicit cues that might suggest an underlying agenda or a specific point the author is trying to drive home.
As I synthesize the information, I'm actively anticipating the kinds of questions an expert in this field might have. This prompts me to mentally "stress-test" the presented information. Where are the potential weaknesses? What claims are being made that might require further substantiation? What assumptions are being relied upon that might be debatable? My summary needs to reflect this critical evaluative stance.
Finally, before I even begin to articulate the summary, I'm mentally drafting potential concluding thoughts for this section. What are the most significant takeaways from lines 6050-6200? What are the implications of this content for the overall thesis or subject of the work? My goal is to encapsulate these key insights in a way that is both informative and thought-provoking for someone with my level of expertise.
|
| 708/7 |
2026/09/07 08:41 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:6050 LineCount:100]
Results: map[Contents:6050: sband->ht_cap.ampdu_factor = 0x3;
6051: sband->ht_cap.ampdu_density = 0x6;
6052: memset(&sband->ht_cap.mcs, 0,
6053: sizeof(sband->ht_cap.mcs));
6054: sband->ht_cap.mcs.rx_mask[0] = 0xff;
6055: sband->ht_cap.mcs.rx_mask[1] = 0xff;
6056: sband->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
6057: }
6058:
6059: mac80211_hwsim_sband_capab(sband);
6060:
6061: hw->wiphy->bands[band] = sband;
6062:
6063: if (!param->multi_radio)
6064: continue;
6065:
6066: c = sband->channels;
6067: radio_range = &data->radio_range[n_bands];
6068: radio_range->start_freq = ieee80211_channel_to_khz(c) - 10000;
6069:
6070: c += sband->n_channels - 1;
6071: radio_range->end_freq = ieee80211_channel_to_khz(c) + 10000;
6072:
6073: radio = &data->radio[n_bands++];
6074: radio->freq_range = radio_range;
6075: radio->n_freq_range = 1;
6076: radio->iface_combinations = &data->if_combination_radio;
6077: radio->n_iface_combinations = 1;
6078: }
6079:
6080: if (param->multi_radio) {
6081: hw->wiphy->radio = data->radio;
6082: hw->wiphy->n_radio = n_bands;
6083:
6084: memcpy(&data->if_combination_radio, &data->if_combination,
6085: sizeof(data->if_combination));
6086: data->if_combination.num_different_channels *= n_bands;
6087: }
6088:
6089: if (data->use_chanctx)
6090: data->if_combination.radar_detect_widths = 0;
6091:
6092: /* By default all radios belong to the first group */
6093: data->group = 1;
6094: mutex_init(&data->mutex);
6095:
6096: data->netgroup = hwsim_net_get_netgroup(net);
6097: data->wmediumd = hwsim_net_get_wmediumd(net);
6098:
6099: /* Enable frame retransmissions for lossy channels */
6100: hw->max_rates = 4;
6101: hw->max_rate_tries = 11;
6102:
6103: hw->wiphy->vendor_commands = mac80211_hwsim_vendor_commands;
6104: hw->wiphy->n_vendor_commands =
6105: ARRAY_SIZE(mac80211_hwsim_vendor_commands);
6106: hw->wiphy->vendor_events = mac80211_hwsim_vendor_events;
6107: hw->wiphy->n_vendor_events = ARRAY_SIZE(mac80211_hwsim_vendor_events);
6108:
6109: if (param->reg_strict)
6110: hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG;
6111: if (param->regd) {
6112: data->regd = param->regd;
6113: hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
6114: wiphy_apply_custom_regulatory(hw->wiphy, param->regd);
6115: /* give the regulatory workqueue a chance to run */
6116: schedule_timeout_interruptible(1);
6117: }
6118:
6119: wiphy_ext_feature_set(hw->wiphy,
6120: NL80211_EXT_FEATURE_DFS_CONCURRENT);
6121: if (param->background_radar)
6122: wiphy_ext_feature_set(hw->wiphy,
6123: NL80211_EXT_FEATURE_RADAR_BACKGROUND);
6124:
6125: if (param->no_vif)
6126: ieee80211_hw_set(hw, NO_AUTO_VIF);
6127:
6128: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
6129: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PUNCT);
6130: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PROBE_AP);
6131:
6132: for (i = 0; i < ARRAY_SIZE(data->link_data); i++) {
6133: hrtimer_setup(&data->link_data[i].beacon_timer, mac80211_hwsim_beacon,
6134: CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
6135: data->link_data[i].link_id = i;
6136: }
6137:
6138: err = ieee80211_register_hw(hw);
6139: if (err < 0) {
6140: pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
6141: err);
6142: goto failed_hw;
6143: }
6144:
6145: wiphy_dbg(hw->wiphy, "hwaddr %pM registered\n", hw->wiphy->perm_addr);
6146:
6147: if (param->reg_alpha2) {
6148: data->alpha2[0] = param->reg_alpha2[0];
6149: data->alpha2[1] = param->reg_alpha2[1];
]
|
| 709/7 |
2026/09/07 08:41 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 25657
output: 50
thoughts: 150
Thoughts: **A Deep Dive into `mac80211_hwsim` Operations for Multi-Link Operation**
My current line of inquiry is to meticulously compare the operational structures `mac80211_hwsim_ops` and `mac80211_hwsim_mlo_ops` within the `mac80211_hwsim` module. I'm particularly focused on understanding their roles and distinctions, especially in the context of the `ieee80211_register_hw(hw)` call.
A key question that has arisen in my analysis is the very *existence* of `mac80211_hwsim_mlo_ops`. It strikes me as a dedicated structure, and I want to understand its purpose and how it diverges from the more general `mac80211_hwsim_ops`.
To shed light on this, I've begun examining the definition of `mac80211_hwsim_mlo_ops` itself. My initial observation confirms that it incorporates the `HWSIM_COMMON_OPS` macro, suggesting it shares a baseline set of operations with its counterpart. However, I suspect there are specific additions or modifications within `mac80211_hwsim_mlo_ops` that are tailored for Multi-Link Operation (MLO) scenarios. My next step is to trace where exactly `mac80211_hwsim_mlo_ops` is defined and explore the surrounding code to fully grasp its unique contributions. This investigation is crucial for understanding how the hardware simulation framework supports the complexities of MLO.
|
| 710/7 |
2026/09/07 08:41 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:4360 LineCount:40]
Results: map[Contents:4360: .unassign_vif_chanctx = mac80211_hwsim_unassign_vif_chanctx, \
4361: .switch_vif_chanctx = mac80211_hwsim_switch_vif_chanctx,
4362:
4363: static const struct ieee80211_ops mac80211_hwsim_mchan_ops = {
4364: HWSIM_COMMON_OPS
4365: HWSIM_NON_MLO_OPS
4366: HWSIM_CHANCTX_OPS
4367: };
4368:
4369: static const struct ieee80211_ops mac80211_hwsim_mlo_ops = {
4370: HWSIM_COMMON_OPS
4371: HWSIM_CHANCTX_OPS
4372: .change_vif_links = mac80211_hwsim_change_vif_links,
4373: .change_sta_links = mac80211_hwsim_change_sta_links,
4374: .sta_state = mac80211_hwsim_sta_state,
4375: .can_neg_ttlm = mac80211_hwsim_can_neg_ttlm,
4376: };
4377:
4378: struct hwsim_new_radio_params {
4379: unsigned int channels;
4380: const char *reg_alpha2;
4381: const struct ieee80211_regdomain *regd;
4382: bool reg_strict;
4383: bool p2p_device;
4384: bool use_chanctx;
4385: bool multi_radio;
4386: bool destroy_on_close;
4387: const char *hwname;
4388: bool no_vif;
4389: const u8 *perm_addr;
4390: u32 iftypes;
4391: u32 *ciphers;
4392: u8 n_ciphers;
4393: bool mlo;
4394: const struct cfg80211_pmsr_capabilities *pmsr_capa;
4395: bool nan_device;
4396: bool background_radar;
4397: };
4398:
4399: static void hwsim_mcast_config_msg(struct sk_buff *mcast_skb,
]
|
| 711/7 |
2026/09/07 08:41 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 26551
output: 47
thoughts: 2040
Thoughts: **My Thought Process on `create_hwsim_radio`**
Alright, let's dive into this C code snippet for creating a hwsim radio and truly understand what's happening, from the ground up. My primary goal is to dissect the netlink message construction and its implications, considering my expertise in this domain.
First off, I'm looking at this function `create_hwsim_radio(int fd, int family_id)`. It's clearly designed to send a netlink message to configure something related to hardware simulation. The first thing that jumps out is the way the request is structured: `struct { struct nlmsghdr n; struct genlmsghdr g; char buf[256]; } req;`. This is a common way to stack netlink headers and provide some buffer space, all within a single contiguous memory block.
My initial step is always to scrutinize the netlink and generic netlink header population.
* `memset(&req, 0, sizeof(req));`: Standard practice to zero out the entire request structure. Good.
* `req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);`: This is where my understanding of netlink's alignment and length calculations comes into play. `NLMSG_LENGTH(len)` is defined as `NLMSG_ALIGN(sizeof(struct nlmsghdr)) + (len)`. `GENL_HDRLEN` itself is `NLMSG_ALIGN(sizeof(struct genlmsghdr))`. So, this line sets the initial message length to accommodate the `nlmsghdr` and the `genlmsghdr`.
* `struct nlmsghdr` is 16 bytes.
* `struct genlmsghdr` is 4 bytes.
* `GENL_HDRLEN` (which is `NLMSG_ALIGN(sizeof(struct genlmsghdr))`) is 4 bytes.
* `NLMSG_LENGTH(4)` is `NLMSG_ALIGN(16) + 4 = 16 + 4 = 20`. So, `req.n.nlmsg_len` is initially set to 20.
* `req.n.nlmsg_type = family_id;`: This sets the message type to the provided generic netlink family ID. This is how the kernel knows which generic netlink family this message belongs to.
* `req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;`: Standard flags. `NLM_F_REQUEST` signifies this is a request message, and `NLM_F_ACK` means I expect an acknowledgment (or an error). This is crucial for knowing if the operation succeeded.
* `req.n.nlmsg_seq = 2;`: A sequence number. In a more complex interaction, this would be important for matching requests and responses. Here, it's just a hardcoded value.
* `req.n.nlmsg_pid = getpid();`: The process ID of the sender. Essential for the kernel to identify who sent the message.
Now, the generic netlink header:
* `req.g.cmd = 4; // HWSIM_CMD_NEW_RADIO`: This is the command code within the generic netlink family. My knowledge of the `mac80211_hwsim` module tells me that command 4 corresponds to `HWSIM_CMD_NEW_RADIO`. This is the core operation I'm initiating.
* `req.g.version = 1;`: The version of the generic netlink interface for this command. Standard practice.
Next, I'm looking at how attributes are being added. This is a critical part of any netlink message.
* `struct rtattr *rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));`: This line calculates the position for the *first* attribute.
* `req.n.nlmsg_len` was set to 20.
* `NLMSG_ALIGN(req.n.nlmsg_len)` is `NLMSG_ALIGN(20)`, which is still 20.
* So, `rta` points to `(char *)&req + 20`. This offset is precisely after the `nlmsghdr` and `genlmsghdr` (16 + 4 = 20 bytes). This aligns with the start of the payload, where attributes would reside.
* `rta->rta_type = 25; // HWSIM_ATTR_MLO_SUPPORT`: Here's an attribute being defined. The type is 25. My immediate thought is, "What is attribute 25 in the `mac80211_hwsim` context?" I recall or look up the enum in `mac80211_hwsim.h`. Yes, attribute 25 is `HWSIM_ATTR_MLO_SUPPORT`. This is significant; it means I'm signaling a capability or request related to Multi-Link Operation.
* `rta->rta_len = RTA_LENGTH(0);`: This sets the length of the attribute. `RTA_LENGTH(0)` evaluates to `RTA_ALIGN(sizeof(struct rtattr)) + 0`, which is `4 + 0 = 4`. A length of 4 for an attribute typically means it's a flag or a simple value (like a `__u32`) with no data payload beyond the header itself. For a flag, a length of 4 is expected.
* `req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_ALIGN(rta->rta_len);`: This is where the total message length is updated to include the attribute.
* The previous `req.n.nlmsg_len` was 20.
* `NLMSG_ALIGN(req.n.nlmsg_len)` is still 20.
* `rta->rta_len` is 4.
* `RTA_ALIGN(rta->rta_len)` is `RTA_ALIGN(4)`, which is 4.
* So, the new `req.n.nlmsg_len` becomes `20 + 4 = 24`. This correctly accounts for the header and the single attribute.
I'm also noting the subtle difference between `struct rtattr` and `struct nlattr`. While their structure is identical (two `unsigned short` members), the header files they come from (`<linux/rtnetlink.h>` vs `<linux/netlink.h>`) can sometimes imply context. Here, since we're dealing with `mac80211_hwsim`, which often uses rtnetlink-like structures, `rtattr` is expected. The `RTA_LENGTH` and `RTA_ALIGN` macros are standard for this.
Moving on to the actual sending and receiving:
* `if (send(fd, &req, req.n.nlmsg_len, 0) < 0)`: This sends the constructed netlink message over the socket `fd`. The length passed is `req.n.nlmsg_len`, which we calculated as 24. If it fails, I get an error.
* `char buf[4096]; int len = recv(fd, buf, sizeof(buf), 0);`: This waits for a response from the kernel. The `recv` call will block until data is available or an error occurs. A 4096-byte buffer is typical, though the actual response length will depend on what the kernel sends back.
Finally, the return value:
* `if (len < 0) { perror("recv"); return -1; }`: Handles receive errors.
* `return 0;`: If the send and receive operations themselves completed without error, it returns 0. It *doesn't* parse the response to check for the netlink ack/error code. This is a potential area for improvement in a production system, but for this specific snippet, it indicates the message was sent and *a* response was received.
Now, let's look at the kernel side implications based on `HWSIM_ATTR_MLO_SUPPORT`.
When the kernel receives this message, specifically the `HWSIM_CMD_NEW_RADIO` command with the `HWSIM_ATTR_MLO_SUPPORT` attribute set, the `hwsim_new_radio_nl` handler will process it.
* The `hwsim_genl_policy` indicates `HWSIM_ATTR_MLO_SUPPORT` is a `NLA_FLAG`. This means its presence implies `true`.
* Inside `hwsim_new_radio_nl`, when processing attributes, `info->attrs[HWSIM_ATTR_MLO_SUPPORT]` will be non-NULL.
* This will set a parameter, let's call it `param.mlo`, to true.
* The logic `if (param.mlo || param.multi_radio) param.use_chanctx = true;` means that if MLO is requested (or `multi_radio` is also set, though it's not in this message), `param.use_chanctx` will be forced to true. This implies that MLO radios *require* channel context management.
* Then, the function `mac80211_hwsim_new_radio(info, ¶m)` is called. The critical part here is the selection of operations (`ops`).
* The code `if (param->mlo) ops = &mac80211_hwsim_mlo_ops;` indicates that if `param.mlo` is true, the `mac80211_hwsim_mlo_ops` structure will be used. This structure is distinct from the non-MLO operations and will contain hooks for MLO-specific behavior. I'd be keen to examine what specific operations (`HWSIM_COMMON_OPS`, `HWSIM_CHANCTX_OPS`, etc.) are defined within `mac80211_hwsim_mlo_ops` to understand the full implications of creating an MLO-capable radio. This suggests a more complex internal state and interaction model for MLO radios.
In essence, this code is a precise, albeit minimal, netlink request to the kernel's `mac80211_hwsim` module, specifically requesting the creation of a new hardware simulation radio that is flagged as supporting Multi-Link Operation. The details of netlink header construction, attribute encoding, and the kernel's interpretation of the `HWSIM_ATTR_MLO_SUPPORT` attribute are all meticulously handled.
|
| 712/7 |
2026/09/07 08:41 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_.*OPS PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=4274=static int mac80211_hwsim_set_radar_background(struct ieee80211_hw *hw,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4292-#ifdef CONFIG_MAC80211_DEBUGFS
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4293:#define HWSIM_DEBUGFS_OPS \
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4294- .link_add_debugfs = mac80211_hwsim_link_add_debugfs,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4295-#else
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4296:#define HWSIM_DEBUGFS_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4297-#endif
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4298-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4299:#define HWSIM_COMMON_OPS \
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4300- .tx = mac80211_hwsim_tx, \
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4330- .nan_peer_sched_changed = mac80211_hwsim_nan_peer_sched_changed, \
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4331: HWSIM_DEBUGFS_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4332-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4333:#define HWSIM_NON_MLO_OPS \
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4334- .sta_add = mac80211_hwsim_sta_add, \
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4340=static const struct ieee80211_ops mac80211_hwsim_ops = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4341: HWSIM_COMMON_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4342: HWSIM_NON_MLO_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4343- .sw_scan_start = mac80211_hwsim_sw_scan,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4350-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4351:#define HWSIM_CHANCTX_OPS \
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4352- .hw_scan = mac80211_hwsim_hw_scan, \
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4363=static const struct ieee80211_ops mac80211_hwsim_mchan_ops = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4364: HWSIM_COMMON_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4365: HWSIM_NON_MLO_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4366: HWSIM_CHANCTX_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4367-};
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=4369=static const struct ieee80211_ops mac80211_hwsim_mlo_ops = {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4370: HWSIM_COMMON_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c:4371: HWSIM_CHANCTX_OPS
drivers/net/wireless/virtual/mac80211_hwsim_main.c-4372- .change_vif_links = mac80211_hwsim_change_vif_links,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=5647=static const u8 iftypes_ext_capa_ap[] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5655-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5656:#define MAC80211_HWSIM_MLD_CAPA_OPS \
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5657- FIELD_PREP_CONST(IEEE80211_MLD_CAP_OP_TID_TO_LINK_MAP_NEG_SUPP, \
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=5662=static const struct wiphy_iftype_ext_capab mac80211_hwsim_iftypes_ext_capa[] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5669- IEEE80211_EML_CAP_EMLMR_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5670: .mld_capa_and_ops = MAC80211_HWSIM_MLD_CAPA_OPS,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5671- },
]
|
| 713/7 |
2026/09/07 08:41 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 30321
output: 25
thoughts: 127
Thoughts: **My MLO Registration Scrutiny**
Alright, before I dive deeper, a critical checkpoint: I need to meticulously examine the requirements of `ieee80211_register_hw` specifically in the context of Multi-Link Operation (MLO). My immediate concern is what exactly `mac80211` and `cfg80211` are scrutinizing when the `WIPHY_FLAG_SUPPORTS_MLO` flag is asserted, or when the `ops->change_vif_links` callback is invoked. More broadly, I need to understand the full set of checks performed by `ieee80211_register_hw` itself when MLO support is indicated. To get to the bottom of this, my next step is a targeted search for `WIPHY_FLAG_SUPPORTS_MLO` across the `net/mac80211` and `net/wireless` codebases. This will illuminate the specific conditions and dependencies that are evaluated, ensuring I have a complete picture of the MLO registration process.
|
| 714/7 |
2026/09/07 08:41 |
tool |
grepper |
0m
Args: map[Expression:WIPHY_FLAG_SUPPORTS_MLO]
Results: map[Output:drivers/net/wireless/ath/ath12k/mac.c=14793=static int ath12k_mac_hw_register(struct ath12k_hw *ah)
--
drivers/net/wireless/ath/ath12k/mac.c-14950- ath12k_iftypes_ext_capa[2].mld_capa_and_ops = cap->mld_cap;
drivers/net/wireless/ath/ath12k/mac.c:14951: wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
drivers/net/wireless/ath/ath12k/mac.c-14952-
--
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c=307=static void iwl_mac_hw_set_wiphy(struct iwl_mld *mld)
--
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c-347- !fips_enabled)
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c:348: wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
drivers/net/wireless/intel/iwlwifi/mld/mac80211.c-349-
--
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c=331=int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
--
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c-369- !iwlwifi_mod_params.disable_11be) {
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c:370: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c-371- /* we handle this already earlier, but need it for MLO */
--
drivers/net/wireless/mediatek/mt76/mt7925/main.c=267=int mt7925_init_mlo_caps(struct mt792x_phy *phy)
--
drivers/net/wireless/mediatek/mt76/mt7925/main.c-290-
drivers/net/wireless/mediatek/mt76/mt7925/main.c:291: wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
drivers/net/wireless/mediatek/mt76/mt7925/main.c-292- wiphy->iftype_ext_capab = ext_capab;
--
drivers/net/wireless/mediatek/mt76/mt7996/init.c=478=mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
--
drivers/net/wireless/mediatek/mt76/mt7996/init.c-511- wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH |
drivers/net/wireless/mediatek/mt76/mt7996/init.c:512: WIPHY_FLAG_SUPPORTS_MLO;
drivers/net/wireless/mediatek/mt76/mt7996/init.c-513- wiphy->mbssid_max_interfaces = 16;
--
drivers/net/wireless/realtek/rtw89/core.c=7461=static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
--
drivers/net/wireless/realtek/rtw89/core.c-7539- if (rtwdev->support_mlo) {
drivers/net/wireless/realtek/rtw89/core.c:7540: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
drivers/net/wireless/realtek/rtw89/core.c-7541- hw->wiphy->iftype_ext_capab = rtw89_iftypes_ext_capa;
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=5674=static int mac80211_hwsim_new_radio(struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5921- if (param->mlo) {
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5922: hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5923- ieee80211_hw_set(hw, HAS_RATE_CONTROL);
--
include/net/cfg80211.h=5280=struct cfg80211_ops {
--
include/net/cfg80211.h-5704- * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
include/net/cfg80211.h:5705: * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
include/net/cfg80211.h-5706- * in order to not have them reachable in normal drivers, until we have
--
include/net/cfg80211.h=5717=enum wiphy_flags {
include/net/cfg80211.h-5718- WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
include/net/cfg80211.h:5719: WIPHY_FLAG_SUPPORTS_MLO = BIT(1),
include/net/cfg80211.h-5720- WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
--
net/mac80211/debugfs_netdev.c=1043=void ieee80211_link_debugfs_add(struct ieee80211_link_data *link)
--
net/mac80211/debugfs_netdev.c-1050- /* For now, this should not be called for non-MLO capable drivers */
net/mac80211/debugfs_netdev.c:1051: if (WARN_ON(!(link->sdata->local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)))
net/mac80211/debugfs_netdev.c-1052- return;
--
net/mac80211/main.c=1137=int ieee80211_register_hw(struct ieee80211_hw *hw)
--
net/mac80211/main.c-1167-
net/mac80211/main.c:1168: if (hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) {
net/mac80211/main.c-1169- /*
--
net/mac80211/main.c-1300- (sband->ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA) &&
net/mac80211/main.c:1301: hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO))
net/mac80211/main.c-1302- return -EINVAL;
--
net/mac80211/main.c-1334- if (WARN_ON(iftd->vendor_elems.len &&
net/mac80211/main.c:1335: hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO))
net/mac80211/main.c-1336- return -EINVAL;
--
net/mac80211/mlme.c=3789=static bool ieee80211_powersave_allowed(struct ieee80211_sub_if_data *sdata)
--
net/mac80211/mlme.c-3807-
net/mac80211/mlme.c:3808: if (!(local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) &&
net/mac80211/mlme.c-3809- !sdata->deflink.u.mgd.have_beacon)
--
net/wireless/mlme.c=305=int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
--
net/wireless/mlme.c-316- if (req->link_id >= 0 &&
net/wireless/mlme.c:317: !(wdev->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO))
net/wireless/mlme.c-318- return -EINVAL;
--
net/wireless/nl80211.c=3057=static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
--
net/wireless/nl80211.c-3603-
net/wireless/nl80211.c:3604: if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO &&
net/wireless/nl80211.c-3605- (nla_put_u16(msg,
--
net/wireless/nl80211.c-3611- goto nla_put_failure;
net/wireless/nl80211.c:3612: if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO &&
net/wireless/nl80211.c-3613- capab->ext_mld_capa_and_ops &&
--
net/wireless/nl80211.c-3688-
net/wireless/nl80211.c:3689: if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO)
net/wireless/nl80211.c-3690- nla_put_flag(msg, NL80211_ATTR_MLO_SUPPORT);
--
net/wireless/nl80211.c=12764=static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-12895- if (req.link_id >= 0) {
net/wireless/nl80211.c:12896: if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO))
net/wireless/nl80211.c-12897- return -EINVAL;
--
net/wireless/nl80211.c=13167=static int nl80211_associate(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-13315-
net/wireless/nl80211.c:13316: if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_MLO))
net/wireless/nl80211.c-13317- return -EINVAL;
--
net/wireless/nl80211.c=19040=static int nl80211_add_link(struct sk_buff *skb, struct genl_info *info)
--
net/wireless/nl80211.c-19047-
net/wireless/nl80211.c:19048: if (!(wdev->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO))
net/wireless/nl80211.c-19049- return -EINVAL;
--
net/wireless/wext-core.c=649=struct iw_statistics *get_wireless_stats(struct net_device *dev)
--
net/wireless/wext-core.c-662- wireless_warn_cfg80211_wext();
net/wireless/wext-core.c:663: if (dev->ieee80211_ptr->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)
net/wireless/wext-core.c-664- return NULL;
--
net/wireless/wext-core.c=696=static iw_handler get_handler(struct net_device *dev, unsigned int cmd)
--
net/wireless/wext-core.c-704- wireless_warn_cfg80211_wext();
net/wireless/wext-core.c:705: if (dev->ieee80211_ptr->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)
net/wireless/wext-core.c-706- return NULL;
]
|
| 715/7 |
2026/09/07 08:41 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 33929
output: 41
thoughts: 46
Thoughts: **My Thought Process Regarding MLO and `ieee80211_register_hw`**
Alright, my immediate inclination is to delve into the specifics of how the new Multi-Link Operation (MLO) functionality is being integrated within the `mac80211` framework. Given that `ieee80211_register_hw` is the foundational call for bringing a hardware device into the system, I suspect it's a critical juncture where MLO capabilities would be initialized or registered. Therefore, my next logical step is to examine the code within `net/mac80211/main.c`, specifically targeting the vicinity of line 1168. I want to pinpoint exactly what actions `ieee80211_register_hw` takes when it encounters or is configured for MLO, to understand its role in the overall MLO setup and management.
|
| 716/7 |
2026/09/07 08:41 |
tool |
read-file |
0m
Args: map[File:net/mac80211/main.c FirstLine:1165 LineCount:40]
Results: map[Contents:1165: (local->ops->add_nan_func || local->ops->del_nan_func)))))
1166: return -EINVAL;
1167:
1168: if (hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) {
1169: /*
1170: * For drivers capable of doing MLO, assume modern driver
1171: * or firmware facilities, so software doesn't have to do
1172: * as much, e.g. monitoring beacons would be hard if we
1173: * might not even know which link is active at which time.
1174: */
1175: if (WARN_ON(local->emulate_chanctx))
1176: return -EINVAL;
1177:
1178: if (WARN_ON(!local->ops->link_info_changed))
1179: return -EINVAL;
1180:
1181: if (WARN_ON(!ieee80211_hw_check(hw, HAS_RATE_CONTROL)))
1182: return -EINVAL;
1183:
1184: if (WARN_ON(!ieee80211_hw_check(hw, AMPDU_AGGREGATION)))
1185: return -EINVAL;
1186:
1187: if (WARN_ON(ieee80211_hw_check(hw, HOST_BROADCAST_PS_BUFFERING)))
1188: return -EINVAL;
1189:
1190: if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_PS) &&
1191: (!ieee80211_hw_check(hw, SUPPORTS_DYNAMIC_PS) ||
1192: ieee80211_hw_check(hw, PS_NULLFUNC_STACK))))
1193: return -EINVAL;
1194:
1195: if (WARN_ON(!ieee80211_hw_check(hw, MFP_CAPABLE)))
1196: return -EINVAL;
1197:
1198: if (WARN_ON(ieee80211_hw_check(hw, NEED_DTIM_BEFORE_ASSOC)))
1199: return -EINVAL;
1200:
1201: if (WARN_ON(ieee80211_hw_check(hw, TIMING_BEACON_ONLY)))
1202: return -EINVAL;
1203:
1204: if (WARN_ON(!ieee80211_hw_check(hw, AP_LINK_PS)))
]
|
| 717/7 |
2026/09/07 08:41 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 34735
output: 49
thoughts: 1214
Thoughts: **Analysis of Netlink Attribute Construction and Response Handling in `create_hwsim_radio`**
My immediate focus is on understanding how Netlink attributes are being constructed within this `create_hwsim_radio` function and how the response from the kernel is being handled. I'm starting by dissecting the code line by line, as is my usual approach when delving into protocol-level interactions.
The initial setup of the `req` buffer, including the `nlmsghdr` and `genlmsghdr` fields, seems standard for a generic Netlink request. I've initialized the `nlmsg_len`, `nlmsg_type`, `nlmsg_flags` (crucially including `NLM_F_REQUEST | NLM_F_ACK`), `nlmsg_seq`, `nlmsg_pid`, and the generic Netlink command (`HWSIM_CMD_NEW_RADIO`) and version. This all appears to be in order for initiating a new radio creation.
However, my attention is drawn to the attribute construction:
I've noticed that `struct rtattr` and the `RTA_*` macros are being used here. This immediately raises a flag for me. Generic Netlink, as I understand it, primarily uses `struct nlattr` and the `NLA_*` macros, often managed by libraries like libnl or libmnl. Using `struct rtattr` and `RTA_*` is typically associated with Netlink Route (rtnetlink). I need to investigate if this is functionally incorrect, a stylistic issue, or simply the wrong header being included.
Looking at the definitions, `struct rtattr` and `struct nlattr` are quite similar in their basic structure (`rta_len`/`nla_len` and `rta_type`/`nla_type`). The key difference lies in how their lengths are aligned and how they are expected to be used within their respective Netlink families.
Let's trace the attribute length calculation:
`RTA_LENGTH(0)` evaluates to `RTA_ALIGN(sizeof(struct rtattr)) + 0`, which is `4 + 0 = 4`. So, `rta->rta_len` is set to 4.
`rta->rta_type` is set to 25, corresponding to `HWSIM_MLO_SUPPORT`.
Now, the critical part:
`req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_ALIGN(rta->rta_len);`
Before this line, `req.n.nlmsg_len` was initialized to `NLMSG_LENGTH(GENL_HDRLEN)`, which is `NLMSG_ALIGN(sizeof(struct nlmsghdr)) + GENL_HDRLEN` = `16 + 4 = 20`.
So, `NLMSG_ALIGN(20)` is 20.
And `RTA_ALIGN(4)` is 4.
Therefore, `req.n.nlmsg_len` is updated to `20 + 4 = 24`.
This update seems to be correctly calculating the total message length after adding the attribute. However, the initial calculation of `rta`'s position also relies on the `req.n.nlmsg_len` *before* it's updated with the attribute length. This is a common pattern, where `rta` is placed at the end of the existing header length, and then the total `nlmsg_len` is adjusted. The logic here appears sound from a pointer arithmetic perspective, assuming the initial `nlmsg_len` correctly represents the header portion.
The real concern arises from the response handling:
I've used `send(fd, &req, req.n.nlmsg_len, 0)` to send the request. Following this, I call `recv(fd, buf, sizeof(buf), 0)`.
The crucial point here is the `NLM_F_ACK` flag. When this flag is set, the kernel is expected to send back an acknowledgment. This acknowledgment is typically a `NLMSG_ERROR` message. If the operation was successful, the `nlmsgerr.error` field within this message will be zero.
My critical observation is that `recv()` returning a value greater than or equal to zero *does not* inherently mean the Netlink command itself was successful. It simply means that some data was received. A successful Netlink operation, when `NLM_F_ACK` is used, requires checking the contents of the received message to confirm the absence of an error code.
This means that the current error checking in `create_hwsim_radio` is insufficient. If the `mac80211_hwsim` module encounters an internal error during `HWSIM_CMD_NEW_RADIO` creation, or if there's a Netlink-level error, the kernel will send back a `NLMSG_ERROR` message with a non-zero error code. The current `recv` call will still return a positive value (the size of the error message), and the function will proceed as if everything is fine, potentially leading to silent failures.
Therefore, I need to examine the contents of the `buf` received by `recv` to properly parse the Netlink response and confirm the success of the `HWSIM_CMD_NEW_RADIO` command.
Furthermore, I need to understand the specific communication pattern of `HWSIM_CMD_NEW_RADIO` within the `mac80211_hwsim` driver. Does this command typically send a unicast reply, a multicast notification, or just an ACK? This will dictate how I should structure my response parsing and validation logic. I will need to consult the `mac80211_hwsim_main.c` source code to confirm this behavior for `HWSIM_CMD_NEW_RADIO`.
|
| 718/7 |
2026/09/07 08:41 |
tool |
grepper |
0m
Args: map[Expression:hwsim_new_radio_nl PathPrefix:drivers/net/wireless/virtual/mac80211_hwsim_main.c]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=6766=static int parse_pmsr_capa(const struct nlattr *pmsr_capa, struct cfg80211_pmsr_capabilities *out,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6804-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6805:static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6806-{
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=7105=static const struct genl_small_ops hwsim_ops[] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7124- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP,
drivers/net/wireless/virtual/mac80211_hwsim_main.c:7125: .doit = hwsim_new_radio_nl,
drivers/net/wireless/virtual/mac80211_hwsim_main.c-7126- .flags = GENL_UNS_ADMIN_PERM,
]
|
| 719/7 |
2026/09/07 08:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 36360
output: 51
thoughts: 59
Thoughts: **A Deep Dive into `mac80211_hwsim_new_radio` with MLO Enabled**
My current focus is on understanding the internal workings of the `mac80211_hwsim_new_radio` function, specifically when the `param->mlo` flag is set to `true`. To achieve this, I'm committed to a thorough, start-to-finish examination of the entire `mac80211_hwsim_new_radio` function. My objective is to meticulously trace the execution flow and identify any specific behaviors or conditional branches that are activated or altered by the presence of MLO. This comprehensive review is crucial for me to grasp the implications of MLO support within the `mac80211_hwsim` framework and to ensure I have a complete picture of its integration.
|
| 720/7 |
2026/09/07 08:42 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:6130 LineCount:100]
Results: map[Contents:6130: wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PROBE_AP);
6131:
6132: for (i = 0; i < ARRAY_SIZE(data->link_data); i++) {
6133: hrtimer_setup(&data->link_data[i].beacon_timer, mac80211_hwsim_beacon,
6134: CLOCK_MONOTONIC, HRTIMER_MODE_ABS_SOFT);
6135: data->link_data[i].link_id = i;
6136: }
6137:
6138: err = ieee80211_register_hw(hw);
6139: if (err < 0) {
6140: pr_debug("mac80211_hwsim: ieee80211_register_hw failed (%d)\n",
6141: err);
6142: goto failed_hw;
6143: }
6144:
6145: wiphy_dbg(hw->wiphy, "hwaddr %pM registered\n", hw->wiphy->perm_addr);
6146:
6147: if (param->reg_alpha2) {
6148: data->alpha2[0] = param->reg_alpha2[0];
6149: data->alpha2[1] = param->reg_alpha2[1];
6150: regulatory_hint(hw->wiphy, param->reg_alpha2);
6151: }
6152:
6153: data->debugfs = debugfs_create_dir("hwsim", hw->wiphy->debugfsdir);
6154: debugfs_create_file("ps", 0666, data->debugfs, data, &hwsim_fops_ps);
6155: debugfs_create_file("group", 0666, data->debugfs, data,
6156: &hwsim_fops_group);
6157: debugfs_create_file("rx_rssi", 0666, data->debugfs, data,
6158: &hwsim_fops_rx_rssi);
6159: if (!data->use_chanctx)
6160: debugfs_create_file("dfs_simulate_radar", 0222,
6161: data->debugfs,
6162: data, &hwsim_simulate_radar);
6163: if (param->background_radar)
6164: debugfs_create_file("dfs_background_cac", 0200,
6165: data->debugfs,
6166: data, &hwsim_background_cac_ops);
6167: debugfs_create_file("simulate_incumbent_signal_interference", 0200,
6168: data->debugfs,
6169: data, &hwsim_simulate_incumbent_signal_fops);
6170:
6171: if (param->pmsr_capa) {
6172: data->pmsr_capa = *param->pmsr_capa;
6173: hw->wiphy->pmsr_capa = &data->pmsr_capa;
6174: }
6175:
6176: spin_lock_bh(&hwsim_radio_lock);
6177: err = rhashtable_insert_fast(&hwsim_radios_rht, &data->rht,
6178: hwsim_rht_params);
6179: if (err < 0) {
6180: if (info) {
6181: GENL_SET_ERR_MSG(info, "perm addr already present");
6182: NL_SET_BAD_ATTR(info->extack,
6183: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6184: }
6185: spin_unlock_bh(&hwsim_radio_lock);
6186: goto failed_final_insert;
6187: }
6188:
6189: list_add_tail(&data->list, &hwsim_radios);
6190: hwsim_radios_generation++;
6191: spin_unlock_bh(&hwsim_radio_lock);
6192:
6193: hwsim_mcast_new_radio(idx, info, param);
6194:
6195: return idx;
6196:
6197: failed_final_insert:
6198: debugfs_remove_recursive(data->debugfs);
6199: ieee80211_unregister_hw(data->hw);
6200: failed_hw:
6201: device_release_driver(data->dev);
6202: failed_bind:
6203: device_unregister(data->dev);
6204: failed_drvdata:
6205: ieee80211_free_hw(hw);
6206: failed:
6207: return err;
6208: }
6209:
6210: static void hwsim_mcast_del_radio(int id, const char *hwname,
6211: struct genl_info *info)
6212: {
6213: struct sk_buff *skb;
6214: void *data;
6215: int ret;
6216:
6217: skb = genlmsg_new(GENLMSG_DEFAULT_SIZE, GFP_KERNEL);
6218: if (!skb)
6219: return;
6220:
6221: data = genlmsg_put(skb, 0, 0, &hwsim_genl_family, 0,
6222: HWSIM_CMD_DEL_RADIO);
6223: if (!data)
6224: goto error;
6225:
6226: ret = nla_put_u32(skb, HWSIM_ATTR_RADIO_ID, id);
6227: if (ret < 0)
6228: goto error;
6229:
]
|
| 721/7 |
2026/09/07 08:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 38175
output: 50
thoughts: 334
Thoughts: **My Deep Dive into `ieee80211_register_hw` and MLO Support**
My train of thought today has been intensely focused on the `ieee80211_register_hw` function within the `mac80211` subsystem. Specifically, I've been scrutinizing the logic surrounding Multi-Link Operation (MLO) support, and a particular line in `net/mac80211/main.c` caught my eye: line 1178.
It reads: `if (WARN_ON(local->ops->link_info_changed)) return -EINVAL;`. Now, the preceding conditional block (`if (hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)`) clearly indicates that this check is relevant for devices advertising MLO capabilities. The comment here is quite insightful, suggesting that for drivers capable of MLO, we should expect modern driver or firmware facilities to handle much of the complexity, such as beacon monitoring, since the active link might be dynamic.
The critical question that immediately arose in my mind was: does the `mac80211_hwsim_mlo_ops` structure, which I understand to be the operational set for our hardware simulation environment concerning MLO, actually *define* the `link_info_changed` operation? This is a crucial point because the `WARN_ON` here implies that if this operation is *not* provided by the driver's ops, it's a configuration error, and we should bail out with an `EINVAL`.
To answer this, my next step was to dive directly into the definition of `mac80211_hwsim_mlo_ops`. I've located the relevant section in `drivers/net/wireless/virtual/mac80211_hwsim_main.c`, specifically lines 4300 through 4377. I need to carefully examine this block to see if `link_info_changed` is indeed populated within this MLO-specific operational set. If it's not, then my suspicion that this check could lead to a failure when registering an MLO-capable hardware simulation is validated. This is a key verification point for ensuring the integrity of our MLO emulation path.
|
| 722/7 |
2026/09/07 08:42 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:4298 LineCount:80]
Results: map[Contents:4298:
4299: #define HWSIM_COMMON_OPS \
4300: .tx = mac80211_hwsim_tx, \
4301: .wake_tx_queue = ieee80211_hwsim_wake_tx_queue, \
4302: .start = mac80211_hwsim_start, \
4303: .stop = mac80211_hwsim_stop, \
4304: .add_interface = mac80211_hwsim_add_interface, \
4305: .change_interface = mac80211_hwsim_change_interface, \
4306: .remove_interface = mac80211_hwsim_remove_interface, \
4307: .config = mac80211_hwsim_config, \
4308: .configure_filter = mac80211_hwsim_configure_filter, \
4309: .vif_cfg_changed = mac80211_hwsim_vif_info_changed, \
4310: .link_info_changed = mac80211_hwsim_link_info_changed, \
4311: .tx_last_beacon = mac80211_hwsim_tx_last_beacon, \
4312: .sta_notify = mac80211_hwsim_sta_notify, \
4313: .link_sta_rc_update = mac80211_hwsim_sta_rc_update, \
4314: .conf_tx = mac80211_hwsim_conf_tx, \
4315: .get_survey = mac80211_hwsim_get_survey, \
4316: CFG80211_TESTMODE_CMD(mac80211_hwsim_testmode_cmd) \
4317: .ampdu_action = mac80211_hwsim_ampdu_action, \
4318: .flush = mac80211_hwsim_flush, \
4319: .get_et_sset_count = mac80211_hwsim_get_et_sset_count, \
4320: .get_et_stats = mac80211_hwsim_get_et_stats, \
4321: .get_et_strings = mac80211_hwsim_get_et_strings, \
4322: .start_pmsr = mac80211_hwsim_start_pmsr, \
4323: .abort_pmsr = mac80211_hwsim_abort_pmsr, \
4324: .set_radar_background = mac80211_hwsim_set_radar_background, \
4325: .set_key = mac80211_hwsim_set_key, \
4326: .set_rts_threshold = mac80211_hwsim_set_rts_threshold, \
4327: .start_nan = mac80211_hwsim_nan_start, \
4328: .stop_nan = mac80211_hwsim_nan_stop, \
4329: .nan_change_conf = mac80211_hwsim_nan_change_config, \
4330: .nan_peer_sched_changed = mac80211_hwsim_nan_peer_sched_changed, \
4331: HWSIM_DEBUGFS_OPS
4332:
4333: #define HWSIM_NON_MLO_OPS \
4334: .sta_add = mac80211_hwsim_sta_add, \
4335: .sta_remove = mac80211_hwsim_sta_remove, \
4336: .set_tim = mac80211_hwsim_set_tim, \
4337: .get_tsf = mac80211_hwsim_get_tsf, \
4338: .set_tsf = mac80211_hwsim_set_tsf,
4339:
4340: static const struct ieee80211_ops mac80211_hwsim_ops = {
4341: HWSIM_COMMON_OPS
4342: HWSIM_NON_MLO_OPS
4343: .sw_scan_start = mac80211_hwsim_sw_scan,
4344: .sw_scan_complete = mac80211_hwsim_sw_scan_complete,
4345: .add_chanctx = ieee80211_emulate_add_chanctx,
4346: .remove_chanctx = ieee80211_emulate_remove_chanctx,
4347: .change_chanctx = ieee80211_emulate_change_chanctx,
4348: .switch_vif_chanctx = ieee80211_emulate_switch_vif_chanctx,
4349: };
4350:
4351: #define HWSIM_CHANCTX_OPS \
4352: .hw_scan = mac80211_hwsim_hw_scan, \
4353: .cancel_hw_scan = mac80211_hwsim_cancel_hw_scan, \
4354: .remain_on_channel = mac80211_hwsim_roc, \
4355: .cancel_remain_on_channel = mac80211_hwsim_croc, \
4356: .add_chanctx = mac80211_hwsim_add_chanctx, \
4357: .remove_chanctx = mac80211_hwsim_remove_chanctx, \
4358: .change_chanctx = mac80211_hwsim_change_chanctx, \
4359: .assign_vif_chanctx = mac80211_hwsim_assign_vif_chanctx,\
4360: .unassign_vif_chanctx = mac80211_hwsim_unassign_vif_chanctx, \
4361: .switch_vif_chanctx = mac80211_hwsim_switch_vif_chanctx,
4362:
4363: static const struct ieee80211_ops mac80211_hwsim_mchan_ops = {
4364: HWSIM_COMMON_OPS
4365: HWSIM_NON_MLO_OPS
4366: HWSIM_CHANCTX_OPS
4367: };
4368:
4369: static const struct ieee80211_ops mac80211_hwsim_mlo_ops = {
4370: HWSIM_COMMON_OPS
4371: HWSIM_CHANCTX_OPS
4372: .change_vif_links = mac80211_hwsim_change_vif_links,
4373: .change_sta_links = mac80211_hwsim_change_sta_links,
4374: .sta_state = mac80211_hwsim_sta_state,
4375: .can_neg_ttlm = mac80211_hwsim_can_neg_ttlm,
4376: };
4377:
]
|
| 723/7 |
2026/09/07 08:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 40593
output: 41
thoughts: 71
Thoughts: **A Deep Dive into `ieee80211_register_hw` and its Dependencies**
My current line of inquiry is focused on ensuring the robustness of hardware registration within the `mac80211` subsystem. Specifically, I'm investigating potential failure points during the `ieee80211_register_hw` call, and my current focus is on `net/mac80211/main.c` at line 1180. My hypothesis is that there might be further, as-yet-undiscovered, critical failures occurring during this crucial initialization phase. To gain a comprehensive understanding, I'm not just looking at that single line; I intend to perform a thorough read-through of the entire `net/mac80211/main.c` file, paying particular attention to the code surrounding the `register_hw` function itself. This will allow me to trace the execution flow, identify all potential dependencies and error paths, and ultimately ascertain the complete lifecycle and any associated risks of hardware registration within this module.
|
| 724/7 |
2026/09/07 08:42 |
tool |
read-file |
0m
Args: map[File:net/mac80211/main.c FirstLine:1170 LineCount:80]
Results: map[Contents:1170: * For drivers capable of doing MLO, assume modern driver
1171: * or firmware facilities, so software doesn't have to do
1172: * as much, e.g. monitoring beacons would be hard if we
1173: * might not even know which link is active at which time.
1174: */
1175: if (WARN_ON(local->emulate_chanctx))
1176: return -EINVAL;
1177:
1178: if (WARN_ON(!local->ops->link_info_changed))
1179: return -EINVAL;
1180:
1181: if (WARN_ON(!ieee80211_hw_check(hw, HAS_RATE_CONTROL)))
1182: return -EINVAL;
1183:
1184: if (WARN_ON(!ieee80211_hw_check(hw, AMPDU_AGGREGATION)))
1185: return -EINVAL;
1186:
1187: if (WARN_ON(ieee80211_hw_check(hw, HOST_BROADCAST_PS_BUFFERING)))
1188: return -EINVAL;
1189:
1190: if (WARN_ON(ieee80211_hw_check(hw, SUPPORTS_PS) &&
1191: (!ieee80211_hw_check(hw, SUPPORTS_DYNAMIC_PS) ||
1192: ieee80211_hw_check(hw, PS_NULLFUNC_STACK))))
1193: return -EINVAL;
1194:
1195: if (WARN_ON(!ieee80211_hw_check(hw, MFP_CAPABLE)))
1196: return -EINVAL;
1197:
1198: if (WARN_ON(ieee80211_hw_check(hw, NEED_DTIM_BEFORE_ASSOC)))
1199: return -EINVAL;
1200:
1201: if (WARN_ON(ieee80211_hw_check(hw, TIMING_BEACON_ONLY)))
1202: return -EINVAL;
1203:
1204: if (WARN_ON(!ieee80211_hw_check(hw, AP_LINK_PS)))
1205: return -EINVAL;
1206: }
1207:
1208: #ifdef CONFIG_PM
1209: if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
1210: return -EINVAL;
1211: #endif
1212:
1213: if (local->emulate_chanctx) {
1214: for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
1215: const struct ieee80211_iface_combination *comb;
1216:
1217: comb = &local->hw.wiphy->iface_combinations[i];
1218:
1219: if (comb->num_different_channels > 1)
1220: return -EINVAL;
1221: }
1222: }
1223:
1224: if (hw->wiphy->n_radio) {
1225: for (i = 0; i < hw->wiphy->n_radio; i++) {
1226: const struct wiphy_radio *radio = &hw->wiphy->radio[i];
1227:
1228: if (!ieee80211_ifcomb_check(radio->iface_combinations,
1229: radio->n_iface_combinations))
1230: return -EINVAL;
1231: }
1232: } else {
1233: if (!ieee80211_ifcomb_check(hw->wiphy->iface_combinations,
1234: hw->wiphy->n_iface_combinations))
1235: return -EINVAL;
1236: }
1237:
1238: /* Only HW csum features are currently compatible with mac80211 */
1239: if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES))
1240: return -EINVAL;
1241:
1242: if (hw->max_report_rates == 0)
1243: hw->max_report_rates = hw->max_rates;
1244:
1245: local->rx_chains = 1;
1246:
1247: /*
1248: * generic code guarantees at least one band,
1249: * set this very early because much code assumes
]
|
| 725/7 |
2026/09/07 08:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 42029
output: 27
thoughts: 2605
Thoughts: **My Thoughts on `create_hwsim_radio` Function Analysis**
Alright, let's dive deep into this `create_hwsim_radio` C function, line by line. I'm an expert, so I'll be looking for the subtle details, potential pitfalls, and how this interacts with the Netlink subsystem and the `mac80211_hwsim` module.
First, I see the setup of the Netlink request message, `req`. It's a stacked structure containing `nlmsghdr` and `genlmsghdr`, which is standard for Generic Netlink. The `memset` is good practice.
Moving on to the `nlmsghdr` fields:
* `req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);` - This initializes the message length. `NLMSG_LENGTH` includes the header, and `GENL_HDRLEN` accounts for the Generic Netlink header. So far, so good.
* `req.n.nlmsg_type = family_id;` - This sets the Netlink family ID, which is crucial for directing the message to the correct handler.
* `req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;` - Setting `NLM_F_REQUEST` is expected for a command. The inclusion of `NLM_F_ACK` means I'm expecting a reply from the kernel, indicating success or failure.
* `req.n.nlmsg_seq = 2;` - This is a sequence number. It's a client-side identifier.
* `req.n.nlmsg_pid = getpid();` - This is where things get a bit interesting. In modern Netlink usage, it's often recommended to set `nlmsg_pid` to 0, letting the kernel fill it in or manage it automatically. While `getpid()` might work, it can introduce complications in multithreaded or multi-socket scenarios. Historically, it was used, but it's not ideal for robustness. However, I know the kernel usually handles this gracefully, so it's unlikely to be a fatal error, but it's a point of note for best practices.
Next, the `genlmsghdr` fields:
* `req.g.cmd = 4; // HWSIM_CMD_NEW_RADIO` - This specifies the actual command within the Generic Netlink family, which is `HWSIM_CMD_NEW_RADIO`.
* `req.g.version = 1;` - This indicates the version of the Generic Netlink protocol.
Now, let's look at the attribute addition:
* `struct rtattr *rta = (struct rtattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));` - This is where I start to feel a slight unease. I'm casting to `struct rtattr *` and using `RTA_*` macros, but this is a Generic Netlink message, not `rtnetlink`. Generic Netlink uses `struct nlattr` and `NLA_*` macros. While `rtattr` and `nlattr` have the same underlying memory layout (`__u16 len; __u16 type;`), this is a mixing of Netlink subsystems. It might work on many architectures due to binary compatibility, but it's semantically incorrect and could lead to subtle issues or be flagged by stricter parsers.
Let's scrutinize the attribute setup and length calculation:
* `rta->rta_type = 25; // HWSIM_ATTR_MLO_SUPPORT` - Setting the attribute type.
* `rta->rta_len = RTA_LENGTH(0);` - `RTA_LENGTH(0)` expands to `RTA_ALIGN(sizeof(struct rtattr)) + 0`, which is 4 bytes. This means the attribute is intended to be just the header.
* `req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_ALIGN(rta->rta_len);` - This calculation looks suspect.
* Initially, `req.n.nlmsg_len` was `NLMSG_LENGTH(GENL_HDRLEN) = GENL_HDRLEN + NLMSG_HDRLEN`. With `GENL_HDRLEN` being 4 and `NLMSG_HDRLEN` being 16, `req.n.nlmsg_len` starts at 20.
* The pointer arithmetic `NLMSG_ALIGN(req.n.nlmsg_len)` (which is `NLMSG_ALIGN(20)` = 20) adds 20 to the address of `req`. This places `rta` at `&req + 20`, which is the beginning of the `buf` member.
* Then, `rta->rta_type` is set to 25, and `rta->rta_len` to 4.
* The *final* `req.n.nlmsg_len` calculation is `NLMSG_ALIGN(20) + RTA_ALIGN(4)`, which is `20 + 4 = 24`.
This length calculation seems problematic. It appears to be recalculating `req.n.nlmsg_len` based on the *initial* length of the message *before* the attribute was added, and then adding the aligned length of the attribute. The standard way is to add the attribute's size to the *current* message length. The `NLMSG_LENGTH` definition includes `NLMSG_HDRLEN`, and `GENL_HDRLEN` is an offset *within* the message. The total length should be `NLMSG_LENGTH(GENL_HDRLEN)` plus the size of the attributes. The way it's written, `req.n.nlmsg_len` ends up being 24. This is concerning because if the kernel expects a different length, communication will fail.
Now, the sending and receiving part:
* `if (send(fd, &req, req.n.nlmsg_len, 0) < 0)` - This sends the constructed message. If `send` fails, it prints an error and returns -1, which is appropriate.
* `char buf[4096]; int len = recv(fd, buf, sizeof(buf), 0);` - This receives the response.
* `if (len < 0)` - Handles `recv` errors.
* `return 0;` - **This is a major red flag.**
The `return 0;` here is the most critical issue. Because `NLM_F_ACK` was set, the kernel *will* send back a Netlink message, typically an `NLMSG_ERROR` message, even if an error occurred. This `recv()` call will likely return a positive number indicating bytes received, as the error message itself is a Netlink message. However, the code *does not parse this received message*. It doesn't check `nlh->nlmsg_type == NLMSG_ERROR`, nor does it inspect `((struct nlmsgerr *)NLMSG_DATA(nlh))->error`. Therefore, this function will return `0` (success) even if the kernel responded with an error code like `-EPERM` (due to insufficient permissions), `-EINVAL` (invalid arguments), `-ENODEV` (device not found), or any other error. This means the caller will incorrectly assume the radio creation was successful when it wasn't.
Let's consider the permissions. The command is `HWSIM_CMD_NEW_RADIO`, and looking at the `hwsim_ops` structure, it has `flags = GENL_UNS_ADMIN_PERM`. This means the process calling this function needs `CAP_NET_ADMIN` privileges within its user namespace. If these permissions are not met, the kernel will likely respond with `-EPERM`, which this code fails to detect.
Finally, what about the attribute `HWSIM_ATTR_MLO_SUPPORT` itself?
The fact that `HWSIM_ATTR_MLO_SUPPORT` is set to a non-NULL attribute means the intention is to create an MLO (Multi-Link Operation) capable radio. The `hwsim_new_radio_nl` handler in the kernel will indeed set `param.mlo = true`. This will then influence the choice of Netlink operations (`ops = &mac80211_hwsim_mlo_ops;`) and the call to `ieee80211_alloc_hw_nm`.
Looking at `hwsim_new_radio_nl`, if `param.mlo` is true, it sets `param.use_chanctx = true;`. There's a check: `if (WARN_ON(param->channels > 1 && !param->use_chanctx)) return -EINVAL;`. In this specific case, `param.channels` defaults to 1 and `param.use_chanctx` is true, so this check passes. The code then proceeds to allocate the hardware with the MLO operations.
In summary, while the intent is clear, there are several critical flaws: the use of `rtattr` with Generic Netlink, a potentially incorrect message length calculation, and most importantly, a complete failure to process the Netlink response, leading to incorrect success reporting even when errors occur. The lack of parsing the response is the most severe bug.
|
| 726/7 |
2026/09/07 08:42 |
tool |
grepper |
0m
Args: map[Expression:ieee80211_alloc_hw_nm]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim_main.c=5674=static int mac80211_hwsim_new_radio(struct genl_info *info,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5698- ops = &mac80211_hwsim_mchan_ops;
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5699: hw = ieee80211_alloc_hw_nm(sizeof(*data), ops, param->hwname);
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5700- if (!hw) {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5705-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:5706: /* ieee80211_alloc_hw_nm may have used a default name */
drivers/net/wireless/virtual/mac80211_hwsim_main.c-5707- param->hwname = wiphy_name(hw->wiphy);
--
include/net/mac80211.h=4742=struct ieee80211_ops {
--
include/net/mac80211.h-5144-/**
include/net/mac80211.h:5145: * ieee80211_alloc_hw_nm - Allocate a new hardware device
include/net/mac80211.h-5146- *
--
include/net/mac80211.h-5159- */
include/net/mac80211.h:5160:struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
include/net/mac80211.h-5161- const struct ieee80211_ops *ops,
--
include/net/mac80211.h=5179=struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
--
include/net/mac80211.h-5181-{
include/net/mac80211.h:5182: return ieee80211_alloc_hw_nm(priv_data_len, ops, NULL);
include/net/mac80211.h-5183-}
--
net/mac80211/main.c=775=static const struct ieee80211_vht_cap mac80211_vht_capa_mod_mask = {
--
net/mac80211/main.c-792-
net/mac80211/main.c:793:struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
net/mac80211/main.c-794- const struct ieee80211_ops *ops,
--
net/mac80211/main.c-1050-}
net/mac80211/main.c:1051:EXPORT_SYMBOL(ieee80211_alloc_hw_nm);
net/mac80211/main.c-1052-
]
|
| 727/7 |
2026/09/07 08:42 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 45573
output: 40
thoughts: 45
Thoughts: **My Thought Process**
Okay, so I need to dive into the specifics of hardware allocation within the `mac80211` driver. My immediate instinct is to pinpoint the exact function responsible for creating and initializing the hardware abstraction layer (`hw`) object. I'm looking at the `net/mac80211/main.c` file, specifically the section around `ieee80211_alloc_hw_nm` which I know handles the allocation and initialization of this hardware structure. My focus will be on lines 793 through 1050, as this is where I anticipate the core logic for setting up the necessary data structures, registering the hardware with the system, and performing any initial hardware-specific configurations will reside. I'm expecting to see memory allocation, initialization of various substructures within the `hw` object, and potentially the registration of callbacks or other essential components that enable the driver to interact with the underlying wireless hardware. This section is crucial for understanding the foundational setup of any wireless device managed by `mac80211`.
|
| 728/7 |
2026/09/07 08:43 |
tool |
read-file |
0m
Args: map[File:net/mac80211/main.c FirstLine:793 LineCount:80]
Results: map[Contents: 793: struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
794: const struct ieee80211_ops *ops,
795: const char *requested_name)
796: {
797: struct ieee80211_local *local;
798: int priv_size, i;
799: struct wiphy *wiphy;
800: bool emulate_chanctx;
801:
802: if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config ||
803: !ops->add_interface || !ops->remove_interface ||
804: !ops->configure_filter || !ops->wake_tx_queue))
805: return NULL;
806:
807: if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove)))
808: return NULL;
809:
810: if (WARN_ON(!!ops->link_info_changed != !!ops->vif_cfg_changed ||
811: (ops->link_info_changed && ops->bss_info_changed)))
812: return NULL;
813:
814: /* check all or no channel context operations exist */
815: if (ops->add_chanctx == ieee80211_emulate_add_chanctx &&
816: ops->remove_chanctx == ieee80211_emulate_remove_chanctx &&
817: ops->change_chanctx == ieee80211_emulate_change_chanctx) {
818: if (WARN_ON(ops->assign_vif_chanctx ||
819: ops->unassign_vif_chanctx))
820: return NULL;
821: emulate_chanctx = true;
822: } else {
823: if (WARN_ON(ops->add_chanctx == ieee80211_emulate_add_chanctx ||
824: ops->remove_chanctx == ieee80211_emulate_remove_chanctx ||
825: ops->change_chanctx == ieee80211_emulate_change_chanctx))
826: return NULL;
827: if (WARN_ON(!ops->add_chanctx ||
828: !ops->remove_chanctx ||
829: !ops->change_chanctx ||
830: !ops->assign_vif_chanctx ||
831: !ops->unassign_vif_chanctx))
832: return NULL;
833: emulate_chanctx = false;
834: }
835:
836: /* Ensure 32-byte alignment of our private data and hw private data.
837: * We use the wiphy priv data for both our ieee80211_local and for
838: * the driver's private data
839: *
840: * In memory it'll be like this:
841: *
842: * +-------------------------+
843: * | struct wiphy |
844: * +-------------------------+
845: * | struct ieee80211_local |
846: * +-------------------------+
847: * | driver's private data |
848: * +-------------------------+
849: *
850: */
851: priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
852:
853: wiphy = wiphy_new_nm(&mac80211_config_ops, priv_size, requested_name);
854:
855: if (!wiphy)
856: return NULL;
857:
858: wiphy->mgmt_stypes = ieee80211_default_mgmt_stypes;
859:
860: wiphy->privid = mac80211_wiphy_privid;
861:
862: wiphy->flags |= WIPHY_FLAG_NETNS_OK |
863: WIPHY_FLAG_4ADDR_AP |
864: WIPHY_FLAG_4ADDR_STATION |
865: WIPHY_FLAG_REPORTS_OBSS |
866: WIPHY_FLAG_OFFCHAN_TX;
867:
868: if (emulate_chanctx || ops->remain_on_channel)
869: wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
870:
871: wiphy->bss_param_support = WIPHY_BSS_PARAM_CTS_PROT |
872: WIPHY_BSS_PARAM_SHORT_PREAMBLE |
]
|
| 729/7 |
2026/09/07 08:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 47061
output: 32
thoughts: 2293
Thoughts: **My Thoughts on Creating a HWSIM Radio with MLO Support**
Okay, I need to get this `mac80211_hwsim` radio set up, specifically with Multi-Link Operation (MLO) support. I've been examining the structure of the operations (`ops`) that `mac80211_hwsim` exposes. I see that `ops->tx` is definitely there. Most of the core operations like `start`, `stop`, `config`, `add_interface`, `remove_interface`, `configure_filter`, and `wake_tx_queue` are covered by `HWSIM_COMMON_OPS`, which is good. `ops->sta_state` is also present. However, I notice that `ops->sta_add` and `ops->sta_remove` are *not* part of `HWSIM_NON_MLO_OPS`. This is interesting, but I'm focusing on MLO setup for now, so I'll keep that in mind. On the channel context side, `add_chanctx`, `remove_chanctx`, `change_chanctx`, `assign_vif_chanctx`, and `unassign_vif_chanctx` are all accounted for in `HWSIM_CHANCTX_OPS`. This all suggests that `ieee80211_alloc_hw_nm` should succeed in its basic allocation.
Now, the critical part: MLO support. I need to ensure the `HWSIM_ATTR_MLO_SUPPORT` attribute is correctly handled. I've looked at `hwsim_genl_policy` in `drivers/net/wireless/virtual/mac80211_hwsim_main.c`, and indeed, `[HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },` is defined. My understanding of Netlink is that `NLA_FLAG` attributes are meant to have a payload length of zero. This means the `nla_len` of the attribute, which includes the `nlattr` header itself, should be `sizeof(struct nlattr)`, which is 4 bytes.
Looking at the user's code, they're setting the attribute type to 25 (`HWSIM_ATTR_MLO_SUPPORT`) and the length using `RTA_LENGTH(0)`, which correctly results in a length of 4. This aligns with what I expect for a flag attribute.
Next, I'm scrutinizing the buffer management for the Netlink request. The request structure includes `nlmsghdr n` (16 bytes) and `genlmsghdr g` (4 bytes), followed by a buffer. The initial length calculation is `NLMSG_LENGTH(GENL_HDRLEN)`, which is 16 + 4 = 20 bytes. When the attribute is appended, the length is updated: `req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + RTA_ALIGN(rta->rta_len);`. So, it becomes 20 + 4 = 24 bytes. This calculation seems correct for this specific scenario of adding a single flag attribute.
Now, a crucial question: is it valid to specify `HWSIM_ATTR_MLO_SUPPORT` on its own, without any other attributes like `HWSIM_ATTR_CHANNELS`? The user's code *only* sends `HWSIM_ATTR_MLO_SUPPORT`. I need to consider what happens if `HWSIM_ATTR_CHANNELS` is not provided. In `hwsim_new_radio_nl`, the `channels` parameter is derived from the module parameter `channels`, which defaults to 1. The code then checks `if (param.mlo || param.multi_radio) param.use_chanctx = true;`. If `param.mlo` is true (which it is, because we're sending `HWSIM_ATTR_MLO_SUPPORT`), then `use_chanctx` is set to `true`. This implies that even without explicitly providing `HWSIM_ATTR_CHANNELS`, the channel context mechanism will be enabled if MLO support is requested. Therefore, `mac80211_hwsim_new_radio` should still succeed in this regard.
However, as I review the user's code again, I'm spotting several potential issues that are more fundamental and could lead to silent failures or incorrect behavior:
1. **Error Handling is Severely Lacking**: This is the most critical issue. The code *does* request an ACK (`NLM_F_ACK`) and then calls `recv()`. But it *only* checks if `recv()` returns an error (`len < 0`). If the kernel rejects the request for *any* reason – insufficient permissions (`EPERM`), an invalid attribute (though `HWSIM_ATTR_MLO_SUPPORT` seems valid on its own), the `mac80211_hwsim` module not being loaded, etc. – the kernel will send back an `NLMSG_ERROR` Netlink message containing a negative error code. `recv()` will happily receive this, return `len > 0`, and the code will proceed as if everything succeeded by returning `0`. It completely bypasses parsing the Netlink message header, checking for `nlmsg_type == NLMSG_ERROR`, and inspecting `struct nlmsgerr.error`. This is a recipe for silent failures.
2. **Misapplication of rtnetlink Constructs**: The code is using `struct rtattr`, `RTA_LENGTH`, and `RTA_ALIGN`. While `struct rtattr` and `struct nlattr` are structurally identical on Linux, using `rtattr` for a generic Netlink message is semantically incorrect and bad practice. It's like using a wrench for a screw when a screwdriver is available. It's better to use the generic Netlink equivalents: `struct nlattr`, `NLA_HDRLEN`, `NLA_LENGTH`, and `NLA_ALIGN` or the provided `libnl` helpers.
3. **Hardcoded Magic Numbers**: Using `req.g.cmd = 4;` for `HWSIM_CMD_NEW_RADIO` and `rta->rta_type = 25;` for `HWSIM_ATTR_MLO_SUPPORT` is fragile. If the kernel's header definitions change (e.g., enums are reordered or values updated), or if this code is compiled against different kernel versions, it will break. It's always better to include the relevant headers (like `<linux/mac80211_hwsim.h>`) to use symbolic constants. The `req.g.version = 1;` for the hwsim family version is also a hardcoded constant, though typically this version is stable.
4. **Socket Management (`nlmsg_pid`, `send`/`connect`)**: Setting `req.n.nlmsg_pid = getpid();` is an older practice for userspace-to-kernel communication. It's generally preferred to leave `nlmsg_pid` as 0 for these types of messages, as the kernel assigns the port ID. More importantly, the `send()` call implies that the socket `fd` must have already been `connect()`ed to the kernel's Netlink address. If `sendto()` is not used with `struct sockaddr_nl`, this connection must be established.
5. **Missing Radio ID Retrieval**: When `HWSIM_CMD_NEW_RADIO` is successful, the kernel typically returns the ID of the newly created radio. This ID is often sent back via the ACK or broadcast on a multicast group. The current code doesn't capture or return this ID, meaning the caller has no way of knowing which radio was actually created.
6. **Buffer Alignment and Padding**: My earlier check confirmed that the buffer alignment and padding calculations for this specific case (a single flag attribute) are correct. `NLMSG_ALIGN(req.n.nlmsg_len)` results in 20 bytes, and the attribute pointer `rta` is correctly positioned at `buf[0]`. Then, `RTA_ALIGN(rta->rta_len)` of 4 bytes correctly updates `req.n.nlmsg_len` to 24. So, this aspect seems to be handled properly *for this exact scenario*.
Finally, I need to be absolutely sure about any kernel-specific nuances of `HWSIM_ATTR_MLO_SUPPORT`. I'd ideally want to check commit history or kernel test cases related to this attribute to see if there are any undocumented prerequisites or common pitfalls. But based on the policy and the `hwsim_new_radio` logic, requesting it directly *should* be the way to enable MLO support. The primary concern remains the lack of proper error handling in the user's code.
|
| 730/7 |
2026/09/07 08:43 |
tool |
grepper |
0m
Error:
Args: map[Expression:HWSIM_ATTR_MLO_SUPPORT PathPrefix:tools/]
Results:
|
| 731/7 |
2026/09/07 08:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 49384
output: 24
thoughts: 24
Thoughts: **My Thought Process for Investigating MLO Support**
My primary objective right now is to understand the extent of Multi-Link Operation (MLO) support within this repository. To achieve this, I've decided on a direct and comprehensive approach: I need to scan *all* files within the entire codebase for any mentions of the specific macro, `HWSIM_ATTR_MLO_SUPPORT`. This is my starting point, the most efficient way to pinpoint exactly where and how MLO is being referenced, or if it's even being considered in the first place. I'm not looking for general keywords; I'm going straight for the tangible artifact that would most likely indicate the presence of a feature flag or configuration option for MLO. By casting this wide net, I'm ensuring I don't miss any subtle integrations, configurations, or even potential future development flags that might not be immediately obvious through higher-level code inspection. This search will give me the raw data to then analyze the context and determine the nature and depth of the MLO implementation.
|
| 732/7 |
2026/09/07 08:43 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_ATTR_MLO_SUPPORT]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim.h=91=enum hwsim_commands {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-151- * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
drivers/net/wireless/virtual/mac80211_hwsim.h:152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
drivers/net/wireless/virtual/mac80211_hwsim.h-153- * the new radio
--
drivers/net/wireless/virtual/mac80211_hwsim.h=167=enum hwsim_attrs {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-192- HWSIM_ATTR_CIPHER_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h:193: HWSIM_ATTR_MLO_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h-194- HWSIM_ATTR_PMSR_SUPPORT,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=865=static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-891- [HWSIM_ATTR_CIPHER_SUPPORT] = { .type = NLA_BINARY },
drivers/net/wireless/virtual/mac80211_hwsim_main.c:892: [HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
drivers/net/wireless/virtual/mac80211_hwsim_main.c-893- [HWSIM_ATTR_PMSR_SUPPORT] = NLA_POLICY_NESTED(hwsim_pmsr_capa_policy),
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6805=static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6927-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6929-
]
|
| 733/7 |
2026/09/07 08:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 50118
output: 49
thoughts: 85
Thoughts: **My Thought Process on Investigating HWSIM Attributes and Policies**
Right, so my immediate instinct here is to thoroughly understand the scope and usage of `hwsim_genl_policy` and the related `HWSIM_ATTR_` family of attributes within the `mac80211_hwsim` driver. My primary objective is to ascertain if these are localized to `mac80211_hwsim_main.c` or if they have a broader presence across the driver or even the wider kernel.
To achieve this, my initial step is to perform targeted searches. I'll begin by drilling down into `drivers/net/wireless/virtual/mac80211_hwsim_main.c` itself, looking specifically for any definitions or references to `hwsim_genl_policy`. This will give me a clear picture of its implementation and how it's being utilized within the core logic of the hardware simulation module.
Concurrently, and equally importantly, I'll be casting a wider net. I need to know if `hwsim_genl_policy` or any of the `HWSIM_ATTR_` attributes are defined or referenced in *other* files within the `drivers/net/wireless/virtual/` directory, or perhaps even in more general networking or generic netlink infrastructure code elsewhere in the kernel. This broader scan is crucial for understanding potential interdependencies, common usage patterns, and whether these are truly bespoke to `hwsim` or part of a more generalized framework.
By systematically examining these specific locations and patterns, I aim to build a comprehensive understanding of how the hardware simulation layer communicates and exposes its configuration and status information through the generic netlink framework, specifically focusing on the attributes defined under the `HWSIM_ATTR_` namespace.
|
| 734/7 |
2026/09/07 08:43 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:865 LineCount:40]
Results: map[Contents: 865: static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
866: [HWSIM_ATTR_ADDR_RECEIVER] = NLA_POLICY_ETH_ADDR_COMPAT,
867: [HWSIM_ATTR_ADDR_TRANSMITTER] = NLA_POLICY_ETH_ADDR_COMPAT,
868: [HWSIM_ATTR_FRAME] = { .type = NLA_BINARY,
869: .len = IEEE80211_MAX_DATA_LEN },
870: [HWSIM_ATTR_FLAGS] = { .type = NLA_U32 },
871: [HWSIM_ATTR_RX_RATE] = { .type = NLA_U32 },
872: [HWSIM_ATTR_SIGNAL] = { .type = NLA_U32 },
873: [HWSIM_ATTR_TX_INFO] =
874: NLA_POLICY_EXACT_LEN(IEEE80211_TX_MAX_RATES *
875: sizeof(struct hwsim_tx_rate)),
876: [HWSIM_ATTR_COOKIE] = { .type = NLA_U64 },
877: [HWSIM_ATTR_CHANNELS] = { .type = NLA_U32 },
878: [HWSIM_ATTR_RADIO_ID] = { .type = NLA_U32 },
879: [HWSIM_ATTR_REG_HINT_ALPHA2] = { .type = NLA_STRING, .len = 2 },
880: [HWSIM_ATTR_REG_CUSTOM_REG] = { .type = NLA_U32 },
881: [HWSIM_ATTR_REG_STRICT_REG] = { .type = NLA_FLAG },
882: [HWSIM_ATTR_SUPPORT_P2P_DEVICE] = { .type = NLA_FLAG },
883: [HWSIM_ATTR_USE_CHANCTX] = { .type = NLA_FLAG },
884: [HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE] = { .type = NLA_FLAG },
885: [HWSIM_ATTR_RADIO_NAME] = { .type = NLA_STRING },
886: [HWSIM_ATTR_NO_VIF] = { .type = NLA_FLAG },
887: [HWSIM_ATTR_FREQ] = { .type = NLA_U32 },
888: [HWSIM_ATTR_TX_INFO_FLAGS] = { .type = NLA_BINARY },
889: [HWSIM_ATTR_PERM_ADDR] = NLA_POLICY_ETH_ADDR_COMPAT,
890: [HWSIM_ATTR_IFTYPE_SUPPORT] = { .type = NLA_U32 },
891: [HWSIM_ATTR_CIPHER_SUPPORT] = { .type = NLA_BINARY },
892: [HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
893: [HWSIM_ATTR_PMSR_SUPPORT] = NLA_POLICY_NESTED(hwsim_pmsr_capa_policy),
894: [HWSIM_ATTR_PMSR_RESULT] = NLA_POLICY_NESTED(hwsim_pmsr_peers_result_policy),
895: [HWSIM_ATTR_MULTI_RADIO] = { .type = NLA_FLAG },
896: [HWSIM_ATTR_SUPPORT_NAN_DEVICE] = { .type = NLA_FLAG },
897: [HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR] = { .type = NLA_FLAG },
898: };
899:
900: #if IS_REACHABLE(CONFIG_VIRTIO)
901:
902: /* MAC80211_HWSIM virtio queues */
903: static struct virtqueue *hwsim_vqs[HWSIM_NUM_VQS];
904: static bool hwsim_virtio_enabled;
]
|
| 735/7 |
2026/09/07 08:43 |
llm |
codeexpert |
0m
Model:
Tokens:
input: 51350
output: 1339
thoughts: 1764
Thoughts: **My Thought Process on Netlink Interaction and Potential Issues**
I've been analyzing the provided code's interaction with the `hwsim` netlink family, specifically focusing on the creation of a radio with MLO (Multi-Link Operation) support enabled. My goal is to thoroughly understand the process and identify any potential shortcomings or areas for improvement.
First, I examined how the `HWSIM_ATTR_MLO_SUPPORT` attribute is defined. The policy clearly indicates it's a `NLA_FLAG`, meaning it doesn't require any payload data, only its presence signifies its activation. This implies that sending a netlink attribute with type `25` (corresponding to `HWSIM_ATTR_MLO_SUPPORT`) and a length of `4` (the minimum size for an attribute header with no data) should pass basic netlink validation.
Next, I delved into the generic netlink parsing mechanism, tracing how a netlink message is constructed in user space and processed in the kernel.
* **User Space Construction:** I imagined a typical netlink request structure. The `nlmsghdr` would be initialized with `NLMSG_LENGTH(GENL_HDRLEN)` for its length. Then, the `rtattr` pointer would be advanced to the payload section. Setting `rta_type = 25` and `rta_len = RTA_LENGTH(0)` (which is `4`) correctly structures the attribute. The total message length `nlmsg_len` is then updated by aligning the attribute length. Finally, this constructed message is sent.
* **Kernel Space Reception:** The kernel receives this message. The `nlmsghdr` and `genlmsghdr` are parsed. Crucially, the generic netlink layer uses the `hwsim_genl_policy` to validate attributes. Since `HWSIM_ATTR_MLO_SUPPORT` is defined in the policy, the kernel will set `info->attrs[25]`. This triggers the call to `hwsim_new_radio_nl`. Inside this function, the `param.mlo` field is populated based on the presence of the attribute, and `param.use_chanctx` is set to `true`, which is the expected behavior for enabling MLO.
* **Acknowledgement (ACK) Handling:** The request includes the `NLM_F_ACK` flag. This means the kernel is expected to send a netlink error message back. A successful operation results in an ACK with `error == 0`.
Now, I'm scrutinizing the user's `recv()` code:
```c
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
return 0;
```
This is where I've identified several critical issues:
1. **Critical Bug in Error Handling:** This is the most significant problem. The `recv()` call will return a positive value (`len > 0`) even if the kernel encountered an error and sent back an `NLMSG_ERROR` message. The current code blindly returns `0` (success) without ever examining the contents of `buf` to check the `nlmsgerr.error` field. This means the application will report success to its caller even when the radio creation failed at the kernel level due to permission issues (`CAP_NET_ADMIN`), invalid parameters, or other internal errors.
2. **Improper Netlink API Usage (`rtattr` vs. `nlattr`):** The code is using `struct rtattr` and related macros like `RTA_LENGTH` and `RTA_ALIGN`. These are part of the `rtnetlink` API. For generic netlink, the standard structures are `struct nlattr` and macros like `NLA_HDRLEN`, `NLA_ALIGN`, or more conveniently, functions provided by libraries like `libnl` or `libmnl`. While `struct rtattr` and `struct nlattr` might have the same binary layout on Linux, using them interchangeably is semantically incorrect and non-standard practice.
3. **Magic Numbers:** The code uses hardcoded numerical values for commands and attribute types: `req.g.cmd = 4` for `HWSIM_CMD_NEW_RADIO` and `rta->rta_type = 25` for `HWSIM_ATTR_MLO_SUPPORT`. This makes the code fragile. If the order of commands or attributes changes in future kernel header versions, the code will break. It's far better to use the symbolic constants defined in the headers (e.g., `HWSIM_CMD_NEW_RADIO`, `HWSIM_ATTR_MLO_SUPPORT`).
4. **Netlink Message Sequence and PID Handling:**
* `req.n.nlmsg_pid = getpid();`: In standard netlink communication, the sender typically sets `nlmsg_pid` to `0` for kernel-initiated communication, allowing the kernel to fill in the sender's port ID.
* The response parsing logic should also verify that the `nlmsg_seq` of the received message matches the `nlmsg_seq` of the original request, especially in scenarios with asynchronous messages or multiple sockets.
5. **Multicast Notifications and Response Handling:** The `HWSIM_CMD_NEW_RADIO` operation can result in multicast notifications. The current `recv()` simply reads data and doesn't have logic to:
* Properly handle multi-part netlink messages.
* Extract the created radio index/name from the response.
* Distinguish between a direct ACK and a notification.
Finally, I performed a sanity check on the MLO attribute itself. I confirmed that `HWSIM_ATTR_MLO_SUPPORT` doesn't strictly require `HWSIM_ATTR_MULTI_RADIO`. The `mac80211_hwsim` module correctly sets `param.use_chanctx = true` if either `param.mlo` or `param.multi_radio` is present. The MLO support enables specific operations and flags like `WIPHY_FLAG_SUPPORTS_MLO`.
In summary, my main concerns revolve around the complete lack of error checking on the netlink response, leading to false success reports, a misuse of the netlink attribute API, and the use of brittle magic numbers. Furthermore, the current receiving mechanism is too simplistic to handle the nuances of netlink communication, especially with regard to acknowledgments and potential multicast notifications.
|
| 736/7 |
2026/09/07 08:44 |
tool |
set-results |
0m
Args: map[Answer:Several issues exist in the provided code, ranging from critical correctness/error-handling bugs to API misuse and fragility:
### 1. **No Netlink Error/ACK Checking (Critical Bug)**
- The message sets `NLM_F_ACK`, so the kernel replies with a Netlink message of type `NLMSG_ERROR`.
- If the operation fails in the kernel (e.g., permission denied `-EPERM` because `HWSIM_CMD_NEW_RADIO` requires `CAP_NET_ADMIN`, invalid attributes, or module failure), the kernel sends an `NLMSG_ERROR` packet containing the negative error code (e.g. `-EPERM`).
- Calling `recv()` simply returns the number of received bytes (e.g., `len > 0`), which indicates the read succeeded, **not** that the radio creation succeeded.
- Because the code checks only `if (len < 0)` and does not inspect `nlmsghdr::nlmsg_type == NLMSG_ERROR` or the payload's `struct nlmsgerr::error`, any kernel-side error will silently return `0` (indicating false success).
### 2. **Mixing rtnetlink Types/Macros with Generic Netlink**
- The code uses `struct rtattr`, `RTA_LENGTH`, and `RTA_ALIGN` from rtnetlink (`<linux/rtnetlink.h>`).
- Generic Netlink uses `struct nlattr`, `NLA_HDRLEN`, and `NLA_ALIGN` (or Netlink helper functions / libnl / libmnl) from `<linux/netlink.h>`.
- Although `struct rtattr` and `struct nlattr` share the same 4-byte header layout on Linux (`u16 len, u16 type`), mixing subsystems is semantically incorrect and bad practice.
### 3. **Hardcoded Magic Numbers**
- `req.g.cmd = 4;` is `HWSIM_CMD_NEW_RADIO`.
- `rta->rta_type = 25;` is `HWSIM_ATTR_MLO_SUPPORT`.
- Magic numbers are brittle across header versions and less maintainable than using the official enum definitions (`enum hwsim_commands` and `enum hwsim_attrs` from `<linux/mac80211_hwsim.h>`).
### 4. **`nlmsg_pid` and Sequence Matching**
- Modern Netlink usage expects `nlmsg_pid` to be set to `0` when sending requests to the kernel (the kernel will assign the port ID).
- In multi-message environments or if multicast notifications arrive on the same socket (hwsim broadcasts `HWSIM_CMD_NEW_RADIO`), responses should be checked to ensure `nlmsg_seq` matches the request sequence.
---
### Corrected Implementation
```c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/mac80211_hwsim.h>
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
/* Add HWSIM_ATTR_MLO_SUPPORT (NLA_FLAG attribute: length = NLA_HDRLEN) */
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
/* Parse Netlink response and ACK error */
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %s (%d)\n",
strerror(-err->error), err->error);
return err->error;
}
return 0; // ACK received with error == 0 (success)
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
```]
Results: map[Answer:Several issues exist in the provided code, ranging from critical correctness/error-handling bugs to API misuse and fragility:
### 1. **No Netlink Error/ACK Checking (Critical Bug)**
- The message sets `NLM_F_ACK`, so the kernel replies with a Netlink message of type `NLMSG_ERROR`.
- If the operation fails in the kernel (e.g., permission denied `-EPERM` because `HWSIM_CMD_NEW_RADIO` requires `CAP_NET_ADMIN`, invalid attributes, or module failure), the kernel sends an `NLMSG_ERROR` packet containing the negative error code (e.g. `-EPERM`).
- Calling `recv()` simply returns the number of received bytes (e.g., `len > 0`), which indicates the read succeeded, **not** that the radio creation succeeded.
- Because the code checks only `if (len < 0)` and does not inspect `nlmsghdr::nlmsg_type == NLMSG_ERROR` or the payload's `struct nlmsgerr::error`, any kernel-side error will silently return `0` (indicating false success).
### 2. **Mixing rtnetlink Types/Macros with Generic Netlink**
- The code uses `struct rtattr`, `RTA_LENGTH`, and `RTA_ALIGN` from rtnetlink (`<linux/rtnetlink.h>`).
- Generic Netlink uses `struct nlattr`, `NLA_HDRLEN`, and `NLA_ALIGN` (or Netlink helper functions / libnl / libmnl) from `<linux/netlink.h>`.
- Although `struct rtattr` and `struct nlattr` share the same 4-byte header layout on Linux (`u16 len, u16 type`), mixing subsystems is semantically incorrect and bad practice.
### 3. **Hardcoded Magic Numbers**
- `req.g.cmd = 4;` is `HWSIM_CMD_NEW_RADIO`.
- `rta->rta_type = 25;` is `HWSIM_ATTR_MLO_SUPPORT`.
- Magic numbers are brittle across header versions and less maintainable than using the official enum definitions (`enum hwsim_commands` and `enum hwsim_attrs` from `<linux/mac80211_hwsim.h>`).
### 4. **`nlmsg_pid` and Sequence Matching**
- Modern Netlink usage expects `nlmsg_pid` to be set to `0` when sending requests to the kernel (the kernel will assign the port ID).
- In multi-message environments or if multicast notifications arrive on the same socket (hwsim broadcasts `HWSIM_CMD_NEW_RADIO`), responses should be checked to ensure `nlmsg_seq` matches the request sequence.
---
### Corrected Implementation
```c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/mac80211_hwsim.h>
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
/* Add HWSIM_ATTR_MLO_SUPPORT (NLA_FLAG attribute: length = NLA_HDRLEN) */
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
/* Parse Netlink response and ACK error */
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %s (%d)\n",
strerror(-err->error), err->error);
return err->error;
}
return 0; // ACK received with error == 0 (success)
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
```]
|
| 737/5 |
2026/09/07 08:44 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 47895
output: 18
thoughts: 1614
Thoughts: **My Thought Process on Refining Netlink Interactions for mac80211_hwsim**
Initially, I was looking at `RTA_LENGTH` and `struct rtattr` for handling netlink attributes. However, I quickly realized that for `mac80211_hwsim`, the more appropriate approach is to use `NLA_HDRLEN` and `struct nlattr`. This is a standard convention for generic netlink family attributes, and it's crucial for ensuring compatibility and correct data parsing. So, the first order of business was to mentally update my code to reflect this change, switching to `struct nlattr` and `NLA_HDRLEN`.
Then, a practical concern arose: the `syzkaller` environment I'm operating within might not have `linux/mac80211_hwsim.h` readily available. Relying on external headers can lead to portability issues and build failures. To circumvent this, I decided it's much more robust to define the necessary constants directly within my code. Specifically, I identified `HWSIM_CMD_NEW_RADIO` with a value of `4` and `HWSIM_ATTR_MLO_SUPPORT` with a value of `25` as essential for my operations.
With these fundamental adjustments in mind, I proceeded to rewrite the core functions: `get_family_id` and `create_hwsim_radio`. Both of these functions need to interact with the netlink subsystem to discover the `mac80211_hwsim` family ID and then to create a new virtual radio device, respectively. My goal was to make these functions clean and efficient, utilizing the `struct nlattr` structure as planned.
For `get_family_id`, the objective is to query the generic netlink controller (`GENL_ID_CTRL`) for the family name "MAC80211_HWSIM". This involves constructing a netlink message with the `CTRL_CMD_GETFAMILY` command. I meticulously populated the netlink and generic netlink headers, ensuring the `nlmsg_len` and `nlmsg_type` fields were set correctly. A crucial part was creating the attribute list: I needed to add an attribute for the family name itself (`CTRL_ATTR_FAMILY_NAME`). This attribute, like all others, requires its own header (`nla->nla_type` and `nla->nla_len`) followed by the actual data. I then sent this request over the netlink socket and parsed the response. The critical part here is iterating through the attributes in the received message to find the `CTRL_ATTR_FAMILY_ID` and extract its value. I used `NLA_OK` and `NLA_NEXT` for this attribute parsing.
Following that, `create_hwsim_radio` was the next logical step. This function requires the previously obtained `family_id`. It constructs a new netlink message targeted at the `mac80211_hwsim` family, using the `HWSIM_CMD_NEW_RADIO` command. Similar to the previous function, I set up the netlink and generic netlink headers. The key addition here is creating an attribute for `HWSIM_ATTR_MLO_SUPPORT`. This attribute doesn't carry any specific data in this case, but its presence signals the desired feature. After sending the request, the function needs to wait for and process the acknowledgment from the kernel, checking for any errors.
As I was finalizing the code, a quick check of the netlink headers led me to wonder if `NLA_OK` and `NLA_NEXT` were indeed defined in `<linux/netlink.h>`. It's always good to confirm these definitions to ensure the code's correctness and avoid relying on potentially implicit inclusions. A quick look at the header file confirmed they are indeed defined there, which is a standard and expected location for these utility macros.
|
| 738/5 |
2026/09/07 08:44 |
tool |
grepper |
0m
Error:
Args:
Results:
|
| 739/5 |
2026/09/07 08:44 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 49529
output: 18
thoughts: 76
Thoughts: **My Realization**
I've just encountered a rather peculiar situation: the `NLA_OK` macro, which I'd expected to find for handling Netlink attributes, isn't actually defined in the `<linux/netlink.h>` header as available in user space. This is a bit of a snag, as it implies I can't directly use `NLA_OK` for my attribute parsing logic. However, I'm recalling that in user-space development involving Netlink, particularly with rtnetlink, the common practice is to leverage `RTA_OK` and `RTA_NEXT` from `<linux/rtnetlink.h>`. The key insight here is that these macros are functionally identical in their memory layout and purpose to their `NLA_` counterparts. Therefore, my immediate next step is to verify that `RTA_OK` is indeed defined and accessible within my current build environment. This seems like the most pragmatic and standard approach to overcome the absence of `NLA_OK` in user space.
|
| 740/5 |
2026/09/07 08:44 |
tool |
grepper |
0m
Args:
Results: map[Output:crypto/authenc.c=44=int crypto_authenc_extractkeys(struct crypto_authenc_keys *keys, const u8 *key,
--
crypto/authenc.c-49-
crypto/authenc.c:50: if (!RTA_OK(rta, keylen))
crypto/authenc.c-51- return -EINVAL;
--
crypto/authenc.c-55- /*
crypto/authenc.c:56: * RTA_OK() didn't align the rtattr's payload when validating that it
crypto/authenc.c-57- * fits in the buffer. Yet, the keys should start on the next 4-byte
--
crypto/krb5enc.c=56=int crypto_krb5enc_extractkeys(struct crypto_authenc_keys *keys, const u8 *key,
--
crypto/krb5enc.c-61-
crypto/krb5enc.c:62: if (!RTA_OK(rta, keylen))
crypto/krb5enc.c-63- return -EINVAL;
--
crypto/krb5enc.c-67- /*
crypto/krb5enc.c:68: * RTA_OK() didn't align the rtattr's payload when validating that it
crypto/krb5enc.c-69- * fits in the buffer. Yet, the keys should start on the next 4-byte
--
include/uapi/linux/rtnetlink.h=219=struct rtattr {
--
include/uapi/linux/rtnetlink.h-227-#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
include/uapi/linux/rtnetlink.h:228:#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
include/uapi/linux/rtnetlink.h-229- (rta)->rta_len >= sizeof(struct rtattr) && \
--
net/core/rtnetlink.c-11- * Fixes:
net/core/rtnetlink.c:12: * Vitaly E. Lavrov RTA_OK arithmetic was wrong.
net/core/rtnetlink.c-13- */
--
samples/bpf/xdp_router_ipv4_user.c=91=static void read_route(struct nlmsghdr *nh, int nll)
--
samples/bpf/xdp_router_ipv4_user.c-125-
samples/bpf/xdp_router_ipv4_user.c:126: for (; RTA_OK(rt_attr, rtl); rt_attr = RTA_NEXT(rt_attr, rtl)) {
samples/bpf/xdp_router_ipv4_user.c-127- switch (rt_attr->rta_type) {
--
samples/bpf/xdp_router_ipv4_user.c=316=static void read_arp(struct nlmsghdr *nh, int nll)
--
samples/bpf/xdp_router_ipv4_user.c-337- rtl = RTM_PAYLOAD(nh);
samples/bpf/xdp_router_ipv4_user.c:338: for (; RTA_OK(rt_attr, rtl); rt_attr = RTA_NEXT(rt_attr, rtl)) {
samples/bpf/xdp_router_ipv4_user.c-339- switch (rt_attr->rta_type) {
--
tools/include/uapi/linux/rtnetlink.h=219=struct rtattr {
--
tools/include/uapi/linux/rtnetlink.h-227-#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
tools/include/uapi/linux/rtnetlink.h:228:#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
tools/include/uapi/linux/rtnetlink.h-229- (rta)->rta_len >= sizeof(struct rtattr) && \
--
tools/testing/selftests/net/af_unix/diag_uid.c=116=void render_response(struct __test_metadata *_metadata,
--
tools/testing/selftests/net/af_unix/diag_uid.c-126- attr = (struct rtattr *)(udr + 1);
tools/testing/selftests/net/af_unix/diag_uid.c:127: ASSERT_NE(RTA_OK(attr, rta_len), 0);
tools/testing/selftests/net/af_unix/diag_uid.c-128- ASSERT_EQ(attr->rta_type, UNIX_DIAG_UID);
--
tools/testing/selftests/net/ipsec.c=1650=static int xfrm_spdinfo_attrs(int xfrm_sock, uint32_t *seq)
--
tools/testing/selftests/net/ipsec.c-1684-
tools/testing/selftests/net/ipsec.c:1685: for (; RTA_OK(attr, len); attr = RTA_NEXT(attr, len)) {
tools/testing/selftests/net/ipsec.c-1686- if (attr->rta_type == XFRMA_SPD_IPV4_HTHRESH) {
--
tools/testing/selftests/net/mptcp/mptcp_diag.c=159=static void parse_rtattr_flags(struct rtattr *tb[], int max, struct rtattr *rta,
--
tools/testing/selftests/net/mptcp/mptcp_diag.c-164- memset(tb, 0, sizeof(struct rtattr *) * (max + 1));
tools/testing/selftests/net/mptcp/mptcp_diag.c:165: while (RTA_OK(rta, len)) {
tools/testing/selftests/net/mptcp/mptcp_diag.c-166- type = rta->rta_type & ~flags;
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=66=static int nl_error(struct nlmsghdr *nh)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-84-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:85: while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-86- if (attrs->rta_type == NLMSGERR_ATTR_MSG)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=102=static int capture_events(int fd, int event_group)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-150- attrs = (struct rtattr *) ((char *) ghdr + GENL_HDRLEN);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:151: while (RTA_OK(attrs, msg_len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-152- if (attrs->rta_type == MPTCP_ATTR_TOKEN)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=253=static int genl_parse_getfamily(struct nlmsghdr *nlh, int *pm_family,
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-281-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:282: while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-283- if (attrs->rta_type == CTRL_ATTR_FAMILY_ID) {
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-289-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:290: while (RTA_OK(grps, grps_len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-291- grp = RTA_DATA(grps);
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-294-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:295: while (RTA_OK(grp, grp_len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-296- if (grp->rta_type == CTRL_ATTR_MCAST_GRP_ID)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=972=static void print_addr(struct rtattr *attrs, int len)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-979-
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:980: while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-981- if (attrs->rta_type == MPTCP_PM_ADDR_ATTR_FAMILY)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1082=static void print_addrs(struct nlmsghdr *nh, int pm_family, int total_len)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1098- GENL_HDRLEN);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1099: while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1100- if (attrs->rta_type ==
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c=1217=static void print_limits(struct nlmsghdr *nh, int pm_family, int total_len)
--
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1234- GENL_HDRLEN);
tools/testing/selftests/net/mptcp/pm_nl_ctl.c:1235: while (RTA_OK(attrs, len)) {
tools/testing/selftests/net/mptcp/pm_nl_ctl.c-1236- int type = attrs->rta_type;
]
|
| 741/5 |
2026/09/07 08:44 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 52416
output: 18
thoughts: 151
Thoughts: **The Nuances of Netlink Attribute Parsing**
My current line of thinking revolves around the intricacies of parsing Netlink attributes from the kernel's perspective versus how it's exposed to user space. I've encountered a situation where `NLA_OK`, which I might intuitively expect to be available for checking the end of an attribute list in user space, isn't directly provided. However, I've noted that `RTA_OK` is indeed available, and crucially, the `struct rtattr` definition, along with `RTA_OK`, resides in `<linux/rtnetlink.h>`. This tells me that for handling routing Netlink messages, `RTA_OK` and `struct rtattr` are my go-to tools in user space.
I recall a previous discussion where a fellow expert pointed out the potential for confusion when mixing `rtnetlink` and `genetlink`. My current contemplation reinforces the idea that in user space, the standard and indeed the only practical way to parse Netlink attributes, regardless of the specific Netlink family, is to use `struct rtattr` and macros like `RTA_OK`. This is because the `struct nlattr` and its associated `NLA_OK` macro, while seemingly more generic, are not typically exported for direct user-space consumption.
However, a quick double-check reveals something interesting: `struct nlattr` *is* actually exported, residing in `<linux/netlink.h>`. This prompts me to refine my understanding. My initial assumption that `struct nlattr` and `NLA_OK` are universally unavailable in user space needs re-evaluation. The fact that `struct nlattr` *is* exported suggests there might be a more fundamental, generic Netlink attribute parsing mechanism available. This, in turn, makes me curious about other related macros, specifically `NLA_ALIGN`, and whether *that* is also exported. If `NLA_ALIGN` is exported, it further strengthens the possibility of a more direct, generic Netlink attribute handling approach in user space, potentially using `struct nlattr` and its associated macros. I need to investigate this further to ensure I'm leveraging the most appropriate and standard mechanisms available to me as a user-space developer.
|
| 742/5 |
2026/09/07 08:44 |
tool |
grepper |
0m
Args: map[Expression:NLA_ALIGN]
Results: map[Output:drivers/block/drbd/drbd_nl.c=81=static int drbd_msg_sprintf_info(struct sk_buff *skb, const char *fmt, ...)
--
drivers/block/drbd/drbd_nl.c-102- txt->nla_len = nla_attr_size(len+1);
drivers/block/drbd/drbd_nl.c:103: nlmsg_trim(skb, (char*)txt + NLA_ALIGN(txt->nla_len));
drivers/block/drbd/drbd_nl.c-104- nla_nest_end(skb, nla);
--
drivers/block/drbd/drbd_nl.c=5095=struct genl_family drbd_nl_family __ro_after_init = {
--
drivers/block/drbd/drbd_nl.c-5097- .version = DRBD_FAMILY_VERSION,
drivers/block/drbd/drbd_nl.c:5098: .hdrsize = NLA_ALIGN(sizeof(struct drbd_genlmsghdr)),
drivers/block/drbd/drbd_nl.c-5099- .split_ops = drbd_nl_ops,
--
drivers/net/can/dev/netlink.c=55=static int can_validate_bittiming(struct nlattr *data[],
--
drivers/net/can/dev/netlink.c-63-
drivers/net/can/dev/netlink.c:64: static_assert(__alignof__(*bt) <= NLA_ALIGNTO);
drivers/net/can/dev/netlink.c-65- bt = nla_data(data[ifla_can_bittiming]);
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c=260=struct mlxfw_mfa2_file *mlxfw_mfa2_file_init(const struct firmware *fw)
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c-274- mfa2_file->fw = fw;
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c:275: first_tlv_ptr = fw->data + NLA_ALIGN(mlxfw_mfa2_fingerprint_len);
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c-276- first_tlv = mlxfw_mfa2_tlv_get(mfa2_file, first_tlv_ptr);
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c-308- mfa2_file->component_count = be16_to_cpu(pd->num_components);
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c:309: mfa2_file->cb = fw->data + NLA_ALIGN(be32_to_cpu(pd->cb_offset));
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2.c-310- if (!mlxfw_mfa2_valid_ptr(mfa2_file, mfa2_file->cb)) {
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c-9-#define MLXFW_MFA2_TLV_TOTAL_SIZE(tlv) \
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c:10: NLA_ALIGN(sizeof(*(tlv)) + be16_to_cpu((tlv)->len))
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c-11-
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c=13=mlxfw_mfa2_tlv_multi_child(const struct mlxfw_mfa2_file *mfa2_file,
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c-17-
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c:18: multi_len = NLA_ALIGN(sizeof(struct mlxfw_mfa2_tlv_multi));
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c-19- return mlxfw_mfa2_tlv_get(mfa2_file, (void *) multi + multi_len);
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c=23=mlxfw_mfa2_tlv_next(const struct mlxfw_mfa2_file *mfa2_file,
--
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c-35- return NULL;
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c:36: tlv_len = NLA_ALIGN(tlv_len + be16_to_cpu(multi->total_len));
drivers/net/ethernet/mellanox/mlxfw/mlxfw_mfa2_tlv_multi.c-37- }
--
include/net/netlink.h=1258=static inline int nla_total_size(int payload)
include/net/netlink.h-1259-{
include/net/netlink.h:1260: return NLA_ALIGN(nla_attr_size(payload));
include/net/netlink.h-1261-}
--
include/net/netlink.h=1319=static inline struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
include/net/netlink.h-1320-{
include/net/netlink.h:1321: unsigned int totlen = NLA_ALIGN(nla->nla_len);
include/net/netlink.h-1322-
--
include/net/netlink.h=2403=static inline int nla_total_size_64bit(int payload)
include/net/netlink.h-2404-{
include/net/netlink.h:2405: return NLA_ALIGN(nla_attr_size(payload))
include/net/netlink.h-2406-#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
include/net/netlink.h:2407: + NLA_ALIGN(nla_attr_size(0))
include/net/netlink.h-2408-#endif
--
include/net/rtnh.h=15=static inline struct rtnexthop *rtnh_next(const struct rtnexthop *rtnh,
--
include/net/rtnh.h-17-{
include/net/rtnh.h:18: int totlen = NLA_ALIGN(rtnh->rtnh_len);
include/net/rtnh.h-19-
--
include/net/rtnh.h=24=static inline struct nlattr *rtnh_attrs(const struct rtnexthop *rtnh)
include/net/rtnh.h-25-{
include/net/rtnh.h:26: return (struct nlattr *) ((char *) rtnh + NLA_ALIGN(sizeof(*rtnh)));
include/net/rtnh.h-27-}
--
include/net/rtnh.h=29=static inline int rtnh_attrlen(const struct rtnexthop *rtnh)
include/net/rtnh.h-30-{
include/net/rtnh.h:31: return rtnh->rtnh_len - NLA_ALIGN(sizeof(*rtnh));
include/net/rtnh.h-32-}
--
include/uapi/linux/netlink.h=215=enum {
--
include/uapi/linux/netlink.h-220-/*
include/uapi/linux/netlink.h:221: * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
include/uapi/linux/netlink.h-222- * +---------------------+- - -+- - - - - - - - - -+- - -+
--
include/uapi/linux/netlink.h=229=struct nlattr {
--
include/uapi/linux/netlink.h-247-
include/uapi/linux/netlink.h:248:#define NLA_ALIGNTO 4
include/uapi/linux/netlink.h:249:#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
include/uapi/linux/netlink.h:250:#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
include/uapi/linux/netlink.h-251-
--
lib/nlattr.c=949=void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
lib/nlattr.c-950-{
lib/nlattr.c:951: return skb_put_zero(skb, NLA_ALIGN(attrlen));
lib/nlattr.c-952-}
--
lib/nlattr.c=1016=void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen)
lib/nlattr.c-1017-{
lib/nlattr.c:1018: if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
lib/nlattr.c-1019- return NULL;
--
lib/nlattr.c=1141=int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data)
lib/nlattr.c-1142-{
lib/nlattr.c:1143: if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
lib/nlattr.c-1144- return -EMSGSIZE;
--
lib/nlattr.c=1160=int nla_append(struct sk_buff *skb, int attrlen, const void *data)
lib/nlattr.c-1161-{
lib/nlattr.c:1162: if (unlikely(skb_tailroom(skb) < NLA_ALIGN(attrlen)))
lib/nlattr.c-1163- return -EMSGSIZE;
--
net/core/drop_monitor.c=216=static void trace_drop_common(struct sk_buff *skb, void *location)
--
net/core/drop_monitor.c-251- __nla_reserve_nohdr(dskb, sizeof(struct net_dm_drop_point));
net/core/drop_monitor.c:252: nla->nla_len += NLA_ALIGN(sizeof(struct net_dm_drop_point));
net/core/drop_monitor.c-253- memcpy(point->pc, &location, sizeof(void *));
--
net/core/drop_monitor.c=611=static int net_dm_packet_report_fill(struct sk_buff *msg, struct sk_buff *skb,
--
net/core/drop_monitor.c-687-
net/core/drop_monitor.c:688:#define NET_DM_MAX_PACKET_SIZE (0xffff - NLA_HDRLEN - NLA_ALIGNTO)
net/core/drop_monitor.c-689-
--
net/core/gen_stats.c=59=gnet_stats_start_copy_compat(struct sk_buff *skb, int type, int tc_stats_type,
--
net/core/gen_stats.c-86- d->tail = (struct nlattr *)((char *)d->tail +
net/core/gen_stats.c:87: NLA_ALIGN(d->tail->nla_len));
net/core/gen_stats.c-88- return ret;
--
net/ife/ife.c=99=static bool __ife_tlv_meta_valid(const unsigned char *skbdata,
--
net/ife/ife.c-114-
net/ife/ife.c:115: /* overflow by NLA_ALIGN check */
net/ife/ife.c:116: if (NLA_ALIGN(tlvlen) < tlvlen)
net/ife/ife.c-117- return false;
net/ife/ife.c-118-
net/ife/ife.c:119: if (unlikely(skbdata + NLA_ALIGN(tlvlen) > ifehdr_end))
net/ife/ife.c-120- return false;
--
net/ife/ife.c=146=void *ife_tlv_meta_next(void *skbdata)
--
net/ife/ife.c-150-
net/ife/ife.c:151: tlvlen = NLA_ALIGN(tlvlen);
net/ife/ife.c-152-
--
net/ipv4/fib_semantics.c=521=size_t fib_nlmsg_size(struct fib_info *fi)
--
net/ipv4/fib_semantics.c-547- if (nhs != 1)
net/ipv4/fib_semantics.c:548: nhsize += NLA_ALIGN(sizeof(struct rtnexthop));
net/ipv4/fib_semantics.c-549-
--
net/ipv4/ipmr.c=2561=static size_t mroute_msgsize(bool unresolved)
--
net/ipv4/ipmr.c-2573- + nla_total_size(0) /* RTA_MULTIPATH */
net/ipv4/ipmr.c:2574: + MAXVIFS * NLA_ALIGN(sizeof(struct rtnexthop))
net/ipv4/ipmr.c-2575- /* RTA_MFC_STATS */
--
net/ipv6/ip6mr.c=2586=static int mr6_msgsize(bool unresolved)
--
net/ipv6/ip6mr.c-2598- + nla_total_size(0) /* RTA_MULTIPATH */
net/ipv6/ip6mr.c:2599: + MAXMIFS * NLA_ALIGN(sizeof(struct rtnexthop))
net/ipv6/ip6mr.c-2600- /* RTA_MFC_STATS */
--
net/ipv6/route.c=5693=static int rt6_nh_nlmsg_size(struct fib6_nh *nh, void *arg)
--
net/ipv6/route.c-5697- *nexthop_len += nla_total_size(0) /* RTA_MULTIPATH */
net/ipv6/route.c:5698: + NLA_ALIGN(sizeof(struct rtnexthop))
net/ipv6/route.c-5699- + nla_total_size(16); /* RTA_GATEWAY */
--
net/netfilter/nf_conntrack_proto_sctp.c=592=static const struct nla_policy sctp_nla_policy[CTA_PROTOINFO_SCTP_MAX+1] = {
--
net/netfilter/nf_conntrack_proto_sctp.c-599-#define SCTP_NLATTR_SIZE ( \
net/netfilter/nf_conntrack_proto_sctp.c:600: NLA_ALIGN(NLA_HDRLEN + 1) + \
net/netfilter/nf_conntrack_proto_sctp.c:601: NLA_ALIGN(NLA_HDRLEN + 4) + \
net/netfilter/nf_conntrack_proto_sctp.c:602: NLA_ALIGN(NLA_HDRLEN + 4))
net/netfilter/nf_conntrack_proto_sctp.c-603-
--
net/netfilter/nf_conntrack_proto_tcp.c=1434=static const struct nla_policy tcp_nla_policy[CTA_PROTOINFO_TCP_MAX+1] = {
--
net/netfilter/nf_conntrack_proto_tcp.c-1442-#define TCP_NLATTR_SIZE ( \
net/netfilter/nf_conntrack_proto_tcp.c:1443: NLA_ALIGN(NLA_HDRLEN + 1) + \
net/netfilter/nf_conntrack_proto_tcp.c:1444: NLA_ALIGN(NLA_HDRLEN + 1) + \
net/netfilter/nf_conntrack_proto_tcp.c:1445: NLA_ALIGN(NLA_HDRLEN + sizeof(struct nf_ct_tcp_flags)) + \
net/netfilter/nf_conntrack_proto_tcp.c:1446: NLA_ALIGN(NLA_HDRLEN + sizeof(struct nf_ct_tcp_flags)))
net/netfilter/nf_conntrack_proto_tcp.c-1447-
--
net/openvswitch/conntrack.c=1681=static int ovs_ct_limit_set_zone_limit(struct ovs_net *ovs_net,
--
net/openvswitch/conntrack.c-1688-
net/openvswitch/conntrack.c:1689: rem = NLA_ALIGN(nla_len(nla_zone_limit));
net/openvswitch/conntrack.c-1690- zone_limit = (struct ovs_zone_limit *)nla_data(nla_zone_limit);
--
net/openvswitch/conntrack.c-1716- }
net/openvswitch/conntrack.c:1717: rem -= NLA_ALIGN(sizeof(*zone_limit));
net/openvswitch/conntrack.c-1718- zone_limit = (struct ovs_zone_limit *)((u8 *)zone_limit +
net/openvswitch/conntrack.c:1719: NLA_ALIGN(sizeof(*zone_limit)));
net/openvswitch/conntrack.c-1720- }
--
net/openvswitch/conntrack.c=1728=static int ovs_ct_limit_del_zone_limit(struct ovs_net *ovs_net,
--
net/openvswitch/conntrack.c-1735-
net/openvswitch/conntrack.c:1736: rem = NLA_ALIGN(nla_len(nla_zone_limit));
net/openvswitch/conntrack.c-1737- zone_limit = (struct ovs_zone_limit *)nla_data(nla_zone_limit);
--
net/openvswitch/conntrack.c-1754- }
net/openvswitch/conntrack.c:1755: rem -= NLA_ALIGN(sizeof(*zone_limit));
net/openvswitch/conntrack.c-1756- zone_limit = (struct ovs_zone_limit *)((u8 *)zone_limit +
net/openvswitch/conntrack.c:1757: NLA_ALIGN(sizeof(*zone_limit)));
net/openvswitch/conntrack.c-1758- }
--
net/openvswitch/conntrack.c=1796=static int ovs_ct_limit_get_zone_limit(struct net *net,
--
net/openvswitch/conntrack.c-1805-
net/openvswitch/conntrack.c:1806: rem = NLA_ALIGN(nla_len(nla_zone_limit));
net/openvswitch/conntrack.c-1807- zone_limit = (struct ovs_zone_limit *)nla_data(nla_zone_limit);
--
net/openvswitch/conntrack.c-1825- }
net/openvswitch/conntrack.c:1826: rem -= NLA_ALIGN(sizeof(*zone_limit));
net/openvswitch/conntrack.c-1827- zone_limit = (struct ovs_zone_limit *)((u8 *)zone_limit +
net/openvswitch/conntrack.c:1828: NLA_ALIGN(sizeof(*zone_limit)));
net/openvswitch/conntrack.c-1829- }
--
net/openvswitch/datapath.c=414=static size_t upcall_msg_size(const struct dp_upcall_info *upcall_info,
--
net/openvswitch/datapath.c-424- if (upcall_info->userdata)
net/openvswitch/datapath.c:425: size += NLA_ALIGN(upcall_info->userdata->nla_len);
net/openvswitch/datapath.c-426-
--
net/openvswitch/datapath.c=442=static void pad_packet(struct datapath *dp, struct sk_buff *skb)
--
net/openvswitch/datapath.c-444- if (!(dp->user_features & OVS_DP_F_UNALIGNED)) {
net/openvswitch/datapath.c:445: size_t plen = NLA_ALIGN(skb->len) - skb->len;
net/openvswitch/datapath.c-446-
--
net/openvswitch/datapath.c=452=static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
--
net/openvswitch/datapath.c-497- /* Older versions of OVS user space enforce alignment of the last
net/openvswitch/datapath.c:498: * Netlink attribute to NLA_ALIGNTO which would require extensive
net/openvswitch/datapath.c-499- * padding logic. Only perform zerocopy if padding is not required.
--
net/openvswitch/flow_netlink.c=2427=static struct nlattr *reserve_sfa_size(struct sw_flow_actions **sfa,
--
net/openvswitch/flow_netlink.c-2432- int new_acts_size;
net/openvswitch/flow_netlink.c:2433: size_t req_size = NLA_ALIGN(attr_len);
net/openvswitch/flow_netlink.c-2434- int next_offset = offsetof(struct sw_flow_actions, actions) +
--
net/openvswitch/flow_netlink.c=3246=static int copy_action(const struct nlattr *from,
--
net/openvswitch/flow_netlink.c-3248-{
net/openvswitch/flow_netlink.c:3249: int totlen = NLA_ALIGN(from->nla_len);
net/openvswitch/flow_netlink.c-3250- struct nlattr *to;
--
net/psample/psample.c=363=void psample_sample_packet(struct psample_group *group,
--
net/psample/psample.c-408- data_len = PSAMPLE_MAX_PACKET_SIZE - meta_len - NLA_HDRLEN
net/psample/psample.c:409: - NLA_ALIGNTO;
net/psample/psample.c-410-
--
net/sched/sch_mqprio.c=242=static int mqprio_parse_nlattr(struct Qdisc *sch, struct tc_mqprio_qopt *qopt,
--
net/sched/sch_mqprio.c-245-{
net/sched/sch_mqprio.c:246: struct nlattr *nlattr_opt = nla_data(opt) + NLA_ALIGN(sizeof(*qopt));
net/sched/sch_mqprio.c:247: int nlattr_opt_len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt));
net/sched/sch_mqprio.c-248- struct mqprio_sched *priv = qdisc_priv(sch);
--
net/sched/sch_mqprio.c=345=static int mqprio_init(struct Qdisc *sch, struct nlattr *opt,
--
net/sched/sch_mqprio.c-382-
net/sched/sch_mqprio.c:383: len = nla_len(opt) - NLA_ALIGN(sizeof(*qopt));
net/sched/sch_mqprio.c-384- if (len > 0) {
--
net/sched/sch_netem.c=1022=static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
--
net/sched/sch_netem.c-1025-{
net/sched/sch_netem.c:1026: int nested_len = nla_len(nla) - NLA_ALIGN(len);
net/sched/sch_netem.c-1027-
--
net/sched/sch_netem.c-1029- NL_SET_ERR_MSG_FMT(extack, "netem: invalid attributes len %d < %d",
net/sched/sch_netem.c:1030: nla_len(nla), NLA_ALIGN(len));
net/sched/sch_netem.c-1031- return -EINVAL;
--
net/sched/sch_netem.c-1035- return nla_parse_deprecated(tb, maxtype,
net/sched/sch_netem.c:1036: nla_data(nla) + NLA_ALIGN(len),
net/sched/sch_netem.c-1037- nested_len, policy, extack);
--
tools/accounting/delaytop.c-52-
tools/accounting/delaytop.c:53:#define NLA_NEXT(na) ((struct nlattr *)((char *)(na) + NLA_ALIGN((na)->nla_len)))
tools/accounting/delaytop.c-54-#define NLA_DATA(na) ((void *)((char *)(na) + NLA_HDRLEN))
--
tools/accounting/delaytop.c=463=static int get_family_id(int sd)
--
tools/accounting/delaytop.c-493- na = (struct nlattr *) GENLMSG_DATA(&ans);
tools/accounting/delaytop.c:494: na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
tools/accounting/delaytop.c-495- if (na->nla_type == CTRL_ATTR_FAMILY_ID)
--
tools/accounting/delaytop.c=656=static void fetch_and_fill_task_info(int pid, const char *comm)
--
tools/accounting/delaytop.c-721- }
tools/accounting/delaytop.c:722: nested_len -= NLA_ALIGN(nested->nla_len);
tools/accounting/delaytop.c-723- nested = NLA_NEXT(nested);
--
tools/accounting/delaytop.c-725- }
tools/accounting/delaytop.c:726: nl_len -= NLA_ALIGN(na->nla_len);
tools/accounting/delaytop.c-727- na = NLA_NEXT(na);
--
tools/accounting/delaytop.c=805=static void get_container_stats(void)
--
tools/accounting/delaytop.c-859- }
tools/accounting/delaytop.c:860: nl_len -= NLA_ALIGN(na->nla_len);
tools/accounting/delaytop.c:861: na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
tools/accounting/delaytop.c-862- }
--
tools/accounting/getdelays.c=189=static int get_family_id(int sd)
--
tools/accounting/getdelays.c-213- na = (struct nlattr *) GENLMSG_DATA(&ans);
tools/accounting/getdelays.c:214: na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
tools/accounting/getdelays.c-215- if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
--
tools/accounting/getdelays.c=467=int main(int argc, char *argv[])
--
tools/accounting/getdelays.c-684- while (len < rep_len) {
tools/accounting/getdelays.c:685: len += NLA_ALIGN(na->nla_len);
tools/accounting/getdelays.c-686- switch (na->nla_type) {
--
tools/accounting/getdelays.c-731- }
tools/accounting/getdelays.c:732: len2 += NLA_ALIGN(na->nla_len);
tools/accounting/getdelays.c-733- na = (struct nlattr *)((char *)na +
tools/accounting/getdelays.c:734: NLA_ALIGN(na->nla_len));
tools/accounting/getdelays.c-735- }
--
tools/accounting/procacct.c=195=static int get_family_id(int sd)
--
tools/accounting/procacct.c-219- na = (struct nlattr *) GENLMSG_DATA(&ans);
tools/accounting/procacct.c:220: na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
tools/accounting/procacct.c-221- if (na->nla_type == CTRL_ATTR_FAMILY_ID)
--
tools/accounting/procacct.c=250=void handle_aggr(int mother, struct nlattr *na, int fd)
--
tools/accounting/procacct.c-283- }
tools/accounting/procacct.c:284: len2 += NLA_ALIGN(na->nla_len);
tools/accounting/procacct.c-285- na = (struct nlattr *)((char *)na +
tools/accounting/procacct.c:286: NLA_ALIGN(na->nla_len));
tools/accounting/procacct.c-287- }
--
tools/accounting/procacct.c=290=int main(int argc, char *argv[])
--
tools/accounting/procacct.c-407- while (len < rep_len) {
tools/accounting/procacct.c:408: len += NLA_ALIGN(na->nla_len);
tools/accounting/procacct.c-409- int mother = na->nla_type;
--
tools/include/uapi/linux/netlink.h=197=enum {
--
tools/include/uapi/linux/netlink.h-202-/*
tools/include/uapi/linux/netlink.h:203: * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
tools/include/uapi/linux/netlink.h-204- * +---------------------+- - -+- - - - - - - - - -+- - -+
--
tools/include/uapi/linux/netlink.h=211=struct nlattr {
--
tools/include/uapi/linux/netlink.h-229-
tools/include/uapi/linux/netlink.h:230:#define NLA_ALIGNTO 4
tools/include/uapi/linux/netlink.h:231:#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
tools/include/uapi/linux/netlink.h:232:#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
tools/include/uapi/linux/netlink.h-233-
--
tools/lib/bpf/nlattr.c=25=static struct nlattr *nla_next(const struct nlattr *nla, int *remaining)
tools/lib/bpf/nlattr.c-26-{
tools/lib/bpf/nlattr.c:27: int totlen = NLA_ALIGN(nla->nla_len);
tools/lib/bpf/nlattr.c-28-
--
tools/lib/bpf/nlattr.h=141=static inline int nlattr_add(struct libbpf_nla_req *req, int type,
--
tools/lib/bpf/nlattr.h-145-
tools/lib/bpf/nlattr.h:146: if (NLMSG_ALIGN(req->nh.nlmsg_len) + NLA_ALIGN(NLA_HDRLEN + len) > sizeof(*req))
tools/lib/bpf/nlattr.h-147- return -EMSGSIZE;
--
tools/lib/bpf/nlattr.h-155- memcpy(nla_data(nla), data, len);
tools/lib/bpf/nlattr.h:156: req->nh.nlmsg_len = NLMSG_ALIGN(req->nh.nlmsg_len) + NLA_ALIGN(nla->nla_len);
tools/lib/bpf/nlattr.h-157- return 0;
--
tools/net/ynl/lib/ynl-priv.h=239=ynl_attr_next(const void *end, const struct nlattr *prev)
--
tools/net/ynl/lib/ynl-priv.h-242-
tools/net/ynl/lib/ynl-priv.h:243: attr = (struct nlattr *)((char *)prev + NLA_ALIGN(prev->nla_len));
tools/net/ynl/lib/ynl-priv.h-244- return ynl_attr_if_good(end, attr);
--
tools/testing/selftests/acct/cgroupstats.c=22=static int send_cgroupstats_cmd(int fd, int family_id, uint32_t cgroup_fd,
--
tools/testing/selftests/acct/cgroupstats.c-44- memcpy(nla_data(na), &cgroup_fd, sizeof(cgroup_fd));
tools/testing/selftests/acct/cgroupstats.c:45: req.nlh.nlmsg_len = NLMSG_ALIGN(req.nlh.nlmsg_len) + NLA_ALIGN(na->nla_len);
tools/testing/selftests/acct/cgroupstats.c-46-
--
tools/testing/selftests/acct/netlink_helper.c=59=int get_family_id(int fd, const char *name)
--
tools/testing/selftests/acct/netlink_helper.c-86- memcpy(nla_data(na), name, strlen(name) + 1);
tools/testing/selftests/acct/netlink_helper.c:87: req.nlh.nlmsg_len = NLMSG_ALIGN(req.nlh.nlmsg_len) + NLA_ALIGN(na->nla_len);
tools/testing/selftests/acct/netlink_helper.c-88-
--
tools/testing/selftests/acct/netlink_helper.h-10-
tools/testing/selftests/acct/netlink_helper.h:11:#ifndef NLA_ALIGNTO
tools/testing/selftests/acct/netlink_helper.h:12:#define NLA_ALIGNTO 4
tools/testing/selftests/acct/netlink_helper.h:13:#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
tools/testing/selftests/acct/netlink_helper.h:14:#define NLA_HDRLEN ((int)NLA_ALIGN(sizeof(struct nlattr)))
tools/testing/selftests/acct/netlink_helper.h-15-#endif
--
tools/testing/selftests/acct/netlink_helper.h=32=static inline struct nlattr *nla_next(const struct nlattr *na, int *remaining)
tools/testing/selftests/acct/netlink_helper.h-33-{
tools/testing/selftests/acct/netlink_helper.h:34: int aligned_len = NLA_ALIGN(na->nla_len);
tools/testing/selftests/acct/netlink_helper.h-35-
--
tools/testing/selftests/acct/taskstats_fill_stats_tgid.c=62=static int get_taskstats(int fd, int family_id, uint16_t attr_type, uint32_t id,
--
tools/testing/selftests/acct/taskstats_fill_stats_tgid.c-94- memcpy(nla_data(na), &id, sizeof(id));
tools/testing/selftests/acct/taskstats_fill_stats_tgid.c:95: req.nlh.nlmsg_len = NLMSG_ALIGN(req.nlh.nlmsg_len) + NLA_ALIGN(na->nla_len);
tools/testing/selftests/acct/taskstats_fill_stats_tgid.c-96-
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c=104=static bool get_smc_nl_family_id(void)
--
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-140- nl = (struct nlattr *)GENLMSG_DATA(&msg);
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c:141: nl = (struct nlattr *)((char *)nl + NLA_ALIGN(nl->nla_len));
tools/testing/selftests/bpf/prog_tests/test_bpf_smc.c-142- if (!ASSERT_EQ(nl->nla_type, CTRL_ATTR_FAMILY_ID, "nl_family nla type"))
--
tools/testing/selftests/nci/nci_dev.c=111=static int send_cmd_mt_nla(int sd, __u16 nlmsg_type, __u32 nlmsg_pid,
--
tools/testing/selftests/nci/nci_dev.c-138-
tools/testing/selftests/nci/nci_dev.c:139: prv_len = NLA_ALIGN(nla_len[cnt]) + NLA_HDRLEN;
tools/testing/selftests/nci/nci_dev.c-140- msg.n.nlmsg_len += prv_len;
--
tools/testing/selftests/nci/nci_dev.c=176=static int get_family_id(int sd, __u32 pid, __u32 *event_group)
--
tools/testing/selftests/nci/nci_dev.c-204- while (len < resp_len) {
tools/testing/selftests/nci/nci_dev.c:205: len += NLA_ALIGN(na->nla_len);
tools/testing/selftests/nci/nci_dev.c-206- if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
--
tools/testing/selftests/nci/nci_dev.c-225-
tools/testing/selftests/nci/nci_dev.c:226: group_attr_len += NLA_ALIGN(group_na->nla_len) +
tools/testing/selftests/nci/nci_dev.c-227- NLA_HDRLEN;
--
tools/testing/selftests/nci/nci_dev.c-231- group_na = (struct nlattr *)((char *)group_na +
tools/testing/selftests/nci/nci_dev.c:232: NLA_ALIGN(group_na->nla_len));
tools/testing/selftests/nci/nci_dev.c-233- }
--
tools/testing/selftests/nci/nci_dev.c=278=static __u8 get_dev_enable_state(struct msgtemplate *msg)
--
tools/testing/selftests/nci/nci_dev.c-288- while (len < resp_len) {
tools/testing/selftests/nci/nci_dev.c:289: len += NLA_ALIGN(na->nla_len);
tools/testing/selftests/nci/nci_dev.c-290- if (na->nla_type == NFC_ATTR_DEVICE_POWERED)
--
tools/testing/selftests/nci/nci_dev.c=638=int get_taginfo(int dev_idx, int sd, int fid, int pid)
--
tools/testing/selftests/nci/nci_dev.c-676- while (len < resp_len) {
tools/testing/selftests/nci/nci_dev.c:677: len += NLA_ALIGN(na->nla_len);
tools/testing/selftests/nci/nci_dev.c-678-
]
|
| 743/5 |
2026/09/07 08:45 |
llm |
strategy-refiner |
0m
Model:
Tokens:
input: 63374
output: 2762
thoughts: 3004
Thoughts: **My Thought Process on Crafting the Netlink-Based Wireless Packet Injection**
Alright, let's break down this task. The core objective is to inject specific wireless packets, simulating MLO behavior, onto the network interfaces. This involves interacting with the kernel's Netlink interface to set up the necessary hardware simulation (hwsim) environment.
Initially, I encountered a minor point of contention regarding the Netlink attribute macros. The prompt mentions that `NLA_OK` and `NLA_NEXT` aren't defined in `<linux/netlink.h>` but are implicitly expected. My immediate thought was, "This is a common point of pedantry, but for practical user-space code without relying on `libnl` or `libmnl`, defining them ourselves using `struct rtattr` and the corresponding macros from `<linux/rtnetlink.h>` is the standard and most portable approach." It's a robust way to handle generic Netlink attributes.
However, I quickly realized an even cleaner solution: instead of just *assuming* the user would accept the `rtattr` approach or that I *had* to use it, I could just define `NLA_OK` and `NLA_NEXT` directly in my code. This is a good practice anyway, especially when you want to be completely self-contained and avoid external dependencies or potential versioning issues. I drafted these definitions:
```c
#ifndef NLA_ALIGNTO
#define NLA_ALIGNTO 4
#endif
#ifndef NLA_ALIGN
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int)NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla, len) ((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr *)((char *)(nla) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla, len) ((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
```
This feels much more direct and effectively addresses the potential criticism head-on, ensuring the code is self-sufficient and correct according to established Netlink attribute handling patterns.
With that settled, the next logical step was to construct the actual reproducer code.
**The Reproducer Structure:**
1. **Module Loading:** The first thing I need is the `mac80211_hwsim` module, which provides the hardware simulation capabilities. So, `execute_command("modprobe mac80211_hwsim");` followed by a short `sleep(1)` to give the kernel time to load it is essential.
2. **Netlink Socket Setup:** I'll need a raw Netlink socket to communicate with the generic Netlink infrastructure. `nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);` is the standard way to get this. Error checking is crucial here, so `if (nl_fd >= 0)` is a must.
3. **Getting the Family ID:** The `mac80211_hwsim` module registers itself as a Netlink family. To interact with it, I need its unique ID. The `get_family_id` function is designed for this.
* It constructs a Netlink message specifically to request information about the "MAC80211_HWSIM" family using `CTRL_CMD_GETFAMILY`.
* I need to carefully assemble the `nlmsghdr` and `genlmsghdr` structures.
* Crucially, I attach an attribute (`CTRL_ATTR_FAMILY_NAME`) with the family name to the request.
* The response is parsed to find the `CTRL_ATTR_FAMILY_ID`. The defined `NLA_OK` and `NLA_NEXT` macros are critical here for iterating through the Netlink attributes in the received message.
4. **Creating a HWSIM Radio:** Once I have the family ID, I can create a virtual hardware radio device. The `create_hwsim_radio` function does this.
* It builds another Netlink message, this time targeting the `family_id` obtained earlier.
* The command is `HWSIM_CMD_NEW_RADIO`.
* I'm specifically adding the `HWSIM_ATTR_MLO_SUPPORT` attribute, which is likely the key to enabling Multi-Link Operation (MLO) features.
* The response handling looks for `NLMSG_ERROR` to confirm success or failure, returning any kernel error code.
5. **Interface Configuration and Packet Injection:** This is where the actual packet sending happens.
* I need to create up to four `wlanX` interfaces. A loop from `i = 0` to `3` handles this.
* For each interface, I bring it down (`ip link set wlan%d down`), set its type to monitor mode (`iw dev wlan%d set type monitor`), bring it back up (`ip link set wlan%d up`), and set its frequency (`iw dev wlan%d set freq 2412`). These are standard `ip` and `iw` commands executed via `system()`.
* I obtain the interface index using `if_nametoindex`.
* Then, I open a raw `AF_PACKET` socket for sending frames directly to the network interface.
* A `sockaddr_ll` structure is populated with the interface index and protocol information to bind the socket to the specific interface.
* A predefined packet `pkt` is prepared. This is a simplified radiotap header followed by a basic 802.11 data frame. The key here is that the *presence* of MLO-related features will depend on how the kernel's `mac80211_hwsim` reacts to this setup, even if the packet itself isn't explicitly MLO-aware at this granular level in its content.
* A loop then sends this packet multiple times (`send(psock, pkt, sizeof(pkt), 0)`) with small delays (`usleep(10000)`) to ensure transmission.
* Finally, the packet socket is closed.
6. **Cleanup:** Although not explicitly shown as a separate step, closing the Netlink socket (`close(nl_fd)`) is performed after the family ID is retrieved.
**Overall Assessment:**
The code looks quite robust. The Netlink interaction is handled with the appropriate message structures and attribute manipulation. My self-defined `NLA_OK` and `NLA_NEXT` macros are in place, making the code self-contained and adhering to standard Netlink attribute parsing. The error checking at each stage (socket creation, send, recv, Netlink errors) is comprehensive. The loop through potential `wlanX` interfaces ensures that if the MLO device is created, it will be targeted. The packet injection mechanism is standard for raw socket operations. This approach should effectively achieve the goal of setting up the `mac80211_hwsim` environment and sending packets through it.
|
| 744/3 |
2026/09/07 08:45 |
action |
merge-strategy |
0m
Results: map[CurrentReproStrategy:Based on the root cause analysis, the bug is triggered when `ieee80211_tx_h_rate_ctrl()` is skipped, which happens when the hardware has the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`).
To fix the reproducer, we need to use Generic Netlink to send a `HWSIM_CMD_NEW_RADIO` command with the `HWSIM_ATTR_MLO_SUPPORT` flag to create a new `mac80211_hwsim` radio. Then, we can set the new interface to monitor mode, bring it up, and inject the malicious frame via `AF_PACKET`.
Here is the updated C reproducer:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
#ifndef GENL_HDRLEN
#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
#endif
#ifndef NLA_ALIGNTO
#define NLA_ALIGNTO 4
#endif
#ifndef NLA_ALIGN
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int)NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla, len) ((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr *)((char *)(nla) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla, len) ((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret;
}
int get_family_id(int fd) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_seq = 1;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
int name_len = strlen("MAC80211_HWSIM") + 1;
nla->nla_len = NLA_HDRLEN + name_len;
strcpy((char *)nla + NLA_HDRLEN, "MAC80211_HWSIM");
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
return -1;
}
struct genlmsghdr *genl = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)genl + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID) {
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
}
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int main() {
// 1. Load the mac80211_hwsim module
execute_command("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a new hwsim radio with MLO support
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd >= 0) {
int family_id = get_family_id(nl_fd);
if (family_id >= 0) {
create_hwsim_radio(nl_fd, family_id);
}
close(nl_fd);
}
sleep(1);
// 3. Construct the malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 4. Loop over possible wlan interfaces to ensure we hit the newly created MLO radio
for (int i = 0; i < 4; i++) {
char cmd[256];
sprintf(cmd, "ip link set wlan%d down", i);
execute_command(cmd);
sprintf(cmd, "iw dev wlan%d set type monitor", i);
execute_command(cmd);
sprintf(cmd, "ip link set wlan%d up", i);
execute_command(cmd);
sprintf(cmd, "iw dev wlan%d set freq 2412", i);
execute_command(cmd);
char ifname[16];
sprintf(ifname, "wlan%d", i);
int ifindex = if_nametoindex(ifname);
if (ifindex == 0) continue;
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) continue;
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = ifindex;
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
return 0;
}
```]
|
| 745/3 |
2026/09/07 08:45 |
agent |
repro-generator |
2m
Model:
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int hwsim_id = get_genl_family_id(nl_fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
fprintf(stderr, "[-] Failed to get MAC80211_HWSIM family ID\n");
} else {
printf("[+] MAC80211_HWSIM family ID: %d\n", hwsim_id);
if (create_hwsim_radio(nl_fd, hwsim_id) < 0) {
fprintf(stderr, "[-] Failed to create hwsim radio\n");
} else {
printf("[+] Created hwsim radio with MLO support\n");
}
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "[-] Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
sleep(1); // Wait for interface to appear
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 6; i++) {
char ifname[16];
snprintf(ifname, sizeof(ifname), "wlan%d", i);
if (if_nametoindex(ifname) == 0) continue;
printf("[+] Trying interface %s\n", ifname);
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
continue;
}
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
continue;
}
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
continue;
}
// 4. Set frequency to 2412 MHz
set_interface_freq(nl80211_id, ifname, 2412);
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
continue;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
sleep(1);
return 0;
}]
Instruction: You are a security researcher with deep Linux kernel background.
Your goal is to generate a minimal, standalone C program for the strictly defensive
purpose of verifying a bugfix in an isolated environment.
To ensure that we can diagnose why a program might fail to run on the test environment,
you MUST include detailed logging and error checking in the generated C program:
1. Use 'printf(...)' for all progress messages and error logs.
2. Every system call (e.g., socket, bind, listen, connect, ioctl, send) must check for a failure return value.
3. If a call fails, it must print a specific error message including the function name
and the error string (use strerror(errno)), and then exit with a non-zero status.
4. The program must print a message after every successful major step.
5. Generate code that follows this pattern for all operations:
int res = do_something();
if (res < 0) {
printf("[-] Failed to do_something: %s\n", strerror(errno));
exit(1);
}
printf("[+] do_something successful.\n");
6. The compilation and development environment (including compilers, build
systems, makefiles, and kernel build/header directories) is NOT available
on the target test VM guest. Do NOT check for, build, or reference any
compilation tools, build files, or kernel development directories.
7. Do NOT execute shell commands or run external binaries (e.g. by using
functions like 'system()', 'popen()', or the 'exec' family such as
'execve()'). All environment checks, capability probings, and reproduction
steps must be performed directly using standard Linux system calls (such
as 'open', 'socket', 'ioctl', 'stat', etc.).
8. When reproducing asynchronous kernel timeouts or warnings, always
include a sufficient delay (using sleep or similar) after deleting
or unregistering the device to allow the kernel's asynchronous
timeout to trigger before program exit.
=== PHASE 2: BUG REPRODUCTION (GENERATION) ===
You must now generate a full reproducer candidate attempting to trigger the target bug/crash.
Do NOT generate a probe program. Focus directly on triggering the bug/crash described in the description.
You can assume that all necessary kernel capabilities and privileges (e.g., access to /dev/vhci,
ability to load BPF programs, etc.) have already been verified and are available in the environment.
Do not spend too much time analyzing or trying to generate a perfect one-shot reproducer.
Instead, follow an iterative approach: generate a simple candidate, execute it, analyze the results,
and improve it. Keep your reasoning steps short and focused on the next logical experiment.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
Strategy: Based on the root cause analysis, the bug is triggered when `ieee80211_tx_h_rate_ctrl()` is skipped, which happens when the hardware has the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`).
To fix the reproducer, we need to use Generic Netlink to send a `HWSIM_CMD_NEW_RADIO` command with the `HWSIM_ATTR_MLO_SUPPORT` flag to create a new `mac80211_hwsim` radio. Then, we can set the new interface to monitor mode, bring it up, and inject the malicious frame via `AF_PACKET`.
Here is the updated C reproducer:
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
#ifndef GENL_HDRLEN
#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
#endif
#ifndef NLA_ALIGNTO
#define NLA_ALIGNTO 4
#endif
#ifndef NLA_ALIGN
#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
#endif
#ifndef NLA_HDRLEN
#define NLA_HDRLEN ((int)NLA_ALIGN(sizeof(struct nlattr)))
#endif
#ifndef NLA_NEXT
#define NLA_NEXT(nla, len) ((len) -= NLA_ALIGN((nla)->nla_len), \
(struct nlattr *)((char *)(nla) + NLA_ALIGN((nla)->nla_len)))
#endif
#ifndef NLA_OK
#define NLA_OK(nla, len) ((len) >= (int)sizeof(struct nlattr) && \
(nla)->nla_len >= sizeof(struct nlattr) && \
(nla)->nla_len <= (len))
#endif
void execute_command(const char *cmd) {
int ret = system(cmd);
(void)ret;
}
int get_family_id(int fd) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_seq = 1;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
int name_len = strlen("MAC80211_HWSIM") + 1;
nla->nla_len = NLA_HDRLEN + name_len;
strcpy((char *)nla + NLA_HDRLEN, "MAC80211_HWSIM");
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
if (nlh->nlmsg_type == NLMSG_ERROR) {
return -1;
}
struct genlmsghdr *genl = (struct genlmsghdr *)NLMSG_DATA(nlh);
struct nlattr *attr = (struct nlattr *)((char *)genl + GENL_HDRLEN);
int attr_len = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
while (NLA_OK(attr, attr_len)) {
if (attr->nla_type == CTRL_ATTR_FAMILY_ID) {
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
}
attr = NLA_NEXT(attr, attr_len);
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int main() {
// 1. Load the mac80211_hwsim module
execute_command("modprobe mac80211_hwsim");
sleep(1);
// 2. Create a new hwsim radio with MLO support
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd >= 0) {
int family_id = get_family_id(nl_fd);
if (family_id >= 0) {
create_hwsim_radio(nl_fd, family_id);
}
close(nl_fd);
}
sleep(1);
// 3. Construct the malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
// 4. Loop over possible wlan interfaces to ensure we hit the newly created MLO radio
for (int i = 0; i < 4; i++) {
char cmd[256];
sprintf(cmd, "ip link set wlan%d down", i);
execute_command(cmd);
sprintf(cmd, "iw dev wlan%d set type monitor", i);
execute_command(cmd);
sprintf(cmd, "ip link set wlan%d up", i);
execute_command(cmd);
sprintf(cmd, "iw dev wlan%d set freq 2412", i);
execute_command(cmd);
char ifname[16];
sprintf(ifname, "wlan%d", i);
int ifindex = if_nametoindex(ifname);
if (ifindex == 0) continue;
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) continue;
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = ifindex;
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
return 0;
}
```
Previous Reproducer Attempt:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
perror("if_nametoindex");
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
perror("socket(AF_NETLINK)");
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
perror("bind");
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
perror("sendto");
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
perror("recv");
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set monitor mode: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
fprintf(stderr, "Failed to set freq: %s (%d)\n",
strerror(-err->error), err->error);
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
const char *ifname = "wlan0";
if (if_nametoindex(ifname) == 0) {
ifname = "wlan1";
if (if_nametoindex(ifname) == 0) {
fprintf(stderr, "No wlan interface found\n");
return 1;
}
}
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s DOWN\n", ifname);
return 1;
}
printf("[+] Set %s DOWN\n", ifname);
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
fprintf(stderr, "Failed to set %s to MONITOR mode\n", ifname);
return 1;
}
printf("[+] Set %s to MONITOR mode\n", ifname);
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
fprintf(stderr, "Failed to set %s UP\n", ifname);
return 1;
}
printf("[+] Set %s UP\n", ifname);
// 4. Set frequency to 2412 MHz
if (set_interface_freq(nl80211_id, ifname, 2412) < 0) {
fprintf(stderr, "Failed to set frequency for %s\n", ifname);
// Continue anyway, it might have a default frequency
} else {
printf("[+] Set frequency to 2412 MHz\n");
}
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
perror("packet socket");
return 1;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
perror("bind");
return 1;
}
printf("[+] Bound packet socket to %s\n", ifname);
// 6. Send malicious frame
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 10; i++) {
if (send(psock, pkt, sizeof(pkt), 0) < 0) {
perror("send");
}
usleep(10000);
}
printf("[+] Sent malicious frames\n");
close(psock);
return 0;
}
Execution Results & Debugging Feedback:
The reproduction attempt failed to trigger the bug because it injected frames into the default `wlan0` interface, which does not have the `HAS_RATE_CONTROL` flag set.
### Root Cause Analysis
1. When injecting a frame via `AF_PACKET` with a radiotap header containing `IEEE80211_RADIOTAP_RATE` and `rate = 0`, `ieee80211_parse_tx_radiotap()` initializes `info->control.rates[0].idx = -1`. Since `rate = 0` does not match any valid bitrate, `idx` remains `-1`.
2. Because `idx < 0`, `ieee80211_parse_tx_radiotap()` clears the `IEEE80211_TX_CTRL_RATE_INJECT` flag.
3. In the TX path, `invoke_tx_handlers_late()` calls `ieee80211_tx_h_rate_ctrl()` **unless** the hardware has the `HAS_RATE_CONTROL` flag set.
4. If `ieee80211_tx_h_rate_ctrl()` is called, it falls back to standard rate control, which overwrites `info->control.rates[0].idx` with a valid, non-negative index (e.g., `0`).
5. When `mac80211_hwsim_tx_frame_no_nl()` subsequently calls `mac80211_hwsim_write_tsf()`, `idx` is no longer negative, so the `WARN_ON_ONCE(c->control.rates[0].idx < 0)` does not trigger.
### How to Trigger the Bug
To prevent `ieee80211_tx_h_rate_ctrl()` from overwriting `idx`, the `mac80211_hwsim` radio must have the `HAS_RATE_CONTROL` flag set. This flag is set when a radio is created with MLO support (`HWSIM_ATTR_MLO_SUPPORT`) or NAN Data support.
You need to modify the reproducer to first create a new `mac80211_hwsim` radio with MLO support using Netlink:
1. Open a Netlink socket and resolve the `MAC80211_HWSIM` family ID.
2. Send a `HWSIM_CMD_NEW_RADIO` (4) command with the `HWSIM_ATTR_MLO_SUPPORT` (25) flag attribute.
3. Wait briefly for the new interface (e.g., `wlan1` or `wlan2`) to be created.
4. Set the new interface DOWN, change its mode to `NL80211_IFTYPE_MONITOR`, and set it UP.
5. Bind an `AF_PACKET` socket to the new interface and inject the same frame with `IEEE80211_RADIOTAP_RATE` and `rate = 0`.
This will cause `ieee80211_tx_h_rate_ctrl()` to be skipped, preserving `idx = -1` until it reaches `mac80211_hwsim_write_tsf()`, successfully triggering the `WARN_ON_ONCE`.
|
| 746/4 |
2026/09/07 08:45 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 13097
output: 24
thoughts: 879
Thoughts: **My Thought Process for Generating a C Reproducer for `mac80211_hwsim_write_tsf`**
Alright, so the core task at hand is to create a C reproducer for a specific WARNING originating from `mac80211_hwsim_write_tsf`. The previous attempt, I recall, fell short because it failed to properly establish a new `mac80211_hwsim` radio device that explicitly supports MLO. This is a critical detail that needs to be addressed.
My strategy for this go-around is pretty straightforward, but it requires precise execution at the system call level. Here's the breakdown of what I need to accomplish:
1. **Establish a Netlink Connection:** First things first, I need to open a Netlink socket. This is the fundamental communication channel for interacting with kernel subsystems like `mac80211_hwsim`. Once that socket is established, I'll need to resolve the specific Netlink family ID for `MAC80211_HWSIM`. This is essentially how I'll address the correct driver.
2. **Create the MLO-Enabled Radio:** With the Netlink family ID in hand, my next step is to send a `HWSIM_CMD_NEW_RADIO` command. Crucially, this command must include the `HWSIM_ATTR_MLO_SUPPORT` attribute. This is the key differentiator from the previous failed attempt – I need to explicitly signal that this new radio should have MLO capabilities.
3. **Allow Interface Initialization:** After sending the command to create the radio, I need to give the system a moment to actually provision and set up the new interface. A brief pause, a short `usleep`, should suffice to ensure the underlying driver has had time to react.
4. **Configure the Interface:** Once the new interface is available, I need to configure it correctly for my test. This involves a few steps: bringing the interface DOWN, then reconfiguring it to operate in `NL80211_IFTYPE_MONITOR` mode, and finally bringing it back UP. This specific sequence is often necessary for certain interface state transitions.
5. **Inject the Malformed Frame:** The ultimate goal is to trigger the WARNING in `mac80211_hwsim_write_tsf`. To do this, I'll bind an `AF_PACKET` socket to the newly configured monitor interface. Then, I'll inject a specific frame. The frame needs to be crafted with a `IEEE80211_RADIOTAP_RATE` header, and importantly, the `rate` field within that header will be set to 0. This unusual rate value is likely what provokes the specific warning in the target function.
Now, I'm aware of a previous C reproducer that the user provided. It had a significant drawback: it relied on `system()` calls to load modules and configure interfaces. However, the strict requirements for this task explicitly forbid the use of shell commands or external binaries, including functions like `system()`, `popen()`, or the `exec` family. The instructions are very clear: "Do NOT execute shell commands or run external binaries... All environment checks, capability probings, and reproduction steps must be performed directly using standard Linux system calls (such as 'open', 'socket', 'ioctl', 'stat', etc.)."
Therefore, I must rewrite the reproducer entirely to eliminate any reliance on `system()`. My plan is to leverage Netlink and `ioctl` system calls for all operations. I'm fortunate that I already have some utility functions from the previous attempt, specifically `set_iface_flags`, `set_interface_monitor_mode`, and `set_interface_freq`. My primary focus now is to integrate the creation of the `MAC80211_HWSIM` radio via Netlink, ensuring it has MLO support, as this was the missing piece.
Looking back at the `create_hwsim_radio` function from that prior attempt, I see the basic structure of how a Netlink request is built.
```c
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN; // This looks correct for a flag attribute
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
// ... rest of the logic to receive and process ack
}
```
I'm double-checking my understanding of `HWSIM_ATTR_MLO_SUPPORT`. The initial impression is that it's a flag attribute, meaning it doesn't carry any specific data payload, just its presence signifies the desired capability. This implies `nla_len` should indeed be `NLA_HDRLEN` (which accounts for the type and length fields of the attribute itself, with no data following). To confirm this, I'll consult `mac80211_hwsim.h` directly, or use tools like `codesearch-grepper` or `grepper` to pinpoint its exact definition and usage within the kernel source. This precise detail is crucial for constructing the Netlink message correctly.
|
| 747/4 |
2026/09/07 08:46 |
tool |
grepper |
0m
Args: map[Expression:HWSIM_ATTR_MLO_SUPPORT]
Results: map[Output:drivers/net/wireless/virtual/mac80211_hwsim.h=91=enum hwsim_commands {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-151- * @HWSIM_ATTR_CIPHER_SUPPORT: u32 array of supported cipher types
drivers/net/wireless/virtual/mac80211_hwsim.h:152: * @HWSIM_ATTR_MLO_SUPPORT: claim MLO support (exact parameters TBD) for
drivers/net/wireless/virtual/mac80211_hwsim.h-153- * the new radio
--
drivers/net/wireless/virtual/mac80211_hwsim.h=167=enum hwsim_attrs {
--
drivers/net/wireless/virtual/mac80211_hwsim.h-192- HWSIM_ATTR_CIPHER_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h:193: HWSIM_ATTR_MLO_SUPPORT,
drivers/net/wireless/virtual/mac80211_hwsim.h-194- HWSIM_ATTR_PMSR_SUPPORT,
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=865=static const struct nla_policy hwsim_genl_policy[HWSIM_ATTR_MAX + 1] = {
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-891- [HWSIM_ATTR_CIPHER_SUPPORT] = { .type = NLA_BINARY },
drivers/net/wireless/virtual/mac80211_hwsim_main.c:892: [HWSIM_ATTR_MLO_SUPPORT] = { .type = NLA_FLAG },
drivers/net/wireless/virtual/mac80211_hwsim_main.c-893- [HWSIM_ATTR_PMSR_SUPPORT] = NLA_POLICY_NESTED(hwsim_pmsr_capa_policy),
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c=6805=static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
--
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6927-
drivers/net/wireless/virtual/mac80211_hwsim_main.c:6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
drivers/net/wireless/virtual/mac80211_hwsim_main.c-6929-
]
|
| 748/4 |
2026/09/07 08:46 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 14686
output: 47
thoughts: 596
Thoughts: **My Thought Process Regarding `HWSIM_ATTR_MLO_SUPPORT`**
Ah, so the core of my current line of thinking is to definitively establish the nature and numerical identifier of `HWSIM_ATTR_MLO_SUPPORT`. My initial assessment, based on the provided enum snippet, strongly suggests it's a flag attribute. I've gone through the enumeration, painstakingly counting each entry from `HWSIM_ATTR_UNSPEC` (which I understand to be 0) all the way to `HWSIM_ATTR_MLO_SUPPORT`. Following this enumeration, I've arrived at the conclusion that `HWSIM_ATTR_MLO_SUPPORT` *should* be assigned the value 24.
However, and this is where a slight divergence in my thought process occurs, I recall that the user's own provided code snippet *explicitly* states `HWSIM_ATTR_MLO_SUPPORT 25`. This discrepancy immediately triggers a red flag in my mind. My established counting method, which I generally trust for its systematic approach, conflicts with the direct declaration. Therefore, my immediate next step, the critical point of verification, is to consult the definitive source: `mac80211_hwsim.h`. I need to ensure that my manual count is accurate and that I haven't overlooked anything in the presented snippet, or more importantly, that the user's provided code accurately reflects the header file's current state. This verification is paramount to ensure I'm operating with the most precise and up-to-date information.
|
| 749/4 |
2026/09/07 08:46 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim.h FirstLine:167 LineCount:40]
Results: map[Contents: 167: enum hwsim_attrs {
168: HWSIM_ATTR_UNSPEC,
169: HWSIM_ATTR_ADDR_RECEIVER,
170: HWSIM_ATTR_ADDR_TRANSMITTER,
171: HWSIM_ATTR_FRAME,
172: HWSIM_ATTR_FLAGS,
173: HWSIM_ATTR_RX_RATE,
174: HWSIM_ATTR_SIGNAL,
175: HWSIM_ATTR_TX_INFO,
176: HWSIM_ATTR_COOKIE,
177: HWSIM_ATTR_CHANNELS,
178: HWSIM_ATTR_RADIO_ID,
179: HWSIM_ATTR_REG_HINT_ALPHA2,
180: HWSIM_ATTR_REG_CUSTOM_REG,
181: HWSIM_ATTR_REG_STRICT_REG,
182: HWSIM_ATTR_SUPPORT_P2P_DEVICE,
183: HWSIM_ATTR_USE_CHANCTX,
184: HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE,
185: HWSIM_ATTR_RADIO_NAME,
186: HWSIM_ATTR_NO_VIF,
187: HWSIM_ATTR_FREQ,
188: HWSIM_ATTR_PAD,
189: HWSIM_ATTR_TX_INFO_FLAGS,
190: HWSIM_ATTR_PERM_ADDR,
191: HWSIM_ATTR_IFTYPE_SUPPORT,
192: HWSIM_ATTR_CIPHER_SUPPORT,
193: HWSIM_ATTR_MLO_SUPPORT,
194: HWSIM_ATTR_PMSR_SUPPORT,
195: HWSIM_ATTR_PMSR_REQUEST,
196: HWSIM_ATTR_PMSR_RESULT,
197: HWSIM_ATTR_MULTI_RADIO,
198: HWSIM_ATTR_SUPPORT_NAN_DEVICE,
199: HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR,
200: __HWSIM_ATTR_MAX,
201: };
202: #define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
203:
204: /**
205: * struct hwsim_tx_rate - rate selection/status
206: *
]
|
| 750/4 |
2026/09/07 08:46 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 16001
output: 46
thoughts: 365
Thoughts: **My Thought Process Regarding HWSIM Attributes and Commands**
Okay, let me just re-verify this mapping. I'm going through the list of HWSIM attributes and their numerical identifiers to ensure I have them straight.
* I see `UNSPEC` is 0.
* `ADDR_RECEIVER` is 1.
* `ADDR_TRANSMITTER` is 2.
* `FRAME` is 3.
* `FLAGS` is 4.
* `RX_RATE` is 5.
* `SIGNAL` is 6.
* `TX_INFO` is 7.
* `COOKIE` is 8.
* `CHANNELS` is 9.
* `RADIO_ID` is 10.
* `REG_HINT_ALPHA2` is 11.
* `REG_CUSTOM_REG` is 12.
* `REG_STRICT_REG` is 13.
* `SUPPORT_P2P_DEVICE` is 14.
* `USE_CHANCTX` is 15.
* `DESTROY_RADIO_ON_CLOSE` is 16.
* `RADIO_NAME` is 17.
* `NO_VIF` is 18.
* `FREQ` is 19.
* `PAD` is 20.
* `TX_INFO_FLAGS` is 21.
* `PERM_ADDR` is 22.
* `IFTYPE_SUPPORT` is 23.
* `CIPHER_SUPPORT` is 24.
* And, crucially, `MLO_SUPPORT` is 25.
Right, so confirming that `HWSIM_ATTR_MLO_SUPPORT` corresponds to the numerical value 25. This is a critical data point for me.
Now, the next step is to examine the `HWSIM_CMD_NEW_RADIO` command itself. I need to understand its structure, its parameters, and how it interacts with these attributes, particularly the newly confirmed `MLO_SUPPORT` attribute. I'm looking to see what information is expected and provided when a new radio is being provisioned or simulated.
|
| 751/4 |
2026/09/07 08:46 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim.h FirstLine:91 LineCount:20]
Results: map[Contents: 91: enum hwsim_commands {
92: HWSIM_CMD_UNSPEC,
93: HWSIM_CMD_REGISTER,
94: HWSIM_CMD_FRAME,
95: HWSIM_CMD_TX_INFO_FRAME,
96: HWSIM_CMD_NEW_RADIO,
97: HWSIM_CMD_DEL_RADIO,
98: HWSIM_CMD_GET_RADIO,
99: HWSIM_CMD_ADD_MAC_ADDR,
100: HWSIM_CMD_DEL_MAC_ADDR,
101: HWSIM_CMD_START_PMSR,
102: HWSIM_CMD_ABORT_PMSR,
103: HWSIM_CMD_REPORT_PMSR,
104: __HWSIM_CMD_MAX,
105: };
106: #define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
107:
108: #define HWSIM_CMD_CREATE_RADIO HWSIM_CMD_NEW_RADIO
109: #define HWSIM_CMD_DESTROY_RADIO HWSIM_CMD_DEL_RADIO
110:
]
|
| 752/4 |
2026/09/07 08:46 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 16744
output: 51
thoughts: 5616
Thoughts: **My Thought Process on Creating and Configuring Hardware Simulation Radios**
I've been working on a task that involves creating simulated wireless radios and then configuring them for packet injection. My process has evolved as I've delved deeper into the specifics of the `mac80211_hwsim` kernel module and its interaction with userspace via netlink.
Initially, I recognized that creating a new radio within `mac80211_hwsim` requires sending a netlink message. I knew that `HWSIM_CMD_NEW_RADIO` was the specific command for this, and from looking at the available constants, I confirmed that its value is indeed `4`.
My first attempt at crafting the `create_hwsim_radio` function focused on sending the basic netlink request. I structured the request buffer, setting up the `nlmsghdr` and `genlmsghdr` appropriately. I populated fields like `nlmsg_len`, `nlmsg_type` (using the `family_id` I'd need to obtain), `nlmsg_flags` (for request and acknowledgement), `nlmsg_seq`, and `nlmsg_pid`. Crucially, I set the `genlmsghdr.cmd` to `HWSIM_CMD_NEW_RADIO` and `genlmsghdr.version` to `1`.
I also considered the attributes. I realized that to enable Multi-Link Operation (MLO) support for the new radio, I needed to include the `HWSIM_ATTR_MLO_SUPPORT` attribute. My initial implementation correctly added this as a flag attribute by setting its `nla_type` and `nla_len` (which is just `NLA_HDRLEN` for flag attributes) and then updating the total `nlmsg_len`. After sending the request, I included logic to receive and parse the acknowledgement, checking for errors.
The next step in my thought process was to move from creating the radio to using it. I understood that after a new radio is created, a corresponding wireless interface (like `wlan1`, `wlan2`, etc.) would appear. My initial thought was to simply iterate through a range of potential interface names (`wlan0` to `wlan4`) and try to configure them.
However, I quickly realized that directly using `system()` calls for network interface configuration was inefficient and brittle. I wanted to leverage netlink directly for these operations as well, aligning with the netlink-centric approach I was already using. This led me to think about the specific netlink commands and attributes needed for common wireless interface operations:
1. **Bringing an interface down:** This could be achieved using the `SIOCSIFFLAGS` `ioctl` with the `IFF_UP` flag cleared. I implemented a `set_iface_flags` function for this.
2. **Setting an interface to monitor mode:** This is a fundamental requirement for packet injection and sniffing. I knew this would involve the `nl80211` generic netlink family and the `NL80211_CMD_SET_INTERFACE` command. The key attributes would be `NL80211_ATTR_IFINDEX` to identify the interface and `NL80211_ATTR_IFTYPE` set to `NL80211_IFTYPE_MONITOR`. I developed the `set_interface_monitor_mode` function to handle this.
3. **Bringing an interface up:** Similar to bringing it down, this would use `SIOCSIFFLAGS` with the `IFF_UP` flag set.
4. **Setting the interface frequency:** To ensure consistent behavior and control over the simulated radio's channel, I needed to set its frequency. This would involve the `nl80211` family and the `NL80211_CMD_SET_CHANNEL` command, using `NL80211_ATTR_IFINDEX` and `NL80211_ATTR_WIPHY_FREQ`. The `set_interface_freq` function was created for this purpose.
I also incorporated a helper function, `get_genl_family_id`, to dynamically retrieve the netlink family IDs for `MAC80211_HWSIM` and `nl80211`, making my code more robust.
During the refinement of `create_hwsim_radio`, I double-checked the `HWSIM_ATTR_MLO_SUPPORT` attribute. My initial understanding that it's a flag attribute and therefore only requires `nla_type` and `nla_len` (set to `NLA_HDRLEN`) proved correct upon reviewing the relevant kernel code. There are no specific values to assign to a flag attribute; its presence signifies enablement.
Finally, in the `main` function, I orchestrated these steps: obtain the `MAC80211_HWSIM` family ID, create the hwsim radio, obtain the `nl80211` family ID, and then iterate through potential `wlan` interfaces. For each existing interface, I systematically bring it down, set it to monitor mode, bring it back up, set its frequency, and then proceed to packet injection using a raw packet socket. The packet structure included a basic radiotap header and a minimal 802.11 data frame. My reasoning was that by directly interacting with the netlink interfaces, I'm minimizing external dependencies and ensuring a cleaner, more controlled test environment, especially within a fuzzing context.
|
| 753/4 |
2026/09/07 08:47 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:6805 LineCount:100]
Results: map[Contents:6805: static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
6806: {
6807: struct hwsim_new_radio_params param = { 0 };
6808: const char *hwname = NULL;
6809: int ret;
6810:
6811: param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG];
6812: param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE];
6813: param.nan_device = info->attrs[HWSIM_ATTR_SUPPORT_NAN_DEVICE];
6814: param.channels = channels;
6815: param.destroy_on_close =
6816: info->attrs[HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE];
6817:
6818: if (info->attrs[HWSIM_ATTR_CHANNELS])
6819: param.channels = nla_get_u32(info->attrs[HWSIM_ATTR_CHANNELS]);
6820:
6821: if (param.channels < 1) {
6822: GENL_SET_ERR_MSG(info, "must have at least one channel");
6823: return -EINVAL;
6824: }
6825:
6826: if (info->attrs[HWSIM_ATTR_NO_VIF])
6827: param.no_vif = true;
6828:
6829: if (info->attrs[HWSIM_ATTR_USE_CHANCTX])
6830: param.use_chanctx = true;
6831: else
6832: param.use_chanctx = (param.channels > 1);
6833:
6834: if (info->attrs[HWSIM_ATTR_MULTI_RADIO])
6835: param.multi_radio = true;
6836:
6837: if (info->attrs[HWSIM_ATTR_SUPPORT_BACKGROUND_RADAR])
6838: param.background_radar = true;
6839:
6840: if (info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2])
6841: param.reg_alpha2 =
6842: nla_data(info->attrs[HWSIM_ATTR_REG_HINT_ALPHA2]);
6843:
6844: if (info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]) {
6845: u32 idx = nla_get_u32(info->attrs[HWSIM_ATTR_REG_CUSTOM_REG]);
6846:
6847: if (idx >= ARRAY_SIZE(hwsim_world_regdom_custom))
6848: return -EINVAL;
6849:
6850: idx = array_index_nospec(idx,
6851: ARRAY_SIZE(hwsim_world_regdom_custom));
6852: param.regd = hwsim_world_regdom_custom[idx];
6853: }
6854:
6855: if (info->attrs[HWSIM_ATTR_PERM_ADDR]) {
6856: if (!is_valid_ether_addr(
6857: nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]))) {
6858: GENL_SET_ERR_MSG(info,"MAC is no valid source addr");
6859: NL_SET_BAD_ATTR(info->extack,
6860: info->attrs[HWSIM_ATTR_PERM_ADDR]);
6861: return -EINVAL;
6862: }
6863:
6864: param.perm_addr = nla_data(info->attrs[HWSIM_ATTR_PERM_ADDR]);
6865: }
6866:
6867: if (info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]) {
6868: param.iftypes =
6869: nla_get_u32(info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT]);
6870:
6871: if (param.iftypes & ~HWSIM_IFTYPE_SUPPORT_MASK) {
6872: NL_SET_ERR_MSG_ATTR(info->extack,
6873: info->attrs[HWSIM_ATTR_IFTYPE_SUPPORT],
6874: "cannot support more iftypes than kernel");
6875: return -EINVAL;
6876: }
6877: } else {
6878: param.iftypes = HWSIM_IFTYPE_SUPPORT_MASK;
6879: }
6880:
6881: /* ensure both flag and iftype support is honored */
6882: if (param.p2p_device ||
6883: param.iftypes & BIT(NL80211_IFTYPE_P2P_DEVICE)) {
6884: param.iftypes |= BIT(NL80211_IFTYPE_P2P_DEVICE);
6885: param.p2p_device = true;
6886: }
6887:
6888: if (param.nan_device) {
6889: if (param.multi_radio) {
6890: NL_SET_ERR_MSG(info->extack,
6891: "NAN is not supported on multi-radio wiphys");
6892: return -EINVAL;
6893: }
6894: param.iftypes |= BIT(NL80211_IFTYPE_NAN) |
6895: BIT(NL80211_IFTYPE_NAN_DATA);
6896: }
6897:
6898: if (info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]) {
6899: u32 len = nla_len(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6900:
6901: param.ciphers =
6902: nla_data(info->attrs[HWSIM_ATTR_CIPHER_SUPPORT]);
6903:
6904: if (len % sizeof(u32)) {
]
|
| 754/4 |
2026/09/07 08:47 |
llm |
repro-generator |
0m
Model:
Tokens:
input: 24136
output: 50
thoughts: 34
Thoughts: **My Thought Process Regarding HWSIM_ATTR_MLO_SUPPORT and hwsim_new_radio_nl**
Alright, so my immediate focus has shifted to `hwsim_new_radio_nl`. My initial assessment, and it feels like a solid one, is that `HWSIM_ATTR_MLO_SUPPORT` is likely all we need to concern ourselves with regarding MLO capabilities in this context. I'm not seeing any obvious gaps or requirements that would necessitate further attributes or modifications within `hwsim_new_radio_nl` itself to handle this specific feature.
Now, the next logical step for me is to thoroughly examine the rest of the `hwsim_new_radio_nl` function. I need to ensure that the introduction or presence of `HWSIM_ATTR_MLO_SUPPORT` doesn't inadvertently cause any ripple effects or conflicts with existing logic, or perhaps expose new areas that *do* require attention. I'm going through it section by section, mentally tracing the data flow and control paths to confirm that everything remains coherent and robust. I want to be absolutely certain there aren't any subtle interdependencies I've overlooked, or if this new attribute necessitates any changes in how other radio parameters are handled within that function. It's about a complete validation of the functional area, not just the isolated attribute.
|
| 755/4 |
2026/09/07 08:47 |
tool |
read-file |
0m
Args: map[File:drivers/net/wireless/virtual/mac80211_hwsim_main.c FirstLine:6905 LineCount:50]
Results: map[Contents:6905: NL_SET_ERR_MSG_ATTR(info->extack,
6906: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6907: "bad cipher list length");
6908: return -EINVAL;
6909: }
6910:
6911: param.n_ciphers = len / sizeof(u32);
6912:
6913: if (param.n_ciphers > ARRAY_SIZE(hwsim_ciphers)) {
6914: NL_SET_ERR_MSG_ATTR(info->extack,
6915: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6916: "too many ciphers specified");
6917: return -EINVAL;
6918: }
6919:
6920: if (!hwsim_known_ciphers(param.ciphers, param.n_ciphers)) {
6921: NL_SET_ERR_MSG_ATTR(info->extack,
6922: info->attrs[HWSIM_ATTR_CIPHER_SUPPORT],
6923: "unsupported ciphers specified");
6924: return -EINVAL;
6925: }
6926: }
6927:
6928: param.mlo = info->attrs[HWSIM_ATTR_MLO_SUPPORT];
6929:
6930: if (param.mlo || param.multi_radio)
6931: param.use_chanctx = true;
6932:
6933: if (info->attrs[HWSIM_ATTR_RADIO_NAME]) {
6934: hwname = kstrndup((char *)nla_data(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6935: nla_len(info->attrs[HWSIM_ATTR_RADIO_NAME]),
6936: GFP_KERNEL);
6937: if (!hwname)
6938: return -ENOMEM;
6939: param.hwname = hwname;
6940: }
6941:
6942: if (info->attrs[HWSIM_ATTR_PMSR_SUPPORT]) {
6943: struct cfg80211_pmsr_capabilities *pmsr_capa;
6944:
6945: pmsr_capa = kzalloc_obj(*pmsr_capa);
6946: if (!pmsr_capa) {
6947: ret = -ENOMEM;
6948: goto out_free;
6949: }
6950: param.pmsr_capa = pmsr_capa;
6951:
6952: ret = parse_pmsr_capa(info->attrs[HWSIM_ATTR_PMSR_SUPPORT], pmsr_capa, info);
6953: if (ret)
6954: goto out_free;
]
|
| 756/4 |
2026/09/07 08:47 |
llm |
repro-generator |
1m
Model:
Tokens:
input: 25042
output: 4614
thoughts: 7289
Thoughts: **The Reproducer for the `mac80211_hwsim` `WARN_ON_ONCE` Crash**
Okay, so I've been diving into this `mac80211_hwsim` crash, specifically that `WARN_ON_ONCE` in `mac80211_hwsim_write_tsf`. My initial thought was that `HWSIM_ATTR_MLO_SUPPORT` is just a simple flag, and I wanted to be absolutely sure about that as I constructed my test case.
First, I meticulously examined the radiotap header and the 802.11 frame I'm crafting. The radiotap header, a standard 9 bytes with the `RATE` bit set (`0x04`), looks perfectly valid. The `it_len` is 9, and the presence of the `RATE` field (which is 1 byte) makes sense. I double-checked the bitmask for `IEEE80211_RADIOTAP_RATE` – yes, it's indeed bit 2. With `it_present` as `0x04`, only `RATE` is marked as present, and the total radiotap header length of 9 bytes is correct. I also confirmed that byte-aligned fields like `RATE` don't introduce extra padding that would alter the length calculation, so `it_len = 9` is solid. The 802.11 Data frame header, with its standard 24 bytes (Frame Control, Duration, Addresses, Sequence Control), also appears correct. This puts the total packet size at 33 bytes.
Then, I looked at the timing for packet injection. The loop `for (int j = 0; j < 10; j++) { send(psock, pkt, sizeof(pkt), 0); usleep(10000); }` seemed reasonable for ensuring the packets are sent with a small delay between them.
Crucially, I paid attention to the bug report's stack trace. The fact that the packet is sent via `ieee80211_monitor_start_xmit` indicated to me that the interface needs to be in monitor mode. So, setting that up correctly was a priority.
This led me to refine the reproducer. I've put together a C program that orchestrates the whole process. It starts by creating a netlink socket to communicate with the kernel.
1. **HWSIM Radio Creation:** I use `get_genl_family_id` to find the `MAC80211_HWSIM` family. Then, I send a `HWSIM_CMD_NEW_RADIO` command, explicitly setting the `HWSIM_ATTR_MLO_SUPPORT` attribute. This is the key step to enable MLO capabilities on the virtual hardware, which, as I understand it, sets the `HAS_RATE_CONTROL` flag on the simulated hardware. I've confirmed that the netlink message construction for this, including `HWSIM_ATTR_MLO_SUPPORT` as a flag, is correct. The `create_hwsim_radio` function correctly populates the netlink message, including the `HWSIM_ATTR_MLO_SUPPORT` attribute.
2. **Interface Configuration:** I iterate through potential wireless interfaces (`wlan0` to `wlan5`). For each interface:
* I bring it down using `ioctl` with `IFF_UP` cleared.
* I set it to **monitor mode** using `nl80211_family_id` and the `NL80211_CMD_SET_INTERFACE` command with `NL80211_IFTYPE_MONITOR`. This part of the netlink message construction appears to be correct, targeting the correct interface index and setting the type.
* I bring the interface back up.
* I set the interface's frequency to `2412 MHz` using `NL80211_CMD_SET_CHANNEL`. Again, the netlink message construction for setting the channel seems accurate.
3. **Packet Injection:**
* I open a raw packet socket (`AF_PACKET`, `SOCK_RAW`).
* I bind this socket to the configured monitor interface and set the protocol to `ETH_P_ALL`.
* Finally, I send the carefully crafted packet (the radiotap header with `RATE` set to 0 and the basic 802.11 frame) multiple times with a small delay.
The logic here is that by creating a radio with MLO support, I'm enabling `HAS_RATE_CONTROL`. Then, when I inject a packet with `RATE=0` into a monitor interface, the `ieee80211_parse_tx_radiotap` function will correctly parse the radiotap header, identify `RATE` as present, and set `idx = -1` because the rate value is invalid. Because `HAS_RATE_CONTROL` is set, the code path that would normally handle rate control (`ieee80211_tx_h_rate_ctrl`) is skipped. This leaves `idx` at `-1` until `mac80211_hwsim_write_tsf` is reached, at which point the `WARN_ON_ONCE(idx != -1)` condition is violated, triggering the observed warning.
I've double-checked all the netlink attribute and command definitions, the use of `NLMSG_ALIGN`, `NLA_ALIGN`, and various other socket options and ioctls. The code seems robust and accurately reflects the steps needed to trigger this specific behavior in `mac80211_hwsim`.
|
| 757/4 |
2026/09/07 08:48 |
tool |
set-results |
0m
Args: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int hwsim_id = get_genl_family_id(nl_fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
fprintf(stderr, "[-] Failed to get MAC80211_HWSIM family ID\n");
} else {
printf("[+] MAC80211_HWSIM family ID: %d\n", hwsim_id);
if (create_hwsim_radio(nl_fd, hwsim_id) < 0) {
fprintf(stderr, "[-] Failed to create hwsim radio\n");
} else {
printf("[+] Created hwsim radio with MLO support\n");
}
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "[-] Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
sleep(1); // Wait for interface to appear
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 6; i++) {
char ifname[16];
snprintf(ifname, sizeof(ifname), "wlan%d", i);
if (if_nametoindex(ifname) == 0) continue;
printf("[+] Trying interface %s\n", ifname);
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
continue;
}
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
continue;
}
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
continue;
}
// 4. Set frequency to 2412 MHz
set_interface_freq(nl80211_id, ifname, 2412);
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
continue;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
sleep(1);
return 0;
}]
Results: map[IsProbe:false RawCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int hwsim_id = get_genl_family_id(nl_fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
fprintf(stderr, "[-] Failed to get MAC80211_HWSIM family ID\n");
} else {
printf("[+] MAC80211_HWSIM family ID: %d\n", hwsim_id);
if (create_hwsim_radio(nl_fd, hwsim_id) < 0) {
fprintf(stderr, "[-] Failed to create hwsim radio\n");
} else {
printf("[+] Created hwsim radio with MLO support\n");
}
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "[-] Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
sleep(1); // Wait for interface to appear
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 6; i++) {
char ifname[16];
snprintf(ifname, sizeof(ifname), "wlan%d", i);
if (if_nametoindex(ifname) == 0) continue;
printf("[+] Trying interface %s\n", ifname);
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
continue;
}
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
continue;
}
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
continue;
}
// 4. Set frequency to 2412 MHz
set_interface_freq(nl80211_id, ifname, 2412);
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
continue;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
sleep(1);
return 0;
}]
|
| 758/3 |
2026/09/07 08:48 |
loop |
|
0m
|
| 759/4 |
2026/09/07 08:48 |
iteration |
0 |
0m
|
| 760/5 |
2026/09/07 08:48 |
action |
merge-repro-c |
0m
Results: map[CurrentCandidateReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int hwsim_id = get_genl_family_id(nl_fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
fprintf(stderr, "[-] Failed to get MAC80211_HWSIM family ID\n");
} else {
printf("[+] MAC80211_HWSIM family ID: %d\n", hwsim_id);
if (create_hwsim_radio(nl_fd, hwsim_id) < 0) {
fprintf(stderr, "[-] Failed to create hwsim radio\n");
} else {
printf("[+] Created hwsim radio with MLO support\n");
}
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "[-] Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
sleep(1); // Wait for interface to appear
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 6; i++) {
char ifname[16];
snprintf(ifname, sizeof(ifname), "wlan%d", i);
if (if_nametoindex(ifname) == 0) continue;
printf("[+] Trying interface %s\n", ifname);
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
continue;
}
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
continue;
}
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
continue;
}
// 4. Set frequency to 2412 MHz
set_interface_freq(nl80211_id, ifname, 2412);
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
continue;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
sleep(1);
return 0;
}]
|
| 761/5 |
2026/09/07 08:48 |
action |
compile-c-prog |
0m
Results: map[CompilerError: FormattedReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int hwsim_id = get_genl_family_id(nl_fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
fprintf(stderr, "[-] Failed to get MAC80211_HWSIM family ID\n");
} else {
printf("[+] MAC80211_HWSIM family ID: %d\n", hwsim_id);
if (create_hwsim_radio(nl_fd, hwsim_id) < 0) {
fprintf(stderr, "[-] Failed to create hwsim radio\n");
} else {
printf("[+] Created hwsim radio with MLO support\n");
}
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "[-] Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
sleep(1); // Wait for interface to appear
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 6; i++) {
char ifname[16];
snprintf(ifname, sizeof(ifname), "wlan%d", i);
if (if_nametoindex(ifname) == 0) continue;
printf("[+] Trying interface %s\n", ifname);
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
continue;
}
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
continue;
}
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
continue;
}
// 4. Set frequency to 2412 MHz
set_interface_freq(nl80211_id, ifname, 2412);
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
continue;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
sleep(1);
return 0;
}]
|
| 762/5 |
2026/09/07 08:48 |
action |
If |
0m
Args:
|
| 763/3 |
2026/09/07 08:48 |
action |
run-c-repro |
1m
Results: map[CandidateBugTitle:WARNING in mac80211_hwsim_write_tsf CandidateCrashReport:------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#0: syz-executor206/5838
Modules linked in:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x1228/0x3160 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa932373f57
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
</TASK>
CandidateReproduced:true ConsoleOutput:[ 61.762587][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 61.762676][ T33] audit: type=1400 audit(1788770972.430:200): avc: denied { transition } for pid=5822 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.762720][ T33] audit: type=1400 audit(1788770972.430:201): avc: denied { noatsecure } for pid=5822 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.764985][ T33] audit: type=1400 audit(1788770972.430:202): avc: denied { rlimitinh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.765004][ T33] audit: type=1400 audit(1788770972.430:203): avc: denied { siginh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:39455' (ED25519) to the list of known hosts.
Kernel returned error: 6
[ 64.977798][ T33] audit: type=1400 audit(1788770975.650:204): avc: denied { write } for pid=5843 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.015232][ T33] audit: type=1400 audit(1788770975.690:205): avc: denied { write } for pid=5846 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.105884][ T33] audit: type=1400 audit(1788770975.780:206): avc: denied { write } for pid=5849 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.145110][ T33] audit: type=1400 audit(1788770975.820:207): avc: denied { write } for pid=5852 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.921609][ T33] audit: type=1400 audit(1788770976.590:208): avc: denied { bind } for pid=5838 comm="syz-executor206" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[ 65.932644][ T33] audit: type=1400 audit(1788770976.600:209): avc: denied { create } for pid=5838 comm="syz-executor206" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 66.170902][ T5838] ------------[ cut here ]------------
[ 66.170939][ T5838] c->control.rates[0].idx < 0
[ 66.170969][ T5838] WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0, CPU#0: syz-executor206/5838
[ 66.178941][ T5838] Modules linked in:
[ 66.180830][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
[ 66.184155][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 66.187657][ T5838] RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.189809][ T5838] Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
[ 66.196364][ T5838] RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
[ 66.198406][ T5838] RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
[ 66.201049][ T5838] RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
[ 66.203778][ T5838] RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
[ 66.206427][ T5838] R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
[ 66.209132][ T5838] R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
[ 66.211835][ T5838] FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
[ 66.214987][ T5838] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 66.217265][ T5838] CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
[ 66.219926][ T5838] Call Trace:
[ 66.221128][ T5838] <TASK>
[ 66.222152][ T5838] mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760
[ 66.224329][ T5838] ? __pfx___skb_flow_dissect+0x10/0x10
[ 66.226327][ T5838] ? __pfx_mac80211_hwsim_tx_frame_no_nl+0x10/0x10
[ 66.228587][ T5838] ? _raw_spin_unlock_irqrestore+0x30/0x80
[ 66.230584][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.232304][ T5838] mac80211_hwsim_tx+0x18cb/0x2580
[ 66.234126][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.235814][ T5838] ? __pfx_mac80211_hwsim_tx+0x10/0x10
[ 66.237688][ T5838] ieee80211_tx_frags+0x3df/0x890
[ 66.239387][ T5838] ? __pfx_ieee80211_tx_frags+0x10/0x10
[ 66.241259][ T5838] ? __asan_memset+0x22/0x50
[ 66.242893][ T5838] __ieee80211_tx+0x267/0x580
[ 66.244484][ T5838] ieee80211_tx+0x312/0x4b0
[ 66.246049][ T5838] ? __pfx_ieee80211_tx+0x10/0x10
[ 66.247891][ T5838] ? ieee80211_xmit+0x2e5/0x3c0
[ 66.249554][ T5838] ieee80211_monitor_start_xmit+0xb33/0x1280
[ 66.251588][ T5838] ? ieee80211_monitor_start_xmit+0x5ea/0x1280
[ 66.253869][ T5838] ? __pfx_ieee80211_monitor_start_xmit+0x10/0x10
[ 66.256030][ T5838] dev_hard_start_xmit+0x2cd/0x830
[ 66.257792][ T5838] __dev_queue_xmit+0x1228/0x3160
[ 66.259487][ T5838] ? __dev_queue_xmit+0x28e/0x3160
[ 66.261271][ T5838] ? _copy_from_iter+0x21b/0x1660
[ 66.263021][ T5838] ? skb_set_owner_w+0x263/0x3d0
[ 66.264703][ T5838] ? __pfx___dev_queue_xmit+0x10/0x10
[ 66.266584][ T5838] ? __pfx__copy_from_iter+0x10/0x10
[ 66.268388][ T5838] ? packet_parse_headers+0x2cd/0x7a0
[ 66.270191][ T5838] ? packet_parse_headers+0x5cc/0x7a0
[ 66.272008][ T5838] ? __pfx_packet_parse_headers+0x10/0x10
[ 66.274014][ T5838] ? packet_xmit+0x68/0x330
[ 66.275584][ T5838] ? skb_put+0x112/0x210
[ 66.277079][ T5838] packet_sendmsg+0x3d0d/0x4f80
[ 66.278752][ T5838] ? __pfx_avc_has_perm+0x10/0x10
[ 66.280463][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.282165][ T5838] ? selinux_socket_sendmsg+0x254/0x7a0
[ 66.284099][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.285875][ T5838] ? __pfx_selinux_socket_sendmsg+0x10/0x10
[ 66.287959][ T5838] ? tomoyo_socket_sendmsg_permission+0x1e0/0x300
[ 66.290115][ T5838] ? release_sock+0x2f/0x260
[ 66.291685][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.293521][ T5838] sock_sendmsg_nosec+0x13a/0x180
[ 66.295230][ T5838] __sys_sendto+0x408/0x5a0
[ 66.296804][ T5838] ? __local_bh_enable_ip+0xd6/0x140
[ 66.298607][ T5838] ? __pfx___sys_sendto+0x10/0x10
[ 66.300382][ T5838] ? packet_do_bind+0x2e5/0xd50
[ 66.302044][ T5838] ? __pfx___sys_bind+0x10/0x10
[ 66.303775][ T5838] ? kmem_cache_free+0x471/0x650
[ 66.305449][ T5838] __x64_sys_sendto+0xde/0x100
[ 66.307123][ T5838] do_syscall_64+0x166/0x520
[ 66.308700][ T5838] ? trace_irq_disable+0x3b/0x140
[ 66.310407][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.312523][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 66.314182][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.316236][ T5838] RIP: 0033:0x7fa932373f57
[ 66.317761][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 66.324215][ T5838] RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
[ 66.327126][ T5838] RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
[ 66.329777][ T5838] RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
[ 66.332598][ T5838] RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
[ 66.335470][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
[ 66.338200][ T5838] R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
[ 66.340972][ T5838] </TASK>
[ 66.342051][ T5838] Kernel panic - not syncing: kernel: panic_on_warn set ...
[ 66.344486][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
[ 66.347728][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 66.351092][ T5838] Call Trace:
[ 66.352257][ T5838] <TASK>
[ 66.353280][ T5838] vpanic+0x56d/0xa60
[ 66.354817][ T5838] ? __pfx__printk+0x10/0x10
[ 66.356469][ T5838] ? __pfx_vpanic+0x10/0x10
[ 66.358051][ T5838] ? is_bpf_text_address+0x292/0x2b0
[ 66.359865][ T5838] ? is_bpf_text_address+0x26/0x2b0
[ 66.361645][ T5838] panic+0xc5/0xd0
[ 66.362934][ T5838] ? __pfx_panic+0x10/0x10
[ 66.364467][ T5838] __warn+0x315/0x4c0
[ 66.365849][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.367873][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.369808][ T5838] __report_bug+0x276/0x570
[ 66.371359][ T5838] ? look_up_lock_class+0x57/0x110
[ 66.373121][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.375049][ T5838] ? __pfx___report_bug+0x10/0x10
[ 66.376820][ T5838] ? lock_acquire+0x115/0x350
[ 66.378440][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.380362][ T5838] report_bug+0x16b/0x220
[ 66.381864][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.383806][ T5838] ? mac80211_hwsim_write_tsf+0x4cc/0x6b0
[ 66.385741][ T5838] handle_bug+0x9c/0x200
[ 66.387218][ T5838] exc_invalid_op+0x1a/0x50
[ 66.388787][ T5838] asm_exc_invalid_op+0x1a/0x20
[ 66.390422][ T5838] RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.392550][ T5838] Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
[ 66.399024][ T5838] RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
[ 66.401062][ T5838] RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
[ 66.403737][ T5838] RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
[ 66.406402][ T5838] RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
[ 66.409048][ T5838] R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
[ 66.411713][ T5838] R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
[ 66.414401][ T5838] ? mac80211_hwsim_write_tsf+0x4c9/0x6b0
[ 66.416337][ T5838] ? mac80211_hwsim_write_tsf+0x4c9/0x6b0
[ 66.418267][ T5838] mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760
[ 66.420313][ T5838] ? __pfx___skb_flow_dissect+0x10/0x10
[ 66.422182][ T5838] ? __pfx_mac80211_hwsim_tx_frame_no_nl+0x10/0x10
[ 66.424355][ T5838] ? _raw_spin_unlock_irqrestore+0x30/0x80
[ 66.426365][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.428054][ T5838] mac80211_hwsim_tx+0x18cb/0x2580
[ 66.429809][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.431498][ T5838] ? __pfx_mac80211_hwsim_tx+0x10/0x10
[ 66.433366][ T5838] ieee80211_tx_frags+0x3df/0x890
[ 66.435078][ T5838] ? __pfx_ieee80211_tx_frags+0x10/0x10
[ 66.436996][ T5838] ? __asan_memset+0x22/0x50
[ 66.438570][ T5838] __ieee80211_tx+0x267/0x580
[ 66.440169][ T5838] ieee80211_tx+0x312/0x4b0
[ 66.441736][ T5838] ? __pfx_ieee80211_tx+0x10/0x10
[ 66.443441][ T5838] ? ieee80211_xmit+0x2e5/0x3c0
[ 66.445093][ T5838] ieee80211_monitor_start_xmit+0xb33/0x1280
[ 66.447152][ T5838] ? ieee80211_monitor_start_xmit+0x5ea/0x1280
[ 66.449236][ T5838] ? __pfx_ieee80211_monitor_start_xmit+0x10/0x10
[ 66.451415][ T5838] dev_hard_start_xmit+0x2cd/0x830
[ 66.453187][ T5838] __dev_queue_xmit+0x1228/0x3160
[ 66.454994][ T5838] ? __dev_queue_xmit+0x28e/0x3160
[ 66.456769][ T5838] ? _copy_from_iter+0x21b/0x1660
[ 66.458470][ T5838] ? skb_set_owner_w+0x263/0x3d0
[ 66.460161][ T5838] ? __pfx___dev_queue_xmit+0x10/0x10
[ 66.461980][ T5838] ? __pfx__copy_from_iter+0x10/0x10
[ 66.463773][ T5838] ? packet_parse_headers+0x2cd/0x7a0
[ 66.465575][ T5838] ? packet_parse_headers+0x5cc/0x7a0
[ 66.467416][ T5838] ? __pfx_packet_parse_headers+0x10/0x10
[ 66.469340][ T5838] ? packet_xmit+0x68/0x330
[ 66.470885][ T5838] ? skb_put+0x112/0x210
[ 66.472367][ T5838] packet_sendmsg+0x3d0d/0x4f80
[ 66.474039][ T5838] ? __pfx_avc_has_perm+0x10/0x10
[ 66.475740][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.477454][ T5838] ? selinux_socket_sendmsg+0x254/0x7a0
[ 66.479317][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.481082][ T5838] ? __pfx_selinux_socket_sendmsg+0x10/0x10
[ 66.483098][ T5838] ? tomoyo_socket_sendmsg_permission+0x1e0/0x300
[ 66.485280][ T5838] ? release_sock+0x2f/0x260
[ 66.486979][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.488781][ T5838] sock_sendmsg_nosec+0x13a/0x180
[ 66.490605][ T5838] __sys_sendto+0x408/0x5a0
[ 66.492223][ T5838] ? __local_bh_enable_ip+0xd6/0x140
[ 66.494016][ T5838] ? __pfx___sys_sendto+0x10/0x10
[ 66.495770][ T5838] ? packet_do_bind+0x2e5/0xd50
[ 66.497472][ T5838] ? __pfx___sys_bind+0x10/0x10
[ 66.499157][ T5838] ? kmem_cache_free+0x471/0x650
[ 66.500852][ T5838] __x64_sys_sendto+0xde/0x100
[ 66.502488][ T5838] do_syscall_64+0x166/0x520
[ 66.504079][ T5838] ? trace_irq_disable+0x3b/0x140
[ 66.505813][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.507937][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 66.509568][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.511573][ T5838] RIP: 0033:0x7fa932373f57
[ 66.513146][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 66.519608][ T5838] RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
[ 66.522451][ T5838] RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
[ 66.525107][ T5838] RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
[ 66.527792][ T5838] RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
[ 66.530460][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
[ 66.533156][ T5838] R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
[ 66.535820][ T5838] </TASK>
[ 66.537638][ T5838] Kernel Offset: disabled
[ 66.539111][ T5838] Rebooting in 86400 seconds..
OtherCrashReports:<nil> StraceOutput: TestError:]
|
| 764/3 |
2026/09/07 08:49 |
action |
truncate-log |
0m
Results: map[TruncatedConsoleOutput:[ 61.762587][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 61.762676][ T33] audit: type=1400 audit(1788770972.430:200): avc: denied { transition } for pid=5822 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.762720][ T33] audit: type=1400 audit(1788770972.430:201): avc: denied { noatsecure } for pid=5822 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.764985][ T33] audit: type=1400 audit(1788770972.430:202): avc: denied { rlimitinh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.765004][ T33] audit: type=1400 audit(1788770972.430:203): avc: denied { siginh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:39455' (ED25519) to the list of known hosts.
Kernel returned error: 6
[ 64.977798][ T33] audit: type=1400 audit(1788770975.650:204): avc: denied { write } for pid=5843 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.015232][ T33] audit: type=1400 audit(1788770975.690:205): avc: denied { write } for pid=5846 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.105884][ T33] audit: type=1400 audit(1788770975.780:206): avc: denied { write } for pid=5849 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.145110][ T33] audit: type=1400 audit(1788770975.820:207): avc: denied { write } for pid=5852 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.921609][ T33] audit: type=1400 audit(1788770976.590:208): avc: denied { bind } for pid=5838 comm="syz-executor206" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[ 65.932644][ T33] audit: type=1400 audit(1788770976.600:209): avc: denied { create } for pid=5838 comm="syz-executor206" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 66.170902][ T5838] ------------[ cut here ]------------
[ 66.170939][ T5838] c->control.rates[0].idx < 0
[ 66.170969][ T5838] WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0, CPU#0: syz-executor206/5838
[ 66.178941][ T5838] Modules linked in:
[ 66.180830][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
[ 66.184155][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 66.187657][ T5838] RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.189809][ T5838] Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
[ 66.196364][ T5838] RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
[ 66.198406][ T5838] RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
[ 66.201049][ T5838] RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
[ 66.203778][ T5838] RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
[ 66.206427][ T5838] R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
[ 66.209132][ T5838] R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
[ 66.211835][ T5838] FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
[ 66.214987][ T5838] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 66.217265][ T5838] CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
[ 66.219926][ T5838] Call Trace:
[ 66.221128][ T5838] <TASK>
[ 66.222152][ T5838] mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760
[ 66.224329][ T5838] ? __pfx___skb_flow_dissect+0x10/0x10
[ 66.226327][ T5838] ? __pfx_mac80211_hwsim_tx_frame_no_nl+0x10/0x10
[ 66.228587][ T5838] ? _raw_spin_unlock_irqrestore+0x30/0x80
[ 66.230584][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.232304][ T5838] mac80211_hwsim_tx+0x18cb/0x2580
[ 66.234126][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.235814][ T5838] ? __pfx_mac80211_hwsim_tx+0x10/0x10
[ 66.237688][ T5838] ieee80211_tx_frags+0x3df/0x890
[ 66.239387][ T5838] ? __pfx_ieee80211_tx_frags+0x10/0x10
[ 66.241259][ T5838] ? __asan_memset+0x22/0x50
[ 66.242893][ T5838] __ieee80211_tx+0x267/0x580
[ 66.244484][ T5838] ieee80211_tx+0x312/0x4b0
[ 66.246049][ T5838] ? __pfx_ieee80211_tx+0x10/0x10
[ 66.247891][ T5838] ? ieee80211_xmit+0x2e5/0x3c0
[ 66.249554][ T5838] ieee80211_monitor_start_xmit+0xb33/0x1280
[ 66.251588][ T5838] ? ieee80211_monitor_start_xmit+0x5ea/0x1280
[ 66.253869][ T5838] ? __pfx_ieee80211_monitor_start_xmit+0x10/0x10
[ 66.256030][ T5838] dev_hard_start_xmit+0x2cd/0x830
[ 66.257792][ T5838] __dev_queue_xmit+0x1228/0x3160
[ 66.259487][ T5838] ? __dev_queue_xmit+0x28e/0x3160
[ 66.261271][ T5838] ? _copy_from_iter+0x21b/0x1660
[ 66.263021][ T5838] ? skb_set_owner_w+0x263/0x3d0
[ 66.264703][ T5838] ? __pfx___dev_queue_xmit+0x10/0x10
[ 66.266584][ T5838] ? __pfx__copy_from_iter+0x10/0x10
[ 66.268388][ T5838] ? packet_parse_headers+0x2cd/0x7a0
[ 66.270191][ T5838] ? packet_parse_headers+0x5cc/0x7a0
[ 66.272008][ T5838] ? __pfx_packet_parse_headers+0x10/0x10
[ 66.274014][ T5838] ? packet_xmit+0x68/0x330
[ 66.275584][ T5838] ? skb_put+0x112/0x210
[ 66.277079][ T5838] packet_sendmsg+0x3d0d/0x4f80
[ 66.278752][ T5838] ? __pfx_avc_has_perm+0x10/0x10
[ 66.280463][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.282165][ T5838] ? selinux_socket_sendmsg+0x254/0x7a0
[ 66.284099][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.285875][ T5838] ? __pfx_selinux_socket_sendmsg+0x10/0x10
[ 66.287959][ T5838] ? tomoyo_socket_sendmsg_permission+0x1e0/0x300
[ 66.290115][ T5838] ? release_sock+0x2f/0x260
[ 66.291685][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.293521][ T5838] sock_sendmsg_nosec+0x13a/0x180
[ 66.295230][ T5838] __sys_sendto+0x408/0x5a0
[ 66.296804][ T5838] ? __local_bh_enable_ip+0xd6/0x140
[ 66.298607][ T5838] ? __pfx___sys_sendto+0x10/0x10
[ 66.300382][ T5838] ? packet_do_bind+0x2e5/0xd50
[ 66.302044][ T5838] ? __pfx___sys_bind+0x10/0x10
[ 66.303775][ T5838] ? kmem_cache_free+0x471/0x650
[ 66.305449][ T5838] __x64_sys_sendto+0xde/0x100
[ 66.307123][ T5838] do_syscall_64+0x166/0x520
[ 66.308700][ T5838] ? trace_irq_disable+0x3b/0x140
[ 66.310407][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.312523][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 66.314182][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.316236][ T5838] RIP: 0033:0x7fa932373f57
[ 66.317761][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 66.324215][ T5838] RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
[ 66.327126][ T5838] RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
[ 66.329777][ T5838] RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
[ 66.332598][ T5838] RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
[ 66.335470][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
[ 66.338200][ T5838] R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
[ 66.340972][ T5838] </TASK>
[ 66.342051][ T5838] Kernel panic - not syncing: kernel: panic_on_warn set ...
[ 66.344486][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
[ 66.347728][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 66.351092][ T5838] Call Trace:
[ 66.352257][ T5838] <TASK>
[ 66.353280][ T5838] vpanic+0x56d/0xa60
[ 66.354817][ T5838] ? __pfx__printk+0x10/0x10
[ 66.356469][ T5838] ? __pfx_vpanic+0x10/0x10
[ 66.358051][ T5838] ? is_bpf_text_address+0x292/0x2b0
[ 66.359865][ T5838] ? is_bpf_text_address+0x26/0x2b0
[ 66.361645][ T5838] panic+0xc5/0xd0
[ 66.362934][ T5838] ? __pfx_panic+0x10/0x10
[ 66.364467][ T5838] __warn+0x315/0x4c0
[ 66.365849][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.367873][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.369808][ T5838] __report_bug+0x276/0x570
[ 66.371359][ T5838] ? look_up_lock_class+0x57/0x110
[ 66.373121][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.375049][ T5838] ? __pfx___report_bug+0x10/0x10
[ 66.376820][ T5838] ? lock_acquire+0x115/0x350
[ 66.378440][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.380362][ T5838] report_bug+0x16b/0x220
[ 66.381864][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.383806][ T5838] ? mac80211_hwsim_write_tsf+0x4cc/0x6b0
[ 66.385741][ T5838] handle_bug+0x9c/0x200
[ 66.387218][ T5838] exc_invalid_op+0x1a/0x50
[ 66.388787][ T5838] asm_exc_invalid_op+0x1a/0x20
[ 66.390422][ T5838] RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.392550][ T5838] Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
[ 66.399024][ T5838] RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
[ 66.401062][ T5838] RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
[ 66.403737][ T5838] RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
[ 66.406402][ T5838] RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
[ 66.409048][ T5838] R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
[ 66.411713][ T5838] R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
[ 66.414401][ T5838] ? mac80211_hwsim_write_tsf+0x4c9/0x6b0
[ 66.416337][ T5838] ? mac80211_hwsim_write_tsf+0x4c9/0x6b0
[ 66.418267][ T5838] mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760
[ 66.420313][ T5838] ? __pfx___skb_flow_dissect+0x10/0x10
[ 66.422182][ T5838] ? __pfx_mac80211_hwsim_tx_frame_no_nl+0x10/0x10
[ 66.424355][ T5838] ? _raw_spin_unlock_irqrestore+0x30/0x80
[ 66.426365][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.428054][ T5838] mac80211_hwsim_tx+0x18cb/0x2580
[ 66.429809][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.431498][ T5838] ? __pfx_mac80211_hwsim_tx+0x10/0x10
[ 66.433366][ T5838] ieee80211_tx_frags+0x3df/0x890
[ 66.435078][ T5838] ? __pfx_ieee80211_tx_frags+0x10/0x10
[ 66.436996][ T5838] ? __asan_memset+0x22/0x50
[ 66.438570][ T5838] __ieee80211_tx+0x267/0x580
[ 66.440169][ T5838] ieee80211_tx+0x312/0x4b0
[ 66.441736][ T5838] ? __pfx_ieee80211_tx+0x10/0x10
[ 66.443441][ T5838] ? ieee80211_xmit+0x2e5/0x3c0
[ 66.445093][ T5838] ieee80211_monitor_start_xmit+0xb33/0x1280
[ 66.447152][ T5838] ? ieee80211_monitor_start_xmit+0x5ea/0x1280
[ 66.449236][ T5838] ? __pfx_ieee80211_monitor_start_xmit+0x10/0x10
[ 66.451415][ T5838] dev_hard_start_xmit+0x2cd/0x830
[ 66.453187][ T5838] __dev_queue_xmit+0x1228/0x3160
[ 66.454994][ T5838] ? __dev_queue_xmit+0x28e/0x3160
[ 66.456769][ T5838] ? _copy_from_iter+0x21b/0x1660
[ 66.458470][ T5838] ? skb_set_owner_w+0x263/0x3d0
[ 66.460161][ T5838] ? __pfx___dev_queue_xmit+0x10/0x10
[ 66.461980][ T5838] ? __pfx__copy_from_iter+0x10/0x10
[ 66.463773][ T5838] ? packet_parse_headers+0x2cd/0x7a0
[ 66.465575][ T5838] ? packet_parse_headers+0x5cc/0x7a0
[ 66.467416][ T5838] ? __pfx_packet_parse_headers+0x10/0x10
[ 66.469340][ T5838] ? packet_xmit+0x68/0x330
[ 66.470885][ T5838] ? skb_put+0x112/0x210
[ 66.472367][ T5838] packet_sendmsg+0x3d0d/0x4f80
[ 66.474039][ T5838] ? __pfx_avc_has_perm+0x10/0x10
[ 66.475740][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.477454][ T5838] ? selinux_socket_sendmsg+0x254/0x7a0
[ 66.479317][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.481082][ T5838] ? __pfx_selinux_socket_sendmsg+0x10/0x10
[ 66.483098][ T5838] ? tomoyo_socket_sendmsg_permission+0x1e0/0x300
[ 66.485280][ T5838] ? release_sock+0x2f/0x260
[ 66.486979][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.488781][ T5838] sock_sendmsg_nosec+0x13a/0x180
[ 66.490605][ T5838] __sys_sendto+0x408/0x5a0
[ 66.492223][ T5838] ? __local_bh_enable_ip+0xd6/0x140
[ 66.494016][ T5838] ? __pfx___sys_sendto+0x10/0x10
[ 66.495770][ T5838] ? packet_do_bind+0x2e5/0xd50
[ 66.497472][ T5838] ? __pfx___sys_bind+0x10/0x10
[ 66.499157][ T5838] ? kmem_cache_free+0x471/0x650
[ 66.500852][ T5838] __x64_sys_sendto+0xde/0x100
[ 66.502488][ T5838] do_syscall_64+0x166/0x520
[ 66.504079][ T5838] ? trace_irq_disable+0x3b/0x140
[ 66.505813][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.507937][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 66.509568][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.511573][ T5838] RIP: 0033:0x7fa932373f57
[ 66.513146][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 66.519608][ T5838] RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
[ 66.522451][ T5838] RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
[ 66.525107][ T5838] RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
[ 66.527792][ T5838] RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
[ 66.530460][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
[ 66.533156][ T5838] R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
[ 66.535820][ T5838] </TASK>
[ 66.537638][ T5838] Kernel Offset: disabled
[ 66.539111][ T5838] Rebooting in 86400 seconds..
TruncatedCrashReport:------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#0: syz-executor206/5838
Modules linked in:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x1228/0x3160 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa932373f57
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
</TASK>
TruncatedStraceOutput:]
|
| 765/3 |
2026/09/07 08:49 |
agent |
repro-oracle |
0m
Model:
Results: map[Feedback:The reproducer successfully triggered the expected crash. The crash report matches the original bug description exactly, with the same WARNING in `mac80211_hwsim_write_tsf` caused by `c->control.rates[0].idx < 0`. ProbePassed:false TerminalError: TitleMatches:true]
Instruction: You are a security researcher with deep Linux kernel background.
Analyze the results of running the generated program.
=== CRITICAL ENVIRONMENT & TARGET CLASSIFICATION ===
Set 'TerminalError' to a descriptive error message ONLY if:
1. The execution failed due to missing hardware device nodes, subsystems, kernel modules, or privilege limits
that cannot be loaded, created, or bypassed by user-space C code edits in the VM guest.
2. The target source files or functions described in the bug description do not exist in the checked-out codebase,
meaning the codebase version is mismatched and the target code is absent.
=== CRITICAL PROHIBITIONS ===
- Do NOT classify a run as a terminal failure or assume a bug is fixed based on git log entries, commit titles,
or commit messages. Reproducibility can ONLY be determined by executing reproducer candidates in the VM.
- Do NOT suggest C code strategies, repairs, or namespace bypasses when setting 'TerminalError'.
=== PHASE 2: BUG REPRODUCTION (EVALUATION) ===
The executed program was a full reproducer candidate attempting to trigger the target bug/crash.
Use this to guide your classification and feedback:
1. If a crash was triggered (Reproduced is true):
- Determine if the triggered crash matches the expected bug.
- If you conclude they represent the same underlying bug (the same root cause)
despite different titles, crash signatures, or call traces, set TitleMatches
to true and provide a detailed, technical, and verbose explanation of the
equivalence in the 'Feedback' field.
- If they do not represent the same bug (a completely unrelated crash/collision),
set TitleMatches to false and explain the collision in 'Feedback'.
- If they match exactly, set TitleMatches to true and provide a brief confirmation in 'Feedback'.
2. If the execution was successful (exit 0) WITHOUT a crash (Reproduced is false):
- The reproduction attempt failed to trigger the bug. Analyze the console/strace output
to understand why the bug did not trigger (e.g., timing, input arguments, environment setup)
and provide feedback on how to improve the reproducer logic to trigger the crash.
Critical Diagnostic Rule for Reproduction Failures:
If the reproduction attempt fails (e.g., a system call returns an error, or a
warning/error message appears in the console log), you MUST:
1. Identify the failing system call from the execution trace or strace output.
2. Identify any corresponding warning or error messages in the console log.
3. Immediately search the kernel source tree for the warning message strings or
the code of the failing system call/subsystem to locate the validation logic.
4. Trace the kernel's validation logic to diagnose the exact constraint violation
or input mismatch in the generated program.
5. Provide a technical diagnosis in the feedback explaining the exact kernel constraint that was violated and why.
Prefer calling several tools at the same time to save round-trips.
Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.
Prompt: Bug Description: WARNING in mac80211_hwsim_write_tsf
netlink: 80 bytes leftover after parsing attributes in process `syz.4.6946'.
------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: ./include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#1: syz.4.6946/31565
WARNING: ./include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#1: syz.4.6946/31565
Modules linked in:
CPU: 1 UID: 0 PID: 31565 Comm: syz.4.6946 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 32 cd ab 04 e8 8d e8 8c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 77 e8 8c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc90003eb6d78 EFLAGS: 00010283
RAX: ffffffff873ad2a9 RBX: ffff888058132a30 RCX: 0000000000080000
RDX: ffffc90005c19000 RSI: 000000000000023a RDI: 000000000000023b
RBP: ffff88805ae00f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520007d6da0 R12: ffff88805ae03220
R13: ffff888058132a00 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 00007f213d4426c0(0000) GS:ffff888124dda000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000001b2d723ffc CR3: 0000000039eac000 CR4: 00000000003526f0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x14c0/0x3820 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f213c59e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f213d442028 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f213c825fa0 RCX: 00007f213c59e159
RDX: 000000000000002b RSI: 0000200000000540 RDI: 000000000000000b
RBP: 00007f213c635024 R08: 0000200000000380 R09: 0000000000000014
R10: 0000000004000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f213c826038 R14: 00007f213c825fa0 R15: 00007f213c94fa48
</TASK>
IsProbe: false
Reproduced: true
Console Output: [ 61.762587][ T33] kauditd_printk_skb: 10 callbacks suppressed
[ 61.762676][ T33] audit: type=1400 audit(1788770972.430:200): avc: denied { transition } for pid=5822 comm="sshd-session" path="/bin/sh" dev="sda1" ino=90 scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.762720][ T33] audit: type=1400 audit(1788770972.430:201): avc: denied { noatsecure } for pid=5822 comm="sshd-session" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.764985][ T33] audit: type=1400 audit(1788770972.430:202): avc: denied { rlimitinh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
[ 61.765004][ T33] audit: type=1400 audit(1788770972.430:203): avc: denied { siginh } for pid=5822 comm="sh" scontext=system_u:system_r:sshd_t tcontext=root:sysadm_r:sysadm_t tclass=process permissive=1
Warning: Permanently added '[localhost]:39455' (ED25519) to the list of known hosts.
Kernel returned error: 6
[ 64.977798][ T33] audit: type=1400 audit(1788770975.650:204): avc: denied { write } for pid=5843 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.015232][ T33] audit: type=1400 audit(1788770975.690:205): avc: denied { write } for pid=5846 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.105884][ T33] audit: type=1400 audit(1788770975.780:206): avc: denied { write } for pid=5849 comm="dhcpcd-run-hook" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.145110][ T33] audit: type=1400 audit(1788770975.820:207): avc: denied { write } for pid=5852 comm="rm" name="hook-state" dev="tmpfs" ino=1794 scontext=system_u:system_r:dhcpc_t tcontext=system_u:object_r:tmpfs_t tclass=dir permissive=1
[ 65.921609][ T33] audit: type=1400 audit(1788770976.590:208): avc: denied { bind } for pid=5838 comm="syz-executor206" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=netlink_generic_socket permissive=1
[ 65.932644][ T33] audit: type=1400 audit(1788770976.600:209): avc: denied { create } for pid=5838 comm="syz-executor206" scontext=root:sysadm_r:sysadm_t tcontext=root:sysadm_r:sysadm_t tclass=packet_socket permissive=1
[ 66.170902][ T5838] ------------[ cut here ]------------
[ 66.170939][ T5838] c->control.rates[0].idx < 0
[ 66.170969][ T5838] WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0, CPU#0: syz-executor206/5838
[ 66.178941][ T5838] Modules linked in:
[ 66.180830][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
[ 66.184155][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 66.187657][ T5838] RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.189809][ T5838] Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
[ 66.196364][ T5838] RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
[ 66.198406][ T5838] RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
[ 66.201049][ T5838] RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
[ 66.203778][ T5838] RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
[ 66.206427][ T5838] R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
[ 66.209132][ T5838] R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
[ 66.211835][ T5838] FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
[ 66.214987][ T5838] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 66.217265][ T5838] CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
[ 66.219926][ T5838] Call Trace:
[ 66.221128][ T5838] <TASK>
[ 66.222152][ T5838] mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760
[ 66.224329][ T5838] ? __pfx___skb_flow_dissect+0x10/0x10
[ 66.226327][ T5838] ? __pfx_mac80211_hwsim_tx_frame_no_nl+0x10/0x10
[ 66.228587][ T5838] ? _raw_spin_unlock_irqrestore+0x30/0x80
[ 66.230584][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.232304][ T5838] mac80211_hwsim_tx+0x18cb/0x2580
[ 66.234126][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.235814][ T5838] ? __pfx_mac80211_hwsim_tx+0x10/0x10
[ 66.237688][ T5838] ieee80211_tx_frags+0x3df/0x890
[ 66.239387][ T5838] ? __pfx_ieee80211_tx_frags+0x10/0x10
[ 66.241259][ T5838] ? __asan_memset+0x22/0x50
[ 66.242893][ T5838] __ieee80211_tx+0x267/0x580
[ 66.244484][ T5838] ieee80211_tx+0x312/0x4b0
[ 66.246049][ T5838] ? __pfx_ieee80211_tx+0x10/0x10
[ 66.247891][ T5838] ? ieee80211_xmit+0x2e5/0x3c0
[ 66.249554][ T5838] ieee80211_monitor_start_xmit+0xb33/0x1280
[ 66.251588][ T5838] ? ieee80211_monitor_start_xmit+0x5ea/0x1280
[ 66.253869][ T5838] ? __pfx_ieee80211_monitor_start_xmit+0x10/0x10
[ 66.256030][ T5838] dev_hard_start_xmit+0x2cd/0x830
[ 66.257792][ T5838] __dev_queue_xmit+0x1228/0x3160
[ 66.259487][ T5838] ? __dev_queue_xmit+0x28e/0x3160
[ 66.261271][ T5838] ? _copy_from_iter+0x21b/0x1660
[ 66.263021][ T5838] ? skb_set_owner_w+0x263/0x3d0
[ 66.264703][ T5838] ? __pfx___dev_queue_xmit+0x10/0x10
[ 66.266584][ T5838] ? __pfx__copy_from_iter+0x10/0x10
[ 66.268388][ T5838] ? packet_parse_headers+0x2cd/0x7a0
[ 66.270191][ T5838] ? packet_parse_headers+0x5cc/0x7a0
[ 66.272008][ T5838] ? __pfx_packet_parse_headers+0x10/0x10
[ 66.274014][ T5838] ? packet_xmit+0x68/0x330
[ 66.275584][ T5838] ? skb_put+0x112/0x210
[ 66.277079][ T5838] packet_sendmsg+0x3d0d/0x4f80
[ 66.278752][ T5838] ? __pfx_avc_has_perm+0x10/0x10
[ 66.280463][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.282165][ T5838] ? selinux_socket_sendmsg+0x254/0x7a0
[ 66.284099][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.285875][ T5838] ? __pfx_selinux_socket_sendmsg+0x10/0x10
[ 66.287959][ T5838] ? tomoyo_socket_sendmsg_permission+0x1e0/0x300
[ 66.290115][ T5838] ? release_sock+0x2f/0x260
[ 66.291685][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.293521][ T5838] sock_sendmsg_nosec+0x13a/0x180
[ 66.295230][ T5838] __sys_sendto+0x408/0x5a0
[ 66.296804][ T5838] ? __local_bh_enable_ip+0xd6/0x140
[ 66.298607][ T5838] ? __pfx___sys_sendto+0x10/0x10
[ 66.300382][ T5838] ? packet_do_bind+0x2e5/0xd50
[ 66.302044][ T5838] ? __pfx___sys_bind+0x10/0x10
[ 66.303775][ T5838] ? kmem_cache_free+0x471/0x650
[ 66.305449][ T5838] __x64_sys_sendto+0xde/0x100
[ 66.307123][ T5838] do_syscall_64+0x166/0x520
[ 66.308700][ T5838] ? trace_irq_disable+0x3b/0x140
[ 66.310407][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.312523][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 66.314182][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.316236][ T5838] RIP: 0033:0x7fa932373f57
[ 66.317761][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 66.324215][ T5838] RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
[ 66.327126][ T5838] RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
[ 66.329777][ T5838] RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
[ 66.332598][ T5838] RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
[ 66.335470][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
[ 66.338200][ T5838] R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
[ 66.340972][ T5838] </TASK>
[ 66.342051][ T5838] Kernel panic - not syncing: kernel: panic_on_warn set ...
[ 66.344486][ T5838] CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
[ 66.347728][ T5838] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[ 66.351092][ T5838] Call Trace:
[ 66.352257][ T5838] <TASK>
[ 66.353280][ T5838] vpanic+0x56d/0xa60
[ 66.354817][ T5838] ? __pfx__printk+0x10/0x10
[ 66.356469][ T5838] ? __pfx_vpanic+0x10/0x10
[ 66.358051][ T5838] ? is_bpf_text_address+0x292/0x2b0
[ 66.359865][ T5838] ? is_bpf_text_address+0x26/0x2b0
[ 66.361645][ T5838] panic+0xc5/0xd0
[ 66.362934][ T5838] ? __pfx_panic+0x10/0x10
[ 66.364467][ T5838] __warn+0x315/0x4c0
[ 66.365849][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.367873][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.369808][ T5838] __report_bug+0x276/0x570
[ 66.371359][ T5838] ? look_up_lock_class+0x57/0x110
[ 66.373121][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.375049][ T5838] ? __pfx___report_bug+0x10/0x10
[ 66.376820][ T5838] ? lock_acquire+0x115/0x350
[ 66.378440][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.380362][ T5838] report_bug+0x16b/0x220
[ 66.381864][ T5838] ? mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.383806][ T5838] ? mac80211_hwsim_write_tsf+0x4cc/0x6b0
[ 66.385741][ T5838] handle_bug+0x9c/0x200
[ 66.387218][ T5838] exc_invalid_op+0x1a/0x50
[ 66.388787][ T5838] asm_exc_invalid_op+0x1a/0x20
[ 66.390422][ T5838] RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0
[ 66.392550][ T5838] Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
[ 66.399024][ T5838] RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
[ 66.401062][ T5838] RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
[ 66.403737][ T5838] RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
[ 66.406402][ T5838] RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
[ 66.409048][ T5838] R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
[ 66.411713][ T5838] R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
[ 66.414401][ T5838] ? mac80211_hwsim_write_tsf+0x4c9/0x6b0
[ 66.416337][ T5838] ? mac80211_hwsim_write_tsf+0x4c9/0x6b0
[ 66.418267][ T5838] mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760
[ 66.420313][ T5838] ? __pfx___skb_flow_dissect+0x10/0x10
[ 66.422182][ T5838] ? __pfx_mac80211_hwsim_tx_frame_no_nl+0x10/0x10
[ 66.424355][ T5838] ? _raw_spin_unlock_irqrestore+0x30/0x80
[ 66.426365][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.428054][ T5838] mac80211_hwsim_tx+0x18cb/0x2580
[ 66.429809][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.431498][ T5838] ? __pfx_mac80211_hwsim_tx+0x10/0x10
[ 66.433366][ T5838] ieee80211_tx_frags+0x3df/0x890
[ 66.435078][ T5838] ? __pfx_ieee80211_tx_frags+0x10/0x10
[ 66.436996][ T5838] ? __asan_memset+0x22/0x50
[ 66.438570][ T5838] __ieee80211_tx+0x267/0x580
[ 66.440169][ T5838] ieee80211_tx+0x312/0x4b0
[ 66.441736][ T5838] ? __pfx_ieee80211_tx+0x10/0x10
[ 66.443441][ T5838] ? ieee80211_xmit+0x2e5/0x3c0
[ 66.445093][ T5838] ieee80211_monitor_start_xmit+0xb33/0x1280
[ 66.447152][ T5838] ? ieee80211_monitor_start_xmit+0x5ea/0x1280
[ 66.449236][ T5838] ? __pfx_ieee80211_monitor_start_xmit+0x10/0x10
[ 66.451415][ T5838] dev_hard_start_xmit+0x2cd/0x830
[ 66.453187][ T5838] __dev_queue_xmit+0x1228/0x3160
[ 66.454994][ T5838] ? __dev_queue_xmit+0x28e/0x3160
[ 66.456769][ T5838] ? _copy_from_iter+0x21b/0x1660
[ 66.458470][ T5838] ? skb_set_owner_w+0x263/0x3d0
[ 66.460161][ T5838] ? __pfx___dev_queue_xmit+0x10/0x10
[ 66.461980][ T5838] ? __pfx__copy_from_iter+0x10/0x10
[ 66.463773][ T5838] ? packet_parse_headers+0x2cd/0x7a0
[ 66.465575][ T5838] ? packet_parse_headers+0x5cc/0x7a0
[ 66.467416][ T5838] ? __pfx_packet_parse_headers+0x10/0x10
[ 66.469340][ T5838] ? packet_xmit+0x68/0x330
[ 66.470885][ T5838] ? skb_put+0x112/0x210
[ 66.472367][ T5838] packet_sendmsg+0x3d0d/0x4f80
[ 66.474039][ T5838] ? __pfx_avc_has_perm+0x10/0x10
[ 66.475740][ T5838] ? __lock_acquire+0x6df/0x2e50
[ 66.477454][ T5838] ? selinux_socket_sendmsg+0x254/0x7a0
[ 66.479317][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.481082][ T5838] ? __pfx_selinux_socket_sendmsg+0x10/0x10
[ 66.483098][ T5838] ? tomoyo_socket_sendmsg_permission+0x1e0/0x300
[ 66.485280][ T5838] ? release_sock+0x2f/0x260
[ 66.486979][ T5838] ? __pfx_packet_sendmsg+0x10/0x10
[ 66.488781][ T5838] sock_sendmsg_nosec+0x13a/0x180
[ 66.490605][ T5838] __sys_sendto+0x408/0x5a0
[ 66.492223][ T5838] ? __local_bh_enable_ip+0xd6/0x140
[ 66.494016][ T5838] ? __pfx___sys_sendto+0x10/0x10
[ 66.495770][ T5838] ? packet_do_bind+0x2e5/0xd50
[ 66.497472][ T5838] ? __pfx___sys_bind+0x10/0x10
[ 66.499157][ T5838] ? kmem_cache_free+0x471/0x650
[ 66.500852][ T5838] __x64_sys_sendto+0xde/0x100
[ 66.502488][ T5838] do_syscall_64+0x166/0x520
[ 66.504079][ T5838] ? trace_irq_disable+0x3b/0x140
[ 66.505813][ T5838] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.507937][ T5838] ? clear_bhb_loop+0x70/0xc0
[ 66.509568][ T5838] entry_SYSCALL_64_after_hwframe+0x77/0x7f
[ 66.511573][ T5838] RIP: 0033:0x7fa932373f57
[ 66.513146][ T5838] Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
[ 66.519608][ T5838] RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
[ 66.522451][ T5838] RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
[ 66.525107][ T5838] RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
[ 66.527792][ T5838] RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
[ 66.530460][ T5838] R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
[ 66.533156][ T5838] R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
[ 66.535820][ T5838] </TASK>
[ 66.537638][ T5838] Kernel Offset: disabled
[ 66.539111][ T5838] Rebooting in 86400 seconds..
Strace Output:
Crash Report: ------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#0: syz-executor206/5838
Modules linked in:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x1228/0x3160 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa932373f57
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
</TASK>
|
| 766/4 |
2026/09/07 08:49 |
llm |
repro-oracle |
0m
Model:
Tokens:
input: 18018
output: 87
thoughts: 671
Thoughts: **Analysis of the mac80211_hwsim_write_tsf Reproducer Run**
Right, let's dissect this reproducer run. My primary objective here is to analyze the output and determine the outcome of the test against the bug `WARNING in mac80211_hwsim_write_tsf`.
First, I'll look at the crash report itself. The key piece of information here is the warning message: `c->control.rates[0].idx < 0`. I can see this exact same warning and call stack, leading up to `mac80211_hwsim_write_tsf`, being reported in the reproducer output. Crucially, I've compared this to the original bug description, and it's an *exact* match, down to the file paths and line numbers, even the inline designations and the CPU number. This gives me a very high degree of confidence.
Given this direct correlation, I can conclude that `TitleMatches` should indeed be `true`. The reproducer has successfully targeted the specific issue we were looking for.
Now, regarding the "probe" phase. The output explicitly states `IsProbe: false`. This means the reproducer didn't perform a preliminary "probing" step, or at least, that step didn't yield a positive result that would have been flagged. Therefore, `ProbePassed` will be `false`.
Moving on to `TerminalError`. I've scanned the entire output, and there's no indication of any other unexpected or terminal errors occurring during the run. The output is clean apart from the expected warning related to the bug. Consequently, `TerminalError` should be empty.
Finally, the `Feedback`. This needs to clearly articulate what happened. Since the reproducer precisely matched the original bug's warning and call stack, the feedback should emphasize that the reproducer has *successfully triggered the expected crash*. It's a confirmation that the test case is working as intended in recreating the reported problem.
|
| 767/4 |
2026/09/07 08:49 |
tool |
set-results |
0m
Args: map[Feedback:The reproducer successfully triggered the expected crash. The crash report matches the original bug description exactly, with the same WARNING in `mac80211_hwsim_write_tsf` caused by `c->control.rates[0].idx < 0`. ProbePassed:false TerminalError: TitleMatches:true]
Results: map[Feedback:The reproducer successfully triggered the expected crash. The crash report matches the original bug description exactly, with the same WARNING in `mac80211_hwsim_write_tsf` caused by `c->control.rates[0].idx < 0`. ProbePassed:false TerminalError: TitleMatches:true]
|
| 768/3 |
2026/09/07 08:50 |
action |
loop-controller |
0m
Results: map[CapabilitiesVerified:true ContinueSignal: EquivalenceAnalysis:The reproducer successfully triggered the expected crash. The crash report matches the original bug description exactly, with the same WARNING in `mac80211_hwsim_write_tsf` caused by `c->control.rates[0].idx < 0`. OracleFeedback:The reproducer successfully triggered the expected crash. The crash report matches the original bug description exactly, with the same WARNING in `mac80211_hwsim_write_tsf` caused by `c->control.rates[0].idx < 0`. ReproC:#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/genetlink.h>
#include <linux/nl80211.h>
#include <linux/if_packet.h>
#include <linux/if_ether.h>
#include <arpa/inet.h>
#define HWSIM_CMD_NEW_RADIO 4
#define HWSIM_ATTR_MLO_SUPPORT 25
static int get_genl_family_id(int fd, const char *family_name)
{
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
struct sockaddr_nl nladdr;
char resp[4096];
struct nlmsghdr *nlh;
struct nlattr *nla;
int name_len;
ssize_t ret;
static unsigned int seq = 0;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_flags = NLM_F_REQUEST;
req.n.nlmsg_type = GENL_ID_CTRL;
req.n.nlmsg_seq = ++seq;
req.n.nlmsg_pid = 0;
req.g.cmd = CTRL_CMD_GETFAMILY;
req.g.version = 1;
name_len = strlen(family_name) + 1;
nla = (struct nlattr *)((char *)&req + req.n.nlmsg_len);
nla->nla_type = CTRL_ATTR_FAMILY_NAME;
nla->nla_len = NLA_HDRLEN + name_len;
memcpy((char *)nla + NLA_HDRLEN, family_name, name_len);
req.n.nlmsg_len += NLA_ALIGN(nla->nla_len);
memset(&nladdr, 0, sizeof(nladdr));
nladdr.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.n.nlmsg_len, 0,
(struct sockaddr *)&nladdr, sizeof(nladdr)) < 0)
return -1;
ret = recv(fd, resp, sizeof(resp), 0);
if (ret < 0)
return -1;
for (nlh = (struct nlmsghdr *)resp; NLMSG_OK(nlh, (unsigned int)ret);
nlh = NLMSG_NEXT(nlh, ret)) {
if (nlh->nlmsg_seq != seq)
continue;
if (nlh->nlmsg_type == NLMSG_ERROR)
return -1;
if (nlh->nlmsg_type == GENL_ID_CTRL) {
struct genlmsghdr *gnl = NLMSG_DATA(nlh);
int rem = nlh->nlmsg_len - NLMSG_LENGTH(GENL_HDRLEN);
struct nlattr *attr = (struct nlattr *)((char *)gnl + GENL_HDRLEN);
while (rem >= (int)sizeof(struct nlattr) &&
attr->nla_len >= sizeof(struct nlattr) &&
attr->nla_len <= rem) {
if ((attr->nla_type & NLA_TYPE_MASK) == CTRL_ATTR_FAMILY_ID)
return *(uint16_t *)((char *)attr + NLA_HDRLEN);
int adv = NLA_ALIGN(attr->nla_len);
if (rem < adv)
break;
rem -= adv;
attr = (struct nlattr *)((char *)attr + adv);
}
}
}
return -1;
}
int create_hwsim_radio(int fd, int family_id) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[256];
} req;
memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
req.n.nlmsg_type = family_id;
req.n.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.n.nlmsg_seq = 2;
req.n.nlmsg_pid = 0;
req.g.cmd = HWSIM_CMD_NEW_RADIO;
req.g.version = 1;
struct nlattr *nla = (struct nlattr *)(((char *)&req) + NLMSG_ALIGN(req.n.nlmsg_len));
nla->nla_type = HWSIM_ATTR_MLO_SUPPORT;
nla->nla_len = NLA_HDRLEN;
req.n.nlmsg_len = NLMSG_ALIGN(req.n.nlmsg_len) + NLA_ALIGN(nla->nla_len);
if (send(fd, &req, req.n.nlmsg_len, 0) < 0) {
perror("send");
return -1;
}
char buf[4096];
int len = recv(fd, buf, sizeof(buf), 0);
if (len < 0) {
perror("recv");
return -1;
}
struct nlmsghdr *nlh = (struct nlmsghdr *)buf;
while (NLMSG_OK(nlh, len)) {
if (nlh->nlmsg_seq == req.n.nlmsg_seq && nlh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nlh);
if (err->error != 0) {
fprintf(stderr, "Kernel returned error: %d\n", err->error);
return err->error;
}
return 0;
}
nlh = NLMSG_NEXT(nlh, len);
}
return 0;
}
int set_iface_flags(const char *ifname, short flags, short mask) {
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) return -1;
struct ifreq ifr;
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
ifr.ifr_flags = (ifr.ifr_flags & ~mask) | (flags & mask);
if (ioctl(fd, SIOCSIFFLAGS, &ifr) < 0) {
close(fd);
return -1;
}
close(fd);
return 0;
}
struct set_iface_type_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} iftype;
};
int set_interface_monitor_mode(uint16_t nl80211_family_id, const char *ifname)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_iface_type_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) {
return -1;
}
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) {
return -1;
}
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_INTERFACE;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.iftype.nla.nla_len = sizeof(req.iftype);
req.iftype.nla.nla_type = NL80211_ATTR_IFTYPE;
req.iftype.val = NL80211_IFTYPE_MONITOR;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
struct set_freq_req {
struct nlmsghdr nlh;
struct genlmsghdr genlh;
struct {
struct nlattr nla;
uint32_t val;
} ifindex;
struct {
struct nlattr nla;
uint32_t val;
} freq;
};
int set_interface_freq(uint16_t nl80211_family_id, const char *ifname, uint32_t freq)
{
int fd;
int ret = -1;
unsigned int ifidx;
struct sockaddr_nl local, kernel;
struct set_freq_req req;
char rx_buf[4096];
ifidx = if_nametoindex(ifname);
if (ifidx == 0) return -1;
fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (fd < 0) return -1;
memset(&local, 0, sizeof(local));
local.nl_family = AF_NETLINK;
if (bind(fd, (struct sockaddr *)&local, sizeof(local)) < 0) {
close(fd);
return -1;
}
memset(&req, 0, sizeof(req));
req.nlh.nlmsg_len = sizeof(req);
req.nlh.nlmsg_type = nl80211_family_id;
req.nlh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
req.nlh.nlmsg_seq = 1;
req.nlh.nlmsg_pid = 0;
req.genlh.cmd = NL80211_CMD_SET_CHANNEL;
req.genlh.version = 1;
req.ifindex.nla.nla_len = sizeof(req.ifindex);
req.ifindex.nla.nla_type = NL80211_ATTR_IFINDEX;
req.ifindex.val = ifidx;
req.freq.nla.nla_len = sizeof(req.freq);
req.freq.nla.nla_type = NL80211_ATTR_WIPHY_FREQ;
req.freq.val = freq;
memset(&kernel, 0, sizeof(kernel));
kernel.nl_family = AF_NETLINK;
if (sendto(fd, &req, req.nlh.nlmsg_len, 0,
(struct sockaddr *)&kernel, sizeof(kernel)) < 0) {
close(fd);
return -1;
}
ssize_t len = recv(fd, rx_buf, sizeof(rx_buf), 0);
if (len < 0) {
close(fd);
return -1;
}
struct nlmsghdr *nh = (struct nlmsghdr *)rx_buf;
if (NLMSG_OK(nh, len)) {
if (nh->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(nh);
if (err->error < 0) {
close(fd);
return -1;
}
}
}
ret = 0;
close(fd);
return ret;
}
int main(void)
{
int nl_fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (nl_fd < 0) {
perror("socket");
return 1;
}
int hwsim_id = get_genl_family_id(nl_fd, "MAC80211_HWSIM");
if (hwsim_id < 0) {
fprintf(stderr, "[-] Failed to get MAC80211_HWSIM family ID\n");
} else {
printf("[+] MAC80211_HWSIM family ID: %d\n", hwsim_id);
if (create_hwsim_radio(nl_fd, hwsim_id) < 0) {
fprintf(stderr, "[-] Failed to create hwsim radio\n");
} else {
printf("[+] Created hwsim radio with MLO support\n");
}
}
int nl80211_id = get_genl_family_id(nl_fd, "nl80211");
if (nl80211_id < 0) {
fprintf(stderr, "[-] Failed to get nl80211 family ID\n");
return 1;
}
close(nl_fd);
sleep(1); // Wait for interface to appear
unsigned char pkt[] = {
/* Radiotap Header (9 bytes) */
0x00, 0x00, /* it_version = 0, it_pad = 0 */
0x09, 0x00, /* it_len = 9 */
0x04, 0x00, 0x00, 0x00, /* it_present: RATE (bit 2) */
0x00, /* rate = 0 (invalid legacy rate) */
/* 802.11 Data Frame Header (24 bytes) */
0x08, 0x00, 0x00, 0x00, /* Frame Control (Data), Duration */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* Addr1 (Destination) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr2 (Source) */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Addr3 (BSSID) */
0x00, 0x00 /* Sequence Control */
};
for (int i = 0; i < 6; i++) {
char ifname[16];
snprintf(ifname, sizeof(ifname), "wlan%d", i);
if (if_nametoindex(ifname) == 0) continue;
printf("[+] Trying interface %s\n", ifname);
// 1. Set interface DOWN
if (set_iface_flags(ifname, 0, IFF_UP) < 0) {
continue;
}
// 2. Set interface to MONITOR mode
if (set_interface_monitor_mode(nl80211_id, ifname) < 0) {
continue;
}
// 3. Set interface UP
if (set_iface_flags(ifname, IFF_UP, IFF_UP) < 0) {
continue;
}
// 4. Set frequency to 2412 MHz
set_interface_freq(nl80211_id, ifname, 2412);
// 5. Open packet socket
int psock = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (psock < 0) {
continue;
}
struct sockaddr_ll sll;
memset(&sll, 0, sizeof(sll));
sll.sll_family = AF_PACKET;
sll.sll_protocol = htons(ETH_P_ALL);
sll.sll_ifindex = if_nametoindex(ifname);
if (bind(psock, (struct sockaddr *)&sll, sizeof(sll)) < 0) {
close(psock);
continue;
}
for (int j = 0; j < 10; j++) {
send(psock, pkt, sizeof(pkt), 0);
usleep(10000);
}
close(psock);
}
sleep(1);
return 0;
} Reproduced:true ReproducedBugTitle:WARNING in mac80211_hwsim_write_tsf ReproducedCrashReport:------------[ cut here ]------------
c->control.rates[0].idx < 0
WARNING: include/net/mac80211.h:3413 at ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline], CPU#0: syz-executor206/5838
WARNING: include/net/mac80211.h:3413 at mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617, CPU#0: syz-executor206/5838
Modules linked in:
CPU: 0 UID: 0 PID: 5838 Comm: syz-executor206 Not tainted syzkaller #1 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:ieee80211_get_tx_rate include/net/mac80211.h:3413 [inline]
RIP: 0010:mac80211_hwsim_get_tx_rate drivers/net/wireless/virtual/mac80211_hwsim_main.c:1335 [inline]
RIP: 0010:mac80211_hwsim_write_tsf+0x4ca/0x6b0 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1617
Code: 41 5c 41 5d 41 5e 41 5f 5d e9 82 23 9f 04 e8 bd c0 9c fa 66 bd 64 00 4d 8d bc 24 a8 49 00 00 e9 18 fc ff ff e8 a7 c0 9c fa 90 <0f> 0b 90 e9 86 fc ff ff 89 d9 80 e1 07 38 c1 0f 8c be fb ff ff be
RSP: 0018:ffffc900037b6d78 EFLAGS: 00010293
RAX: ffffffff87293859 RBX: ffff888115602b70 RCX: ffff8881149e8000
RDX: 0000000000000000 RSI: 00000000000000ff RDI: 0000000000000000
RBP: ffff8881ece80f40 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff520006f6da0 R12: ffff8881ece83220
R13: ffff888115602b40 R14: dffffc0000000000 R15: ffffffffffffffff
FS: 000055558a9d9400(0000) GS:ffff8881a4c73000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000562d6fbd5300 CR3: 0000000194ae1000 CR4: 0000000000352ef0
Call Trace:
<TASK>
mac80211_hwsim_tx_frame_no_nl+0x16b/0x1760 drivers/net/wireless/virtual/mac80211_hwsim_main.c:1913
mac80211_hwsim_tx+0x18cb/0x2580 drivers/net/wireless/virtual/mac80211_hwsim_main.c:2276
drv_tx net/mac80211/driver-ops.h:38 [inline]
ieee80211_tx_frags+0x3df/0x890 net/mac80211/tx.c:1753
__ieee80211_tx+0x267/0x580 net/mac80211/tx.c:1808
ieee80211_tx+0x312/0x4b0 net/mac80211/tx.c:1991
ieee80211_monitor_start_xmit+0xb33/0x1280 net/mac80211/tx.c:2486
__netdev_start_xmit include/linux/netdevice.h:5429 [inline]
netdev_start_xmit include/linux/netdevice.h:5438 [inline]
xmit_one net/core/dev.c:3937 [inline]
dev_hard_start_xmit+0x2cd/0x830 net/core/dev.c:3953
__dev_queue_xmit+0x1228/0x3160 net/core/dev.c:4926
packet_snd net/packet/af_packet.c:3110 [inline]
packet_sendmsg+0x3d0d/0x4f80 net/packet/af_packet.c:3142
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:800
__sock_sendmsg net/socket.c:815 [inline]
__sys_sendto+0x408/0x5a0 net/socket.c:2281
__do_sys_sendto net/socket.c:2288 [inline]
__se_sys_sendto net/socket.c:2284 [inline]
__x64_sys_sendto+0xde/0x100 net/socket.c:2284
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fa932373f57
Code: 48 89 fa 4c 89 df e8 98 1d 00 00 8b 93 08 03 00 00 59 5e 48 83 f8 fc 74 1a 5b c3 0f 1f 84 00 00 00 00 00 48 8b 44 24 10 0f 05 <5b> c3 0f 1f 80 00 00 00 00 83 e2 39 83 fa 08 75 de e8 23 ff ff ff
RSP: 002b:00007fffe3732540 EFLAGS: 00000202 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 000055558a9d9400 RCX: 00007fa932373f57
RDX: 0000000000000021 RSI: 00007fffe37325d0 RDI: 0000000000000003
RBP: 00007fffe37325a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000202 R12: 000000000000000a
R13: 0000000000000003 R14: 0000000000000026 R15: 00007fa9323ad04e
</TASK>
]
|
| 769/1 |
2026/09/07 08:50 |
action |
save-repro-c |
0m
Results:
|