Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2789915ybf; Mon, 2 Mar 2020 15:50:40 -0800 (PST) X-Google-Smtp-Source: ADFU+vtz05RjA2w3pzJIlKiUScf3ao1SSKx5BOcYgVK+31ZZWvJGrUfyLD+j99bGdxfedMmjrTDI X-Received: by 2002:a05:6808:64e:: with SMTP id z14mr608158oih.79.1583193040747; Mon, 02 Mar 2020 15:50:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583193040; cv=none; d=google.com; s=arc-20160816; b=pqhJ2gnd9inSe2iLTISJzNxzvrH/xtUtZmaA9GiNhOkHsMZfvWRNmub5SO1363i37K gXB9z77eX5SRQITYXqGu6sqZtXONwAZ14+qz5lC9lVujAgH4pEx56or/ex+dJAithpis 6KVvc0g1KzXIgcksmEAtRkFoE36SWvfTeFue5zwBYwcU2JnmVSfkUlLcnocDf9DZChV+ Yi1hOOaSRqfHlqRIniZep8SphlB7AXOWc9Mj8MMLiIIxsbpTLr1MtQAkGk7k0u/g1MGG UgCvPrZ5PXKAUjOzVSAcmHNeIcTk8bvZvFetdDTNCVaKRbky2A60vVn3W4JoENLLAvXh Zqew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=qkHpPN7XbNDKm27YorIIR9c6eJ2NB+3lFpi/2cpvZIg=; b=MdSTaoyxzqWX4QFbJ7HkAHyDfIt0rRi6xu3bfLYDB3vWAeU7OG33lutcrSRpm27mfd ElCugoSpxL6sooBl1Ayp20Rd6Rh7kQVsQErS7DOMBuA4rNKZzdPSRbj0PJEuI8d5ooB9 GQdDJikGRCyKSN7K6ndoE97O5w9BxFD2eGlldePZr0jrXSZ5KMtzPfbIlz0bUWoTOxXE pNkCjWW8QtxTHPpnlVauwzJMtn0/IcA4Rhs/rup6eVGvt8/6qi7Muhrxpuz5yPgwxo0V QCpKO+v222kgSz/aNvhdN5aQztSy0BYw9fW7KNh6WDhxUdu0eOn423VkQtKGV1uTWwyU goVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tHADq9oO; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si6939968oie.105.2020.03.02.15.50.15; Mon, 02 Mar 2020 15:50:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tHADq9oO; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726785AbgCBXuI (ORCPT + 99 others); Mon, 2 Mar 2020 18:50:08 -0500 Received: from mail-pl1-f202.google.com ([209.85.214.202]:37989 "EHLO mail-pl1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbgCBXuI (ORCPT ); Mon, 2 Mar 2020 18:50:08 -0500 Received: by mail-pl1-f202.google.com with SMTP id r16so749931pls.5 for ; Mon, 02 Mar 2020 15:50:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=qkHpPN7XbNDKm27YorIIR9c6eJ2NB+3lFpi/2cpvZIg=; b=tHADq9oOprlWZEs91Bjo6UT4sqKlhfADhv6v9/ZdPREwmO9vXEWww3NdnbVjc5oxON 6Z53i9AQqiYFuRvpizdxw+Xnwjct13gFRgFH8hWIudcozQSBzExNVDBkhoJRpnIuE3Xl 52PIyg7eu1J6NR+mVtNjw491HGYzhnfJTB/HQ3gLO0KFWC2oqvoTbthe1KQv/JkmeYDk X+Q7ME2T85CnRcL7bi3cxlNYBLTUPtWfXYbJYA6swveJCZbky25peWc4qmwstycwyRHL VDOqIaVwXpOpwDymjMWo1RMUSDhhWBcNZtm+fk/wZpIgS/tjRZuig3RBvmJ/KNbuoI86 oLzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=qkHpPN7XbNDKm27YorIIR9c6eJ2NB+3lFpi/2cpvZIg=; b=rf1v4DApDSNYlBRWOpyDHFtIvltrIzPr9nAmgjdYk8xUPRLASuOp9b0GiBwTh4XFIb Jydw6hOfc1I2XePOSKHcFqWFTrnX9zgvrE86HeImx/R8/DWQEbTda3zYSLLyCjNcxziu 6c+/UsqBg06B/cyI0SJ18v5MCal9f1LRh4bVTY/Aq6QHQCial6Si/6xTF3M4eHvC0Gpc q5r16iF3IRdcC6ZlzzuZ2V8fvfKG53p57UqUSoT9oFpQFQ+VhyJptzZoxJNbgeEtMX4g FDryP38t5BaurgLrk3FIl+B6JRMqls2dXfTGZIwLBl/hZwMrf50U19C7XOvxHm8GrSfe c3Pg== X-Gm-Message-State: ANhLgQ1j8nCcjtuIK+VwkTsnCl+eVyBfXH+oTQe1szSbQfCZkehax0c3 Ztdnmtw+IEc8GesJPOSMD3gxNiAk X-Received: by 2002:a63:d245:: with SMTP id t5mr1308586pgi.84.1583193003770; Mon, 02 Mar 2020 15:50:03 -0800 (PST) Date: Mon, 2 Mar 2020 15:49:46 -0800 Message-Id: <20200302234946.75425-1-rkir@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.25.0.265.gbab2e86ba0-goog Subject: [PATCH] net: wireless: Add module_param(mac_prefix) to mac80211_hwsim From: rkir@google.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, lfy@google.com, Roman Kiryanov Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Roman Kiryanov By default mac80211_hwsim creates N radios with MAC addresses like '02:00:00:nn:nn:00' where nnnn is incremented. We (Android Studio Emulator) need a way to have unique MAC addresses. Currently in mac80211_hwsim this can be done by sending HWSIM_CMD_DEL_RADIO and HWSIM_CMD_NEW_RADIO commands. The 'mac_prefix' parameter provides an easier way to make MAC address unique by specifying two octets in MAC address, i.e. '02:pp:pp:nn:nn:00'. Signed-off-by: Roman Kiryanov --- drivers/net/wireless/mac80211_hwsim.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 03738107fd10..1519435ecc76 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -62,6 +62,10 @@ static bool support_p2p_device = true; module_param(support_p2p_device, bool, 0444); MODULE_PARM_DESC(support_p2p_device, "Support P2P-Device interface type"); +static ushort mac_prefix; +module_param(mac_prefix, ushort, 0444); +MODULE_PARM_DESC(mac_prefix, "Second and third most significant octets in MAC"); + /** * enum hwsim_regtest - the type of regulatory tests we offer * @@ -2811,6 +2815,8 @@ static int mac80211_hwsim_new_radio(struct genl_info *info, if (!param->perm_addr) { eth_zero_addr(addr); addr[0] = 0x02; + addr[1] = (mac_prefix >> 8) & 0xFF; + addr[2] = mac_prefix & 0xFF; addr[3] = idx >> 8; addr[4] = idx; memcpy(data->addresses[0].addr, addr, ETH_ALEN); -- 2.25.0.265.gbab2e86ba0-goog