distro: remove nm_backend_ipv6_use_tempaddr()

This function was *not* distribution specific and was used only in one place.
This commit is contained in:
Pavel Šimerda 2012-08-01 21:10:15 +02:00 committed by Dan Williams
parent 97745c7498
commit 3ada5b5a6a
17 changed files with 43 additions and 131 deletions

View file

@ -42,9 +42,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -40,9 +40,3 @@ void nm_backend_enable_loopback (void)
else
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -35,9 +35,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -30,9 +30,3 @@ void nm_backend_enable_loopback (void)
{
fwnet_loup ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -102,60 +102,10 @@ out:
rtnl_addr_put (addr);
}
/*
* nm_generic_ipv6_use_tempaddr
*
* Get net.ipv6.conf.default.use_tempaddr value from /etc/sysctl.conf or
* /lib/sysctl.d/sysctl.conf
*
*/
int nm_generic_ipv6_use_tempaddr (void)
{
char *contents = NULL;
gsize len = 0;
const char *group_name = "[forged_group]\n";
char *sysctl_data = NULL;
GKeyFile *keyfile;
GError *error = NULL;
int tmp, ret = -1;
/* Read file contents to a string. */
if (!g_file_get_contents ("/etc/sysctl.conf", &contents, &len, NULL))
if (!g_file_get_contents ("/lib/sysctl.d/sysctl.conf", &contents, &len, NULL))
return -1;
/* Prepend a group so that we can use GKeyFile parser. */
sysctl_data = g_strdup_printf ("%s%s", group_name, contents);
keyfile = g_key_file_new ();
if (keyfile == NULL)
goto done;
if (!g_key_file_load_from_data (keyfile, sysctl_data, len + strlen (group_name), G_KEY_FILE_NONE, NULL))
goto done;
tmp = g_key_file_get_integer (keyfile, "forged_group", "net.ipv6.conf.default.use_tempaddr", &error);
if (error == NULL)
ret = tmp;
done:
g_free (contents);
g_free (sysctl_data);
g_clear_error (&error);
g_key_file_free (keyfile);
return ret;
}
#ifdef TARGET_GENERIC
void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}
#endif

View file

@ -27,6 +27,5 @@
#include "nm-backend.h"
void nm_generic_enable_loopback (void);
int nm_generic_ipv6_use_tempaddr (void);
#endif /* NM_GENERIC_H */

View file

@ -63,9 +63,3 @@ void nm_backend_enable_loopback (void)
g_free (comm);
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -37,8 +37,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -36,9 +36,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -32,9 +32,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -34,9 +34,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -30,9 +30,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -30,9 +30,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -30,9 +30,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -35,9 +35,3 @@ void nm_backend_enable_loopback (void)
{
nm_generic_enable_loopback ();
}
int nm_backend_ipv6_use_tempaddr (void)
{
return nm_generic_ipv6_use_tempaddr ();
}

View file

@ -24,6 +24,5 @@
/* Random disto-specific stuff */
void nm_backend_enable_loopback (void);
int nm_backend_ipv6_use_tempaddr (void);
#endif /* NM_BACKEND_H */

View file

@ -40,7 +40,6 @@
#include "nm-glib-compat.h"
#include "nm-device.h"
#include "nm-device-private.h"
#include "backends/nm-backend.h"
#include "NetworkManagerUtils.h"
#include "nm-system.h"
#include "nm-dhcp-manager.h"
@ -2295,6 +2294,48 @@ addrconf6_cleanup (NMDevice *self)
/******************************************/
/* Get net.ipv6.conf.default.use_tempaddr value from /etc/sysctl.conf or
* /lib/sysctl.d/sysctl.conf
*/
static int
ip6_use_tempaddr (void)
{
char *contents = NULL;
gsize len = 0;
const char *group_name = "[forged_group]\n";
char *sysctl_data = NULL;
GKeyFile *keyfile;
GError *error = NULL;
int tmp, ret = -1;
/* Read file contents to a string. */
if (!g_file_get_contents ("/etc/sysctl.conf", &contents, &len, NULL))
if (!g_file_get_contents ("/lib/sysctl.d/sysctl.conf", &contents, &len, NULL))
return -1;
/* Prepend a group so that we can use GKeyFile parser. */
sysctl_data = g_strdup_printf ("%s%s", group_name, contents);
keyfile = g_key_file_new ();
if (keyfile == NULL)
goto done;
if (!g_key_file_load_from_data (keyfile, sysctl_data, len + strlen (group_name), G_KEY_FILE_NONE, NULL))
goto done;
tmp = g_key_file_get_integer (keyfile, "forged_group", "net.ipv6.conf.default.use_tempaddr", &error);
if (error == NULL)
ret = tmp;
done:
g_free (contents);
g_free (sysctl_data);
g_clear_error (&error);
g_key_file_free (keyfile);
return ret;
}
static NMActStageReturn
real_act_stage3_ip6_config_start (NMDevice *self,
NMIP6Config **out_config,
@ -2362,7 +2403,7 @@ real_act_stage3_ip6_config_start (NMDevice *self,
* If a global value is configured by sysadmin (e.g. /etc/sysctl.conf),
* use that value instead of per-connection value.
*/
conf_use_tempaddr = nm_backend_ipv6_use_tempaddr ();
conf_use_tempaddr = ip6_use_tempaddr ();
if (conf_use_tempaddr >= 0)
ip6_privacy = conf_use_tempaddr;
else {