From nobody Thu Apr 25 22:39:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1490709639865795.4709098880992; Tue, 28 Mar 2017 07:00:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F396F4E03F; Tue, 28 Mar 2017 14:00:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B2BB618ADC; Tue, 28 Mar 2017 14:00:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 496755EC60; Tue, 28 Mar 2017 14:00:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2SE0YBJ011271 for ; Tue, 28 Mar 2017 10:00:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id A4F867F970; Tue, 28 Mar 2017 14:00:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 928097FBC2 for ; Tue, 28 Mar 2017 14:00:31 +0000 (UTC) Received: from smtp.nue.novell.com (smtp.nue.novell.com [195.135.221.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 148E680F9E for ; Tue, 28 Mar 2017 14:00:30 +0000 (UTC) Received: from laptop.vms (mhy71-2-88-167-63-197.fbx.proxad.net [88.167.63.197]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 28 Mar 2017 16:00:28 +0200 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F396F4E03F Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com F396F4E03F DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 148E680F9E Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=cbosdonnat@suse.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 148E680F9E From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: libvir-list@redhat.com Date: Tue, 28 Mar 2017 16:00:24 +0200 Message-Id: <20170328140024.11694-1-cbosdonnat@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 Mar 2017 14:00:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 Mar 2017 14:00:30 +0000 (UTC) for IP:'195.135.221.5' DOMAIN:'smtp.nue.novell.com' HELO:'smtp.nue.novell.com' FROM:'cbosdonnat@suse.com' RCPT:'' X-RedHat-Spam-Score: -1.491 (BAYES_50, RCVD_IN_DNSWL_MED, SPF_PASS, T_SUBJ_BRKN_WORDNUMS) 195.135.221.5 smtp.nue.novell.com 195.135.221.5 smtp.nue.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Subject: [libvirt] [PATCH v2] virNetDevIPCheckIPv6ForwardingCallback fixes X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 28 Mar 2017 14:00:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add check for more than one RTA_OIF, even though this is rather unlikely. Get rid of the buggy switch / break as this code won't need to handle more attributes. Use VIR_WARNINGS_NO_CAST_ALIGN to fix impossible to fix util/virnetdevip.c:560:17: error: cast increases required alignment of targ= et type [-Werror=3Dcast-align] --- Diff to v1: * Add error message * Use VIR_WARNINGS_NO_CAST_ALIGN src/util/virnetdevip.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index c9ac6baf7..726fa6c3e 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -556,15 +556,24 @@ virNetDevIPCheckIPv6ForwardingCallback(const struct n= lmsghdr *resp, if (resp->nlmsg_type !=3D RTM_NEWROUTE) return ret; =20 - /* Extract a few attributes */ + /* Extract a device ID attribute */ + VIR_WARNINGS_NO_CAST_ALIGN for (rta =3D RTM_RTA(rtmsg); RTA_OK(rta, len); rta =3D RTA_NEXT(rta, l= en)) { - switch (rta->rta_type) { - case RTA_OIF: + VIR_WARNINGS_RESET + if (rta->rta_type =3D=3D RTA_OIF) { oif =3D *(int *)RTA_DATA(rta); =20 + /* Should never happen: netlink message would be broken */ + if (ifname) { + char *ifname2 =3D virNetDevGetName(oif); + VIR_WARN("Single route has unexpected 2nd interface " + "- '%s' and '%s'", ifname, ifname2); + VIR_FREE(ifname2); + break; + } + if (!(ifname =3D virNetDevGetName(oif))) goto error; - break; } } =20 --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list