All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211_hwsim: check ATTR_FREQ for wmediumd (netlink) packets
@ 2015-11-02 15:25 arwelle
  2015-11-26 16:48 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: arwelle @ 2015-11-02 15:25 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

From: Adam Welle <arwelle@cert.org>

If a packet is received from netlink with the frequency value set it is
checked against the current radio's frequency and discarded if different.

Signed-off-by: Adam Welle <arwelle@cert.org>
---
 drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index ee46f46..191b576 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2827,10 +2827,16 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
 
 	/* A frame is received from user space */
 	memset(&rx_status, 0, sizeof(rx_status));
-	/* TODO: Check ATTR_FREQ if it exists, and maybe throw away off-channel
-	 * packets?
-	 */
-	rx_status.freq = data2->channel->center_freq;
+
+	/* Check ATTR_FREQ if it exists, and throw away off-channel packets */
+	if (info->attrs[HWSIM_ATTR_FREQ]) {
+		rx_status.freq = nla_get_u32(info->attrs[HWSIM_ATTR_FREQ]);
+		if (rx_status.freq != data2->channel->center_freq)
+			goto out;
+	} else {
+		rx_status.freq = data2->channel->center_freq;
+	}
+
 	rx_status.band = data2->channel->band;
 	rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]);
 	rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mac80211_hwsim: check ATTR_FREQ for wmediumd (netlink) packets
  2015-11-02 15:25 [PATCH] mac80211_hwsim: check ATTR_FREQ for wmediumd (netlink) packets arwelle
@ 2015-11-26 16:48 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2015-11-26 16:48 UTC (permalink / raw)
  To: arwelle; +Cc: linux-wireless

On Mon, 2015-11-02 at 10:25 -0500, arwelle@cert.org wrote:
> From: Adam Welle <arwelle@cert.org>
> 
> If a packet is received from netlink with the frequency value set it
> is
> checked against the current radio's frequency and discarded if
> different.
> 
Reviewing this more closely, it seems that the frequency should also be
checked against data->tmp_channel if that's non-zero, to support the
"hw" off-channel/scan case.

johannes

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-26 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-02 15:25 [PATCH] mac80211_hwsim: check ATTR_FREQ for wmediumd (netlink) packets arwelle
2015-11-26 16:48 ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.