diff options
author | Simon Farnsworth <simon@farnz.org.uk> | 2015-02-18 11:05:27 -0600 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-04-22 09:56:35 +0200 |
commit | 5036f09e5595462dfbf73c3b6bdb51224a1ad23c (patch) | |
tree | 0aa38fb3c9c480cebe8f59adfebe83ffd1681ab4 | |
parent | 474ba5ab0eacb97a50c0ac2ac53ff2dbd9beac34 (diff) | |
download | NetworkManager-bg/kernel-pppoe-bgo742939.tar.gz |
ppp: Fix PPPoE MRU and MTU handlingbg/kernel-pppoe-bgo742939
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 <simon@farnz.org.uk>
-rw-r--r-- | src/ppp-manager/nm-ppp-manager.c | 15 |
1 files 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)); } |