diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-04-28 10:05:42 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-08-04 12:43:17 +0200 |
commit | 375100715f5d530ce69d83272f6134f50ea89f76 (patch) | |
tree | 4f513edd070af2b101669a0ac78e1e282138ff2d | |
parent | ecb93850c1f222369532a0a8beaecc129ee767f0 (diff) | |
download | NetworkManager-375100715f5d530ce69d83272f6134f50ea89f76.tar.gz |
device: set Ethernet MTU for PPPoE connections in stage2/config
Try to set the MTU of the parent Ethernet interface to match the
requested PPP MTU and MRU. This allows the negotiation of a PPP MTU
and MRU greater than 1492.
(cherry picked from commit 1d3eff45d2e1eb36edbb5170f321b01bc5fc0484)
-rw-r--r-- | src/devices/nm-device-ethernet.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index af2cb8f26e..7bdb4cd28c 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -66,6 +66,7 @@ G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE) #define WIRED_SECRETS_TRIES "wired-secrets-tries" #define PPPOE_RECONNECT_DELAY 7 +#define PPPOE_ENCAP_OVERHEAD 8 /* 2 bytes for PPP, 6 for PPPoE */ static NMSetting *device_get_setting (NMDevice *device, GType setting_type); @@ -1231,6 +1232,28 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason) ret = NM_ACT_STAGE_RETURN_POSTPONE; } + /* PPPoE setup */ + if (nm_connection_is_type (nm_device_get_connection (device), + NM_SETTING_PPPOE_SETTING_NAME)) { + NMSettingPpp *s_ppp; + + s_ppp = (NMSettingPpp *) device_get_setting (device, NM_TYPE_SETTING_PPP); + if (s_ppp) { + guint32 mtu = 0, mru = 0, mxu; + + mtu = nm_setting_ppp_get_mtu (s_ppp); + mru = nm_setting_ppp_get_mru (s_ppp); + mxu = mru > mtu ? mru : mtu; + if (mxu) { + _LOGD (LOGD_PPP, "set MTU to %u (PPP interface MRU %u, MTU %u)", + mxu + PPPOE_ENCAP_OVERHEAD, mru, mtu); + nm_platform_link_set_mtu (NM_PLATFORM_GET, + nm_device_get_ifindex (device), + mxu + PPPOE_ENCAP_OVERHEAD); + } + } + } + return ret; } |