From 1d3eff45d2e1eb36edbb5170f321b01bc5fc0484 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 28 Apr 2015 10:05:42 +0200 Subject: [PATCH] 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. --- src/devices/nm-device-ethernet.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 3337a106d4..14c9d187bb 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -68,6 +68,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); @@ -1239,6 +1240,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; }