From owner-svn-src-stable@freebsd.org Wed Jan 11 20:29:59 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 819CCCABF85; Wed, 11 Jan 2017 20:29:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 389A3137A; Wed, 11 Jan 2017 20:29:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0BKTwhg056056; Wed, 11 Jan 2017 20:29:58 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0BKTwCb056055; Wed, 11 Jan 2017 20:29:58 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701112029.v0BKTwCb056055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 11 Jan 2017 20:29:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r311936 - stable/11/sbin/ping X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jan 2017 20:29:59 -0000 Author: dim Date: Wed Jan 11 20:29:58 2017 New Revision: 311936 URL: https://svnweb.freebsd.org/changeset/base/311936 Log: MFC r311530: Fix clang 4.0.0 warnings about taking the address of a packed member of struct ip in ping(8): sbin/ping/ping.c:1684:53: error: taking address of packed member 'ip_src' of class or structure 'ip' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_src.s_addr)); ^~~~~~~~~~~~~~~~~ sbin/ping/ping.c:1685:53: error: taking address of packed member 'ip_dst' of class or structure 'ip' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_dst.s_addr)); ^~~~~~~~~~~~~~~~~ Modified: stable/11/sbin/ping/ping.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ping/ping.c ============================================================================== --- stable/11/sbin/ping/ping.c Wed Jan 11 20:23:45 2017 (r311935) +++ stable/11/sbin/ping/ping.c Wed Jan 11 20:29:58 2017 (r311936) @@ -1666,6 +1666,7 @@ pr_icmph(struct icmp *icp) static void pr_iph(struct ip *ip) { + struct in_addr ina; u_char *cp; int hlen; @@ -1681,8 +1682,10 @@ pr_iph(struct ip *ip) (u_long) ntohl(ip->ip_off) & 0x1fff); (void)printf(" %02x %02x %04x", ip->ip_ttl, ip->ip_p, ntohs(ip->ip_sum)); - (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_src.s_addr)); - (void)printf(" %s ", inet_ntoa(*(struct in_addr *)&ip->ip_dst.s_addr)); + memcpy(&ina, &ip->ip_src.s_addr, sizeof ina); + (void)printf(" %s ", inet_ntoa(ina)); + memcpy(&ina, &ip->ip_dst.s_addr, sizeof ina); + (void)printf(" %s ", inet_ntoa(ina)); /* dump any option bytes */ while (hlen-- > 20) { (void)printf("%02x", *cp++);