1
0
mirror of https://github.com/systemd/systemd synced 2025-09-28 08:14:46 +02:00

Compare commits

...

10 Commits

Author SHA1 Message Date
Tad Fisher
712fffd4b8 hwdb.d/70-mouse.hwdb: add entry for ELECOM Huge TrackBall 2021-01-12 14:27:09 +09:00
Yu Watanabe
0375cb546f
Merge pull request #18209 from poettering/virt-fix
three minor fixes to virt.c
2021-01-12 14:24:37 +09:00
Yu Watanabe
1536b7b2d0 network: introduce new UseAddress= setting in [DHCPv6] section
If it is disabled, then the addresses provided by the DHCPv6 server will
be ignored.

Closes #18203.
2021-01-12 14:19:03 +09:00
Yu Watanabe
e2645ca619
Merge pull request #18204 from yuwata/wifi-util-fix-18059
wifi-util: do not ignore wifi iftype when the interface does not have SSID
2021-01-12 14:18:24 +09:00
igo95862
5adfb06d55 docs: mesonconf is not a valid command, meson configure is
Meson documentation for `meson configure`
https://mesonbuild.com/Commands.html#configure
2021-01-12 14:17:48 +09:00
Lennart Poettering
79efcd0235 virt: fix path mentioned in log message 2021-01-11 21:10:55 +01:00
Lennart Poettering
b7ec9e719b virt: debug log on unexpected error conditions
Let's make this more debuggable by logging if we look for something and
get any error other than ENOENT back.
2021-01-11 21:10:51 +01:00
Lennart Poettering
a7e508f899 virt: merge three variable declarations 2021-01-11 21:10:24 +01:00
Yu Watanabe
a66a402da4 wifi-util: do not ignore wifi iftype when SSID is not set
Previously, if an interface does not have SSID, e.g. run in mesh-point
type, then the wifi iftype obtained by the netlink call was ignored.

Fixes #18059.
2021-01-12 01:12:37 +09:00
Yu Watanabe
a533007815 wifi-util: cleanup header inclusion 2021-01-12 01:11:50 +09:00
11 changed files with 67 additions and 30 deletions

4
README
View File

@ -192,8 +192,8 @@ REQUIREMENTS:
Any configuration options can be specified as -Darg=value... arguments Any configuration options can be specified as -Darg=value... arguments
to meson. After the build directory is initially configured, meson will to meson. After the build directory is initially configured, meson will
refuse to run again, and options must be changed with: refuse to run again, and options must be changed with:
mesonconf -Darg=value... meson configure -Darg=value build/
mesonconf without any arguments will print out available options and meson configure without any arguments will print out available options and
their current values. their current values.
Useful commands: Useful commands:

View File

@ -190,6 +190,14 @@ mouse:usb:v413cp301a:name:PixArt Dell MS116 USB Optical Mouse:*
mouse:usb:v0461p4d46:name:USB Optical Mouse:* mouse:usb:v0461p4d46:name:USB Optical Mouse:*
MOUSE_DPI=1000@125 MOUSE_DPI=1000@125
##########################################
# Elecom
#########################################
# Elecom HUGE TrackBall (M-HT1DR)
mouse:usb:v056ep010d:name:ELECOM TrackBall Mouse HUGE TrackBall:*
MOUSE_DPI=500@125 *1000@125 1500@125
########################################## ##########################################
# Fujitsu Siemens # Fujitsu Siemens
########################################## ##########################################

View File

@ -1866,6 +1866,14 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
<varname>DHCP=</varname> setting described above, or invoked by the IPv6 Router Advertisement:</para> <varname>DHCP=</varname> setting described above, or invoked by the IPv6 Router Advertisement:</para>
<variablelist class='network-directives'> <variablelist class='network-directives'>
<varlistentry>
<term><varname>UseAddress=</varname></term>
<listitem>
<para>When true (the default), the IP addresses provided by the DHCPv6 server will be
assigned.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>UseDNS=</varname></term> <term><varname>UseDNS=</varname></term>
<term><varname>UseNTP=</varname></term> <term><varname>UseNTP=</varname></term>

View File

