mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
device: store the original MTU before force-setting it
In case the MTU is force-set (e.g. for bridges), priv->mtu_initial and
priv->ip6_mtu_initial must be initialized before changing the MTU,
otherwise the wrong value will be restored on deactivation.
Fixes: e23798a5e5
('bridge: force (hack)-set of the MTU when explicitly set in the profile')
https://bugzilla.redhat.com/show_bug.cgi?id=1973536
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/955
This commit is contained in:
parent
a9279d1e89
commit
3f42e2005a
|
@ -10689,10 +10689,30 @@ _commit_mtu(NMDevice *self, const NMIP4Config *config)
|
|||
}
|
||||
}
|
||||
|
||||
#define _IP6_MTU_SYS() \
|
||||
({ \
|
||||
if (!ip6_mtu_sysctl.initialized) { \
|
||||
ip6_mtu_sysctl.value = nm_device_sysctl_ip_conf_get_int_checked(self, \
|
||||
AF_INET6, \
|
||||
"mtu", \
|
||||
10, \
|
||||
0, \
|
||||
G_MAXUINT32, \
|
||||
0); \
|
||||
ip6_mtu_sysctl.initialized = TRUE; \
|
||||
} \
|
||||
ip6_mtu_sysctl.value; \
|
||||
})
|
||||
|
||||
if (mtu_desired && NM_DEVICE_GET_CLASS(self)->mtu_force_set && !priv->mtu_force_set_done) {
|
||||
priv->mtu_force_set_done = TRUE;
|
||||
|
||||
if (mtu_desired == mtu_plat) {
|
||||
if (!priv->mtu_initial && !priv->ip6_mtu_initial) {
|
||||
/* before touching any of the MTU parameters, record the
|
||||
* original setting to restore on deactivation. */
|
||||
priv->mtu_initial = mtu_plat;
|
||||
priv->ip6_mtu_initial = _IP6_MTU_SYS();
|
||||
}
|
||||
mtu_plat--;
|
||||
if (NM_DEVICE_GET_CLASS(self)->set_platform_mtu(self, mtu_desired - 1)) {
|
||||
_LOGD(LOGD_DEVICE, "mtu: force-set MTU to %u", mtu_desired - 1);
|
||||
|
@ -10711,20 +10731,6 @@ _commit_mtu(NMDevice *self, const NMIP4Config *config)
|
|||
ip6_mtu == ip6_mtu_orig ? "" : nm_sprintf_buf(sbuf2, " (was %u)", (guint) ip6_mtu_orig),
|
||||
ifindex);
|
||||
|
||||
#define _IP6_MTU_SYS() \
|
||||
({ \
|
||||
if (!ip6_mtu_sysctl.initialized) { \
|
||||
ip6_mtu_sysctl.value = nm_device_sysctl_ip_conf_get_int_checked(self, \
|
||||
AF_INET6, \
|
||||
"mtu", \
|
||||
10, \
|
||||
0, \
|
||||
G_MAXUINT32, \
|
||||
0); \
|
||||
ip6_mtu_sysctl.initialized = TRUE; \
|
||||
} \
|
||||
ip6_mtu_sysctl.value; \
|
||||
})
|
||||
if ((mtu_desired && mtu_desired != mtu_plat) || (ip6_mtu && ip6_mtu != _IP6_MTU_SYS())) {
|
||||
gboolean anticipated_failure = FALSE;
|
||||
|
||||
|
|
Loading…
Reference in a new issue