Compare commits
13 Commits
a5648b8094
...
1bcefad919
Author | SHA1 | Date |
---|---|---|
Zbigniew Jędrzejewski-Szmek | 1bcefad919 | |
Yu Watanabe | 15e089644c | |
Yu Watanabe | 78404d22cc | |
Zbigniew Jędrzejewski-Szmek | df7c4eb62a | |
Dan Streetman | 1c089741d3 | |
Yu Watanabe | f2106b1789 | |
Chen Qi | 4a434023d2 | |
Zbigniew Jędrzejewski-Szmek | f7af63fd86 | |
Zbigniew Jędrzejewski-Szmek | 9b08c804ef | |
Zbigniew Jędrzejewski-Szmek | de157fe2a7 | |
Zbigniew Jędrzejewski-Szmek | 730b76bd2c | |
Zbigniew Jędrzejewski-Szmek | 0e7f5ad9d3 | |
Zbigniew Jędrzejewski-Szmek | 8a2c82ac88 |
|
@ -153,6 +153,18 @@
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>WLANInterfaceType=</varname></term>
|
||||||
|
<listitem>
|
||||||
|
<para>A whitespace-separated list of wireless network type. Supported values are
|
||||||
|
<literal>ad-hoc</literal>, <literal>station</literal>, <literal>ap</literal>,
|
||||||
|
<literal>ap-vlan</literal>, <literal>wds</literal>, <literal>monitor</literal>,
|
||||||
|
<literal>mesh-point</literal>, <literal>p2p-client</literal>, <literal>p2p-go</literal>,
|
||||||
|
<literal>p2p-device</literal>, <literal>ocb</literal>, and <literal>nan</literal>. If the
|
||||||
|
list is prefixed with a "!", the test is inverted.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>SSID=</varname></term>
|
<term><varname>SSID=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[Match]
|
||||||
|
Type=wifi
|
||||||
|
WLANInterfaceType=ad-hoc
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
LinkLocalAddressing=yes
|
|
@ -0,0 +1,8 @@
|
||||||
|
[Match]
|
||||||
|
Type=wifi
|
||||||
|
WLANInterfaceType=ap
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
Address=0.0.0.0/24
|
||||||
|
DHCPServer=yes
|
||||||
|
IPMasquerade=yes
|
|
@ -0,0 +1,6 @@
|
||||||
|
[Match]
|
||||||
|
Type=wifi
|
||||||
|
WLANInterfaceType=station
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=yes
|
|
@ -2093,7 +2093,7 @@ int analyze_security(sd_bus *bus, char **units, AnalyzeSecurityFlags flags) {
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(*i, 0, ".service", &mangled);
|
r = unit_name_mangle(*i, 0, &mangled);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle unit name '%s': %m", *i);
|
return log_error_errno(r, "Failed to mangle unit name '%s': %m", *i);
|
||||||
|
|
||||||
|
|
|
@ -58,3 +58,8 @@
|
||||||
STRV_MAKE(CONF_PATHS(n))
|
STRV_MAKE(CONF_PATHS(n))
|
||||||
|
|
||||||
#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
|
#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
|
||||||
|
|
||||||
|
#define PLYMOUTH_SOCKET { \
|
||||||
|
.un.sun_family = AF_UNIX, \
|
||||||
|
.un.sun_path = "\0/org/freedesktop/plymouthd", \
|
||||||
|
}
|
||||||
|
|
|
@ -162,8 +162,6 @@ basic_sources = files('''
|
||||||
parse-util.h
|
parse-util.h
|
||||||
path-util.c
|
path-util.c
|
||||||
path-util.h
|
path-util.h
|
||||||
plymouth-util.c
|
|
||||||
plymouth-util.h
|
|
||||||
prioq.c
|
prioq.c
|
||||||
prioq.h
|
prioq.h
|
||||||
proc-cmdline.c
|
proc-cmdline.c
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "plymouth-util.h"
|
|
||||||
|
|
||||||
bool plymouth_running(void) {
|
|
||||||
return access("/run/plymouth/pid", F_OK) >= 0;
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#define PLYMOUTH_SOCKET { \
|
|
||||||
.un.sun_family = AF_UNIX, \
|
|
||||||
.un.sun_path = "\0/org/freedesktop/plymouthd", \
|
|
||||||
}
|
|
||||||
|
|
||||||
bool plymouth_running(void);
|
|
|
@ -597,10 +597,10 @@ static bool do_escape_mangle(const char *f, bool allow_globs, char *t) {
|
||||||
*
|
*
|
||||||
* If @allow_globs, globs characters are preserved. Otherwise, they are escaped.
|
* If @allow_globs, globs characters are preserved. Otherwise, they are escaped.
|
||||||
*/
|
*/
|
||||||
int unit_name_mangle_with_suffix(const char *name, UnitNameMangle flags, const char *suffix, char **ret) {
|
int unit_name_mangle_with_suffix(const char *name, const char *operation, UnitNameMangle flags, const char *suffix, char **ret) {
|
||||||
char *s;
|
char *s;
|
||||||
int r;
|
int r;
|
||||||
bool mangled;
|
bool mangled, suggest_escape = true;
|
||||||
|
|
||||||
assert(name);
|
assert(name);
|
||||||
assert(suffix);
|
assert(suffix);
|
||||||
|
@ -617,10 +617,14 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle flags, const c
|
||||||
goto good;
|
goto good;
|
||||||
|
|
||||||
/* Already a fully valid globbing expression? If so, no mangling is necessary either... */
|
/* Already a fully valid globbing expression? If so, no mangling is necessary either... */
|
||||||
if ((flags & UNIT_NAME_MANGLE_GLOB) &&
|
if (string_is_glob(name) && in_charset(name, VALID_CHARS_GLOB)) {
|
||||||
string_is_glob(name) &&
|
if (flags & UNIT_NAME_MANGLE_GLOB)
|
||||||
in_charset(name, VALID_CHARS_GLOB))
|
|
||||||
goto good;
|
goto good;
|
||||||
|
log_full(flags & UNIT_NAME_MANGLE_WARN ? LOG_NOTICE : LOG_DEBUG,
|
||||||
|
"Glob pattern passed%s%s, but globs are not supported for this.",
|
||||||
|
operation ? " " : "", operation ?: "");
|
||||||
|
suggest_escape = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (is_device_path(name)) {
|
if (is_device_path(name)) {
|
||||||
r = unit_name_from_path(name, ".device", ret);
|
r = unit_name_from_path(name, ".device", ret);
|
||||||
|
@ -645,11 +649,12 @@ int unit_name_mangle_with_suffix(const char *name, UnitNameMangle flags, const c
|
||||||
mangled = do_escape_mangle(name, flags & UNIT_NAME_MANGLE_GLOB, s);
|
mangled = do_escape_mangle(name, flags & UNIT_NAME_MANGLE_GLOB, s);
|
||||||
if (mangled)
|
if (mangled)
|
||||||
log_full(flags & UNIT_NAME_MANGLE_WARN ? LOG_NOTICE : LOG_DEBUG,
|
log_full(flags & UNIT_NAME_MANGLE_WARN ? LOG_NOTICE : LOG_DEBUG,
|
||||||
"Invalid unit name \"%s\" was escaped as \"%s\" (maybe you should use systemd-escape?)",
|
"Invalid unit name \"%s\" escaped as \"%s\"%s.",
|
||||||
name, s);
|
name, s,
|
||||||
|
suggest_escape ? " (maybe you should use systemd-escape?)" : "");
|
||||||
|
|
||||||
/* Append a suffix if it doesn't have any, but only if this is not a glob, so that we can allow "foo.*" as a
|
/* Append a suffix if it doesn't have any, but only if this is not a glob, so that we can allow
|
||||||
* valid glob. */
|
* "foo.*" as a valid glob. */
|
||||||
if ((!(flags & UNIT_NAME_MANGLE_GLOB) || !string_is_glob(s)) && unit_name_to_type(s) < 0)
|
if ((!(flags & UNIT_NAME_MANGLE_GLOB) || !string_is_glob(s)) && unit_name_to_type(s) < 0)
|
||||||
strcat(s, suffix);
|
strcat(s, suffix);
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,10 @@ typedef enum UnitNameMangle {
|
||||||
UNIT_NAME_MANGLE_WARN = 1 << 1,
|
UNIT_NAME_MANGLE_WARN = 1 << 1,
|
||||||
} UnitNameMangle;
|
} UnitNameMangle;
|
||||||
|
|
||||||
int unit_name_mangle_with_suffix(const char *name, UnitNameMangle flags, const char *suffix, char **ret);
|
int unit_name_mangle_with_suffix(const char *name, const char *operation, UnitNameMangle flags, const char *suffix, char **ret);
|
||||||
|
|
||||||
static inline int unit_name_mangle(const char *name, UnitNameMangle flags, char **ret) {
|
static inline int unit_name_mangle(const char *name, UnitNameMangle flags, char **ret) {
|
||||||
return unit_name_mangle_with_suffix(name, flags, ".service", ret);
|
return unit_name_mangle_with_suffix(name, NULL, flags, ".service", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool service_unit_name_is_valid(const char *name);
|
bool service_unit_name_is_valid(const char *name);
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "dbus-manager.h"
|
#include "dbus-manager.h"
|
||||||
#include "dbus-unit.h"
|
#include "dbus-unit.h"
|
||||||
#include "dbus.h"
|
#include "dbus.h"
|
||||||
|
#include "def.h"
|
||||||
#include "dirent-util.h"
|
#include "dirent-util.h"
|
||||||
#include "env-util.h"
|
#include "env-util.h"
|
||||||
#include "escape.h"
|
#include "escape.h"
|
||||||
|
@ -58,7 +59,6 @@
|
||||||
#include "parse-util.h"
|
#include "parse-util.h"
|
||||||
#include "path-lookup.h"
|
#include "path-lookup.h"
|
||||||
#include "path-util.h"
|
#include "path-util.h"
|
||||||
#include "plymouth-util.h"
|
|
||||||
#include "process-util.h"
|
#include "process-util.h"
|
||||||
#include "ratelimit.h"
|
#include "ratelimit.h"
|
||||||
#include "rlimit-util.h"
|
#include "rlimit-util.h"
|
||||||
|
|
|
@ -227,7 +227,7 @@ static int write_dependency(FILE *f, const char *opts,
|
||||||
STRV_FOREACH(s, names) {
|
STRV_FOREACH(s, names) {
|
||||||
char *x;
|
char *x;
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(*s, 0, ".mount", &x);
|
r = unit_name_mangle_with_suffix(*s, "as dependency", 0, ".mount", &x);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to generate unit name: %m");
|
return log_error_errno(r, "Failed to generate unit name: %m");
|
||||||
r = strv_consume(&units, x);
|
r = strv_consume(&units, x);
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "parse-util.h"
|
#include "parse-util.h"
|
||||||
#include "siphash24.h"
|
#include "siphash24.h"
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
@ -136,17 +137,36 @@ static int net_condition_test_property(char * const *match_property, sd_device *
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *const wifi_iftype_table[NL80211_IFTYPE_MAX+1] = {
|
||||||
|
[NL80211_IFTYPE_ADHOC] = "ad-hoc",
|
||||||
|
[NL80211_IFTYPE_STATION] = "station",
|
||||||
|
[NL80211_IFTYPE_AP] = "ap",
|
||||||
|
[NL80211_IFTYPE_AP_VLAN] = "ap-vlan",
|
||||||
|
[NL80211_IFTYPE_WDS] = "wds",
|
||||||
|
[NL80211_IFTYPE_MONITOR] = "monitor",
|
||||||
|
[NL80211_IFTYPE_MESH_POINT] = "mesh-point",
|
||||||
|
[NL80211_IFTYPE_P2P_CLIENT] = "p2p-client",
|
||||||
|
[NL80211_IFTYPE_P2P_GO] = "p2p-go",
|
||||||
|
[NL80211_IFTYPE_P2P_DEVICE] = "p2p-device",
|
||||||
|
[NL80211_IFTYPE_OCB] = "ocb",
|
||||||
|
[NL80211_IFTYPE_NAN] = "nan",
|
||||||
|
};
|
||||||
|
|
||||||
|
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(wifi_iftype, enum nl80211_iftype);
|
||||||
|
|
||||||
bool net_match_config(Set *match_mac,
|
bool net_match_config(Set *match_mac,
|
||||||
char * const *match_paths,
|
char * const *match_paths,
|
||||||
char * const *match_drivers,
|
char * const *match_drivers,
|
||||||
char * const *match_types,
|
char * const *match_types,
|
||||||
char * const *match_names,
|
char * const *match_names,
|
||||||
char * const *match_property,
|
char * const *match_property,
|
||||||
|
char * const *match_wifi_iftype,
|
||||||
char * const *match_ssid,
|
char * const *match_ssid,
|
||||||
Set *match_bssid,
|
Set *match_bssid,
|
||||||
sd_device *device,
|
sd_device *device,
|
||||||
const struct ether_addr *dev_mac,
|
const struct ether_addr *dev_mac,
|
||||||
const char *dev_name,
|
const char *dev_name,
|
||||||
|
enum nl80211_iftype wifi_iftype,
|
||||||
const char *ssid,
|
const char *ssid,
|
||||||
const struct ether_addr *bssid) {
|
const struct ether_addr *bssid) {
|
||||||
|
|
||||||
|
@ -182,6 +202,9 @@ bool net_match_config(Set *match_mac,
|
||||||
if (!net_condition_test_property(match_property, device))
|
if (!net_condition_test_property(match_property, device))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!net_condition_test_strv(match_wifi_iftype, wifi_iftype_to_string(wifi_iftype)))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!net_condition_test_strv(match_ssid, ssid))
|
if (!net_condition_test_strv(match_ssid, ssid))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <linux/nl80211.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "sd-device.h"
|
#include "sd-device.h"
|
||||||
|
@ -20,11 +21,13 @@ bool net_match_config(Set *match_mac,
|
||||||
char * const *match_type,
|
char * const *match_type,
|
||||||
char * const *match_name,
|
char * const *match_name,
|
||||||
char * const *match_property,
|
char * const *match_property,
|
||||||
|
char * const *match_wifi_iftype,
|
||||||
char * const *match_ssid,
|
char * const *match_ssid,
|
||||||
Set *match_bssid,
|
Set *match_bssid,
|
||||||
sd_device *device,
|
sd_device *device,
|
||||||
const struct ether_addr *dev_mac,
|
const struct ether_addr *dev_mac,
|
||||||
const char *dev_name,
|
const char *dev_name,
|
||||||
|
enum nl80211_iftype wifi_iftype,
|
||||||
const char *ssid,
|
const char *ssid,
|
||||||
const struct ether_addr *bssid);
|
const struct ether_addr *bssid);
|
||||||
|
|
||||||
|
|
|
@ -548,16 +548,14 @@ static sd_dhcp_option* dhcp_option_free(sd_dhcp_option *i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_dhcp_option_new(uint8_t option, void *data, size_t length, sd_dhcp_option **ret) {
|
int sd_dhcp_option_new(uint8_t option, void *data, size_t length, sd_dhcp_option **ret) {
|
||||||
_cleanup_(sd_dhcp_option_unrefp) sd_dhcp_option *p = NULL;
|
assert_return(ret, -EINVAL);
|
||||||
_cleanup_free_ void *q = NULL;
|
assert_return(length == 0 || data, -EINVAL);
|
||||||
|
|
||||||
assert(ret);
|
_cleanup_free_ void *q = memdup(data, length);
|
||||||
|
|
||||||
q = memdup(data, length);
|
|
||||||
if (!q)
|
if (!q)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
p = new(sd_dhcp_option, 1);
|
sd_dhcp_option *p = new(sd_dhcp_option, 1);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
@ -2050,7 +2048,8 @@ sd_event *sd_dhcp_client_get_event(sd_dhcp_client *client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) {
|
static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) {
|
||||||
assert(client);
|
if (!client)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
log_dhcp_client(client, "FREE");
|
log_dhcp_client(client, "FREE");
|
||||||
|
|
||||||
|
@ -2076,11 +2075,9 @@ static sd_dhcp_client *dhcp_client_free(sd_dhcp_client *client) {
|
||||||
DEFINE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp_client, sd_dhcp_client, dhcp_client_free);
|
DEFINE_TRIVIAL_REF_UNREF_FUNC(sd_dhcp_client, sd_dhcp_client, dhcp_client_free);
|
||||||
|
|
||||||
int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize) {
|
int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize) {
|
||||||
_cleanup_(sd_dhcp_client_unrefp) sd_dhcp_client *client = NULL;
|
|
||||||
|
|
||||||
assert_return(ret, -EINVAL);
|
assert_return(ret, -EINVAL);
|
||||||
|
|
||||||
client = new(sd_dhcp_client, 1);
|
_cleanup_(sd_dhcp_client_unrefp) sd_dhcp_client *client = new(sd_dhcp_client, 1);
|
||||||
if (!client)
|
if (!client)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
|
|
@ -838,8 +838,7 @@ _public_ int sd_device_get_subsystem(sd_device *device, const char **ret) {
|
||||||
_public_ int sd_device_get_devtype(sd_device *device, const char **devtype) {
|
_public_ int sd_device_get_devtype(sd_device *device, const char **devtype) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(devtype);
|
assert_return(device, -EINVAL);
|
||||||
assert(device);
|
|
||||||
|
|
||||||
r = device_read_uevent_file(device);
|
r = device_read_uevent_file(device);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -848,9 +847,10 @@ _public_ int sd_device_get_devtype(sd_device *device, const char **devtype) {
|
||||||
if (!device->devtype)
|
if (!device->devtype)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
|
||||||
|
if (devtype)
|
||||||
*devtype = device->devtype;
|
*devtype = device->devtype;
|
||||||
|
|
||||||
return 0;
|
return !!device->devtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int sd_device_get_parent_with_subsystem_devtype(sd_device *child, const char *subsystem, const char *devtype, sd_device **ret) {
|
_public_ int sd_device_get_parent_with_subsystem_devtype(sd_device *child, const char *subsystem, const char *devtype, sd_device **ret) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ static int lookup_id(sd_netlink *nl, sd_genl_family family, uint16_t *id) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nlmsg_type_to_genl_family(sd_netlink *nl, uint16_t type, sd_genl_family *ret) {
|
int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family *ret) {
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
assert_return(nl, -EINVAL);
|
assert_return(nl, -EINVAL);
|
||||||
|
@ -160,7 +160,7 @@ int nlmsg_type_to_genl_family(sd_netlink *nl, uint16_t type, sd_genl_family *ret
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_genl_message_get_family(sd_netlink *nl, sd_netlink_message *m, sd_genl_family *family) {
|
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family *family) {
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
|
|
||||||
#include "sd-netlink.h"
|
#include "sd-netlink.h"
|
||||||
|
|
||||||
int nlmsg_type_to_genl_family(sd_netlink *nl, uint16_t type, sd_genl_family *ret);
|
int nlmsg_type_to_genl_family(const sd_netlink *nl, uint16_t type, sd_genl_family *ret);
|
||||||
|
|
|
@ -114,7 +114,7 @@ sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type) {
|
int sd_netlink_message_get_type(const sd_netlink_message *m, uint16_t *type) {
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
assert_return(type, -EINVAL);
|
assert_return(type, -EINVAL);
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_message_is_broadcast(sd_netlink_message *m) {
|
int sd_netlink_message_is_broadcast(const sd_netlink_message *m) {
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
|
||||||
return m->broadcast;
|
return m->broadcast;
|
||||||
|
@ -1001,14 +1001,14 @@ uint32_t rtnl_message_get_serial(sd_netlink_message *m) {
|
||||||
return m->hdr->nlmsg_seq;
|
return m->hdr->nlmsg_seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_message_is_error(sd_netlink_message *m) {
|
int sd_netlink_message_is_error(const sd_netlink_message *m) {
|
||||||
assert_return(m, 0);
|
assert_return(m, 0);
|
||||||
assert_return(m->hdr, 0);
|
assert_return(m->hdr, 0);
|
||||||
|
|
||||||
return m->hdr->nlmsg_type == NLMSG_ERROR;
|
return m->hdr->nlmsg_type == NLMSG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_message_get_errno(sd_netlink_message *m) {
|
int sd_netlink_message_get_errno(const sd_netlink_message *m) {
|
||||||
struct nlmsgerr *err;
|
struct nlmsgerr *err;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
|
|
@ -142,7 +142,7 @@ void *sd_netlink_slot_set_userdata(sd_netlink_slot *slot, void *userdata) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_slot_get_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t *callback) {
|
int sd_netlink_slot_get_destroy_callback(const sd_netlink_slot *slot, sd_netlink_destroy_t *callback) {
|
||||||
assert_return(slot, -EINVAL);
|
assert_return(slot, -EINVAL);
|
||||||
|
|
||||||
if (callback)
|
if (callback)
|
||||||
|
@ -158,7 +158,7 @@ int sd_netlink_slot_set_destroy_callback(sd_netlink_slot *slot, sd_netlink_destr
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_slot_get_floating(sd_netlink_slot *slot) {
|
int sd_netlink_slot_get_floating(const sd_netlink_slot *slot) {
|
||||||
assert_return(slot, -EINVAL);
|
assert_return(slot, -EINVAL);
|
||||||
|
|
||||||
return slot->floating;
|
return slot->floating;
|
||||||
|
@ -186,7 +186,7 @@ int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_slot_get_description(sd_netlink_slot *slot, const char **description) {
|
int sd_netlink_slot_get_description(const sd_netlink_slot *slot, const char **description) {
|
||||||
assert_return(slot, -EINVAL);
|
assert_return(slot, -EINVAL);
|
||||||
|
|
||||||
if (description)
|
if (description)
|
||||||
|
|
|
@ -993,6 +993,7 @@ static const NLType genl_nl80211_types[] = {
|
||||||
[NL80211_ATTR_IFINDEX] = { .type = NETLINK_TYPE_U32 },
|
[NL80211_ATTR_IFINDEX] = { .type = NETLINK_TYPE_U32 },
|
||||||
[NL80211_ATTR_MAC] = { .type = NETLINK_TYPE_ETHER_ADDR },
|
[NL80211_ATTR_MAC] = { .type = NETLINK_TYPE_ETHER_ADDR },
|
||||||
[NL80211_ATTR_SSID] = { .type = NETLINK_TYPE_STRING },
|
[NL80211_ATTR_SSID] = { .type = NETLINK_TYPE_STRING },
|
||||||
|
[NL80211_ATTR_IFTYPE] = { .type = NETLINK_TYPE_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NLTypeSystem genl_nl80211_type_system = {
|
static const NLTypeSystem genl_nl80211_type_system = {
|
||||||
|
|
|
@ -80,7 +80,7 @@ int sd_rtnl_message_route_set_flags(sd_netlink_message *m, unsigned flags) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_flags(sd_netlink_message *m, unsigned *flags) {
|
int sd_rtnl_message_route_get_flags(const sd_netlink_message *m, unsigned *flags) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -109,7 +109,7 @@ int sd_rtnl_message_route_set_table(sd_netlink_message *m, unsigned char table)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_family(sd_netlink_message *m, int *family) {
|
int sd_rtnl_message_route_get_family(const sd_netlink_message *m, int *family) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -138,7 +138,7 @@ int sd_rtnl_message_route_set_family(sd_netlink_message *m, int family) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_type(sd_netlink_message *m, unsigned char *type) {
|
int sd_rtnl_message_route_get_type(const sd_netlink_message *m, unsigned char *type) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -167,7 +167,7 @@ int sd_rtnl_message_route_set_type(sd_netlink_message *m, unsigned char type) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_protocol(sd_netlink_message *m, unsigned char *protocol) {
|
int sd_rtnl_message_route_get_protocol(const sd_netlink_message *m, unsigned char *protocol) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -182,7 +182,7 @@ int sd_rtnl_message_route_get_protocol(sd_netlink_message *m, unsigned char *pro
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_scope(sd_netlink_message *m, unsigned char *scope) {
|
int sd_rtnl_message_route_get_scope(const sd_netlink_message *m, unsigned char *scope) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -197,7 +197,7 @@ int sd_rtnl_message_route_get_scope(sd_netlink_message *m, unsigned char *scope)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_tos(sd_netlink_message *m, unsigned char *tos) {
|
int sd_rtnl_message_route_get_tos(const sd_netlink_message *m, unsigned char *tos) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -212,7 +212,7 @@ int sd_rtnl_message_route_get_tos(sd_netlink_message *m, unsigned char *tos) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_table(sd_netlink_message *m, unsigned char *table) {
|
int sd_rtnl_message_route_get_table(const sd_netlink_message *m, unsigned char *table) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -227,7 +227,7 @@ int sd_rtnl_message_route_get_table(sd_netlink_message *m, unsigned char *table)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_dst_prefixlen(sd_netlink_message *m, unsigned char *dst_len) {
|
int sd_rtnl_message_route_get_dst_prefixlen(const sd_netlink_message *m, unsigned char *dst_len) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -242,7 +242,7 @@ int sd_rtnl_message_route_get_dst_prefixlen(sd_netlink_message *m, unsigned char
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_route_get_src_prefixlen(sd_netlink_message *m, unsigned char *src_len) {
|
int sd_rtnl_message_route_get_src_prefixlen(const sd_netlink_message *m, unsigned char *src_len) {
|
||||||
struct rtmsg *rtm;
|
struct rtmsg *rtm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -338,7 +338,7 @@ int sd_rtnl_message_nexthop_set_family(sd_netlink_message *m, uint8_t family) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_nexthop_get_family(sd_netlink_message *m, uint8_t *family) {
|
int sd_rtnl_message_nexthop_get_family(const sd_netlink_message *m, uint8_t *family) {
|
||||||
struct nhmsg *nhm;
|
struct nhmsg *nhm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -376,7 +376,7 @@ int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_neigh_get_flags(sd_netlink_message *m, uint8_t *flags) {
|
int sd_rtnl_message_neigh_get_flags(const sd_netlink_message *m, uint8_t *flags) {
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -389,7 +389,7 @@ int sd_rtnl_message_neigh_get_flags(sd_netlink_message *m, uint8_t *flags) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_neigh_get_state(sd_netlink_message *m, uint16_t *state) {
|
int sd_rtnl_message_neigh_get_state(const sd_netlink_message *m, uint16_t *state) {
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -402,7 +402,7 @@ int sd_rtnl_message_neigh_get_state(sd_netlink_message *m, uint16_t *state) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_neigh_get_family(sd_netlink_message *m, int *family) {
|
int sd_rtnl_message_neigh_get_family(const sd_netlink_message *m, int *family) {
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -417,7 +417,7 @@ int sd_rtnl_message_neigh_get_family(sd_netlink_message *m, int *family) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_neigh_get_ifindex(sd_netlink_message *m, int *index) {
|
int sd_rtnl_message_neigh_get_ifindex(const sd_netlink_message *m, int *index) {
|
||||||
struct ndmsg *ndm;
|
struct ndmsg *ndm;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -568,7 +568,7 @@ int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_addr_get_family(sd_netlink_message *m, int *family) {
|
int sd_rtnl_message_addr_get_family(const sd_netlink_message *m, int *family) {
|
||||||
struct ifaddrmsg *ifa;
|
struct ifaddrmsg *ifa;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -583,7 +583,7 @@ int sd_rtnl_message_addr_get_family(sd_netlink_message *m, int *family) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_addr_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen) {
|
int sd_rtnl_message_addr_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen) {
|
||||||
struct ifaddrmsg *ifa;
|
struct ifaddrmsg *ifa;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -598,7 +598,7 @@ int sd_rtnl_message_addr_get_prefixlen(sd_netlink_message *m, unsigned char *pre
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_addr_get_scope(sd_netlink_message *m, unsigned char *scope) {
|
int sd_rtnl_message_addr_get_scope(const sd_netlink_message *m, unsigned char *scope) {
|
||||||
struct ifaddrmsg *ifa;
|
struct ifaddrmsg *ifa;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -613,7 +613,7 @@ int sd_rtnl_message_addr_get_scope(sd_netlink_message *m, unsigned char *scope)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_addr_get_flags(sd_netlink_message *m, unsigned char *flags) {
|
int sd_rtnl_message_addr_get_flags(const sd_netlink_message *m, unsigned char *flags) {
|
||||||
struct ifaddrmsg *ifa;
|
struct ifaddrmsg *ifa;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -628,7 +628,7 @@ int sd_rtnl_message_addr_get_flags(sd_netlink_message *m, unsigned char *flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_addr_get_ifindex(sd_netlink_message *m, int *ifindex) {
|
int sd_rtnl_message_addr_get_ifindex(const sd_netlink_message *m, int *ifindex) {
|
||||||
struct ifaddrmsg *ifa;
|
struct ifaddrmsg *ifa;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -688,7 +688,7 @@ int sd_rtnl_message_new_addr_update(sd_netlink *rtnl, sd_netlink_message **ret,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_link_get_ifindex(sd_netlink_message *m, int *ifindex) {
|
int sd_rtnl_message_link_get_ifindex(const sd_netlink_message *m, int *ifindex) {
|
||||||
struct ifinfomsg *ifi;
|
struct ifinfomsg *ifi;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -703,7 +703,7 @@ int sd_rtnl_message_link_get_ifindex(sd_netlink_message *m, int *ifindex) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_link_get_flags(sd_netlink_message *m, unsigned *flags) {
|
int sd_rtnl_message_link_get_flags(const sd_netlink_message *m, unsigned *flags) {
|
||||||
struct ifinfomsg *ifi;
|
struct ifinfomsg *ifi;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -718,7 +718,7 @@ int sd_rtnl_message_link_get_flags(sd_netlink_message *m, unsigned *flags) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned short *type) {
|
int sd_rtnl_message_link_get_type(const sd_netlink_message *m, unsigned short *type) {
|
||||||
struct ifinfomsg *ifi;
|
struct ifinfomsg *ifi;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -733,7 +733,7 @@ int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned short *type) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_get_family(sd_netlink_message *m, int *family) {
|
int sd_rtnl_message_get_family(const sd_netlink_message *m, int *family) {
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
assert_return(family, -EINVAL);
|
assert_return(family, -EINVAL);
|
||||||
|
|
||||||
|
@ -831,7 +831,7 @@ int sd_rtnl_message_addrlabel_set_prefixlen(sd_netlink_message *m, unsigned char
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_addrlabel_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen) {
|
int sd_rtnl_message_addrlabel_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen) {
|
||||||
struct ifaddrlblmsg *addrlabel;
|
struct ifaddrlblmsg *addrlabel;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -882,7 +882,7 @@ int sd_rtnl_message_routing_policy_rule_set_tos(sd_netlink_message *m, unsigned
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_routing_policy_rule_get_tos(sd_netlink_message *m, unsigned char *tos) {
|
int sd_rtnl_message_routing_policy_rule_get_tos(const sd_netlink_message *m, unsigned char *tos) {
|
||||||
struct rtmsg *routing_policy_rule;
|
struct rtmsg *routing_policy_rule;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -910,7 +910,7 @@ int sd_rtnl_message_routing_policy_rule_set_table(sd_netlink_message *m, unsigne
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_routing_policy_rule_get_table(sd_netlink_message *m, unsigned char *table) {
|
int sd_rtnl_message_routing_policy_rule_get_table(const sd_netlink_message *m, unsigned char *table) {
|
||||||
struct rtmsg *routing_policy_rule;
|
struct rtmsg *routing_policy_rule;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -937,7 +937,7 @@ int sd_rtnl_message_routing_policy_rule_set_flags(sd_netlink_message *m, unsigne
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_routing_policy_rule_get_flags(sd_netlink_message *m, unsigned *flags) {
|
int sd_rtnl_message_routing_policy_rule_get_flags(const sd_netlink_message *m, unsigned *flags) {
|
||||||
struct rtmsg *routing_policy_rule;
|
struct rtmsg *routing_policy_rule;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -964,7 +964,7 @@ int sd_rtnl_message_routing_policy_rule_set_rtm_type(sd_netlink_message *m, unsi
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_routing_policy_rule_get_rtm_type(sd_netlink_message *m, unsigned char *type) {
|
int sd_rtnl_message_routing_policy_rule_get_rtm_type(const sd_netlink_message *m, unsigned char *type) {
|
||||||
struct rtmsg *routing_policy_rule;
|
struct rtmsg *routing_policy_rule;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -992,7 +992,7 @@ int sd_rtnl_message_routing_policy_rule_set_rtm_dst_prefixlen(sd_netlink_message
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_routing_policy_rule_get_rtm_dst_prefixlen(sd_netlink_message *m, unsigned char *len) {
|
int sd_rtnl_message_routing_policy_rule_get_rtm_dst_prefixlen(const sd_netlink_message *m, unsigned char *len) {
|
||||||
struct rtmsg *routing_policy_rule;
|
struct rtmsg *routing_policy_rule;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
@ -1020,7 +1020,7 @@ int sd_rtnl_message_routing_policy_rule_set_rtm_src_prefixlen(sd_netlink_message
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_routing_policy_rule_get_rtm_src_prefixlen(sd_netlink_message *m, unsigned char *len) {
|
int sd_rtnl_message_routing_policy_rule_get_rtm_src_prefixlen(const sd_netlink_message *m, unsigned char *len) {
|
||||||
struct rtmsg *routing_policy_rule;
|
struct rtmsg *routing_policy_rule;
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
assert_return(m, -EINVAL);
|
||||||
|
|
|
@ -79,7 +79,7 @@ int sd_netlink_new_from_netlink(sd_netlink **ret, int fd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool rtnl_pid_changed(sd_netlink *rtnl) {
|
static bool rtnl_pid_changed(const sd_netlink *rtnl) {
|
||||||
assert(rtnl);
|
assert(rtnl);
|
||||||
|
|
||||||
/* We don't support people creating an rtnl connection and
|
/* We don't support people creating an rtnl connection and
|
||||||
|
@ -673,7 +673,7 @@ int sd_netlink_call(sd_netlink *rtnl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_get_events(sd_netlink *rtnl) {
|
int sd_netlink_get_events(const sd_netlink *rtnl) {
|
||||||
assert_return(rtnl, -EINVAL);
|
assert_return(rtnl, -EINVAL);
|
||||||
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
|
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
|
||||||
|
|
||||||
|
@ -683,7 +683,7 @@ int sd_netlink_get_events(sd_netlink *rtnl) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_get_timeout(sd_netlink *rtnl, uint64_t *timeout_usec) {
|
int sd_netlink_get_timeout(const sd_netlink *rtnl, uint64_t *timeout_usec) {
|
||||||
struct reply_callback *c;
|
struct reply_callback *c;
|
||||||
|
|
||||||
assert_return(rtnl, -EINVAL);
|
assert_return(rtnl, -EINVAL);
|
||||||
|
|
|
@ -66,7 +66,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||||
assert(argc >= 0);
|
assert(argc >= 0);
|
||||||
assert(argv);
|
assert(argv);
|
||||||
|
|
||||||
while ((c = getopt_long(argc, argv, "hqcv", options, NULL)) >= 0)
|
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
||||||
|
|
|
@ -167,6 +167,7 @@ typedef struct LinkInfo {
|
||||||
NetDevPort port;
|
NetDevPort port;
|
||||||
|
|
||||||
/* wlan info */
|
/* wlan info */
|
||||||
|
enum nl80211_iftype wlan_iftype;
|
||||||
char *ssid;
|
char *ssid;
|
||||||
struct ether_addr bssid;
|
struct ether_addr bssid;
|
||||||
|
|
||||||
|
@ -384,7 +385,7 @@ static void acquire_ether_link_info(int *fd, LinkInfo *link) {
|
||||||
static void acquire_wlan_link_info(LinkInfo *link) {
|
static void acquire_wlan_link_info(LinkInfo *link) {
|
||||||
_cleanup_(sd_netlink_unrefp) sd_netlink *genl = NULL;
|
_cleanup_(sd_netlink_unrefp) sd_netlink *genl = NULL;
|
||||||
const char *type = NULL;
|
const char *type = NULL;
|
||||||
int r, k;
|
int r, k = 0;
|
||||||
|
|
||||||
if (link->sd_device)
|
if (link->sd_device)
|
||||||
(void) sd_device_get_devtype(link->sd_device, &type);
|
(void) sd_device_get_devtype(link->sd_device, &type);
|
||||||
|
@ -399,13 +400,15 @@ static void acquire_wlan_link_info(LinkInfo *link) {
|
||||||
|
|
||||||
(void) sd_netlink_inc_rcvbuf(genl, RCVBUF_SIZE);
|
(void) sd_netlink_inc_rcvbuf(genl, RCVBUF_SIZE);
|
||||||
|
|
||||||
r = wifi_get_ssid(genl, link->ifindex, &link->ssid);
|
r = wifi_get_interface(genl, link->ifindex, &link->wlan_iftype, &link->ssid);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_debug_errno(r, "%s: failed to query ssid: %m", link->name);
|
log_debug_errno(r, "%s: failed to query ssid: %m", link->name);
|
||||||
|
|
||||||
k = wifi_get_bssid(genl, link->ifindex, &link->bssid);
|
if (link->iftype == NL80211_IFTYPE_STATION) {
|
||||||
|
k = wifi_get_station(genl, link->ifindex, &link->bssid);
|
||||||
if (k < 0)
|
if (k < 0)
|
||||||
log_debug_errno(k, "%s: failed to query bssid: %m", link->name);
|
log_debug_errno(k, "%s: failed to query bssid: %m", link->name);
|
||||||
|
}
|
||||||
|
|
||||||
link->has_wlan_link_info = r > 0 || k > 0;
|
link->has_wlan_link_info = r > 0 || k > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2865,7 +2865,7 @@ int link_reconfigure(Link *link, bool force) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = network_get(link->manager, link->sd_device, link->ifname,
|
r = network_get(link->manager, link->sd_device, link->ifname,
|
||||||
&link->mac, link->ssid, &link->bssid, &network);
|
&link->mac, link->wlan_iftype, link->ssid, &link->bssid, &network);
|
||||||
if (r == -ENOENT) {
|
if (r == -ENOENT) {
|
||||||
link_enter_unmanaged(link);
|
link_enter_unmanaged(link);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2959,7 +2959,7 @@ static int link_initialized_and_synced(Link *link) {
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = network_get(link->manager, link->sd_device, link->ifname,
|
r = network_get(link->manager, link->sd_device, link->ifname,
|
||||||
&link->mac, link->ssid, &link->bssid, &network);
|
&link->mac, link->wlan_iftype, link->ssid, &link->bssid, &network);
|
||||||
if (r == -ENOENT) {
|
if (r == -ENOENT) {
|
||||||
link_enter_unmanaged(link);
|
link_enter_unmanaged(link);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
|
#include <linux/nl80211.h>
|
||||||
|
|
||||||
#include "sd-bus.h"
|
#include "sd-bus.h"
|
||||||
#include "sd-device.h"
|
#include "sd-device.h"
|
||||||
|
@ -56,6 +57,7 @@ typedef struct Link {
|
||||||
sd_device *sd_device;
|
sd_device *sd_device;
|
||||||
|
|
||||||
/* wlan */
|
/* wlan */
|
||||||
|
enum nl80211_iftype wlan_iftype;
|
||||||
char *ssid;
|
char *ssid;
|
||||||
struct ether_addr bssid;
|
struct ether_addr bssid;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ Match.MACAddress, config_parse_hwaddrs,
|
||||||
Match.Path, config_parse_match_strv, 0, offsetof(Network, match_path)
|
Match.Path, config_parse_match_strv, 0, offsetof(Network, match_path)
|
||||||
Match.Driver, config_parse_match_strv, 0, offsetof(Network, match_driver)
|
Match.Driver, config_parse_match_strv, 0, offsetof(Network, match_driver)
|
||||||
Match.Type, config_parse_match_strv, 0, offsetof(Network, match_type)
|
Match.Type, config_parse_match_strv, 0, offsetof(Network, match_type)
|
||||||
|
Match.WLANInterfaceType, config_parse_match_strv, 0, offsetof(Network, match_wlan_iftype)
|
||||||
Match.SSID, config_parse_match_strv, 0, offsetof(Network, match_ssid)
|
Match.SSID, config_parse_match_strv, 0, offsetof(Network, match_ssid)
|
||||||
Match.BSSID, config_parse_hwaddrs, 0, offsetof(Network, match_bssid)
|
Match.BSSID, config_parse_hwaddrs, 0, offsetof(Network, match_bssid)
|
||||||
Match.Name, config_parse_match_ifnames, 0, offsetof(Network, match_name)
|
Match.Name, config_parse_match_ifnames, 0, offsetof(Network, match_name)
|
||||||
|
|
|
@ -595,6 +595,7 @@ static Network *network_free(Network *network) {
|
||||||
strv_free(network->match_type);
|
strv_free(network->match_type);
|
||||||
strv_free(network->match_name);
|
strv_free(network->match_name);
|
||||||
strv_free(network->match_property);
|
strv_free(network->match_property);
|
||||||
|
strv_free(network->match_wlan_iftype);
|
||||||
strv_free(network->match_ssid);
|
strv_free(network->match_ssid);
|
||||||
set_free_free(network->match_bssid);
|
set_free_free(network->match_bssid);
|
||||||
condition_free_list(network->conditions);
|
condition_free_list(network->conditions);
|
||||||
|
@ -701,7 +702,8 @@ int network_get_by_name(Manager *manager, const char *name, Network **ret) {
|
||||||
|
|
||||||
int network_get(Manager *manager, sd_device *device,
|
int network_get(Manager *manager, sd_device *device,
|
||||||
const char *ifname, const struct ether_addr *address,
|
const char *ifname, const struct ether_addr *address,
|
||||||
const char *ssid, const struct ether_addr *bssid, Network **ret) {
|
enum nl80211_iftype wlan_iftype, const char *ssid, const struct ether_addr *bssid,
|
||||||
|
Network **ret) {
|
||||||
Network *network;
|
Network *network;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
|
|
||||||
|
@ -711,8 +713,8 @@ int network_get(Manager *manager, sd_device *device,
|
||||||
ORDERED_HASHMAP_FOREACH(network, manager->networks, i)
|
ORDERED_HASHMAP_FOREACH(network, manager->networks, i)
|
||||||
if (net_match_config(network->match_mac, network->match_path, network->match_driver,
|
if (net_match_config(network->match_mac, network->match_path, network->match_driver,
|
||||||
network->match_type, network->match_name, network->match_property,
|
network->match_type, network->match_name, network->match_property,
|
||||||
network->match_ssid, network->match_bssid,
|
network->match_wlan_iftype, network->match_ssid, network->match_bssid,
|
||||||
device, address, ifname, ssid, bssid)) {
|
device, address, ifname, wlan_iftype, ssid, bssid)) {
|
||||||
if (network->match_name && device) {
|
if (network->match_name && device) {
|
||||||
const char *attr;
|
const char *attr;
|
||||||
uint8_t name_assign_type = NET_NAME_UNKNOWN;
|
uint8_t name_assign_type = NET_NAME_UNKNOWN;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <linux/nl80211.h>
|
||||||
|
|
||||||
#include "sd-bus.h"
|
#include "sd-bus.h"
|
||||||
#include "sd-device.h"
|
#include "sd-device.h"
|
||||||
|
|
||||||
|
@ -64,6 +66,7 @@ struct Network {
|
||||||
char **match_type;
|
char **match_type;
|
||||||
char **match_name;
|
char **match_name;
|
||||||
char **match_property;
|
char **match_property;
|
||||||
|
char **match_wlan_iftype;
|
||||||
char **match_ssid;
|
char **match_ssid;
|
||||||
Set *match_bssid;
|
Set *match_bssid;
|
||||||
LIST_HEAD(Condition, conditions);
|
LIST_HEAD(Condition, conditions);
|
||||||
|
@ -291,7 +294,7 @@ int network_verify(Network *network);
|
||||||
|
|
||||||
int network_get_by_name(Manager *manager, const char *name, Network **ret);
|
int network_get_by_name(Manager *manager, const char *name, Network **ret);
|
||||||
int network_get(Manager *manager, sd_device *device, const char *ifname, const struct ether_addr *mac,
|
int network_get(Manager *manager, sd_device *device, const char *ifname, const struct ether_addr *mac,
|
||||||
const char *ssid, const struct ether_addr *bssid, Network **ret);
|
enum nl80211_iftype wlan_iftype, const char *ssid, const struct ether_addr *bssid, Network **ret);
|
||||||
int network_apply(Network *network, Link *link);
|
int network_apply(Network *network, Link *link);
|
||||||
void network_apply_anonymize_if_set(Network *network);
|
void network_apply_anonymize_if_set(Network *network);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
int wifi_get_info(Link *link) {
|
int wifi_get_info(Link *link) {
|
||||||
const char *type;
|
const char *type;
|
||||||
int r, s;
|
int r, s = 0;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
|
|
||||||
|
@ -33,24 +33,26 @@ int wifi_get_info(Link *link) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_cleanup_free_ char *ssid = NULL;
|
_cleanup_free_ char *ssid = NULL;
|
||||||
r = wifi_get_ssid(link->manager->genl, link->ifindex, &ssid);
|
r = wifi_get_interface(link->manager->genl, link->ifindex, &link->wlan_iftype, &ssid);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
if (r > 0 && streq_ptr(link->ssid, ssid))
|
if (r > 0 && streq_ptr(link->ssid, ssid))
|
||||||
r = 0;
|
r = 0;
|
||||||
free_and_replace(link->ssid, ssid);
|
free_and_replace(link->ssid, ssid);
|
||||||
|
|
||||||
|
if (link->wlan_iftype == NL80211_IFTYPE_STATION) {
|
||||||
struct ether_addr old_bssid = link->bssid;
|
struct ether_addr old_bssid = link->bssid;
|
||||||
s = wifi_get_bssid(link->manager->genl, link->ifindex, &link->bssid);
|
s = wifi_get_station(link->manager->genl, link->ifindex, &link->bssid);
|
||||||
if (s < 0)
|
if (s < 0)
|
||||||
return s;
|
return s;
|
||||||
if (s > 0 && memcmp(&old_bssid, &link->bssid, sizeof old_bssid) == 0)
|
if (s > 0 && memcmp(&old_bssid, &link->bssid, sizeof old_bssid) == 0)
|
||||||
s = 0;
|
s = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (r > 0 || s > 0) {
|
if (r > 0 || s > 0) {
|
||||||
char buf[ETHER_ADDR_TO_STRING_MAX];
|
char buf[ETHER_ADDR_TO_STRING_MAX];
|
||||||
|
|
||||||
if (link->ssid)
|
if (link->wlan_iftype == NL80211_IFTYPE_STATION && link->ssid)
|
||||||
log_link_info(link, "Connected WiFi access point: %s (%s)",
|
log_link_info(link, "Connected WiFi access point: %s (%s)",
|
||||||
link->ssid, ether_addr_to_string(&link->bssid, buf));
|
link->ssid, ether_addr_to_string(&link->bssid, buf));
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -125,7 +125,7 @@ static void test_network_get(Manager *manager, sd_device *loopback) {
|
||||||
|
|
||||||
/* let's assume that the test machine does not have a .network file
|
/* let's assume that the test machine does not have a .network file
|
||||||
that applies to the loopback device... */
|
that applies to the loopback device... */
|
||||||
assert_se(network_get(manager, loopback, "lo", &mac, NULL, NULL, &network) == -ENOENT);
|
assert_se(network_get(manager, loopback, "lo", &mac, 0, NULL, NULL, &network) == -ENOENT);
|
||||||
assert_se(!network);
|
assert_se(!network);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ int allocate_scope(
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Could not watch job: %m");
|
return log_error_errno(r, "Could not watch job: %m");
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(machine_name, 0, ".scope", &scope);
|
r = unit_name_mangle_with_suffix(machine_name, "as machine name", 0, ".scope", &scope);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle scope name: %m");
|
return log_error_errno(r, "Failed to mangle scope name: %m");
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ int terminate_scope(
|
||||||
_cleanup_free_ char *scope = NULL;
|
_cleanup_free_ char *scope = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(machine_name, 0, ".scope", &scope);
|
r = unit_name_mangle_with_suffix(machine_name, "to terminate", 0, ".scope", &scope);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle scope name: %m");
|
return log_error_errno(r, "Failed to mangle scope name: %m");
|
||||||
|
|
||||||
|
|
|
@ -515,6 +515,7 @@ int dns_stream_new(
|
||||||
.n_ref = 1,
|
.n_ref = 1,
|
||||||
.fd = -1,
|
.fd = -1,
|
||||||
.protocol = protocol,
|
.protocol = protocol,
|
||||||
|
.type = type,
|
||||||
};
|
};
|
||||||
|
|
||||||
r = ordered_set_ensure_allocated(&s->write_queue, &dns_packet_hash_ops);
|
r = ordered_set_ensure_allocated(&s->write_queue, &dns_packet_hash_ops);
|
||||||
|
|
|
@ -641,7 +641,9 @@ static int transient_cgroup_set_properties(sd_bus_message *m) {
|
||||||
if (!isempty(arg_slice)) {
|
if (!isempty(arg_slice)) {
|
||||||
_cleanup_free_ char *slice = NULL;
|
_cleanup_free_ char *slice = NULL;
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(arg_slice, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".slice", &slice);
|
r = unit_name_mangle_with_suffix(arg_slice, "as slice",
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
".slice", &slice);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle name '%s': %m", arg_slice);
|
return log_error_errno(r, "Failed to mangle name '%s': %m", arg_slice);
|
||||||
|
|
||||||
|
@ -1112,7 +1114,9 @@ static int start_transient_service(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_unit) {
|
if (arg_unit) {
|
||||||
r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".service", &service);
|
r = unit_name_mangle_with_suffix(arg_unit, "as unit",
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
".service", &service);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle unit name: %m");
|
return log_error_errno(r, "Failed to mangle unit name: %m");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1355,7 +1359,9 @@ static int start_transient_scope(sd_bus *bus) {
|
||||||
return log_oom();
|
return log_oom();
|
||||||
|
|
||||||
if (arg_unit) {
|
if (arg_unit) {
|
||||||
r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".scope", &scope);
|
r = unit_name_mangle_with_suffix(arg_unit, "as unit",
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
".scope", &scope);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle scope name: %m");
|
return log_error_errno(r, "Failed to mangle scope name: %m");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1530,11 +1536,15 @@ static int start_transient_trigger(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".service", &service);
|
r = unit_name_mangle_with_suffix(arg_unit, "as unit",
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
".service", &service);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle unit name: %m");
|
return log_error_errno(r, "Failed to mangle unit name: %m");
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(arg_unit, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, suffix, &trigger);
|
r = unit_name_mangle_with_suffix(arg_unit, "as trigger",
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
suffix, &trigger);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle unit name: %m");
|
return log_error_errno(r, "Failed to mangle unit name: %m");
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "ask-password-api.h"
|
#include "ask-password-api.h"
|
||||||
|
#include "def.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "format-util.h"
|
#include "format-util.h"
|
||||||
|
@ -34,7 +35,6 @@
|
||||||
#include "memory-util.h"
|
#include "memory-util.h"
|
||||||
#include "missing.h"
|
#include "missing.h"
|
||||||
#include "mkdir.h"
|
#include "mkdir.h"
|
||||||
#include "plymouth-util.h"
|
|
||||||
#include "process-util.h"
|
#include "process-util.h"
|
||||||
#include "random-util.h"
|
#include "random-util.h"
|
||||||
#include "signal-util.h"
|
#include "signal-util.h"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@
|
||||||
#include "netlink-util.h"
|
#include "netlink-util.h"
|
||||||
#include "wifi-util.h"
|
#include "wifi-util.h"
|
||||||
|
|
||||||
int wifi_get_ssid(sd_netlink *genl, int ifindex, char **ssid) {
|
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL;
|
||||||
sd_genl_family family;
|
sd_genl_family family;
|
||||||
int r;
|
int r;
|
||||||
|
@ -40,14 +40,25 @@ int wifi_get_ssid(sd_netlink *genl, int ifindex, char **ssid) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iftype) {
|
||||||
|
uint32_t t;
|
||||||
|
|
||||||
|
r = sd_netlink_message_read_u32(reply, NL80211_ATTR_IFTYPE, &t);
|
||||||
|
if (r < 0)
|
||||||
|
return log_debug_errno(r, "Failed to get NL80211_ATTR_IFTYPE attribute: %m");
|
||||||
|
*iftype = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ssid) {
|
||||||
r = sd_netlink_message_read_string_strdup(reply, NL80211_ATTR_SSID, ssid);
|
r = sd_netlink_message_read_string_strdup(reply, NL80211_ATTR_SSID, ssid);
|
||||||
if (r < 0 && r != -ENODATA)
|
if (r < 0 && r != -ENODATA)
|
||||||
return log_debug_errno(r, "Failed to get NL80211_ATTR_SSID attribute: %m");
|
return log_debug_errno(r, "Failed to get NL80211_ATTR_SSID attribute: %m");
|
||||||
|
}
|
||||||
|
|
||||||
return r == -ENODATA ? 0 : 1;
|
return r == -ENODATA ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wifi_get_bssid(sd_netlink *genl, int ifindex, struct ether_addr *bssid) {
|
int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid) {
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL, *reply = NULL;
|
||||||
sd_genl_family family;
|
sd_genl_family family;
|
||||||
int r;
|
int r;
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <linux/nl80211.h>
|
||||||
|
|
||||||
#include "netlink-util.h"
|
#include "netlink-util.h"
|
||||||
|
|
||||||
int wifi_get_ssid(sd_netlink *genl, int ifindex, char **ssid);
|
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid);
|
||||||
int wifi_get_bssid(sd_netlink *genl, int ifindex, struct ether_addr *bssid);
|
int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid);
|
||||||
|
|
|
@ -761,10 +761,7 @@ static int expand_names(sd_bus *bus, char **names, const char* suffix, char ***r
|
||||||
char *t;
|
char *t;
|
||||||
UnitNameMangle options = UNIT_NAME_MANGLE_GLOB | (arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN);
|
UnitNameMangle options = UNIT_NAME_MANGLE_GLOB | (arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN);
|
||||||
|
|
||||||
if (suffix)
|
r = unit_name_mangle_with_suffix(*name, NULL, options, suffix ?: ".service", &t);
|
||||||
r = unit_name_mangle_with_suffix(*name, options, suffix, &t);
|
|
||||||
else
|
|
||||||
r = unit_name_mangle(*name, options, &t);
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle name: %m");
|
return log_error_errno(r, "Failed to mangle name: %m");
|
||||||
|
|
||||||
|
@ -2182,7 +2179,9 @@ static int set_default(int argc, char *argv[], void *userdata) {
|
||||||
assert(argc >= 2);
|
assert(argc >= 2);
|
||||||
assert(argv);
|
assert(argv);
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(argv[1], arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".target", &unit);
|
r = unit_name_mangle_with_suffix(argv[1], "set-default",
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
".target", &unit);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle unit name: %m");
|
return log_error_errno(r, "Failed to mangle unit name: %m");
|
||||||
|
|
||||||
|
@ -6565,7 +6564,7 @@ static int enable_sysv_units(const char *verb, char **args) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mangle_names(char **original_names, char ***mangled_names) {
|
static int mangle_names(const char *operation, char **original_names, char ***mangled_names) {
|
||||||
char **i, **l, **name;
|
char **i, **l, **name;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -6585,7 +6584,9 @@ static int mangle_names(char **original_names, char ***mangled_names) {
|
||||||
return log_oom();
|
return log_oom();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
r = unit_name_mangle(*name, arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, i);
|
r = unit_name_mangle_with_suffix(*name, operation,
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
".service", i);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
*i = NULL;
|
*i = NULL;
|
||||||
strv_free(l);
|
strv_free(l);
|
||||||
|
@ -6696,7 +6697,7 @@ static int enable_unit(int argc, char *argv[], void *userdata) {
|
||||||
if (!argv[1])
|
if (!argv[1])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = mangle_names(strv_skip(argv, 1), &names);
|
r = mangle_names("to enable", strv_skip(argv, 1), &names);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -6923,11 +6924,13 @@ static int add_dependency(int argc, char *argv[], void *userdata) {
|
||||||
if (!argv[1])
|
if (!argv[1])
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = unit_name_mangle_with_suffix(argv[1], arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN, ".target", &target);
|
r = unit_name_mangle_with_suffix(argv[1], "as target",
|
||||||
|
arg_quiet ? 0 : UNIT_NAME_MANGLE_WARN,
|
||||||
|
".target", &target);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to mangle unit name: %m");
|
return log_error_errno(r, "Failed to mangle unit name: %m");
|
||||||
|
|
||||||
r = mangle_names(strv_skip(argv, 2), &names);
|
r = mangle_names("as dependency", strv_skip(argv, 2), &names);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -7113,7 +7116,7 @@ static int unit_is_enabled(int argc, char *argv[], void *userdata) {
|
||||||
char **name;
|
char **name;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = mangle_names(strv_skip(argv, 1), &names);
|
r = mangle_names("to check", strv_skip(argv, 1), &names);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,8 @@ int sd_netlink_call_async(sd_netlink *nl, sd_netlink_slot **ret_slot, sd_netlink
|
||||||
int sd_netlink_call(sd_netlink *nl, sd_netlink_message *message, uint64_t timeout,
|
int sd_netlink_call(sd_netlink *nl, sd_netlink_message *message, uint64_t timeout,
|
||||||
sd_netlink_message **reply);
|
sd_netlink_message **reply);
|
||||||
|
|
||||||
int sd_netlink_get_events(sd_netlink *nl);
|
int sd_netlink_get_events(const sd_netlink *nl);
|
||||||
int sd_netlink_get_timeout(sd_netlink *nl, uint64_t *timeout);
|
int sd_netlink_get_timeout(const sd_netlink *nl, uint64_t *timeout);
|
||||||
int sd_netlink_process(sd_netlink *nl, sd_netlink_message **ret);
|
int sd_netlink_process(sd_netlink *nl, sd_netlink_message **ret);
|
||||||
int sd_netlink_wait(sd_netlink *nl, uint64_t timeout);
|
int sd_netlink_wait(sd_netlink *nl, uint64_t timeout);
|
||||||
|
|
||||||
|
@ -122,11 +122,11 @@ sd_netlink_message *sd_netlink_message_ref(sd_netlink_message *m);
|
||||||
sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m);
|
sd_netlink_message *sd_netlink_message_unref(sd_netlink_message *m);
|
||||||
|
|
||||||
int sd_netlink_message_request_dump(sd_netlink_message *m, int dump);
|
int sd_netlink_message_request_dump(sd_netlink_message *m, int dump);
|
||||||
int sd_netlink_message_is_error(sd_netlink_message *m);
|
int sd_netlink_message_is_error(const sd_netlink_message *m);
|
||||||
int sd_netlink_message_get_errno(sd_netlink_message *m);
|
int sd_netlink_message_get_errno(const sd_netlink_message *m);
|
||||||
int sd_netlink_message_get_type(sd_netlink_message *m, uint16_t *type);
|
int sd_netlink_message_get_type(const sd_netlink_message *m, uint16_t *type);
|
||||||
int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags);
|
int sd_netlink_message_set_flags(sd_netlink_message *m, uint16_t flags);
|
||||||
int sd_netlink_message_is_broadcast(sd_netlink_message *m);
|
int sd_netlink_message_is_broadcast(const sd_netlink_message *m);
|
||||||
|
|
||||||
/* rtnl */
|
/* rtnl */
|
||||||
|
|
||||||
|
@ -136,23 +136,23 @@ int sd_rtnl_message_new_addr(sd_netlink *nl, sd_netlink_message **ret, uint16_t
|
||||||
int sd_rtnl_message_new_route(sd_netlink *nl, sd_netlink_message **ret, uint16_t nlmsg_type, int rtm_family, unsigned char rtm_protocol);
|
int sd_rtnl_message_new_route(sd_netlink *nl, sd_netlink_message **ret, uint16_t nlmsg_type, int rtm_family, unsigned char rtm_protocol);
|
||||||
int sd_rtnl_message_new_neigh(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int nda_family);
|
int sd_rtnl_message_new_neigh(sd_netlink *nl, sd_netlink_message **ret, uint16_t msg_type, int index, int nda_family);
|
||||||
|
|
||||||
int sd_rtnl_message_get_family(sd_netlink_message *m, int *family);
|
int sd_rtnl_message_get_family(const sd_netlink_message *m, int *family);
|
||||||
|
|
||||||
int sd_rtnl_message_addr_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
int sd_rtnl_message_addr_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
||||||
int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope);
|
int sd_rtnl_message_addr_set_scope(sd_netlink_message *m, unsigned char scope);
|
||||||
int sd_rtnl_message_addr_set_flags(sd_netlink_message *m, unsigned char flags);
|
int sd_rtnl_message_addr_set_flags(sd_netlink_message *m, unsigned char flags);
|
||||||
int sd_rtnl_message_addr_get_family(sd_netlink_message *m, int *family);
|
int sd_rtnl_message_addr_get_family(const sd_netlink_message *m, int *family);
|
||||||
int sd_rtnl_message_addr_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen);
|
int sd_rtnl_message_addr_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen);
|
||||||
int sd_rtnl_message_addr_get_scope(sd_netlink_message *m, unsigned char *scope);
|
int sd_rtnl_message_addr_get_scope(const sd_netlink_message *m, unsigned char *scope);
|
||||||
int sd_rtnl_message_addr_get_flags(sd_netlink_message *m, unsigned char *flags);
|
int sd_rtnl_message_addr_get_flags(const sd_netlink_message *m, unsigned char *flags);
|
||||||
int sd_rtnl_message_addr_get_ifindex(sd_netlink_message *m, int *ifindex);
|
int sd_rtnl_message_addr_get_ifindex(const sd_netlink_message *m, int *ifindex);
|
||||||
|
|
||||||
int sd_rtnl_message_link_set_flags(sd_netlink_message *m, unsigned flags, unsigned change);
|
int sd_rtnl_message_link_set_flags(sd_netlink_message *m, unsigned flags, unsigned change);
|
||||||
int sd_rtnl_message_link_set_type(sd_netlink_message *m, unsigned type);
|
int sd_rtnl_message_link_set_type(sd_netlink_message *m, unsigned type);
|
||||||
int sd_rtnl_message_link_set_family(sd_netlink_message *m, unsigned family);
|
int sd_rtnl_message_link_set_family(sd_netlink_message *m, unsigned family);
|
||||||
int sd_rtnl_message_link_get_ifindex(sd_netlink_message *m, int *ifindex);
|
int sd_rtnl_message_link_get_ifindex(const sd_netlink_message *m, int *ifindex);
|
||||||
int sd_rtnl_message_link_get_flags(sd_netlink_message *m, unsigned *flags);
|
int sd_rtnl_message_link_get_flags(const sd_netlink_message *m, unsigned *flags);
|
||||||
int sd_rtnl_message_link_get_type(sd_netlink_message *m, unsigned short *type);
|
int sd_rtnl_message_link_get_type(const sd_netlink_message *m, unsigned short *type);
|
||||||
|
|
||||||
int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
int sd_rtnl_message_route_set_dst_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
||||||
int sd_rtnl_message_route_set_src_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
int sd_rtnl_message_route_set_src_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
||||||
|
@ -160,52 +160,52 @@ int sd_rtnl_message_route_set_scope(sd_netlink_message *m, unsigned char scope);
|
||||||
int sd_rtnl_message_route_set_flags(sd_netlink_message *m, unsigned flags);
|
int sd_rtnl_message_route_set_flags(sd_netlink_message *m, unsigned flags);
|
||||||
int sd_rtnl_message_route_set_table(sd_netlink_message *m, unsigned char table);
|
int sd_rtnl_message_route_set_table(sd_netlink_message *m, unsigned char table);
|
||||||
int sd_rtnl_message_route_set_type(sd_netlink_message *m, unsigned char type);
|
int sd_rtnl_message_route_set_type(sd_netlink_message *m, unsigned char type);
|
||||||
int sd_rtnl_message_route_get_flags(sd_netlink_message *m, unsigned *flags);
|
int sd_rtnl_message_route_get_flags(const sd_netlink_message *m, unsigned *flags);
|
||||||
int sd_rtnl_message_route_get_family(sd_netlink_message *m, int *family);
|
int sd_rtnl_message_route_get_family(const sd_netlink_message *m, int *family);
|
||||||
int sd_rtnl_message_route_set_family(sd_netlink_message *m, int family);
|
int sd_rtnl_message_route_set_family(sd_netlink_message *m, int family);
|
||||||
int sd_rtnl_message_route_get_protocol(sd_netlink_message *m, unsigned char *protocol);
|
int sd_rtnl_message_route_get_protocol(const sd_netlink_message *m, unsigned char *protocol);
|
||||||
int sd_rtnl_message_route_get_scope(sd_netlink_message *m, unsigned char *scope);
|
int sd_rtnl_message_route_get_scope(const sd_netlink_message *m, unsigned char *scope);
|
||||||
int sd_rtnl_message_route_get_tos(sd_netlink_message *m, unsigned char *tos);
|
int sd_rtnl_message_route_get_tos(const sd_netlink_message *m, unsigned char *tos);
|
||||||
int sd_rtnl_message_route_get_table(sd_netlink_message *m, unsigned char *table);
|
int sd_rtnl_message_route_get_table(const sd_netlink_message *m, unsigned char *table);
|
||||||
int sd_rtnl_message_route_get_dst_prefixlen(sd_netlink_message *m, unsigned char *dst_len);
|
int sd_rtnl_message_route_get_dst_prefixlen(const sd_netlink_message *m, unsigned char *dst_len);
|
||||||
int sd_rtnl_message_route_get_src_prefixlen(sd_netlink_message *m, unsigned char *src_len);
|
int sd_rtnl_message_route_get_src_prefixlen(const sd_netlink_message *m, unsigned char *src_len);
|
||||||
int sd_rtnl_message_route_get_type(sd_netlink_message *m, unsigned char *type);
|
int sd_rtnl_message_route_get_type(const sd_netlink_message *m, unsigned char *type);
|
||||||
|
|
||||||
int sd_rtnl_message_new_nexthop(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nhmsg_type, int nh_family, unsigned char nh_protocol);
|
int sd_rtnl_message_new_nexthop(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nhmsg_type, int nh_family, unsigned char nh_protocol);
|
||||||
|
|
||||||
int sd_rtnl_message_nexthop_set_flags(sd_netlink_message *m, uint8_t flags);
|
int sd_rtnl_message_nexthop_set_flags(sd_netlink_message *m, uint8_t flags);
|
||||||
int sd_rtnl_message_nexthop_set_family(sd_netlink_message *m, uint8_t family);
|
int sd_rtnl_message_nexthop_set_family(sd_netlink_message *m, uint8_t family);
|
||||||
int sd_rtnl_message_nexthop_get_family(sd_netlink_message *m, uint8_t *family);
|
int sd_rtnl_message_nexthop_get_family(const sd_netlink_message *m, uint8_t *family);
|
||||||
|
|
||||||
int sd_rtnl_message_neigh_set_flags(sd_netlink_message *m, uint8_t flags);
|
int sd_rtnl_message_neigh_set_flags(sd_netlink_message *m, uint8_t flags);
|
||||||
int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state);
|
int sd_rtnl_message_neigh_set_state(sd_netlink_message *m, uint16_t state);
|
||||||
int sd_rtnl_message_neigh_get_family(sd_netlink_message *m, int *family);
|
int sd_rtnl_message_neigh_get_family(const sd_netlink_message *m, int *family);
|
||||||
int sd_rtnl_message_neigh_get_ifindex(sd_netlink_message *m, int *family);
|
int sd_rtnl_message_neigh_get_ifindex(const sd_netlink_message *m, int *family);
|
||||||
int sd_rtnl_message_neigh_get_state(sd_netlink_message *m, uint16_t *state);
|
int sd_rtnl_message_neigh_get_state(const sd_netlink_message *m, uint16_t *state);
|
||||||
int sd_rtnl_message_neigh_get_flags(sd_netlink_message *m, uint8_t *flags);
|
int sd_rtnl_message_neigh_get_flags(const sd_netlink_message *m, uint8_t *flags);
|
||||||
|
|
||||||
int sd_rtnl_message_new_addrlabel(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifindex, int ifal_family);
|
int sd_rtnl_message_new_addrlabel(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifindex, int ifal_family);
|
||||||
int sd_rtnl_message_addrlabel_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
int sd_rtnl_message_addrlabel_set_prefixlen(sd_netlink_message *m, unsigned char prefixlen);
|
||||||
int sd_rtnl_message_addrlabel_get_prefixlen(sd_netlink_message *m, unsigned char *prefixlen);
|
int sd_rtnl_message_addrlabel_get_prefixlen(const sd_netlink_message *m, unsigned char *prefixlen);
|
||||||
|
|
||||||
int sd_rtnl_message_new_routing_policy_rule(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifal_family);
|
int sd_rtnl_message_new_routing_policy_rule(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int ifal_family);
|
||||||
int sd_rtnl_message_routing_policy_rule_set_tos(sd_netlink_message *m, unsigned char tos);
|
int sd_rtnl_message_routing_policy_rule_set_tos(sd_netlink_message *m, unsigned char tos);
|
||||||
int sd_rtnl_message_routing_policy_rule_get_tos(sd_netlink_message *m, unsigned char *tos);
|
int sd_rtnl_message_routing_policy_rule_get_tos(const sd_netlink_message *m, unsigned char *tos);
|
||||||
int sd_rtnl_message_routing_policy_rule_set_table(sd_netlink_message *m, unsigned char table);
|
int sd_rtnl_message_routing_policy_rule_set_table(sd_netlink_message *m, unsigned char table);
|
||||||
int sd_rtnl_message_routing_policy_rule_get_table(sd_netlink_message *m, unsigned char *table);
|
int sd_rtnl_message_routing_policy_rule_get_table(const sd_netlink_message *m, unsigned char *table);
|
||||||
int sd_rtnl_message_routing_policy_rule_set_rtm_src_prefixlen(sd_netlink_message *m, unsigned char len);
|
int sd_rtnl_message_routing_policy_rule_set_rtm_src_prefixlen(sd_netlink_message *m, unsigned char len);
|
||||||
int sd_rtnl_message_routing_policy_rule_get_rtm_src_prefixlen(sd_netlink_message *m, unsigned char *len);
|
int sd_rtnl_message_routing_policy_rule_get_rtm_src_prefixlen(const sd_netlink_message *m, unsigned char *len);
|
||||||
int sd_rtnl_message_routing_policy_rule_set_rtm_dst_prefixlen(sd_netlink_message *m, unsigned char len);
|
int sd_rtnl_message_routing_policy_rule_set_rtm_dst_prefixlen(sd_netlink_message *m, unsigned char len);
|
||||||
int sd_rtnl_message_routing_policy_rule_get_rtm_dst_prefixlen(sd_netlink_message *m, unsigned char *len);
|
int sd_rtnl_message_routing_policy_rule_get_rtm_dst_prefixlen(const sd_netlink_message *m, unsigned char *len);
|
||||||
int sd_rtnl_message_routing_policy_rule_set_rtm_type(sd_netlink_message *m, unsigned char type);
|
int sd_rtnl_message_routing_policy_rule_set_rtm_type(sd_netlink_message *m, unsigned char type);
|
||||||
int sd_rtnl_message_routing_policy_rule_get_rtm_type(sd_netlink_message *m, unsigned char *type);
|
int sd_rtnl_message_routing_policy_rule_get_rtm_type(const sd_netlink_message *m, unsigned char *type);
|
||||||
int sd_rtnl_message_routing_policy_rule_set_flags(sd_netlink_message *m, unsigned flags);
|
int sd_rtnl_message_routing_policy_rule_set_flags(sd_netlink_message *m, unsigned flags);
|
||||||
int sd_rtnl_message_routing_policy_rule_get_flags(sd_netlink_message *m, unsigned *flags);
|
int sd_rtnl_message_routing_policy_rule_get_flags(const sd_netlink_message *m, unsigned *flags);
|
||||||
|
|
||||||
/* genl */
|
/* genl */
|
||||||
int sd_genl_socket_open(sd_netlink **nl);
|
int sd_genl_socket_open(sd_netlink **nl);
|
||||||
int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **m);
|
int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **m);
|
||||||
int sd_genl_message_get_family(sd_netlink *nl, sd_netlink_message *m, sd_genl_family *family);
|
int sd_genl_message_get_family(const sd_netlink *nl, const sd_netlink_message *m, sd_genl_family *family);
|
||||||
|
|
||||||
/* slot */
|
/* slot */
|
||||||
sd_netlink_slot *sd_netlink_slot_ref(sd_netlink_slot *nl);
|
sd_netlink_slot *sd_netlink_slot_ref(sd_netlink_slot *nl);
|
||||||
|
@ -214,11 +214,11 @@ sd_netlink_slot *sd_netlink_slot_unref(sd_netlink_slot *nl);
|
||||||
sd_netlink *sd_netlink_slot_get_netlink(sd_netlink_slot *slot);
|
sd_netlink *sd_netlink_slot_get_netlink(sd_netlink_slot *slot);
|
||||||
void *sd_netlink_slot_get_userdata(sd_netlink_slot *slot);
|
void *sd_netlink_slot_get_userdata(sd_netlink_slot *slot);
|
||||||
void *sd_netlink_slot_set_userdata(sd_netlink_slot *slot, void *userdata);
|
void *sd_netlink_slot_set_userdata(sd_netlink_slot *slot, void *userdata);
|
||||||
int sd_netlink_slot_get_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t *callback);
|
int sd_netlink_slot_get_destroy_callback(const sd_netlink_slot *slot, sd_netlink_destroy_t *callback);
|
||||||
int sd_netlink_slot_set_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t callback);
|
int sd_netlink_slot_set_destroy_callback(sd_netlink_slot *slot, sd_netlink_destroy_t callback);
|
||||||
int sd_netlink_slot_get_floating(sd_netlink_slot *slot);
|
int sd_netlink_slot_get_floating(const sd_netlink_slot *slot);
|
||||||
int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b);
|
int sd_netlink_slot_set_floating(sd_netlink_slot *slot, int b);
|
||||||
int sd_netlink_slot_get_description(sd_netlink_slot *slot, const char **description);
|
int sd_netlink_slot_get_description(const sd_netlink_slot *slot, const char **description);
|
||||||
int sd_netlink_slot_set_description(sd_netlink_slot *slot, const char *description);
|
int sd_netlink_slot_set_description(sd_netlink_slot *slot, const char *description);
|
||||||
|
|
||||||
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref);
|
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_netlink, sd_netlink_unref);
|
||||||
|
|
|
@ -242,8 +242,8 @@ int link_config_get(link_config_ctx *ctx, sd_device *device, link_config **ret)
|
||||||
|
|
||||||
LIST_FOREACH(links, link, ctx->links) {
|
LIST_FOREACH(links, link, ctx->links) {
|
||||||
if (net_match_config(link->match_mac, link->match_path, link->match_driver,
|
if (net_match_config(link->match_mac, link->match_path, link->match_driver,
|
||||||
link->match_type, link->match_name, link->match_property, NULL, NULL,
|
link->match_type, link->match_name, link->match_property, NULL, NULL, NULL,
|
||||||
device, NULL, NULL, NULL, NULL)) {
|
device, NULL, NULL, 0, NULL, NULL)) {
|
||||||
if (link->match_name && !strv_contains(link->match_name, "*")) {
|
if (link->match_name && !strv_contains(link->match_name, "*")) {
|
||||||
unsigned name_assign_type = NET_NAME_UNKNOWN;
|
unsigned name_assign_type = NET_NAME_UNKNOWN;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ Type=
|
||||||
Driver=
|
Driver=
|
||||||
Architecture=
|
Architecture=
|
||||||
Path=
|
Path=
|
||||||
|
WLANInterfaceType=
|
||||||
SSID=
|
SSID=
|
||||||
BSSID=
|
BSSID=
|
||||||
Name=
|
Name=
|
||||||
|
|
Loading…
Reference in New Issue