From nobody Mon May 6 21:19:24 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 1544544362752260.9106899061758; Tue, 11 Dec 2018 08:06:02 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 66CD137EE0; Tue, 11 Dec 2018 16:05:58 +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 E95605D738; Tue, 11 Dec 2018 16:05:57 +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 04EFB181B9E5; Tue, 11 Dec 2018 16:05:57 +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 wBBG5uud013330 for ; Tue, 11 Dec 2018 11:05:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2AF295D977; Tue, 11 Dec 2018 16:05:56 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-200-47.brq.redhat.com [10.40.200.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A3095D9CC; Tue, 11 Dec 2018 16:05:50 +0000 (UTC) From: Casey Callendrello To: libvir-list@redhat.com Date: Tue, 11 Dec 2018 17:05:43 +0100 Message-Id: <20181211160543.10120-1-cdc@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Casey Callendrello Subject: [libvirt] [PATCH] network: set mtu as a DHCP option when specified 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 11 Dec 2018 16:06:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This adds an additional directive to the dnsmasq configuration file that notifies clients via dhcp about the link's MTU. Guests can then choose adjust their link accordingly. Signed-off-by: Casey Callendrello Reviewed-by: J=C3=A1n Tomko --- src/network/bridge_driver.c | 7 ++++++ .../networkxml2confdata/nat-network-mtu.conf | 19 +++++++++++++++ tests/networkxml2confdata/nat-network-mtu.xml | 22 +++++++++++++++++ tests/networkxml2conftest.c | 1 + tests/networkxml2xmlin/nat-network-mtu.xml | 22 +++++++++++++++++ tests/networkxml2xmlout/nat-network-mtu.xml | 24 +++++++++++++++++++ tests/networkxml2xmltest.c | 1 + 7 files changed, 96 insertions(+) create mode 100644 tests/networkxml2confdata/nat-network-mtu.conf create mode 100644 tests/networkxml2confdata/nat-network-mtu.xml create mode 100644 tests/networkxml2xmlin/nat-network-mtu.xml create mode 100644 tests/networkxml2xmlout/nat-network-mtu.xml diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 4bbc4f5a6d..81edf72493 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1506,6 +1506,13 @@ networkDnsmasqConfContents(virNetworkObjPtr obj, dctx->addnhostsfile->path); } =20 + /* Configure DHCP to tell clients about the MTU. + */ + if (def->mtu > 0) { + virBufferAsprintf(&configbuf, "dhcp-option=3Doption:mtu,%d\n", + def->mtu); + } + /* Are we doing RA instead of radvd? */ if (DNSMASQ_RA_SUPPORT(caps)) { if (ipv6def) { diff --git a/tests/networkxml2confdata/nat-network-mtu.conf b/tests/network= xml2confdata/nat-network-mtu.conf new file mode 100644 index 0000000000..91b574b964 --- /dev/null +++ b/tests/networkxml2confdata/nat-network-mtu.conf @@ -0,0 +1,19 @@ +##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE +##OVERWRITTEN AND LOST. Changes to this configuration should be made usin= g: +## virsh net-edit default +## or other application using the libvirt API. +## +## dnsmasq conf file created by libvirt +strict-order +except-interface=3Dlo +bind-dynamic +interface=3Dvirbr0 +dhcp-range=3D192.168.122.2,192.168.122.254 +dhcp-no-override +dhcp-authoritative +dhcp-lease-max=3D253 +dhcp-hostsfile=3D/var/lib/libvirt/dnsmasq/default.hostsfile +addn-hosts=3D/var/lib/libvirt/dnsmasq/default.addnhosts +dhcp-option=3Doption:mtu,7000 +dhcp-range=3D2001:db8:ac10:fe01::1,ra-only +dhcp-range=3D2001:db8:ac10:fd01::1,ra-only diff --git a/tests/networkxml2confdata/nat-network-mtu.xml b/tests/networkx= ml2confdata/nat-network-mtu.xml new file mode 100644 index 0000000000..87b214e95c --- /dev/null +++ b/tests/networkxml2confdata/nat-network-mtu.xml @@ -0,0 +1,22 @@ + + default + 81ff0d90-c91e-6742-64da-4a736edb9a9b + + + + + + + + + + + + + + + + + + + diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c index 367e30b994..f3b4dafc1b 100644 --- a/tests/networkxml2conftest.c +++ b/tests/networkxml2conftest.c @@ -137,6 +137,7 @@ mymain(void) DO_TEST("nat-network-dns-forwarders", full); DO_TEST("nat-network-dns-forwarder-no-resolv", full); DO_TEST("nat-network-dns-local-domain", full); + DO_TEST("nat-network-mtu", dhcpv6); DO_TEST("dhcp6-network", dhcpv6); DO_TEST("dhcp6-nat-network", dhcpv6); DO_TEST("dhcp6host-routed-network", dhcpv6); diff --git a/tests/networkxml2xmlin/nat-network-mtu.xml b/tests/networkxml2= xmlin/nat-network-mtu.xml new file mode 100644 index 0000000000..07d0d9f22d --- /dev/null +++ b/tests/networkxml2xmlin/nat-network-mtu.xml @@ -0,0 +1,22 @@ + + default + 81ff0d90-c91e-6742-64da-4a736edb9a9b + + + + + + + + + + + + + + + + + + + diff --git a/tests/networkxml2xmlout/nat-network-mtu.xml b/tests/networkxml= 2xmlout/nat-network-mtu.xml new file mode 100644 index 0000000000..715bc1b505 --- /dev/null +++ b/tests/networkxml2xmlout/nat-network-mtu.xml @@ -0,0 +1,24 @@ + + default + 81ff0d90-c91e-6742-64da-4a736edb9a9b + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index 4e4c7d20a6..b19a365ff4 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -141,6 +141,7 @@ mymain(void) DO_TEST("nat-network-dns-forwarder-no-resolv"); DO_TEST("nat-network-forward-nat-address"); DO_TEST("nat-network-forward-nat-no-address"); + DO_TEST("nat-network-mtu"); DO_TEST("8021Qbh-net"); DO_TEST("direct-net"); DO_TEST("host-bridge-net"); --=20 2.17.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list