summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-02-27 13:54:43 +0100
committerThomas Haller <thaller@redhat.com>2020-08-17 17:41:07 +0200
commitb81370f70b538688a62ad4a29482dbf9b34c69bc (patch)
treefee5c50ce597fb1515d669d9b14f9640c13180ef
parent990f46505d6d9bd4de40db458978b6c94664de13 (diff)
downloadNetworkManager-b81370f70b538688a62ad4a29482dbf9b34c69bc.tar.gz
ovs: set MTU from connection when creating an internal interface
The ovs-vswitchd.conf.db(5) man page says about the the mtu_request column in the Interface table: "Requested MTU (Maximum Transmission Unit) for the interface. A client can fill this column to change the MTU of an interface [...] If this is not set and if the interface has internal type, Open vSwitch will change the MTU to match the minimum of the other interfaces in the bridge." Therefore, if the connection specifies a MTU, set it early when adding the interface to the ovsdb so that it will not be changed to the minimum of other interfaces. (cherry picked from commit ad12f26312bb4ccc73076f39bd2a618094af6e7e) (cherry picked from commit 7311d5e2943931a70fb427096ea934072aed63b3)
-rw-r--r--src/devices/ovs/nm-ovsdb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c
index cd330d192c..5782e51851 100644
--- a/src/devices/ovs/nm-ovsdb.c
+++ b/src/devices/ovs/nm-ovsdb.c
@@ -367,11 +367,20 @@ _insert_interface (json_t *params, NMConnection *interface, NMDevice *interface_
gs_free char *cloned_mac = NULL;
gs_free_error GError *error = NULL;
json_t *row;
+ guint32 mtu = 0;
s_ovs_iface = nm_connection_get_setting_ovs_interface (interface);
if (s_ovs_iface)
type = nm_setting_ovs_interface_get_interface_type (s_ovs_iface);
+ if (nm_streq0 (type, "internal")) {
+ NMSettingWired *s_wired;
+
+ s_wired = _nm_connection_get_setting (interface, NM_TYPE_SETTING_WIRED);
+ if (s_wired)
+ mtu = nm_setting_wired_get_mtu (s_wired);
+ }
+
if (!nm_device_hw_addr_get_cloned (interface_device,
interface,
FALSE,
@@ -413,6 +422,9 @@ _insert_interface (json_t *params, NMConnection *interface, NMDevice *interface_
if (cloned_mac)
json_object_set_new (row, "mac", json_string (cloned_mac));
+ if (mtu != 0)
+ json_object_set_new (row, "mtu_request", json_integer (mtu));
+
json_array_append_new (params,
json_pack ("{s:s, s:s, s:o, s:s}",
"op", "insert",