@ -456,9 +456,7 @@ DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(container, int);
int detect_container(void) { int detect_container(void) {
static thread_local int cached_found = _VIRTUALIZATION_INVALID; static thread_local int cached_found = _VIRTUALIZATION_INVALID;
_cleanup_free_ char *m = NULL; _cleanup_free_ char *m = NULL, *o = NULL, *p = NULL;
_cleanup_free_ char *o = NULL;
_cleanup_free_ char *p = NULL;
const char *e = NULL; const char *e = NULL;
int r; int r;
@ -466,16 +464,23 @@ int detect_container(void) {
return cached_found; return cached_found;
/* /proc/vz exists in container and outside of the container, /proc/bc only outside of the container. */ /* /proc/vz exists in container and outside of the container, /proc/bc only outside of the container. */
if (access("/proc/vz", F_OK) >= 0 && if (access("/proc/vz", F_OK) < 0) {
access("/proc/bc", F_OK) < 0) { if (errno != ENOENT)
log_debug_errno(errno, "Failed to check if /proc/vz exists, ignoring: %m");
} else if (access("/proc/bc", F_OK) < 0) {
if (errno == ENOENT) {
r = VIRTUALIZATION_OPENVZ; r = VIRTUALIZATION_OPENVZ;
goto finish; goto finish;
} }
log_debug_errno(errno, "Failed to check if /proc/bc exists, ignoring: %m");
}
/* "Official" way of detecting WSL https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364 */ /* "Official" way of detecting WSL https://github.com/Microsoft/WSL/issues/423#issuecomment-221627364 */
r = read_one_line_file("/proc/sys/kernel/osrelease", &o); r = read_one_line_file("/proc/sys/kernel/osrelease", &o);
if (r >= 0 && if (r < 0)
(strstr(o, "Microsoft") || strstr(o, "WSL"))) { log_debug_errno(r, "Failed to read /proc/sys/kernel/osrelease, ignoring: %m");
else if (strstr(o, "Microsoft") || strstr(o, "WSL")) {
r = VIRTUALIZATION_WSL; r = VIRTUALIZATION_WSL;
goto finish; goto finish;
} }
@ -484,21 +489,30 @@ int detect_container(void) {
* invocation without worrying about it being elsewhere. * invocation without worrying about it being elsewhere.
*/ */
r = get_proc_field("/proc/self/status", "TracerPid", WHITESPACE, &p); r = get_proc_field("/proc/self/status", "TracerPid", WHITESPACE, &p);
if (r == 0 && !streq(p, "0")) { if (r < 0)
log_debug_errno(r, "Failed to read our own trace PID, ignoring: %m");
else if (!streq(p, "0")) {
pid_t ptrace_pid; pid_t ptrace_pid;
r = parse_pid(p, &ptrace_pid); r = parse_pid(p, &ptrace_pid);
if (r == 0) { if (r < 0)
const char *pf = procfs_file_alloca(ptrace_pid, "comm"); log_debug_errno(r, "Failed to parse our own tracer PID, ignoring: %m");
else {
_cleanup_free_ char *ptrace_comm = NULL; _cleanup_free_ char *ptrace_comm = NULL;
const char *pf;
pf = procfs_file_alloca(ptrace_pid, "comm");
r = read_one_line_file(pf, &ptrace_comm); r = read_one_line_file(pf, &ptrace_comm);
if (r >= 0 && startswith(ptrace_comm, "proot")) { if (r < 0)
log_debug_errno(r, "Failed to read %s, ignoring: %m", pf);
else if (startswith(ptrace_comm, "proot")) {
r = VIRTUALIZATION_PROOT; r = VIRTUALIZATION_PROOT;
goto finish; goto finish;
} }
} }
} }
/* The container manager might have placed this in the /run/host hierarchy for us, which is best /* The container manager might have placed this in the /run/host/ hierarchy for us, which is best
* because we can be consumed just like that, without special privileges. */ * because we can be consumed just like that, without special privileges. */
r = read_one_line_file("/run/host/container-manager", &m); r = read_one_line_file("/run/host/container-manager", &m);
if (r > 0) { if (r > 0) {
@ -506,7 +520,7 @@ int detect_container(void) {
goto translate_name; goto translate_name;
} }
if (!IN_SET(r, -ENOENT, 0)) if (!IN_SET(r, -ENOENT, 0))
return log_debug_errno(r, "Failed to read /run/systemd/container-manager: %m"); return log_debug_errno(r, "Failed to read /run/host/container-manager: %m");
if (getpid_cached() == 1) { if (getpid_cached() == 1) {
/* If we are PID 1 we can just check our own environment variable, and that's authoritative. /* If we are PID 1 we can just check our own environment variable, and that's authoritative.

View File

@ -1078,8 +1078,12 @@ static int dhcp6_address_acquired(Link *link) {
int r; int r;
assert(link); assert(link);
assert(link->network);
assert(link->dhcp6_lease); assert(link->dhcp6_lease);
if (!link->network->dhcp6_use_address)
return 0;
for (sd_dhcp6_lease_reset_address_iter(link->dhcp6_lease);;) { for (sd_dhcp6_lease_reset_address_iter(link->dhcp6_lease);;) {
uint32_t lifetime_preferred, lifetime_valid; uint32_t lifetime_preferred, lifetime_valid;
struct in6_addr ip6_addr; struct in6_addr ip6_addr;

View File

@ -221,6 +221,7 @@ DHCPv4.SendOption, config_parse_dhcp_send_option,
DHCPv4.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_vendor_options) DHCPv4.SendVendorOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_vendor_options)
DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu) DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu)
DHCPv4.FallbackLeaseLifetimeSec, config_parse_dhcp_fallback_lease_lifetime, 0, 0 DHCPv4.FallbackLeaseLifetimeSec, config_parse_dhcp_fallback_lease_lifetime, 0, 0
DHCPv6.UseAddress, config_parse_bool, 0, offsetof(Network, dhcp6_use_address)
DHCPv6.UseDNS, config_parse_dhcp_use_dns, 0, 0 DHCPv6.UseDNS, config_parse_dhcp_use_dns, 0, 0
DHCPv6.UseNTP, config_parse_dhcp_use_ntp, 0, 0 DHCPv6.UseNTP, config_parse_dhcp_use_ntp, 0, 0
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, dhcp6_rapid_commit) DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, dhcp6_rapid_commit)

View File

@ -352,10 +352,11 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.dhcp_use_timezone = false, .dhcp_use_timezone = false,
.dhcp_ip_service_type = -1, .dhcp_ip_service_type = -1,
.dhcp6_use_address = true,
.dhcp6_use_dns = true,
.dhcp6_use_ntp = true,
.dhcp6_rapid_commit = true, .dhcp6_rapid_commit = true,
.dhcp6_route_metric = DHCP_ROUTE_METRIC, .dhcp6_route_metric = DHCP_ROUTE_METRIC,
.dhcp6_use_ntp = true,
.dhcp6_use_dns = true,
.dhcp6_pd = -1, .dhcp6_pd = -1,
.dhcp6_pd_announce = true, .dhcp6_pd_announce = true,

View File

@ -146,6 +146,7 @@ struct Network {
OrderedHashmap *dhcp_client_send_vendor_options; OrderedHashmap *dhcp_client_send_vendor_options;
/* DHCPv6 Client support*/ /* DHCPv6 Client support*/
bool dhcp6_use_address;
bool dhcp6_use_dns; bool dhcp6_use_dns;
bool dhcp6_use_dns_set; bool dhcp6_use_dns_set;
bool dhcp6_use_ntp; bool dhcp6_use_ntp;

View File

@ -1,12 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <net/ethernet.h>
#include <linux/nl80211.h>
#include "sd-bus.h"
#include "log.h" #include "log.h"
#include "netlink-util.h"
#include "wifi-util.h" #include "wifi-util.h"
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid) { int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid) {
@ -35,8 +29,10 @@ int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftyp
} }
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to request information about wifi interface %d: %m", ifindex); return log_debug_errno(r, "Failed to request information about wifi interface %d: %m", ifindex);
if (!reply) if (!reply) {
log_debug_errno(r, "No reply received to request for information about wifi interface %d, ignoring.", ifindex);
goto nodata; goto nodata;
}
r = sd_netlink_message_get_errno(reply); r = sd_netlink_message_get_errno(reply);
if (r < 0) if (r < 0)
@ -62,8 +58,8 @@ int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftyp
if (ssid) { 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 == -ENODATA) if (r == -ENODATA)
goto nodata; *ssid = NULL;
if (r < 0) else if (r < 0)
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");
} }
@ -101,8 +97,10 @@ int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid) {
r = sd_netlink_call(genl, m, 0, &reply); r = sd_netlink_call(genl, m, 0, &reply);
if (r < 0) if (r < 0)
return log_debug_errno(r, "Failed to request information about wifi station: %m"); return log_debug_errno(r, "Failed to request information about wifi station: %m");
if (!reply) if (!reply) {
log_debug_errno(r, "No reply received to request for information about wifi station, ignoring.");
goto nodata; goto nodata;
}
r = sd_netlink_message_get_errno(reply); r = sd_netlink_message_get_errno(reply);
if (r < 0) if (r < 0)

View File

@ -3,8 +3,9 @@
#pragma once #pragma once
#include <linux/nl80211.h> #include <linux/nl80211.h>
#include <net/ethernet.h>
#include "netlink-util.h" #include "sd-netlink.h"
int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid); int wifi_get_interface(sd_netlink *genl, int ifindex, enum nl80211_iftype *iftype, char **ssid);
int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid); int wifi_get_station(sd_netlink *genl, int ifindex, struct ether_addr *bssid);

View File

@ -125,6 +125,7 @@ MUDURL=
RouteMTUBytes= RouteMTUBytes=
FallbackLeaseLifetimeSec= FallbackLeaseLifetimeSec=
[DHCPv6] [DHCPv6]
UseAddress=
UseNTP= UseNTP=
UseDNS= UseDNS=
RapidCommit= RapidCommit=