net/mac80211/tests/mfp.c

Source file repositories/reference/linux-study-clean/net/mac80211/tests/mfp.c

File Facts

System
Linux kernel
Corpus path
net/mac80211/tests/mfp.c
Extension
.c
Size
7361 bytes
Lines
287
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: implementation source
Status
source implementation candidate

Why This File Exists

Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 * KUnit tests for management frame acceptance
 *
 * Copyright (C) 2023 Intel Corporation
 */
#include <kunit/test.h>
#include <kunit/skbuff.h>
#include "../ieee80211_i.h"
#include "../sta_info.h"

MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");

static const struct mfp_test_case {
	const char *desc;
	bool sta, mfp, decrypted, unicast, assoc;
	u8 category;
	u8 stype;
	u8 action;
	ieee80211_rx_result result;
} accept_mfp_cases[] = {
	/* regular public action */
	{
		.desc = "public action: accept unicast from unknown peer",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PUBLIC,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,
		.unicast = true,
		.result = RX_CONTINUE,
	},
	{
		.desc = "public action: accept multicast from unknown peer",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PUBLIC,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,
		.unicast = false,
		.result = RX_CONTINUE,
	},
	{
		.desc = "public action: accept unicast without MFP",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PUBLIC,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,
		.unicast = true,
		.sta = true,
		.result = RX_CONTINUE,
	},
	{
		.desc = "public action: accept multicast without MFP",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PUBLIC,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,
		.unicast = false,
		.sta = true,
		.result = RX_CONTINUE,
	},
	{
		.desc = "public action: drop unicast with MFP",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PUBLIC,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,
		.unicast = true,
		.sta = true,
		.mfp = true,
		.result = RX_DROP_U_UNPROT_UNICAST_PUB_ACTION,
	},
	{
		.desc = "public action: accept multicast with MFP",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PUBLIC,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,
		.unicast = false,
		.sta = true,
		.mfp = true,
		.result = RX_CONTINUE,
	},
	/* protected dual of public action */
	{
		.desc = "protected dual: drop unicast from unknown peer",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,
		.unicast = true,
		.result = RX_DROP_U_UNPROT_DUAL,
	},
	{
		.desc = "protected dual: drop multicast from unknown peer",
		.stype = IEEE80211_STYPE_ACTION,
		.category = WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION,
		.action = WLAN_PUB_ACTION_DSE_ENABLEMENT,

Annotation

Implementation Notes