From owner-svn-src-all@FreeBSD.ORG Fri Mar 13 19:05:34 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6745106564A; Fri, 13 Mar 2009 19:05:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C96868FC12; Fri, 13 Mar 2009 19:05:34 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2DJ5YkC070986; Fri, 13 Mar 2009 19:05:34 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2DJ5YoC070985; Fri, 13 Mar 2009 19:05:34 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200903131905.n2DJ5YoC070985@svn.freebsd.org> From: Sam Leffler Date: Fri, 13 Mar 2009 19:05:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189775 - head/contrib/wpa/wpa_supplicant X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Mar 2009 19:05:35 -0000 Author: sam Date: Fri Mar 13 19:05:34 2009 New Revision: 189775 URL: http://svn.freebsd.org/changeset/base/189775 Log: fix portability; linux does not have sa_len/sun_len Modified: head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c Modified: head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c ============================================================================== --- head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c Fri Mar 13 16:43:31 2009 (r189774) +++ head/contrib/wpa/wpa_supplicant/ctrl_iface_unix.c Fri Mar 13 19:05:34 2009 (r189775) @@ -16,6 +16,7 @@ #include #include #include +#include #include "common.h" #include "eloop.h" @@ -69,7 +70,8 @@ static int wpa_supplicant_ctrl_iface_att dst->next = priv->ctrl_dst; priv->ctrl_dst = dst; wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor attached", - (u8 *) from->sun_path, fromlen - sizeof(from->sun_family)); + (u8 *) from->sun_path, + fromlen - offsetof(struct sockaddr_un, sun_path)); return 0; } @@ -84,7 +86,7 @@ static int wpa_supplicant_ctrl_iface_det while (dst) { if (fromlen == dst->addrlen && os_memcmp(from->sun_path, dst->addr.sun_path, - fromlen - sizeof(from->sun_family)) == 0) { + fromlen - offsetof(struct sockaddr_un, sun_path)) == 0) { if (prev == NULL) priv->ctrl_dst = dst->next; else @@ -92,7 +94,7 @@ static int wpa_supplicant_ctrl_iface_det os_free(dst); wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor detached", (u8 *) from->sun_path, - fromlen - sizeof(from->sun_family)); + fromlen - offsetof(struct sockaddr_un, sun_path)); return 0; } prev = dst; @@ -115,10 +117,10 @@ static int wpa_supplicant_ctrl_iface_lev while (dst) { if (fromlen == dst->addrlen && os_memcmp(from->sun_path, dst->addr.sun_path, - fromlen - sizeof(from->sun_family)) == 0) { + fromlen - offsetof(struct sockaddr_un, sun_path)) == 0) { wpa_hexdump(MSG_DEBUG, "CTRL_IFACE changed monitor " "level", (u8 *) from->sun_path, - fromlen - sizeof(from->sun_family)); + fromlen - offsetof(struct sockaddr_un, sun_path)); dst->debug_level = atoi(level); return 0; } @@ -339,6 +341,8 @@ wpa_supplicant_ctrl_iface_init(struct wp } os_memset(&addr, 0, sizeof(addr)); + /* XXX #ifdef */ + addr.sun_len = sizeof(addr); addr.sun_family = AF_UNIX; fname = wpa_supplicant_ctrl_iface_path(wpa_s); if (fname == NULL) @@ -509,8 +513,8 @@ static void wpa_supplicant_ctrl_iface_se next = dst->next; if (level >= dst->debug_level) { wpa_hexdump(MSG_DEBUG, "CTRL_IFACE monitor send", - (u8 *) dst->addr.sun_path, dst->addrlen - - sizeof(dst->addr.sun_family)); + (u8 *) dst->addr.sun_path, + dst->addrlen - offsetof(struct sockaddr_un, sun_path)); msg.msg_name = (void *) &dst->addr; msg.msg_namelen = dst->addrlen; if (sendmsg(priv->sock, &msg, 0) < 0) { @@ -637,6 +641,8 @@ wpa_supplicant_global_ctrl_iface_init(st } os_memset(&addr, 0, sizeof(addr)); + /* XXX #ifdef */ + addr.sun_len = sizeof(addr); addr.sun_family = AF_UNIX; os_strlcpy(addr.sun_path, global->params.ctrl_interface, sizeof(addr.sun_path));