ppp: change handling of lcp-echo-failure and lcp-echo-interval (bgo #663970)

Don't set default values for the properties, which didn't allow users to
switch off sending echo-request packets. Rather set defaults in editor
or while completing connection for modems.
This commit is contained in:
Jiří Klimeš 2011-11-16 10:03:02 +01:00
parent 1713d3791b
commit aed37465be
3 changed files with 25 additions and 7 deletions

View file

@ -32,6 +32,7 @@
#include "nm-dbus-manager.h"
#include "nm-setting-connection.h"
#include "nm-setting-cdma.h"
#include "nm-setting-ppp.h"
#include "NetworkManagerUtils.h"
#include "nm-logging.h"
@ -280,6 +281,7 @@ real_complete_connection (NMModem *modem,
GError **error)
{
NMSettingCdma *s_cdma;
NMSettingPPP *s_ppp;
s_cdma = nm_connection_get_setting_cdma (connection);
if (!s_cdma) {
@ -290,6 +292,16 @@ real_complete_connection (NMModem *modem,
if (!nm_setting_cdma_get_number (s_cdma))
g_object_set (G_OBJECT (s_cdma), NM_SETTING_CDMA_NUMBER, "#777", NULL);
s_ppp = nm_connection_get_setting_ppp (connection);
if (!s_ppp) {
s_ppp = (NMSettingPPP *) nm_setting_ppp_new ();
g_object_set (G_OBJECT (s_ppp),
NM_SETTING_PPP_LCP_ECHO_FAILURE, 5,
NM_SETTING_PPP_LCP_ECHO_INTERVAL, 30,
NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ppp));
}
nm_utils_complete_generic (connection,
NM_SETTING_CDMA_SETTING_NAME,
existing_connections,

View file

@ -30,6 +30,7 @@
#include "nm-device-private.h"
#include "nm-setting-connection.h"
#include "nm-setting-gsm.h"
#include "nm-setting-ppp.h"
#include "nm-modem-types.h"
#include "nm-logging.h"
#include "NetworkManagerUtils.h"
@ -501,6 +502,7 @@ real_complete_connection (NMModem *modem,
GError **error)
{
NMSettingGsm *s_gsm;
NMSettingPPP *s_ppp;
s_gsm = nm_connection_get_setting_gsm (connection);
if (!s_gsm || !nm_setting_gsm_get_apn (s_gsm)) {
@ -515,6 +517,16 @@ real_complete_connection (NMModem *modem,
if (!nm_setting_gsm_get_number (s_gsm))
g_object_set (G_OBJECT (s_gsm), NM_SETTING_GSM_NUMBER, "*99#", NULL);
s_ppp = nm_connection_get_setting_ppp (connection);
if (!s_ppp) {
s_ppp = (NMSettingPPP *) nm_setting_ppp_new ();
g_object_set (G_OBJECT (s_ppp),
NM_SETTING_PPP_LCP_ECHO_FAILURE, 5,
NM_SETTING_PPP_LCP_ECHO_INTERVAL, 30,
NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ppp));
}
nm_utils_complete_generic (connection,
NM_SETTING_GSM_SETTING_NAME,
existing_connections,

View file

@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2008 Novell, Inc.
* Copyright (C) 2008 - 2010 Red Hat, Inc.
* Copyright (C) 2008 - 2011 Red Hat, Inc.
*/
#include <config.h>
@ -935,12 +935,6 @@ pppoe_fill_defaults (NMSettingPPP *setting)
if (!nm_setting_ppp_get_mru (setting))
g_object_set (setting, NM_SETTING_PPP_MRU, (guint32) 1492, NULL);
if (!nm_setting_ppp_get_lcp_echo_interval (setting))
g_object_set (setting, NM_SETTING_PPP_LCP_ECHO_INTERVAL, (guint32) 20, NULL);
if (!nm_setting_ppp_get_lcp_echo_failure (setting))
g_object_set (setting, NM_SETTING_PPP_LCP_ECHO_FAILURE, (guint32) 3, NULL);
g_object_set (setting,
NM_SETTING_PPP_NOAUTH, TRUE,
NM_SETTING_PPP_NODEFLATE, TRUE,