summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-04-28 10:05:42 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-05-13 13:29:51 +0200
commit1d3eff45d2e1eb36edbb5170f321b01bc5fc0484 (patch)
tree614de72f5a354d100dfbc3e93f4783d23899e9a4
parent6fdfb03107138e96e641d12a7c4df5ecfacb5406 (diff)
downloadNetworkManager-1d3eff45d2e1eb36edbb5170f321b01bc5fc0484.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.
-rw-r--r--src/devices/nm-device-ethernet.c23
1 files changed, 23 insertions, 0 deletions
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;
}