From nobody Wed May 8 01:36:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599242499; cv=none; d=zohomail.com; s=zohoarc; b=Wq3yCxQkmgGtJ4NB1lhPrnSXImsXMd8pBwaI71oo/DKG1rAefbdw7i37varTAyTaOEWKpWl3qRd4lFAxT9m3FE06uPdjw/IDqQMxQDZ+egLhUEmTbxkMjQTAAGGIBUc5RsC20lsgf/CcRyrdgidzkUdkjoZhrSHgfFK8QyYQ2oI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599242499; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jSeIGGacI0oP3TgTcr2+X/3Qly65jtqfq7HcOmMOiEQ=; b=TuBzKzWI6R7xLaY7Pz9BCmnniMBDE3Y7CFNBZaO85Ti/8mz1Hk84JKwHsYExWt617kX1rRp7nIszTFXeVNlhAEtBsjIdjXnKidsglTqIY01fF606j8/UsIkAMUIEIaqv9m5y0fY2iUOQqW5aIFT2KZlnVj6+rHItwEZglPv1KNc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599242499675437.11923700793386; Fri, 4 Sep 2020 11:01:39 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-R4y-m3u7NSyrSLhmLQU0MA-1; Fri, 04 Sep 2020 14:01:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D591588EF10; Fri, 4 Sep 2020 18:01:26 +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 B2BA17E16B; Fri, 4 Sep 2020 18:01:26 +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 54629972E4; Fri, 4 Sep 2020 18:01:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 084I1NtL001556 for ; Fri, 4 Sep 2020 14:01:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E1961992D; Fri, 4 Sep 2020 18:01:23 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-99.phx2.redhat.com [10.3.112.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4B1019C59 for ; Fri, 4 Sep 2020 18:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599242498; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jSeIGGacI0oP3TgTcr2+X/3Qly65jtqfq7HcOmMOiEQ=; b=aenKh6axvgc3SM6SzHqx8fVcCgUrIo4PlZ0Ew6hxfSPg6EbLYe5td0RT2ZXjdxKPehZQ70 oNrHQKwzgNw7XXZSOG+AVv0+dZm6ZjqpQdr6qjNN7D4TTzuMA0HjgxPcgaW71ua2wlK0C5 KJ9IDsfSoPKqPaM0L3Bc6X/wByjYQCY= X-MC-Unique: R4y-m3u7NSyrSLhmLQU0MA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] network: don't wait for IPv6 DAD completion when starting a network Date: Fri, 4 Sep 2020 14:01:14 -0400 Message-Id: <20200904180115.74839-2-laine@redhat.com> In-Reply-To: <20200904180115.74839-1-laine@redhat.com> References: <20200904180115.74839-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 0f7436ca54 added code during virtual network startup to wait for DAD (Duplicate Address Detection) to complete if there were any IPv6 addresses on the network. This wait was needed because (according to the commit log) "created problems when [the "dummy" tap device] is set to IFF_DOWN prior to DAD completing". That commit in turn referenced commit db488c7917, which had added the code to set the dummy tap device IFF_DOWN, commenting "DAD has happened (dnsmasq waits for it)", and in its commit message pointed out that if we just got rid of the dummy tap device this wouldn't be needed. Now that the dummy tap device has indeed been removed (commit ee6c936fbb), there is no longer any need to set it IFF_DOWN, and thus nothing requiring us to wait for DAD to complete. At any rate, with the dummy tap device removed, leaving nothing else on the bridge when it is first started, DAD never completes, leading to failure to start any IPv6 network. So, yes, this patch removes the wait for DAD completion, and IPv6 networks can once again start, and their associated dnsmasq process starts successfully (this is the problem that the DAD wait was originally intended to fix) Signed-off-by: Laine Stump Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/network/bridge_driver.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 5c00befc16..87d7acab06 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -2286,32 +2286,6 @@ networkAddRouteToBridge(virNetworkObjPtr obj, return 0; } =20 -static int -networkWaitDadFinish(virNetworkObjPtr obj) -{ - virNetworkDefPtr def =3D virNetworkObjGetDef(obj); - virNetworkIPDefPtr ipdef; - g_autofree virSocketAddrPtr *addrs =3D NULL; - virSocketAddrPtr addr =3D NULL; - size_t naddrs =3D 0; - int ret =3D -1; - - VIR_DEBUG("Begin waiting for IPv6 DAD on network %s", def->name); - - while ((ipdef =3D virNetworkDefGetIPByIndex(def, AF_INET6, naddrs))) { - addr =3D &ipdef->address; - if (VIR_APPEND_ELEMENT_COPY(addrs, naddrs, addr) < 0) - goto cleanup; - } - - ret =3D (naddrs =3D=3D 0) ? 0 : virNetDevIPWaitDadFinish(addrs, naddrs= ); - - cleanup: - VIR_DEBUG("Finished waiting for IPv6 DAD on network %s with status %d", - def->name, ret); - return ret; -} - =20 static int networkStartNetworkVirtual(virNetworkDriverStatePtr driver, @@ -2444,12 +2418,6 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr = driver, if (v6present && networkStartRadvd(driver, obj) < 0) goto error; =20 - /* dnsmasq does not wait for DAD to complete before daemonizing, - * so we need to wait for it ourselves. - */ - if (v6present && networkWaitDadFinish(obj) < 0) - goto error; - if (virNetDevBandwidthSet(def->bridge, def->bandwidth, true, true) < 0) goto error; =20 --=20 2.26.2 From nobody Wed May 8 01:36:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1599242497; cv=none; d=zohomail.com; s=zohoarc; b=B1TVBPTYlximkhaTFOLSMhZW/bTJGMSQZNESqPpty50Qv4wjVlyhIp3T/QaQoRlbyfXu0q1Q4+6oAdMz/k7+MhK/PfTk7qHW0ZUQbOdr+AXLwo2/hSAzhBpBdtqhIV8AjQJ/PZ5dmHPGyNadib2Gkd3e4V6RH4PBqzZdmweaVvE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599242497; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4Kmg0tx3QAh40J5Ur21bDff8ENpH+4jNr0dSEpUnDHw=; b=ZLm1Wc22Htnl6WwmLPV6zLY9r7tm6NwYhfNkCspnWe/0ka8ve1cFOKMMZd6HIok8PCSBsnvLSo/QhhEqMQLP/27Vo719RamwCcQ/gIsUo36oFrGur9N+NZRnfbP4Vgjvd3bai4NdgQO6y9/8Ld5DwAPirda0qFhnMdYe9daCrys= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599242497300449.53502665908036; Fri, 4 Sep 2020 11:01:37 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-yXUUGRg_OL6eZv-mN5_MaQ-1; Fri, 04 Sep 2020 14:01:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 917B31006710; Fri, 4 Sep 2020 18:01:26 +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 5C68A60BF1; Fri, 4 Sep 2020 18:01:26 +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 299DD18561B3; Fri, 4 Sep 2020 18:01:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 084I1NLa001562 for ; Fri, 4 Sep 2020 14:01:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8FE741992D; Fri, 4 Sep 2020 18:01:23 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-99.phx2.redhat.com [10.3.112.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4082B19C59 for ; Fri, 4 Sep 2020 18:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599242496; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4Kmg0tx3QAh40J5Ur21bDff8ENpH+4jNr0dSEpUnDHw=; b=VcKjwqQmak0ugL6mOoMOoK3Eg+UH9q9cT7ReH9Qjk9pQ8nPIIcOoVIS1RlftwtspXu6djw 5lz0/Dvf2WDKfJ0WY2TL2jl0sCNA72MH/Lh4q+4IYimLbniRqOqgwQaEzFXOEx3ZGXsTkw pgJuAaFF1zsEQoyk+dWMSG/LPHB38j0= X-MC-Unique: yXUUGRg_OL6eZv-mN5_MaQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] util: remove unused virNetDevIPWaitDadFinish() Date: Fri, 4 Sep 2020 14:01:15 -0400 Message-Id: <20200904180115.74839-3-laine@redhat.com> In-Reply-To: <20200904180115.74839-1-laine@redhat.com> References: <20200904180115.74839-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since we no longer need to wait for IPv6 DAD to complete, we never call this function. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 1 - src/util/virnetdevip.c | 119 --------------------------------------- src/util/virnetdevip.h | 2 - 3 files changed, 122 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 1272ac6506..f8cdd01797 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2633,7 +2633,6 @@ virNetDevIPRouteGetAddress; virNetDevIPRouteGetGateway; virNetDevIPRouteGetMetric; virNetDevIPRouteGetPrefix; -virNetDevIPWaitDadFinish; =20 =20 # util/virnetdevmacvlan.h diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c index 1e7e64f8f3..7bd5a75f85 100644 --- a/src/util/virnetdevip.c +++ b/src/util/virnetdevip.c @@ -45,8 +45,6 @@ # include #endif =20 -#define VIR_DAD_WAIT_TIMEOUT 20 /* seconds */ - #define VIR_FROM_THIS VIR_FROM_NONE =20 VIR_LOG_INIT("util.netdevip"); @@ -372,113 +370,6 @@ virNetDevIPRouteAdd(const char *ifname, } =20 =20 -/* return true if there is a known address with 'tentative' flag set */ -static bool -virNetDevIPParseDadStatus(struct nlmsghdr *nlh, int len, - virSocketAddrPtr *addrs, size_t count) -{ - struct ifaddrmsg *ifaddrmsg_ptr; - unsigned int ifaddrmsg_len; - struct rtattr *rtattr_ptr; - size_t i; - struct in6_addr *addr; - - VIR_WARNINGS_NO_CAST_ALIGN - for (; NLMSG_OK(nlh, len); nlh =3D NLMSG_NEXT(nlh, len)) { - VIR_WARNINGS_RESET - if (NLMSG_PAYLOAD(nlh, 0) < sizeof(struct ifaddrmsg)) { - /* Message without payload is the last one. */ - break; - } - - ifaddrmsg_ptr =3D (struct ifaddrmsg *)NLMSG_DATA(nlh); - if (!(ifaddrmsg_ptr->ifa_flags & IFA_F_TENTATIVE)) { - /* Not tentative: we are not interested in this entry. */ - continue; - } - - ifaddrmsg_len =3D IFA_PAYLOAD(nlh); - VIR_WARNINGS_NO_CAST_ALIGN - rtattr_ptr =3D (struct rtattr *) IFA_RTA(ifaddrmsg_ptr); - for (; RTA_OK(rtattr_ptr, ifaddrmsg_len); - rtattr_ptr =3D RTA_NEXT(rtattr_ptr, ifaddrmsg_len)) { - VIR_WARNINGS_RESET - if (RTA_PAYLOAD(rtattr_ptr) !=3D sizeof(struct in6_addr)) { - /* No address: ignore. */ - continue; - } - - /* We check only known addresses. */ - for (i =3D 0; i < count; i++) { - addr =3D &addrs[i]->data.inet6.sin6_addr; - if (!memcmp(addr, RTA_DATA(rtattr_ptr), - sizeof(struct in6_addr))) { - /* We found matching tentative address. */ - return true; - } - } - } - } - return false; -} - - -/* return after DAD finishes for all known IPv6 addresses or an error */ -int -virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs, size_t count) -{ - struct ifaddrmsg ifa; - unsigned int recvbuflen; - bool dad =3D true; - time_t max_time =3D time(NULL) + VIR_DAD_WAIT_TIMEOUT; - g_autoptr(virNetlinkMsg) nlmsg =3D NULL; - - if (!(nlmsg =3D nlmsg_alloc_simple(RTM_GETADDR, - NLM_F_REQUEST | NLM_F_DUMP))) { - virReportOOMError(); - return -1; - } - - memset(&ifa, 0, sizeof(ifa)); - /* DAD is for IPv6 addresses only. */ - ifa.ifa_family =3D AF_INET6; - if (nlmsg_append(nlmsg, &ifa, sizeof(ifa), NLMSG_ALIGNTO) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("allocated netlink buffer is too small")); - return -1; - } - - /* Periodically query netlink until DAD finishes on all known addresse= s. */ - while (dad && time(NULL) < max_time) { - g_autofree struct nlmsghdr *resp =3D NULL; - - if (virNetlinkCommand(nlmsg, &resp, &recvbuflen, 0, 0, - NETLINK_ROUTE, 0) < 0) - return -1; - - if (virNetlinkGetErrorCode(resp, recvbuflen) < 0) { - virReportError(VIR_ERR_SYSTEM_ERROR, "%s", - _("error reading DAD state information")); - return -1; - } - - /* Parse response. */ - dad =3D virNetDevIPParseDadStatus(resp, recvbuflen, addrs, count); - if (dad) - g_usleep(1000 * 10); - } - /* Check timeout. */ - if (dad) { - virReportError(VIR_ERR_SYSTEM_ERROR, - _("Duplicate Address Detection " - "not finished in %d seconds"), VIR_DAD_WAIT_TIMEO= UT); - } else { - return 0; - } - - return -1; -} - static int virNetDevIPGetAcceptRA(const char *ifname) { @@ -798,16 +689,6 @@ virNetDevIPRouteAdd(const char *ifname, } =20 =20 -/* return after DAD finishes for all known IPv6 addresses or an error */ -int -virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs G_GNUC_UNUSED, - size_t count G_GNUC_UNUSED) -{ - virReportSystemError(ENOSYS, "%s", - _("Unable to wait for IPv6 DAD on this platform")= ); - return -1; -} - bool virNetDevIPCheckIPv6Forwarding(void) { diff --git a/src/util/virnetdevip.h b/src/util/virnetdevip.h index 1fa6dd8836..faaa4f2c01 100644 --- a/src/util/virnetdevip.h +++ b/src/util/virnetdevip.h @@ -76,8 +76,6 @@ int virNetDevIPAddrDel(const char *ifname, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; int virNetDevIPAddrGet(const char *ifname, virSocketAddrPtr addr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; -int virNetDevIPWaitDadFinish(virSocketAddrPtr *addrs, size_t count) - ATTRIBUTE_NONNULL(1); bool virNetDevIPCheckIPv6Forwarding(void); void virNetDevIPAddrFree(virNetDevIPAddrPtr ip); =20 --=20 2.26.2