From nobody Wed Feb 11 10:18:01 2026 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 1490331786875865.5732152333385; Thu, 23 Mar 2017 22:03:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 71F26C05490A; Fri, 24 Mar 2017 05:03:06 +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 1A5E07D3C2; Fri, 24 Mar 2017 05:03:06 +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 3336618523D5; Fri, 24 Mar 2017 05:03:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2O52m1N008837 for ; Fri, 24 Mar 2017 01:02:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F7621714E; Fri, 24 Mar 2017 05:02:48 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-59.phx2.redhat.com [10.3.116.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49D6717589 for ; Fri, 24 Mar 2017 05:02:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 71F26C05490A Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=laine.org Authentication-Results: ext-mx08.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 71F26C05490A From: Laine Stump To: libvir-list@redhat.com Date: Fri, 24 Mar 2017 01:02:34 -0400 Message-Id: <20170324050235.29110-11-laine@laine.org> In-Reply-To: <20170324050235.29110-1-laine@laine.org> References: <20170324050235.29110-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 10/11] util: log all setting of MAC addresses and vlan tags 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 24 Mar 2017 05:03:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Having this information available will make it easier to determine the culprit when MAC or vlan tag appear to not be set, eg.: https://bugzilla.redhat.com/1364073 (This patch doesn't fix that bug, just makes it easier to diagnose) --- src/util/virnetdev.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 0169e1c..31eca2d 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -241,6 +241,7 @@ virNetDevSetMACInternal(const char *ifname, int fd =3D -1; int ret =3D -1; struct ifreq ifr; + char macstr[VIR_MAC_STRING_BUFLEN]; =20 if ((fd =3D virNetDevSetupControl(ifname, &ifr)) < 0) return -1; @@ -256,7 +257,6 @@ virNetDevSetMACInternal(const char *ifname, virMacAddrGetRaw(macaddr, (unsigned char *)ifr.ifr_hwaddr.sa_data); =20 if (ioctl(fd, SIOCSIFHWADDR, &ifr) < 0) { - char macstr[VIR_MAC_STRING_BUFLEN]; =20 if (quiet && errno =3D=3D EADDRNOTAVAIL) goto cleanup; @@ -270,6 +270,10 @@ virNetDevSetMACInternal(const char *ifname, ret =3D 0; =20 cleanup: + VIR_DEBUG("SIOCSIFHWADDR %s MAC=3D%s - %s", + ifname, virMacAddrFormat(macaddr, macstr), + ret < 0 ? "Fail" : "Success"); + VIR_FORCE_CLOSE(fd); return ret; } @@ -312,6 +316,9 @@ virNetDevSetMACInternal(const char *ifname, =20 ret =3D 0; cleanup: + VIR_DEBUG("SIOCSIFLLADDR %s MAC=3D%s - %s", ifname, mac + 1), + ret < 0 ? "Fail" : "Success"); + VIR_FORCE_CLOSE(s); =20 return ret; @@ -1508,6 +1515,7 @@ virNetDevSetVfConfig(const char *ifname, int vf, bool *allowRetry) { int rc =3D -1; + char macstr[VIR_MAC_STRING_BUFLEN]; struct nlmsghdr *resp =3D NULL; struct nlmsgerr *err; unsigned int recvbuflen =3D 0; @@ -1591,8 +1599,6 @@ virNetDevSetVfConfig(const char *ifname, int vf, goto cleanup; } else if (err->error) { /* other errors are permanent */ - char macstr[VIR_MAC_STRING_BUFLEN]; - virReportSystemError(-err->error, _("Cannot set interface MAC/vlanid to %s/= %d " "for ifname %s vf %d"), @@ -1616,6 +1622,11 @@ virNetDevSetVfConfig(const char *ifname, int vf, =20 rc =3D 0; cleanup: + VIR_DEBUG("RTM_SETLINK %s vf %d MAC=3D%s vlanid=3D%d - %s", + ifname, vf, + macaddr ? virMacAddrFormat(macaddr, macstr) : "(unchanged)", + vlanid, rc < 0 ? "Fail" : "Success"); + nlmsg_free(nl_msg); VIR_FREE(resp); return rc; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list