From patchwork Sat Jan 24 05:04:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Hintz X-Patchwork-Id: 432377 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 183B61402A6 for ; Sat, 24 Jan 2015 16:05:18 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id AACC428BE90; Sat, 24 Jan 2015 06:02:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id EA7C828BE89 for ; Sat, 24 Jan 2015 06:02:35 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .hotmail. - helo: .blu004-omc2s28.hotmail. - helo-domain: .hotmail.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from BLU004-OMC2S28.hotmail.com (blu004-omc2s28.hotmail.com [65.55.111.103]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sat, 24 Jan 2015 06:02:35 +0100 (CET) Received: from BLU436-SMTP168 ([65.55.111.73]) by BLU004-OMC2S28.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Fri, 23 Jan 2015 21:04:15 -0800 X-TMN: [PiwfXhTj2qePNX6dmltFTzmbOYsXBdwq] X-Originating-Email: [nlhintz@hotmail.com] Message-ID: From: Nathan Hintz To: openwrt-devel@lists.openwrt.org Date: Fri, 23 Jan 2015 21:04:09 -0800 X-Mailer: git-send-email 1.9.3 X-OriginalArrivalTime: 24 Jan 2015 05:04:14.0274 (UTC) FILETIME=[329EEA20:01D03793] MIME-Version: 1.0 Cc: Nathan Hintz Subject: [OpenWrt-Devel] [PATCH] mac80211: fix fallback to macaddr X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" If '/sys/class/ieee80211/phyN' is not a symlink, the call to readlink produces either an empty path (if /sys/class/ieee80211/phyN/device doesn't exist) or a path that begins with '/sys/class/ieee80211' (which does not work with the subsequent line to strip '/sys/devices' from the beginning of the path). Modify the checks to detect these conditions, and fallback to using the macaddr. Signed-off-by: Nathan Hintz --- package/kernel/mac80211/files/lib/wifi/mac80211.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh index 0b662eb..a7c4d2d 100644 --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh @@ -94,8 +94,12 @@ detect_mac80211() { [ -n $htmode ] && append ht_capab " option htmode $htmode" "$N" - if [ -x /usr/bin/readlink ]; then + if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then path="$(readlink -f /sys/class/ieee80211/${dev}/device)" + else + path="" + fi + if [ -n "$path" ]; then path="${path##/sys/devices/}" dev_id=" option path '$path'" else