From patchwork Wed Sep 6 20:58:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 810795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oO0bTEAI"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xnbYm68fBz9ryT for ; Thu, 7 Sep 2017 06:59:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=1uzoFI8ke2Xf6mXclSLxs8dPJvyY5nn1MuTEoE4mNmo=; b=oO0 bTEAI6iIcNDR/ju1ykZDB3MDQbWX1liWFl5GHACRJLTA2fLfLE5XwEsz2T7RbHaWZGuIOwZg0dIca ddBqrwBrXmjN43Uyl/z8dVMvkNamQsKALYQ7uvBg7KsS/ETypsu/8VtUiN/BLus4RgwJhMSKCtS8n XqxCQwIaDnj/xWy8vJYSm5yvI/8c9N6WM038Ghaw6na2P61rMoNVeN5VH4EF5vo63ZIa5Hu49cOcG Kwa4Cu5LfpYsLLPeWcaqJ0sS3MT2BvcYzX/vPdZFAHnKzvNx3DffFqk/M72MZFdFw5xS+3OXOaxBO dwoCOi5iftLaGlYhqSUOF8hMXue8foA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dphPj-0007nm-MO; Wed, 06 Sep 2017 20:59:11 +0000 Received: from mail2.candelatech.com ([208.74.158.173]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dphPY-0007dd-8n for hostap@lists.infradead.org; Wed, 06 Sep 2017 20:59:09 +0000 Received: from v-f26-64.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id 28F27409E08; Wed, 6 Sep 2017 13:58:39 -0700 (PDT) From: greearb@candelatech.com To: hostap@lists.infradead.org Subject: [PATCH] Hacks to build on Fedora-26. Date: Wed, 6 Sep 2017 13:58:34 -0700 Message-Id: <20170906205834.13224-1-greearb@candelatech.com> X-Mailer: git-send-email 2.13.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170906_135900_557875_D7FDC488 X-CRM114-Status: GOOD ( 10.20 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ben Greear MIME-Version: 1.0 Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Ben Greear The compiler on Fedora-26 has gotten pickier about some things. The issues it complains about seem real, but I guess they do not happen in practice or someone one have noticed already. Signed-off-by: Ben Greear --- src/drivers/driver_hostap.c | 11 ++++++++--- src/drivers/driver_nl80211.c | 5 ++++- src/drivers/driver_nl80211_monitor.c | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/drivers/driver_hostap.c b/src/drivers/driver_hostap.c index 597da335e..218020250 100644 --- a/src/drivers/driver_hostap.c +++ b/src/drivers/driver_hostap.c @@ -217,6 +217,7 @@ static int hostap_init_sockets(struct hostap_driver_data *drv, u8 *own_addr) { struct ifreq ifr; struct sockaddr_ll addr; + char buf[32]; drv->sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)); if (drv->sock < 0) { @@ -231,7 +232,9 @@ static int hostap_init_sockets(struct hostap_driver_data *drv, u8 *own_addr) } memset(&ifr, 0, sizeof(ifr)); - snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%sap", drv->iface); + snprintf(buf, sizeof(buf), "%sap", drv->iface); + os_strlcpy(ifr.ifr_name, buf, sizeof(ifr.ifr_name)); + if (ioctl(drv->sock, SIOCGIFINDEX, &ifr) != 0) { wpa_printf(MSG_ERROR, "ioctl(SIOCGIFINDEX): %s", strerror(errno)); @@ -346,9 +349,11 @@ static int hostap_set_iface_flags(void *priv, int dev_up) { struct hostap_driver_data *drv = priv; struct ifreq ifr; - char ifname[IFNAMSIZ]; + char ifname[IFNAMSIZ + 10]; + + os_snprintf(ifname, sizeof(ifname), "%sap", drv->iface); + ifname[IFNAMSIZ - 1] = 0; - os_snprintf(ifname, IFNAMSIZ, "%sap", drv->iface); if (linux_set_iface_flags(drv->ioctl_sock, ifname, dev_up) < 0) return -1; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 0271f960c..ffec533e1 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -6398,8 +6398,11 @@ static int i802_set_wds_sta(void *priv, const u8 *addr, int aid, int val, struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; char name[IFNAMSIZ + 1]; + char tmp[34]; /* make F-26 gcc stop complaining about size of snprintf destination */ + + os_snprintf(tmp, sizeof(tmp), "%s.sta%d", bss->ifname, aid); + os_strlcpy(name, tmp, sizeof(name)); - os_snprintf(name, sizeof(name), "%s.sta%d", bss->ifname, aid); if (ifname_wds) os_strlcpy(ifname_wds, name, IFNAMSIZ + 1); diff --git a/src/drivers/driver_nl80211_monitor.c b/src/drivers/driver_nl80211_monitor.c index 28a99f274..e7ea023a2 100644 --- a/src/drivers/driver_nl80211_monitor.c +++ b/src/drivers/driver_nl80211_monitor.c @@ -340,7 +340,7 @@ void nl80211_remove_monitor_interface(struct wpa_driver_nl80211_data *drv) int nl80211_create_monitor_interface(struct i802_bss *bss, struct wpa_driver_nl80211_data *drv) { - char buf[IFNAMSIZ]; + char buf[IFNAMSIZ + 20]; struct sockaddr_ll ll; int optval; socklen_t optlen; @@ -362,7 +362,7 @@ int nl80211_create_monitor_interface(struct i802_bss *bss, struct wpa_driver_nl8 snprintf(buf, IFNAMSIZ, "mon-%s", drv->first_bss->ifname + 4); } else { /* Non-P2P interface with AP functionality. */ - snprintf(buf, IFNAMSIZ, "mon.%s", drv->first_bss->ifname); + snprintf(buf, sizeof(buf), "mon.%s", drv->first_bss->ifname); } buf[IFNAMSIZ - 1] = '\0';