diff options
author | Jouni Malinen <j@w1.fi> | 2009-11-01 04:31:45 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-02 15:43:27 -0500 |
commit | 6c085227bd7168fd84976479218f81bf35b5acd7 (patch) | |
tree | 209ed8e0446693a88335b778bfe2327de510a3f9 /drivers/net/wireless/mac80211_hwsim.c | |
parent | 70541839dd2eacb521fa4f8515ab696599b36ea3 (diff) |
mac80211_hwsim: Send ACK frames on the hwsim0 interface
Report successful transmissions (receiver awake and on the same
channel) by generating ACK frames on the hwsim0 interface. This makes
it easier to figure out from packet capture logs whether frames were
delivered or not.
Signed-off-by: Jouni Malinen <j@w1.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mac80211_hwsim.c')
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 58c357eaf216..fc4ec48eda12 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -365,6 +365,49 @@ static void mac80211_hwsim_monitor_rx(struct ieee80211_hw *hw, | |||
365 | } | 365 | } |
366 | 366 | ||
367 | 367 | ||
368 | static void mac80211_hwsim_monitor_ack(struct ieee80211_hw *hw, const u8 *addr) | ||
369 | { | ||
370 | struct mac80211_hwsim_data *data = hw->priv; | ||
371 | struct sk_buff *skb; | ||
372 | struct hwsim_radiotap_hdr *hdr; | ||
373 | u16 flags; | ||
374 | struct ieee80211_hdr *hdr11; | ||
375 | |||
376 | if (!netif_running(hwsim_mon)) | ||
377 | return; | ||
378 | |||
379 | skb = dev_alloc_skb(100); | ||
380 | if (skb == NULL) | ||
381 | return; | ||
382 | |||
383 | hdr = (struct hwsim_radiotap_hdr *) skb_put(skb, sizeof(*hdr)); | ||
384 | hdr->hdr.it_version = PKTHDR_RADIOTAP_VERSION; | ||
385 | hdr->hdr.it_pad = 0; | ||
386 | hdr->hdr.it_len = cpu_to_le16(sizeof(*hdr)); | ||
387 | hdr->hdr.it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_FLAGS) | | ||
388 | (1 << IEEE80211_RADIOTAP_CHANNEL)); | ||
389 | hdr->rt_flags = 0; | ||
390 | hdr->rt_rate = 0; | ||
391 | hdr->rt_channel = cpu_to_le16(data->channel->center_freq); | ||
392 | flags = IEEE80211_CHAN_2GHZ; | ||
393 | hdr->rt_chbitmask = cpu_to_le16(flags); | ||
394 | |||
395 | hdr11 = (struct ieee80211_hdr *) skb_put(skb, 10); | ||
396 | hdr11->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL | | ||
397 | IEEE80211_STYPE_ACK); | ||
398 | hdr11->duration_id = cpu_to_le16(0); | ||
399 | memcpy(hdr11->addr1, addr, ETH_ALEN); | ||
400 | |||
401 | skb->dev = hwsim_mon; | ||
402 | skb_set_mac_header(skb, 0); | ||
403 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
404 | skb->pkt_type = PACKET_OTHERHOST; | ||
405 | skb->protocol = htons(ETH_P_802_2); | ||
406 | memset(skb->cb, 0, sizeof(skb->cb)); | ||
407 | netif_rx(skb); | ||
408 | } | ||
409 | |||
410 | |||
368 | static bool hwsim_ps_rx_ok(struct mac80211_hwsim_data *data, | 411 | static bool hwsim_ps_rx_ok(struct mac80211_hwsim_data *data, |
369 | struct sk_buff *skb) | 412 | struct sk_buff *skb) |
370 | { | 413 | { |
@@ -471,6 +514,10 @@ static int mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
471 | } | 514 | } |
472 | 515 | ||
473 | ack = mac80211_hwsim_tx_frame(hw, skb); | 516 | ack = mac80211_hwsim_tx_frame(hw, skb); |
517 | if (ack && skb->len >= 16) { | ||
518 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
519 | mac80211_hwsim_monitor_ack(hw, hdr->addr2); | ||
520 | } | ||
474 | 521 | ||
475 | txi = IEEE80211_SKB_CB(skb); | 522 | txi = IEEE80211_SKB_CB(skb); |
476 | 523 | ||