From patchwork Tue Feb 24 13:39:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 5872751 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3A457BF440 for ; Tue, 24 Feb 2015 13:40:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3096F20251 for ; Tue, 24 Feb 2015 13:40:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB2732024D for ; Tue, 24 Feb 2015 13:40:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752244AbbBXNkc (ORCPT ); Tue, 24 Feb 2015 08:40:32 -0500 Received: from mail-ie0-f169.google.com ([209.85.223.169]:40257 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750925AbbBXNkb (ORCPT ); Tue, 24 Feb 2015 08:40:31 -0500 Received: by iebtr6 with SMTP id tr6so31866180ieb.7 for ; Tue, 24 Feb 2015 05:40:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=s+vZaJdu414OyzPqzMmd2O2C13tMwH3XMaFHycQ3Op8=; b=JE3w7+Pbdk/bDAstplwNO76Y9c92ssgpL8swIBIxH7RxrZuHpdDtaU6Mklq9VMX3V2 MrG+FTZg+9ZJj4NwzUeOrkxx+lmzJLhrikCPpFGkT8X7hc8hR5thtBDYLMHtq54+ArzO ob8VJWXGpmYuBVFIS6nt00NEyFm2YvoSMSkckBJnWd8yoloY5cidnIwc/W/ar+vNVyLz 6NSpYaU7gYu+AB+VoqfNHKem6RPxuh6YZ2yihPgb1HatQ0ijI1gUvURCQ4UAhDBlFs/l 55xLeTMNZoGJNbF2/6grc7o0/Ec6l7dL6GBmnofIUHtRYYkw9hXrBQZRMY1kieA9Wu6p 3E0Q== X-Gm-Message-State: ALoCoQkSslxo7K+BtfWYzKi/btAMVTgQXeW/nxUzqPlerlkUvPCzKBfUSmy1BDPYGW0vvRZ57KdZ X-Received: by 10.107.167.3 with SMTP id q3mr20646360ioe.18.1424785230741; Tue, 24 Feb 2015 05:40:30 -0800 (PST) Received: from hash ([2001:470:1d:6db:230:48ff:fe9d:9c89]) by mx.google.com with ESMTPSA id s10sm7981421igr.2.2015.02.24.05.40.28 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 24 Feb 2015 05:40:29 -0800 (PST) Received: from glass.lan ([192.168.1.51] helo=glass) by hash with esmtp (Exim 4.80) (envelope-from ) id 1YQFiN-0002iK-Gg; Tue, 24 Feb 2015 08:39:55 -0500 Received: from bob by glass with local (Exim 4.84) (envelope-from ) id 1YQFiJ-0001A2-0x; Tue, 24 Feb 2015 08:39:51 -0500 From: Bob Copeland To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Bob Copeland Subject: [PATCH v2] mac80211_hwsim: support any address in userspace Date: Tue, 24 Feb 2015 08:39:44 -0500 Message-Id: <1424785184-4427-1-git-send-email-me@bobcopeland.com> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Due to the checks in get_hwsim_data_ref_from_addr, wmediumd was only able to use the second mac address (those starting with 0x42). This is confusing and needlessly limiting, so allow any configured address. Signed-off-by: Bob Copeland --- v2: use mac80211_hwsim_addr_match instead which checks active interface addresses instead of pre-configured 'hardware' addresses (Johannes) drivers/net/wireless/mac80211_hwsim.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 1204853..3555251 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -907,8 +907,7 @@ static void mac80211_hwsim_tx_frame_nl(struct ieee80211_hw *hw, goto nla_put_failure; } - if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, - ETH_ALEN, data->addresses[1].addr)) + if (nla_put(skb, HWSIM_ATTR_ADDR_TRANSMITTER, ETH_ALEN, hdr->addr2)) goto nla_put_failure; /* We get the skb->data */ @@ -2611,7 +2610,7 @@ static struct mac80211_hwsim_data *get_hwsim_data_ref_from_addr(const u8 *addr) spin_lock_bh(&hwsim_radio_lock); list_for_each_entry(data, &hwsim_radios, list) { - if (memcmp(data->addresses[1].addr, addr, ETH_ALEN) == 0) { + if (mac80211_hwsim_addr_match(data, addr)) { _found = true; break; }