From nobody Tue Oct 28 12:14:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515432696378235.35047671714415; Mon, 8 Jan 2018 09:31:36 -0800 (PST) Received: from localhost ([::1]:46976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYbGn-0000yP-CY for importer@patchew.org; Mon, 08 Jan 2018 12:31:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYbEi-00087S-Hc for qemu-devel@nongnu.org; Mon, 08 Jan 2018 12:29:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYbEf-0008UQ-D0 for qemu-devel@nongnu.org; Mon, 08 Jan 2018 12:29:24 -0500 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:42952) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYbEf-0008Tp-8g for qemu-devel@nongnu.org; Mon, 08 Jan 2018 12:29:21 -0500 Received: by mail-qt0-x244.google.com with SMTP id g9so14526144qth.9 for ; Mon, 08 Jan 2018 09:29:21 -0800 (PST) Received: from x1.local ([138.117.48.219]) by smtp.gmail.com with ESMTPSA id j127sm787922qkd.88.2018.01.08.09.29.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 09:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LN/3meoTPfJi74I+z0Zajww3FRTJjjGyCJ9jcM5HPys=; b=cWEklN5GOabTW0Aa8EOj7Z2OT6oGfe9M4fCtmnJYY9lHM00zgKc8LFy9ba623ILemj W8ZNpWFseZSwknt96AQigsfpNXxVgU/pjvG0wF9+oSBg9Wn1Y4C9MsW3yjtoNZe9fqjm +LbCR56ka734oDuufA7W6G1ldF5POlcz80CrZB54pGCoYWS133Dqgi3vWO5N5duAjJ2A bc+T5l20cZ96r/vjY4ks5dPVGcS190meF3NKIJbhqQvFKhNuiT+p3uW3VCqc1ogq36/S iC8KxM2ch132c3LRP1FoSrukuFsacQ43cOPVti7bMrgqoQ975J0BkoGil9v7L9JyDTDT ygNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LN/3meoTPfJi74I+z0Zajww3FRTJjjGyCJ9jcM5HPys=; b=F6Bu5nkJrStKSmKqzgSm9QO9s5XEWgPXT2k+fUr51HiVmV9ys/Cxbf17QFLuiKxE5F /ngIYpafcd0FqSflBaA16wK0GptGrD9KKkbSSjsJx4cTTMGeMAaX8mKmvAcYPHLO6Bfn 5uNhEphn6nxEKX50WA+sIft+5aEAvXPxZoAO0oF2K/6WdsrqgWf4nltEGc14c2Gn4xG9 Iz3UcGl252YRNt1egs9xSXYQeo60Vf6dR7kMMWM8W/18wMLkoD1dy6WLQkkocwR9y1jr 8sqNRlyexYy3OBkBIiN3130WjV/TG7SwrTICkq9QU2cFgq2kTFHHteals9RB/S5ZThuS hsbA== X-Gm-Message-State: AKwxytcGukK4RY8ZBbpHqr3kIJeGyDASJt1cld47LeeE0ZGZyrXvZP46 o0GIqhr/1BkvsH3H0NpgMwE= X-Google-Smtp-Source: ACJfBov8pc9fZ/sFcCUN5nxARz4c8O0hsV+OXwnXHlcDbmRX0Vi4BSd3qF4o28G0hGM43l3t8g5Jmg== X-Received: by 10.200.2.157 with SMTP id p29mr17179967qtg.155.1515432560700; Mon, 08 Jan 2018 09:29:20 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Samuel Thibault , Jan Kiszka , "Michael S . Tsirkin" , Paolo Bonzini , Eric Blake , Thomas Huth Date: Mon, 8 Jan 2018 14:28:55 -0300 Message-Id: <20180108172904.8772-4-f4bug@amsat.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180108172904.8772-1-f4bug@amsat.org> References: <20180108172904.8772-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::244 Subject: [Qemu-devel] [PATCH 03/12] slirp: avoid IN6_IS_ADDR_UNSPECIFIED(), rather use in6_zero() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Host: Mac OS 10.12.5 Compiler: Apple LLVM version 8.1.0 (clang-802.0.42) slirp/ip6_icmp.c:80:38: warning: taking address of packed member 'ip_src'= of class or structure 'ip6' may result in an unaligned pointer value [-Waddress-of-packed-member] IN6_IS_ADDR_UNSPECIFIED(&ip->ip_src)) { ^~~~~~~~~~ /usr/include/netinet6/in6.h:238:42: note: expanded from macro 'IN6_IS_ADD= R_UNSPECIFIED' ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) =3D=3D 0)= && \ ^ Reported-by: John Arbuckle Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- slirp/ip6_icmp.c | 6 +++--- slirp/ndp_table.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/slirp/ip6_icmp.c b/slirp/ip6_icmp.c index 777eb574be..ee333d05a2 100644 --- a/slirp/ip6_icmp.c +++ b/slirp/ip6_icmp.c @@ -77,7 +77,7 @@ void icmp6_send_error(struct mbuf *m, uint8_t type, uint8= _t code) DEBUG_ARGS((dfd, " type =3D %d, code =3D %d\n", type, code)); =20 if (IN6_IS_ADDR_MULTICAST(&ip->ip_src) || - IN6_IS_ADDR_UNSPECIFIED(&ip->ip_src)) { + in6_zero(&ip->ip_src)) { /* TODO icmp error? */ return; } @@ -272,7 +272,7 @@ static void ndp_send_na(Slirp *slirp, struct ip6 *ip, s= truct icmp6 *icmp) struct mbuf *t =3D m_get(slirp); struct ip6 *rip =3D mtod(t, struct ip6 *); rip->ip_src =3D icmp->icmp6_nns.target; - if (IN6_IS_ADDR_UNSPECIFIED(&ip->ip_src)) { + if (in6_zero(&ip->ip_src)) { rip->ip_dst =3D (struct in6_addr)ALLNODES_MULTICAST; } else { rip->ip_dst =3D ip->ip_src; @@ -350,7 +350,7 @@ static void ndp_input(struct mbuf *m, Slirp *slirp, str= uct ip6 *ip, && icmp->icmp6_code =3D=3D 0 && !IN6_IS_ADDR_MULTICAST(&icmp->icmp6_nns.target) && ntohs(ip->ip_pl) >=3D ICMP6_NDP_NS_MINLEN - && (!IN6_IS_ADDR_UNSPECIFIED(&ip->ip_src) + && (!in6_zero(&ip->ip_src) || in6_solicitednode_multicast(&ip->ip_dst))) { if (in6_equal_host(&icmp->icmp6_nns.target)) { /* Gratuitous NDP */ diff --git a/slirp/ndp_table.c b/slirp/ndp_table.c index 9d4c39b45c..e1676a0a7b 100644 --- a/slirp/ndp_table.c +++ b/slirp/ndp_table.c @@ -23,7 +23,7 @@ void ndp_table_add(Slirp *slirp, struct in6_addr ip_addr, ethaddr[0], ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5])); =20 - if (IN6_IS_ADDR_MULTICAST(&ip_addr) || IN6_IS_ADDR_UNSPECIFIED(&ip_add= r)) { + if (IN6_IS_ADDR_MULTICAST(&ip_addr) || in6_zero(&ip_addr)) { /* Do not register multicast or unspecified addresses */ DEBUG_CALL(" abort: do not register multicast or unspecified addre= ss"); return; @@ -60,7 +60,7 @@ bool ndp_table_search(Slirp *slirp, struct in6_addr ip_ad= dr, DEBUG_ARG("ip =3D %s", addrstr); #endif =20 - assert(!IN6_IS_ADDR_UNSPECIFIED(&ip_addr)); + assert(!in6_zero(&ip_addr)); =20 /* Multicast address: fec0::abcd:efgh/8 -> 33:33:ab:cd:ef:gh */ if (IN6_IS_ADDR_MULTICAST(&ip_addr)) { --=20 2.15.1