From nobody Sat May 4 13:33:09 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521186996911439.3649458606935; Fri, 16 Mar 2018 00:56:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 635607FEAD; Fri, 16 Mar 2018 07:56:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFF2460C1B; Fri, 16 Mar 2018 07:56:34 +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 A7147181B9FD; Fri, 16 Mar 2018 07:56:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2G7uT49030477 for ; Fri, 16 Mar 2018 03:56:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F6B7AFD74; Fri, 16 Mar 2018 07:56:29 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46A25AFD70 for ; Fri, 16 Mar 2018 07:56:29 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 16 Mar 2018 08:56:24 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] virarptable: Avoid cast align warnings 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 16 Mar 2018 07:56:35 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We have to use VIR_WARNINGS_NO_CAST_ALIGN to avoid clang warning about increased required alignment caused by some netlink macros. Signed-off-by: Michal Privoznik --- src/util/virarptable.c | 100 ++++++++++++++++++++++++---------------------= ---- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/src/util/virarptable.c b/src/util/virarptable.c index 8d9ab5fdc8..3819435d38 100644 --- a/src/util/virarptable.c +++ b/src/util/virarptable.c @@ -51,10 +51,11 @@ static int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len) { memset(tb, 0, sizeof(struct rtattr *) * (max + 1)); - while (RTA_OK(rta, len)) { + VIR_WARNINGS_NO_CAST_ALIGN + for (; RTA_OK(rta, len); rta =3D RTA_NEXT(rta, len)) { + VIR_WARNINGS_RESET if ((rta->rta_type <=3D max) && (!tb[rta->rta_type])) tb[rta->rta_type] =3D rta; - rta =3D RTA_NEXT(rta, len); } =20 if (len) @@ -82,73 +83,72 @@ virArpTablePtr virArpTableGet(void) =20 nh =3D (struct nlmsghdr*)nlData; =20 - while (NLMSG_OK(nh, msglen)) { + VIR_WARNINGS_NO_CAST_ALIGN + for(; NLMSG_OK(nh, msglen); nh =3D NLMSG_NEXT(nh, msglen)) { + VIR_WARNINGS_RESET struct ndmsg *r =3D NLMSG_DATA(nh); int len =3D nh->nlmsg_len; void *addr; =20 - if ((len -=3D NLMSG_LENGTH(sizeof(*nh))) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("wrong nlmsg len")); - goto cleanup; - } + if ((len -=3D NLMSG_LENGTH(sizeof(*nh))) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("wrong nlmsg len")); + goto cleanup; + } =20 - if (r->ndm_family && (r->ndm_family !=3D AF_INET)) - goto next_nlmsg; + if (r->ndm_family && (r->ndm_family !=3D AF_INET)) + continue; =20 - /* catch stale and reachalbe arp entry only */ - if (r->ndm_state && - (!(r->ndm_state =3D=3D NUD_STALE || r->ndm_state =3D=3D NUD_REAC= HABLE))) { - nh =3D NLMSG_NEXT(nh, msglen); - continue; - } + /* catch stale and reachalbe arp entry only */ + if (r->ndm_state && + (!(r->ndm_state =3D=3D NUD_STALE || r->ndm_state =3D=3D NUD_RE= ACHABLE))) + continue; =20 - if (nh->nlmsg_type =3D=3D NLMSG_DONE) - goto end_of_netlink_messages; + if (nh->nlmsg_type =3D=3D NLMSG_DONE) + goto end_of_netlink_messages; =20 - parse_rtattr(tb, NDA_MAX, NDA_RTA(r), - nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); + VIR_WARNINGS_NO_CAST_ALIGN + parse_rtattr(tb, NDA_MAX, NDA_RTA(r), + nh->nlmsg_len - NLMSG_LENGTH(sizeof(*r))); + VIR_WARNINGS_RESET =20 - if (tb[NDA_DST] =3D=3D NULL || tb[NDA_LLADDR] =3D=3D NULL) - goto next_nlmsg; + if (tb[NDA_DST] =3D=3D NULL || tb[NDA_LLADDR] =3D=3D NULL) + continue; =20 - if (tb[NDA_DST]) { - virSocketAddr virAddr; - if (VIR_REALLOC_N(table->t, num + 1) < 0) - goto cleanup; + if (tb[NDA_DST]) { + virSocketAddr virAddr; + if (VIR_REALLOC_N(table->t, num + 1) < 0) + goto cleanup; =20 - table->n =3D num + 1; + table->n =3D num + 1; =20 - addr =3D RTA_DATA(tb[NDA_DST]); - bzero(&virAddr, sizeof(virAddr)); - virAddr.len =3D sizeof(virAddr.data.inet4); - virAddr.data.inet4.sin_family =3D AF_INET; - virAddr.data.inet4.sin_addr =3D *(struct in_addr *)addr; - ipstr =3D virSocketAddrFormat(&virAddr); + addr =3D RTA_DATA(tb[NDA_DST]); + bzero(&virAddr, sizeof(virAddr)); + virAddr.len =3D sizeof(virAddr.data.inet4); + virAddr.data.inet4.sin_family =3D AF_INET; + virAddr.data.inet4.sin_addr =3D *(struct in_addr *)addr; + ipstr =3D virSocketAddrFormat(&virAddr); =20 - if (VIR_STRDUP(table->t[num].ipaddr, ipstr) < 0) - goto cleanup; + if (VIR_STRDUP(table->t[num].ipaddr, ipstr) < 0) + goto cleanup; =20 - VIR_FREE(ipstr); - } + VIR_FREE(ipstr); + } =20 - if (tb[NDA_LLADDR]) { - virMacAddr macaddr; - char ifmac[VIR_MAC_STRING_BUFLEN]; + if (tb[NDA_LLADDR]) { + virMacAddr macaddr; + char ifmac[VIR_MAC_STRING_BUFLEN]; =20 - addr =3D RTA_DATA(tb[NDA_LLADDR]); - memcpy(macaddr.addr, addr, VIR_MAC_BUFLEN); + addr =3D RTA_DATA(tb[NDA_LLADDR]); + memcpy(macaddr.addr, addr, VIR_MAC_BUFLEN); =20 - virMacAddrFormat(&macaddr, ifmac); + virMacAddrFormat(&macaddr, ifmac); =20 - if (VIR_STRDUP(table->t[num].mac, ifmac) < 0) - goto cleanup; + if (VIR_STRDUP(table->t[num].mac, ifmac) < 0) + goto cleanup; =20 - num++; - } - - next_nlmsg: - nh =3D NLMSG_NEXT(nh, msglen); + num++; + } } =20 end_of_netlink_messages: --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 13:33:09 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521187016205933.4150870758358; Fri, 16 Mar 2018 00:56:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 987F58051D; Fri, 16 Mar 2018 07:56:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B9005D9C7; Fri, 16 Mar 2018 07:56:54 +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 E4C064CA9B; Fri, 16 Mar 2018 07:56:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2G7uULp030485 for ; Fri, 16 Mar 2018 03:56:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3CFB9AFD70; Fri, 16 Mar 2018 07:56:30 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id D85019457E for ; Fri, 16 Mar 2018 07:56:29 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 16 Mar 2018 08:56:25 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] virnetlink: Provide virNetlinkGetNeighbor non-Linux stub 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 16 Mar 2018 07:56:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This function is exported and therefore we have to have implementation for all platforms. Signed-off-by: Michal Privoznik --- src/util/virnetlink.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c index f0a92db234..0e281b06b8 100644 --- a/src/util/virnetlink.c +++ b/src/util/virnetlink.c @@ -1207,6 +1207,17 @@ virNetlinkDelLink(const char *ifname ATTRIBUTE_UNUSE= D, return -1; } =20 + +int +virNetlinkGetNeighbor(void **nlData ATTRIBUTE_UNUSED, + uint32_t src_pid ATTRIBUTE_UNUSED, + uint32_t dst_pid ATTRIBUTE_UNUSED) +{ + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported)); + return -1; +} + + /** * stopNetlinkEventServer: stop the monitor to receive netlink * messages for libvirtd --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list