From patchwork Fri Jun 9 13:02:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17037 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id DD78D81F18; Fri, 9 Jun 2017 15:02:59 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="bbn4n6gt"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver= Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id A21FF809E4 for ; Fri, 9 Jun 2017 15:02:58 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C2BAF90000000000004065.dip0.t-ipconnect.de [IPv6:2003:c5:93c2:baf9::4065]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 0E6A41100EA; Fri, 9 Jun 2017 15:02:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1497013378; bh=vANl9R1TLugGbXD5N2qpXSUqguCehtINphak9cJVAIk=; h=From:To:Cc:Subject:Date:From; b=bbn4n6gtByQaH5PIOg/SxwnSughjny/sXkBvGiIjjAi7xDGKhteaabaM77qpiM2pC TjmbsrnV6NtGJr0gTO49jl+rERwklrx4rGCXfk6qqmEoBadX5UpUTnLnHKhomXTzTC cSq90XJ8p8lLzc5aIAf1SWBSpPelVa+Z93DO8flk= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 9 Jun 2017 15:02:54 +0200 Message-Id: <20170609130255.8577-1-sven@narfation.org> X-Mailer: git-send-email 2.11.0 Subject: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Use default throughput value on cfg80211 error X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" A wifi interface should never be handled like an ethernet devices. The parser of the cfg80211 output must therefore skip the ethtool code when cfg80211_get_station returned an error. Fixes: 01b1fe819ee0 ("batman-adv: refactor wifi interface detection") Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_v_elp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index b90c9903..96e73337 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -109,8 +109,10 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) */ return 0; } - if (!ret) - return sinfo.expected_throughput / 100; + if (ret) + goto default_throughput; + + return sinfo.expected_throughput / 100; } /* if not a wifi interface, check if this device provides data via From patchwork Fri Jun 9 13:02:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17038 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id B7F2F81FC9; Fri, 9 Jun 2017 15:03:07 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=narfation.org header.i=@narfation.org header.b="z4AaoAhe"; dkim-atps=neutral Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver= Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id EF55581FBD for ; Fri, 9 Jun 2017 15:03:00 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C2BAF90000000000004065.dip0.t-ipconnect.de [IPv6:2003:c5:93c2:baf9::4065]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 77B321100EA; Fri, 9 Jun 2017 15:03:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1497013380; bh=eM05ziWI5W1fRsWRWlyBaQ96ywfcbwy6Dy62OvsOg+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4AaoAheYaKSR6RNkhGkgfgCeihHbPtlN2sUKoLNXjJz+Ohg447DDXrdl9Q3UBPTk oNSQlNhL8r2wb1gUt9H3OlRdaRycYsQ6EgQQVH7GtD5mzAKrfe2C7yBPpMOoNUH1V6 VqelTOFSILW3qS6VTHLwaQPg4aim1u28NugzugVM= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Fri, 9 Jun 2017 15:02:55 +0200 Message-Id: <20170609130255.8577-2-sven@narfation.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170609130255.8577-1-sven@narfation.org> References: <20170609130255.8577-1-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Accept only filled wifi station info X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" The wifi driver can decide to not provide parts of the station info. For example, the expected throughput of the station can be omitted when the used rate control doesn't provide this kind of information. The B.A.T.M.A.N. V implementation must therefore check the filled bitfield before it tries to access the expected_throughput of the returned station_info. Reported-by: Alvaro Antelo Fixes: 5c3245172c01 ("batman-adv: ELP - compute the metric based on the estimated throughput") Signed-off-by: Sven Eckelmann --- compat-include/net/cfg80211.h | 2 ++ net/batman-adv/bat_v_elp.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/compat-include/net/cfg80211.h b/compat-include/net/cfg80211.h index 6e0eca3c..f65fa756 100644 --- a/compat-include/net/cfg80211.h +++ b/compat-include/net/cfg80211.h @@ -20,6 +20,8 @@ static inline int cfg80211_get_station(struct net_device *dev, */ #define expected_throughput filled +#define STATION_INFO_EXPECTED_THROUGHPUT BIT(28) + #endif /* < KERNEL_VERSION(3, 16, 0) */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index 96e73337..16552568 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -111,6 +111,8 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) } if (ret) goto default_throughput; + if (!(sinfo.filled & STATION_INFO_EXPECTED_THROUGHPUT)) + goto default_throughput; return sinfo.expected_throughput / 100; }