[libvirt] [PATCH] network: set mtu as a DHCP option when specified

Ján Tomko jtomko at redhat.com
Thu Jan 31 16:49:31 UTC 2019


On Tue, Dec 11, 2018 at 05:05:43PM +0100, Casey Callendrello wrote:
>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 <cdc at redhat.com>
>---
> 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);
>     }
>
>+    /* Configure DHCP to tell clients about the MTU.
>+     */

This comment can fit on one line,

>+    if (def->mtu > 0) {
>+        virBufferAsprintf(&configbuf, "dhcp-option=option:mtu,%d\n",
>+                          def->mtu);

and so can this command.

>+    }
>+
>     /* Are we doing RA instead of radvd? */
>     if (DNSMASQ_RA_SUPPORT(caps)) {
>         if (ipv6def) {

With that adjusted:
Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190131/c84e9a72/attachment-0001.sig>


More information about the libvir-list mailing list