From patchwork Fri Jun 7 13:36:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kici?ski X-Patchwork-Id: 2686981 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 957A93FC23 for ; Fri, 7 Jun 2013 13:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752755Ab3FGNg0 (ORCPT ); Fri, 7 Jun 2013 09:36:26 -0400 Received: from mx3.wp.pl ([212.77.101.7]:13808 "EHLO mx3.wp.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432Ab3FGNgX (ORCPT ); Fri, 7 Jun 2013 09:36:23 -0400 Received: (wp-smtpd smtp.wp.pl 13183 invoked from network); 7 Jun 2013 15:36:21 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1370612181; bh=FD256V4oCoWseYc3pV8lgRnD0JIVTMl33pzVZiWXOsA=; h=From:To:Cc:Subject; b=xAbEuekgQKOlroG8LdS8I0y+rfVn4t/kaXuiN40ZIjRZhuuzkRdkAVx7ssHMJ3LeT YtiZNrd96tEYBnUdWTHYoXQW5zzERJYhTLSH1/CtEcuMyGPkUe84L2vAd/uPlYaS9T JyVwTCWLmlgjA9TRdXNZTrLd4vyklRi9dEYU/uMw= Received: from 89-71-197-70.dynamic.chello.pl (HELO localhost.localdomain) (moorray3@[89.71.197.70]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with SMTP for ; 7 Jun 2013 15:36:21 +0200 From: Jakub Kicinski To: linux-wireless@vger.kernel.org Cc: Helmut Schaa , Felix Fietkau , Johannes Berg , nietrywialneprzejscie@gmail.com Subject: [RFC 4/5] mac80211: enforce address verification on monitors Date: Fri, 7 Jun 2013 15:36:18 +0200 Message-Id: <1370612179-24385-5-git-send-email-moorray3@wp.pl> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370612179-24385-1-git-send-email-moorray3@wp.pl> References: <1370612179-24385-1-git-send-email-moorray3@wp.pl> X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [4QLM] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jakub Kicinski Mac address of passive monitor have to treated the same as address any other interface because type of interface can be changed or monitor can be later put into active mode. Refusing to change interface type because of mismatch in mac addresses would likely be confusing to users. This requirement only applies to hardware that sets addr_mask and need to have all addresses kept within it. Signed-off-by: Jakub Kicinski --- net/mac80211/iface.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 1f26980..96bfafa 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -159,8 +159,7 @@ static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) return 0; } -static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr, - bool check_dup) +static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr) { struct ieee80211_local *local = sdata->local; struct ieee80211_sub_if_data *iter; @@ -181,18 +180,11 @@ static int ieee80211_verify_mac(struct ieee80211_sub_if_data *sdata, u8 *addr, ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | ((u64)m[4] << 1*8) | ((u64)m[5] << 0*8); - if (!check_dup) - return ret; - mutex_lock(&local->iflist_mtx); list_for_each_entry(iter, &local->interfaces, list) { if (iter == sdata) continue; - if (sdata->vif.type == NL80211_IFTYPE_MONITOR && - !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)) - continue; - m = iter->vif.addr; tmp = ((u64)m[0] << 5*8) | ((u64)m[1] << 4*8) | ((u64)m[2] << 3*8) | ((u64)m[3] << 2*8) | @@ -212,17 +204,12 @@ static int ieee80211_change_mac(struct net_device *dev, void *addr) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct sockaddr *sa = addr; - bool check_dup = true; int ret; if (ieee80211_sdata_running(sdata)) return -EBUSY; - if (sdata->vif.type == NL80211_IFTYPE_MONITOR && - !(sdata->u.mntr_flags & MONITOR_FLAG_ACTIVE)) - check_dup = false; - - ret = ieee80211_verify_mac(sdata, sa->sa_data, check_dup); + ret = ieee80211_verify_mac(sdata, sa->sa_data); if (ret) return ret;