From nobody Fri Apr 19 09:33:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1580962831688295.71114002485103; Wed, 5 Feb 2020 20:20:31 -0800 (PST) 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-34-BkwMKSYVMmuXk1Rbf3OMng-1; Wed, 05 Feb 2020 23:20:28 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id C0F7D1413; Thu, 6 Feb 2020 04:20:22 +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 769B548; Thu, 6 Feb 2020 04:20:19 +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 06C4985CFF; Thu, 6 Feb 2020 04:20:13 +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 0164KC0B005000 for ; Wed, 5 Feb 2020 23:20:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id E4C47F84FE; Thu, 6 Feb 2020 04:20:11 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E0BD6F89E5 for ; Thu, 6 Feb 2020 04:20:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C8F4D185A7B8 for ; Thu, 6 Feb 2020 04:20:09 +0000 (UTC) Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-413-iwzUAbrnPbqLZjHUvzOr_Q-1; Wed, 05 Feb 2020 23:20:04 -0500 Received: by mail-qv1-f66.google.com with SMTP id db9so2271239qvb.3 for ; Wed, 05 Feb 2020 20:20:04 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ca:a5ab:a101:b6c3:81ed:d299]) by smtp.gmail.com with ESMTPSA id x41sm1081617qtj.52.2020.02.05.20.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 20:20:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580962830; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=o0Jalf9fOWPKXytTLaTrosN20ST26W0ze4utnY6Ycv0=; b=DEfIOD6rICcXTKeVqOoc5iUyyhEcb6Xkmma9P9xOUJL3/LLmkm+TmuUn4yTZcL2B9SgGwy Olece+3HryJIGj+EuCYeTIN7OEPSJAwfpzkUGHpH71xWplWUPAizq2LFFlnJ2ohzXEzijk AluP/RDR3QsfcU03CyY7LL6xgGWpGTU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=mxlXK7Qj0vB9FumyKKD/iNKCqK0gB0ZBgBtaQ5vIYVk=; b=OL5vZrvyGL4Fk6TlIw8lPiqsbt86py/5nX2NbsUKARudMWB7XVXkFo3wXaOUnwPSfw fODJg+RFg52+fODftTuf3zQDwSZJ12Mdzsf1w8PWIe3khD6UtNReDkHRB5VgAoVlHagn thKifRTzhJvY5fRSzAKLnAvPPvfXe4GAu7YzhWRw0ke2ESILdmhYJlqj8WWddC0omzwJ +3RS5+zkpi0vQi+KNXdw1z2lPXTe3+xlR0jb58KQW4PizxqEhc7A+Fe/G4LO5lSg9E4b KVD+wgLmlTKZRvwbItqdTUm7z3trt1Pvwi4O15LDiAxeY9sDm6E+Obl/pk5TXmbiXtwb W4rQ== X-Gm-Message-State: APjAAAXUcbSIdE67o7vOl2OuWWxKh2ThFnWDJaVvW8AU9HsNoG9M27oT 7eyQgvHOfAAr0Qtm9KZjGUa0+ULa X-Google-Smtp-Source: APXvYqzmBnmxJ7sSXyzywJ40QiZwuhyQj6teEWJSAT0Ou8ZaooVfc41AZl1wMYmTuE8EDM+5bybucw== X-Received: by 2002:ad4:45ad:: with SMTP id y13mr814100qvu.31.1580962803013; Wed, 05 Feb 2020 20:20:03 -0800 (PST) From: Julio Faracco To: libvir-list@redhat.com Subject: [PATCH] lxc: Fix wrong addresses statements for IPv{4, 6} in native network definitions Date: Thu, 6 Feb 2020 01:19:56 -0300 Message-Id: <20200206041956.14855-1-jcfaracco@gmail.com> MIME-Version: 1.0 X-MC-Unique: iwzUAbrnPbqLZjHUvzOr_Q-1 X-MC-Unique: BkwMKSYVMmuXk1Rbf3OMng-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0164KC0B005000 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.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" After LXC version 3, some settings were changed to new names. Same as network. LXC introduced network indexes and changed IPv{4,6} addresses fields. Before, users should only pass `lxc.network.ipv4` to define an IPv4 address. Now, on version 3, users need to pass `lxc.net.X.ipv4.address` to specify the same thing. Same for IPv6. Signed-off-by: Julio Faracco Reviewed-by: Michal Privoznik --- For further details: https://discuss.linuxcontainers.org/t/lxc-2-1-has-been-released/487 --- --- src/lxc/lxc_native.c | 12 ++++++++---- src/lxc/lxc_native.h | 2 ++ tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config | 4 ++-- .../lxcconf2xml-miscnetwork-v3.config | 4 ++-- .../lxcconf2xml-physnetwork-v3.config | 4 ++-- tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config | 4 ++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 5462b74b85..ea79c90f83 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -44,10 +44,12 @@ VIR_ENUM_IMPL(virLXCNetworkConfigEntry, "flags", "macvlan.mode", "vlan.id", - "ipv4", + "ipv4", /* Legacy: LXC IPv4 address */ "ipv4.gateway", - "ipv6", - "ipv6.gateway" + "ipv4.address", + "ipv6", /* Legacy: LXC IPv6 address */ + "ipv6.gateway", + "ipv6.address" ); =20 static virDomainFSDefPtr @@ -570,7 +572,7 @@ lxcNetworkParseDataIPs(const char *name, if (VIR_ALLOC(ip) < 0) return -1; =20 - if (STREQ(name, "ipv6")) + if (STREQ(name, "ipv6") || STREQ(name, "ipv6.address")) family =3D AF_INET6; =20 ipparts =3D virStringSplit(value->str, "/", 2); @@ -627,7 +629,9 @@ lxcNetworkParseDataSuffix(const char *entry, parseData->name =3D value->str; break; case VIR_LXC_NETWORK_CONFIG_IPV4: + case VIR_LXC_NETWORK_CONFIG_IPV4_ADDRESS: case VIR_LXC_NETWORK_CONFIG_IPV6: + case VIR_LXC_NETWORK_CONFIG_IPV6_ADDRESS: if (lxcNetworkParseDataIPs(entry, value, parseData) < 0) return -1; break; diff --git a/src/lxc/lxc_native.h b/src/lxc/lxc_native.h index f16407f2e6..813272e129 100644 --- a/src/lxc/lxc_native.h +++ b/src/lxc/lxc_native.h @@ -35,8 +35,10 @@ typedef enum { VIR_LXC_NETWORK_CONFIG_VLAN_ID, VIR_LXC_NETWORK_CONFIG_IPV4, VIR_LXC_NETWORK_CONFIG_IPV4_GATEWAY, + VIR_LXC_NETWORK_CONFIG_IPV4_ADDRESS, VIR_LXC_NETWORK_CONFIG_IPV6, VIR_LXC_NETWORK_CONFIG_IPV6_GATEWAY, + VIR_LXC_NETWORK_CONFIG_IPV6_ADDRESS, VIR_LXC_NETWORK_CONFIG_LAST, } virLXCNetworkConfigEntry; =20 diff --git a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config b/tests/l= xcconf2xmldata/lxcconf2xml-ethernet-v3.config index 0a641549f3..f2ca48f1f2 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-ethernet-v3.config @@ -5,9 +5,9 @@ lxc.net.0.type =3D veth lxc.net.0.flags =3D up lxc.net.0.hwaddr =3D 02:00:15:8f:05:c1 lxc.net.0.name =3D eth0 -lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.address =3D 192.168.122.2/24 lxc.net.0.ipv4.gateway =3D 192.168.122.1 -lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address =3D 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 #remove next line if host DNS configuration should not be available to con= tainer diff --git a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config b/test= s/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config index 537da64592..6bc22b8e46 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-miscnetwork-v3.config @@ -1,9 +1,9 @@ lxc.net.0.type =3D phys lxc.net.0.link =3D eth0 lxc.net.0.name =3D eth1 -lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.address =3D 192.168.122.2/24 lxc.net.0.ipv4.gateway =3D 192.168.122.1 -lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address =3D 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 lxc.net.1.type =3D vlan diff --git a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config b/test= s/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config index 9cf96163b3..649b73c8b8 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-physnetwork-v3.config @@ -1,9 +1,9 @@ lxc.net.0.type =3D phys lxc.net.0.link =3D eth0 lxc.net.0.name =3D eth1 -lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.address =3D 192.168.122.2/24 lxc.net.0.ipv4.gateway =3D 192.168.122.1 -lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address =3D 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 lxc.rootfs.path =3D /var/lib/lxc/migrate_test/rootfs diff --git a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config b/tests/lxc= conf2xmldata/lxcconf2xml-simple-v3.config index b0656571b2..ecd71044f9 100644 --- a/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config +++ b/tests/lxcconf2xmldata/lxcconf2xml-simple-v3.config @@ -6,9 +6,9 @@ lxc.net.0.flags =3D up lxc.net.0.link =3D virbr0 lxc.net.0.hwaddr =3D 02:00:15:8f:05:c1 lxc.net.0.name =3D eth0 -lxc.net.0.ipv4 =3D 192.168.122.2/24 +lxc.net.0.ipv4.address =3D 192.168.122.2/24 lxc.net.0.ipv4.gateway =3D 192.168.122.1 -lxc.net.0.ipv6 =3D 2003:db8:1:0:214:1234:fe0b:3596/64 +lxc.net.0.ipv6.address =3D 2003:db8:1:0:214:1234:fe0b:3596/64 lxc.net.0.ipv6.gateway =3D 2003:db8:1:0:214:1234:fe0b:3595 =20 #remove next line if host DNS configuration should not be available to con= tainer --=20 2.20.1