summaryrefslogtreecommitdiff
path: root/src/core/nm-proxy-config.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-08-06 15:17:05 +0200
committerThomas Haller <thaller@redhat.com>2021-09-30 09:56:19 +0200
commitd64b4a30d21fa98f6a7d11c28ac21a8f9d8ee299 (patch)
treeddb782113363dea1fa8e0a38e2570c269b98ff24 /src/core/nm-proxy-config.c
parentf20431bf89fd00c88659275f69419601cf98cb6b (diff)
downloadNetworkManager-next.tar.gz
core: rework IP configuration in NetworkManager using layer 3 configurationnext
Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3 manager for the IP configuration of an interface. Use NML3ConfigData as pieces of configuration that the various components collect and configure. NMDevice is managing most of the IP configuration at a higher level, that is, it starts DHCP and other IP methods. Rework the state handling there. This is a huge rework of how NetworkManager daemon handles IP configuration. Some fallout is to be expected. It appears the patch deletes many lines of code. That is not accurate, because you also have to count the files `src/core/nm-l3*`, which were unused previously. Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
Diffstat (limited to 'src/core/nm-proxy-config.c')
-rw-r--r--src/core/nm-proxy-config.c172
1 files changed, 0 insertions, 172 deletions
diff --git a/src/core/nm-proxy-config.c b/src/core/nm-proxy-config.c
deleted file mode 100644
index 49156dfae0..0000000000
--- a/src/core/nm-proxy-config.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2016 Atul Anand <atulhjp@gmail.com>.
- */
-
-#include "src/core/nm-default-daemon.h"
-
-#include "nm-proxy-config.h"
-
-#include <stdlib.h>
-
-#include "libnm-core-intern/nm-core-internal.h"
-
-/*****************************************************************************/
-
-typedef struct {
- NMProxyConfigMethod method;
- gboolean browser_only;
- char * pac_url;
- char * pac_script;
-} NMProxyConfigPrivate;
-
-struct _NMProxyConfig {
- GObject parent;
- NMProxyConfigPrivate _priv;
-};
-
-struct _NMProxyConfigClass {
- GObjectClass parent;
-};
-
-G_DEFINE_TYPE(NMProxyConfig, nm_proxy_config, G_TYPE_OBJECT)
-
-#define NM_PROXY_CONFIG_GET_PRIVATE(self) _NM_GET_PRIVATE(self, NMProxyConfig, NM_IS_PROXY_CONFIG)
-
-/*****************************************************************************/
-
-void
-nm_proxy_config_set_method(NMProxyConfig *config, NMProxyConfigMethod method)
-{
- NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- priv->method = method;
-}
-
-NMProxyConfigMethod
-nm_proxy_config_get_method(const NMProxyConfig *config)
-{
- const NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- return priv->method;
-}
-
-void
-nm_proxy_config_merge_setting(NMProxyConfig *config, NMSettingProxy *setting)
-{
- const char * tmp = NULL;
- NMProxyConfigPrivate *priv;
- NMSettingProxyMethod method;
-
- if (!setting)
- return;
-
- g_return_if_fail(NM_IS_SETTING_PROXY(setting));
-
- priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- nm_clear_g_free(&priv->pac_script);
-
- method = nm_setting_proxy_get_method(setting);
- switch (method) {
- case NM_SETTING_PROXY_METHOD_AUTO:
- priv->method = NM_PROXY_CONFIG_METHOD_AUTO;
-
- /* Free DHCP Obtained PAC Url (i.e Option 252)
- * only when libnm overrides it.
- */
- tmp = nm_setting_proxy_get_pac_url(setting);
- if (tmp) {
- g_free(priv->pac_url);
- priv->pac_url = g_strdup(tmp);
- }
-
- tmp = nm_setting_proxy_get_pac_script(setting);
- priv->pac_script = g_strdup(tmp);
-
- break;
- case NM_SETTING_PROXY_METHOD_NONE:
- priv->method = NM_PROXY_CONFIG_METHOD_NONE;
- break;
- }
-
- priv->browser_only = nm_setting_proxy_get_browser_only(setting);
-}
-
-gboolean
-nm_proxy_config_get_browser_only(const NMProxyConfig *config)
-{
- const NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- return priv->browser_only;
-}
-
-void
-nm_proxy_config_set_pac_url(NMProxyConfig *config, const char *url)
-{
- NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- g_free(priv->pac_url);
- priv->pac_url = g_strdup(url);
-}
-
-const char *
-nm_proxy_config_get_pac_url(const NMProxyConfig *config)
-{
- const NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- return priv->pac_url;
-}
-
-void
-nm_proxy_config_set_pac_script(NMProxyConfig *config, const char *script)
-{
- NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- g_free(priv->pac_script);
- priv->pac_script = g_strdup(script);
-}
-
-const char *
-nm_proxy_config_get_pac_script(const NMProxyConfig *config)
-{
- const NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- return priv->pac_script;
-}
-
-/*****************************************************************************/
-
-static void
-nm_proxy_config_init(NMProxyConfig *config)
-{
- NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(config);
-
- priv->method = NM_PROXY_CONFIG_METHOD_NONE;
-}
-
-NMProxyConfig *
-nm_proxy_config_new(void)
-{
- return g_object_new(NM_TYPE_PROXY_CONFIG, NULL);
-}
-
-static void
-finalize(GObject *object)
-{
- NMProxyConfig * self = NM_PROXY_CONFIG(object);
- NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE(self);
-
- g_free(priv->pac_url);
- g_free(priv->pac_script);
-
- G_OBJECT_CLASS(nm_proxy_config_parent_class)->finalize(object);
-}
-
-static void
-nm_proxy_config_class_init(NMProxyConfigClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
- object_class->finalize = finalize;
-}