mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 03:20:11 +01:00
device/trivial: rename device's sysctl function
These functions call platform's sysctl getter and setters. Note that the called platform functions are called nm_platform_sysctl_get() and nm_platform_sysctl_set(). Also, in this case they use the ip-conf path via nm_utils_sysctl_ip_conf_path(). Also, next we will add API nm_platform_sysctl_ip_conf_get() and nm_platform_sysctl_ip_conf_set(), which will be wrappers around nm_platform_sysctl_get() and nm_platform_sysctl_set(), using the ip-conf paths as well. Rename the device functions, to be more similar to the existing and future naming in platform.
This commit is contained in:
parent
d27fa36272
commit
395374cfbe
3 changed files with 37 additions and 34 deletions
|
|
@ -113,7 +113,10 @@ gboolean nm_device_hw_addr_is_explict (NMDevice *device);
|
|||
|
||||
void nm_device_ip_method_failed (NMDevice *self, int addr_family, NMDeviceStateReason reason);
|
||||
|
||||
gboolean nm_device_ip_sysctl_set (NMDevice *self, int addr_family, const char *property, const char *value);
|
||||
gboolean nm_device_sysctl_ip_conf_set (NMDevice *self,
|
||||
int addr_family,
|
||||
const char *property,
|
||||
const char *value);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -1136,10 +1136,10 @@ init_ip_config_dns_priority (NMDevice *self, NMIPConfig *config)
|
|||
/*****************************************************************************/
|
||||
|
||||
gboolean
|
||||
nm_device_ip_sysctl_set (NMDevice *self,
|
||||
int addr_family,
|
||||
const char *property,
|
||||
const char *value)
|
||||
nm_device_sysctl_ip_conf_set (NMDevice *self,
|
||||
int addr_family,
|
||||
const char *property,
|
||||
const char *value)
|
||||
{
|
||||
NMPlatform *platform = nm_device_get_platform (self);
|
||||
gs_free char *value_to_free = NULL;
|
||||
|
|
@ -1178,7 +1178,7 @@ nm_device_ip_sysctl_set (NMDevice *self,
|
|||
}
|
||||
|
||||
static guint32
|
||||
nm_device_ipv4_sysctl_get_effective_uint32 (NMDevice *self, const char *property, guint32 fallback)
|
||||
nm_device_sysctl_ip_conf_get_effective_uint32 (NMDevice *self, const char *property, guint32 fallback)
|
||||
{
|
||||
char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
|
||||
gint64 v, v_all;
|
||||
|
|
@ -1216,7 +1216,7 @@ nm_device_ipv4_sysctl_get_effective_uint32 (NMDevice *self, const char *property
|
|||
}
|
||||
|
||||
static guint32
|
||||
nm_device_ipv6_sysctl_get_uint32 (NMDevice *self, const char *property, guint32 fallback)
|
||||
nm_device_sysctl_ip_conf_get_uint32 (NMDevice *self, const char *property, guint32 fallback)
|
||||
{
|
||||
char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
|
||||
|
||||
|
|
@ -4019,7 +4019,7 @@ ip4_rp_filter_update (NMDevice *self)
|
|||
|
||||
if ( priv->v4_has_shadowed_routes
|
||||
|| nm_device_get_best_default_route (self, AF_INET)) {
|
||||
if (nm_device_ipv4_sysctl_get_effective_uint32 (self, "rp_filter", 0) != 1) {
|
||||
if (nm_device_sysctl_ip_conf_get_effective_uint32 (self, "rp_filter", 0) != 1) {
|
||||
/* Don't touch the rp_filter if it's not strict. */
|
||||
return;
|
||||
}
|
||||
|
|
@ -4031,7 +4031,7 @@ ip4_rp_filter_update (NMDevice *self)
|
|||
}
|
||||
|
||||
if (ip4_rp_filter != priv->ip4_rp_filter) {
|
||||
nm_device_ip_sysctl_set (self, AF_INET, "rp_filter", ip4_rp_filter);
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET, "rp_filter", ip4_rp_filter);
|
||||
priv->ip4_rp_filter = ip4_rp_filter;
|
||||
}
|
||||
}
|
||||
|
|
@ -9246,7 +9246,7 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config)
|
|||
#define _IP6_MTU_SYS() \
|
||||
({ \
|
||||
if (!ip6_mtu_sysctl.initialized) { \
|
||||
ip6_mtu_sysctl.value = nm_device_ipv6_sysctl_get_uint32 (self, "mtu", 0); \
|
||||
ip6_mtu_sysctl.value = nm_device_sysctl_ip_conf_get_uint32 (self, "mtu", 0); \
|
||||
ip6_mtu_sysctl.initialized = TRUE; \
|
||||
} \
|
||||
ip6_mtu_sysctl.value; \
|
||||
|
|
@ -9277,8 +9277,8 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config)
|
|||
}
|
||||
|
||||
if (ip6_mtu && ip6_mtu != _IP6_MTU_SYS ()) {
|
||||
if (!nm_device_ip_sysctl_set (self, AF_INET6, "mtu",
|
||||
nm_sprintf_buf (sbuf, "%u", (unsigned) ip6_mtu))) {
|
||||
if (!nm_device_sysctl_ip_conf_set (self, AF_INET6, "mtu",
|
||||
nm_sprintf_buf (sbuf, "%u", (unsigned) ip6_mtu))) {
|
||||
int errsv = errno;
|
||||
|
||||
_NMLOG (anticipated_failure && errsv == EINVAL ? LOGL_DEBUG : LOGL_WARN,
|
||||
|
|
@ -9487,14 +9487,14 @@ addrconf6_start_with_link_ready (NMDevice *self)
|
|||
switch (nm_ndisc_get_node_type (priv->ndisc)) {
|
||||
case NM_NDISC_NODE_TYPE_HOST:
|
||||
/* Accepting prefixes from discovered routers. */
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra", "1");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra_defrtr", "0");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra_pinfo", "0");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra_rtr_pref", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra", "1");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra_defrtr", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra_pinfo", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra_rtr_pref", "0");
|
||||
break;
|
||||
case NM_NDISC_NODE_TYPE_ROUTER:
|
||||
/* We're the router. */
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "forwarding", "1");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "forwarding", "1");
|
||||
nm_device_activate_schedule_ip6_config_result (self);
|
||||
priv->needs_ip6_subnet = TRUE;
|
||||
g_signal_emit (self, signals[IP6_SUBNET_NEEDED], 0);
|
||||
|
|
@ -9656,7 +9656,7 @@ restore_ip6_properties (NMDevice *self)
|
|||
if ( priv->ipv6ll_handle
|
||||
&& nm_streq (key, "disable_ipv6"))
|
||||
continue;
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, key, value);
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9665,7 +9665,7 @@ set_disable_ipv6 (NMDevice *self, const char *value)
|
|||
{
|
||||
/* We only touch disable_ipv6 when NM is not managing the IPv6LL address */
|
||||
if (!NM_DEVICE_GET_PRIVATE (self)->ipv6ll_handle)
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "disable_ipv6", value);
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "disable_ipv6", value);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
@ -9702,11 +9702,11 @@ set_nm_ipv6ll (NMDevice *self, gboolean enable)
|
|||
value = nm_platform_sysctl_get (nm_device_get_platform (self),
|
||||
NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (AF_INET6, buf, nm_device_get_ip_iface (self), "disable_ipv6")));
|
||||
if (g_strcmp0 (value, "0") == 0)
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "disable_ipv6", "1");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "disable_ipv6", "1");
|
||||
g_free (value);
|
||||
|
||||
/* Ensure IPv6 is enabled */
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "disable_ipv6", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "disable_ipv6", "0");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -9834,7 +9834,7 @@ act_stage3_ip6_config_start (NMDevice *self,
|
|||
*/
|
||||
set_nm_ipv6ll (self, FALSE);
|
||||
if (ipv6ll_handle_old)
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "disable_ipv6", "1");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "disable_ipv6", "1");
|
||||
restore_ip6_properties (self);
|
||||
}
|
||||
return NM_ACT_STAGE_RETURN_IP_DONE;
|
||||
|
|
@ -9906,7 +9906,7 @@ act_stage3_ip6_config_start (NMDevice *self,
|
|||
ip6_privacy_str = "2";
|
||||
break;
|
||||
}
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "use_tempaddr", ip6_privacy_str);
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "use_tempaddr", ip6_privacy_str);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -14476,8 +14476,8 @@ nm_device_cleanup (NMDevice *self, NMDeviceStateReason reason, CleanupType clean
|
|||
/* Turn off kernel IPv6 */
|
||||
if (cleanup_type == CLEANUP_TYPE_DECONFIGURE) {
|
||||
set_disable_ipv6 (self, "1");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra", "0");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "use_tempaddr", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "use_tempaddr", "0");
|
||||
}
|
||||
|
||||
/* Call device type-specific deactivation */
|
||||
|
|
@ -14543,8 +14543,8 @@ nm_device_cleanup (NMDevice *self, NMDeviceStateReason reason, CleanupType clean
|
|||
if (priv->ip6_mtu_initial) {
|
||||
char sbuf[64];
|
||||
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "mtu",
|
||||
nm_sprintf_buf (sbuf, "%u", (unsigned) priv->ip6_mtu_initial));
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "mtu",
|
||||
nm_sprintf_buf (sbuf, "%u", (unsigned) priv->ip6_mtu_initial));
|
||||
}
|
||||
}
|
||||
priv->mtu_initial = 0;
|
||||
|
|
@ -14762,11 +14762,11 @@ ip6_managed_setup (NMDevice *self)
|
|||
{
|
||||
set_nm_ipv6ll (self, TRUE);
|
||||
set_disable_ipv6 (self, "1");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra_defrtr", "0");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra_pinfo", "0");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "accept_ra_rtr_pref", "0");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "use_tempaddr", "0");
|
||||
nm_device_ip_sysctl_set (self, AF_INET6, "forwarding", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra_defrtr", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra_pinfo", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "accept_ra_rtr_pref", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "use_tempaddr", "0");
|
||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "forwarding", "0");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ modem_ip6_config_result (NMModem *modem,
|
|||
}
|
||||
|
||||
/* Re-enable IPv6 on the interface */
|
||||
nm_device_ip_sysctl_set (device, AF_INET6, "disable_ipv6", "0");
|
||||
nm_device_sysctl_ip_conf_set (device, AF_INET6, "disable_ipv6", "0");
|
||||
|
||||
if (config)
|
||||
nm_device_set_wwan_ip6_config (device, config);
|
||||
|
|
@ -303,7 +303,7 @@ ip_ifindex_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
|
|||
* internally, and leaving it enabled could allow the kernel's IPv6
|
||||
* RA handling code to run before NM is ready.
|
||||
*/
|
||||
nm_device_ip_sysctl_set (device, AF_INET6, "disable_ipv6", "1");
|
||||
nm_device_sysctl_ip_conf_set (device, AF_INET6, "disable_ipv6", "1");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue