aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/inject.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-08-28 16:19:38 (GMT)
committerJouni Malinen <j@w1.fi>2011-08-28 16:19:38 (GMT)
commit02b915f689d4e53ce1a09636d5b416209396c889 (patch)
treedecea784f8d0d0650d72aecf5340a97c1f86b433 /wlantest/inject.c
parent17f6b9005641c9c44f55cda825b3a170ffa8ff04 (diff)
downloadhostap-02b915f689d4e53ce1a09636d5b416209396c889.zip
hostap-02b915f689d4e53ce1a09636d5b416209396c889.tar.gz
hostap-02b915f689d4e53ce1a09636d5b416209396c889.tar.bz2
wlantest: Allow injection of unprotected frames to unknown BSS
Diffstat (limited to 'wlantest/inject.c')
-rw-r--r--wlantest/inject.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/wlantest/inject.c b/wlantest/inject.c
index 3644edf..e8e7de7 100644
--- a/wlantest/inject.c
+++ b/wlantest/inject.c
@@ -326,13 +326,20 @@ int wlantest_inject(struct wlantest *wt, struct wlantest_bss *bss,
return -1;
}
+ if (prot != WLANTEST_INJECT_UNPROTECTED &&
+ (bss == NULL || sta == NULL)) {
+ wpa_printf(MSG_INFO, "No BSS/STA information to inject "
+ "protected frames");
+ return -1;
+ }
+
hdr = (struct ieee80211_hdr *) frame;
fc = le_to_host16(hdr->frame_control);
protectable = WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_DATA ||
is_robust_mgmt(frame, len);
- if (prot == WLANTEST_INJECT_PROTECTED ||
- prot == WLANTEST_INJECT_INCORRECT_KEY) {
+ if ((prot == WLANTEST_INJECT_PROTECTED ||
+ prot == WLANTEST_INJECT_INCORRECT_KEY) && bss) {
if (!sta &&
((WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT &&
!bss->igtk_set[bss->igtk_idx]) ||
@@ -350,7 +357,7 @@ int wlantest_inject(struct wlantest *wt, struct wlantest_bss *bss,
return -1;
}
protect = 1;
- } else if (protectable && prot != WLANTEST_INJECT_UNPROTECTED) {
+ } else if (protectable && prot != WLANTEST_INJECT_UNPROTECTED && bss) {
if (sta && sta->ptk_set)
protect = 1;
else if (!sta) {
@@ -363,7 +370,7 @@ int wlantest_inject(struct wlantest *wt, struct wlantest_bss *bss,
}
}
- if (protect)
+ if (protect && bss)
return wlantest_inject_prot(
wt, bss, sta, frame, len,
prot == WLANTEST_INJECT_INCORRECT_KEY);