mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 19:10:17 +01:00
connectivity: use default on missing connectivity.interval config
Manual page claims that a missing configuration option for connectivity interval means "300". That was not the case for a long time (never?). https://bugzilla.gnome.org/show_bug.cgi?id=723350 Based-on-patch-by: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
This commit is contained in:
parent
5b04fde302
commit
652853e0d0
3 changed files with 13 additions and 4 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "nm-config.h"
|
||||
#include "gsystem-local-alloc.h"
|
||||
#include "nm-device.h"
|
||||
#include "nm-core-internal.h"
|
||||
|
||||
typedef struct {
|
||||
char *config_main_file;
|
||||
|
|
@ -343,13 +344,18 @@ constructed (GObject *object)
|
|||
{
|
||||
NMConfigData *self = NM_CONFIG_DATA (object);
|
||||
NMConfigDataPrivate *priv = NM_CONFIG_DATA_GET_PRIVATE (self);
|
||||
int interval;
|
||||
char *interval;
|
||||
|
||||
priv->connectivity.uri = g_key_file_get_value (priv->keyfile, "connectivity", "uri", NULL);
|
||||
priv->connectivity.response = g_key_file_get_value (priv->keyfile, "connectivity", "response", NULL);
|
||||
|
||||
interval = g_key_file_get_integer (priv->keyfile, "connectivity", "interval", NULL);
|
||||
priv->connectivity.interval = MAX (0, interval);
|
||||
/* On missing config value, fallback to 300. On invalid value, disable connectivity checking by setting
|
||||
* the interval to zero. */
|
||||
interval = g_key_file_get_value (priv->keyfile, "connectivity", "interval", NULL);
|
||||
priv->connectivity.interval = interval
|
||||
? _nm_utils_ascii_str_to_int64 (interval, 10, 0, G_MAXUINT, 0)
|
||||
: NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL;
|
||||
g_free (interval);
|
||||
|
||||
priv->dns_mode = g_key_file_get_value (priv->keyfile, "main", "dns", NULL);
|
||||
priv->rc_manager = g_key_file_get_value (priv->keyfile, "main", "rc-manager", NULL);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ G_BEGIN_DECLS
|
|||
/* Signals */
|
||||
#define NM_CONFIG_SIGNAL_CONFIG_CHANGED "config-changed"
|
||||
|
||||
#define NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL 300
|
||||
|
||||
typedef struct NMConfigCmdLineOptions NMConfigCmdLineOptions;
|
||||
|
||||
struct _NMConfig {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#endif
|
||||
|
||||
#include "nm-connectivity.h"
|
||||
#include "nm-config.h"
|
||||
#include "nm-logging.h"
|
||||
|
||||
G_DEFINE_TYPE (NMConnectivity, nm_connectivity, G_TYPE_OBJECT)
|
||||
|
|
@ -499,7 +500,7 @@ nm_connectivity_class_init (NMConnectivityClass *klass)
|
|||
g_object_class_install_property
|
||||
(object_class, PROP_INTERVAL,
|
||||
g_param_spec_uint (NM_CONNECTIVITY_INTERVAL, "", "",
|
||||
0, G_MAXUINT, 300,
|
||||
0, G_MAXUINT, NM_CONFIG_DEFAULT_CONNECTIVITY_INTERVAL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue