mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-20 01:20:47 +02:00
platform: add nm_platform_sysctl_ip_conf_*() wrappers
This commit is contained in:
parent
395374cfbe
commit
7fa398d596
2 changed files with 109 additions and 1 deletions
|
|
@ -570,7 +570,14 @@ nm_platform_sysctl_get_int32 (NMPlatform *self, const char *pathid, int dirfd, c
|
|||
* (inclusive) or @fallback.
|
||||
*/
|
||||
gint64
|
||||
nm_platform_sysctl_get_int_checked (NMPlatform *self, const char *pathid, int dirfd, const char *path, guint base, gint64 min, gint64 max, gint64 fallback)
|
||||
nm_platform_sysctl_get_int_checked (NMPlatform *self,
|
||||
const char *pathid,
|
||||
int dirfd,
|
||||
const char *path,
|
||||
guint base,
|
||||
gint64 min,
|
||||
gint64 max,
|
||||
gint64 fallback)
|
||||
{
|
||||
char *value = NULL;
|
||||
gint32 ret;
|
||||
|
|
@ -597,6 +604,81 @@ nm_platform_sysctl_get_int_checked (NMPlatform *self, const char *pathid, int di
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
char *
|
||||
nm_platform_sysctl_ip_conf_get (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property)
|
||||
{
|
||||
char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
|
||||
|
||||
return nm_platform_sysctl_get (platform,
|
||||
NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (addr_family,
|
||||
buf,
|
||||
ifname,
|
||||
property)));
|
||||
}
|
||||
|
||||
gint64
|
||||
nm_platform_sysctl_ip_conf_get_int_checked (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property,
|
||||
guint base,
|
||||
gint64 min,
|
||||
gint64 max,
|
||||
gint64 fallback)
|
||||
{
|
||||
char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
|
||||
|
||||
return nm_platform_sysctl_get_int_checked (platform,
|
||||
NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (addr_family,
|
||||
buf,
|
||||
ifname,
|
||||
property)),
|
||||
base,
|
||||
min,
|
||||
max,
|
||||
fallback);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_sysctl_ip_conf_set (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property,
|
||||
const char *value)
|
||||
{
|
||||
char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
|
||||
|
||||
return nm_platform_sysctl_set (platform,
|
||||
NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (addr_family,
|
||||
buf,
|
||||
ifname,
|
||||
property)),
|
||||
value);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_platform_sysctl_ip_conf_set_int64 (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property,
|
||||
gint64 value)
|
||||
{
|
||||
char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE];
|
||||
char s[64];
|
||||
|
||||
return nm_platform_sysctl_set (platform,
|
||||
NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (addr_family,
|
||||
buf,
|
||||
ifname,
|
||||
property)),
|
||||
nm_sprintf_buf (s, "%"G_GINT64_FORMAT, value));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static int
|
||||
_link_get_all_presort (gconstpointer p_a,
|
||||
gconstpointer p_b,
|
||||
|
|
|
|||
|
|
@ -1128,6 +1128,32 @@ char *nm_platform_sysctl_get (NMPlatform *self, const char *pathid, int dirfd, c
|
|||
gint32 nm_platform_sysctl_get_int32 (NMPlatform *self, const char *pathid, int dirfd, const char *path, gint32 fallback);
|
||||
gint64 nm_platform_sysctl_get_int_checked (NMPlatform *self, const char *pathid, int dirfd, const char *path, guint base, gint64 min, gint64 max, gint64 fallback);
|
||||
|
||||
char *nm_platform_sysctl_ip_conf_get (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property);
|
||||
|
||||
gint64 nm_platform_sysctl_ip_conf_get_int_checked (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property,
|
||||
guint base,
|
||||
gint64 min,
|
||||
gint64 max,
|
||||
gint64 fallback);
|
||||
|
||||
gboolean nm_platform_sysctl_ip_conf_set (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property,
|
||||
const char *value);
|
||||
|
||||
gboolean nm_platform_sysctl_ip_conf_set_int64 (NMPlatform *platform,
|
||||
int addr_family,
|
||||
const char *ifname,
|
||||
const char *property,
|
||||
gint64 value);
|
||||
|
||||
gboolean nm_platform_sysctl_set_ip6_hop_limit_safe (NMPlatform *self, const char *iface, int value);
|
||||
|
||||
const char *nm_platform_if_indextoname (NMPlatform *self, int ifindex, char *out_ifname/* of size IFNAMSIZ */);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue