From 5036f09e5595462dfbf73c3b6bdb51224a1ad23c Mon Sep 17 00:00:00 2001 From: Simon Farnsworth Date: Wed, 18 Feb 2015 11:05:27 -0600 Subject: ppp: Fix PPPoE MRU and MTU handling With a default 1500 Ethernet MTU, PPPoE can't do a PPP MTU or MRU greater than 1492 bytes; you need a larger Ethernet MTU to do larger PPP M[RT]U. rp-pppoe.so caps M[RT]U based on the Ethernet MTU of the underlying interface. Attempt to increase the Ethernet MTU of the underlying interface to match the user's requested M[RT]U, ignoring failure. This gets the user their chosen M[RT]U if it's possible on their hardware, and fails gracefully if the user has requested an M[RT]U that cannot be supported. Signed-off-by: Simon Farnsworth --- src/ppp-manager/nm-ppp-manager.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c index fc05602194..809ef61f0b 100644 --- a/src/ppp-manager/nm-ppp-manager.c +++ b/src/ppp-manager/nm-ppp-manager.c @@ -857,6 +857,7 @@ create_pppd_cmd_line (NMPPPManager *self, const char *pppd_binary = NULL; NMCmdLine *cmd; gboolean ppp_debug; + guint32 mru, mtu, mxu = 0; g_return_val_if_fail (setting != NULL, NULL); @@ -864,6 +865,9 @@ create_pppd_cmd_line (NMPPPManager *self, if (!pppd_binary) return NULL; + mru = nm_setting_ppp_get_mru (setting); + mtu = nm_setting_ppp_get_mru (setting); + /* Create pppd command line */ cmd = nm_cmd_line_new (); nm_cmd_line_add_string (cmd, pppd_binary); @@ -906,6 +910,8 @@ create_pppd_cmd_line (NMPPPManager *self, nm_cmd_line_add_string (cmd, "rp_pppoe_service"); nm_cmd_line_add_string (cmd, pppoe_service); } + + mxu = mru > mtu ? mru : mtu; } else if (adsl) { const gchar *protocol = nm_setting_adsl_get_protocol (adsl); @@ -931,6 +937,8 @@ create_pppd_cmd_line (NMPPPManager *self, nm_cmd_line_add_string (cmd, "plugin"); nm_cmd_line_add_string (cmd, "rp-pppoe.so"); nm_cmd_line_add_string (cmd, priv->parent_iface); + + mxu = mru > mtu ? mru : mtu; } nm_cmd_line_add_string (cmd, "noipdefault"); @@ -940,6 +948,9 @@ create_pppd_cmd_line (NMPPPManager *self, nm_cmd_line_add_string (cmd, "noipdefault"); } + if (mxu && mxu > 1492) + nm_platform_link_set_mtu (nm_platform_link_get_ifindex (priv->parent_iface), mxu + 8); + if (nm_setting_ppp_get_baud (setting)) nm_cmd_line_add_int (cmd, nm_setting_ppp_get_baud (setting)); @@ -979,12 +990,12 @@ create_pppd_cmd_line (NMPPPManager *self, */ nm_cmd_line_add_string (cmd, "usepeerdns"); - if (nm_setting_ppp_get_mru (setting)) { + if (mru) { nm_cmd_line_add_string (cmd, "mru"); nm_cmd_line_add_int (cmd, nm_setting_ppp_get_mru (setting)); } - if (nm_setting_ppp_get_mtu (setting)) { + if (mtu) { nm_cmd_line_add_string (cmd, "mtu"); nm_cmd_line_add_int (cmd, nm_setting_ppp_get_mtu (setting)); } -- cgit v1.2.1