mirror of
https://github.com/systemd/systemd
synced 2026-04-21 06:24:49 +02:00
Compare commits
No commits in common. "f370708084bf0d81e43360db103a44cbd2ed4aad" and "0234f0c0531682e7f28a4ef51852c102c6e97267" have entirely different histories.
f370708084
...
0234f0c053
@ -21,9 +21,9 @@ actions:
|
|||||||
# Drop the "sources" file so rebase-helper doesn't think we're a dist-git
|
# Drop the "sources" file so rebase-helper doesn't think we're a dist-git
|
||||||
- "rm -fv .packit_rpm/sources"
|
- "rm -fv .packit_rpm/sources"
|
||||||
# Drop backported patches from the specfile, but keep the downstream-only ones
|
# Drop backported patches from the specfile, but keep the downstream-only ones
|
||||||
# - Patch(0000-0499): backported patches from upstream
|
# - Patch0000-0499: backported patches from upstream
|
||||||
# - Patch0500-9999: downstream-only patches
|
# - Patch0500-9999: downstream-only patches
|
||||||
- "sed -ri '/^Patch(0[0-4]?[0-9]{0,2})?\\:.+\\.patch/d' .packit_rpm/systemd.spec"
|
- "sed -ri '/^Patch0[0-4]?[0-9]{0,2}\\:.+\\.patch/d' .packit_rpm/systemd.spec"
|
||||||
# Build the RPM with --werror. Even though --werror doesn't work in all
|
# Build the RPM with --werror. Even though --werror doesn't work in all
|
||||||
# cases (see [0]), we can't use -Dc_args=/-Dcpp_args= here because of the
|
# cases (see [0]), we can't use -Dc_args=/-Dcpp_args= here because of the
|
||||||
# RPM hardening macros, that use $CFLAGS/$CPPFLAGS (see [1]).
|
# RPM hardening macros, that use $CFLAGS/$CPPFLAGS (see [1]).
|
||||||
|
|||||||
@ -178,20 +178,6 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry id='kind'>
|
|
||||||
<term><varname>Kind=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>A whitespace-separated list of shell-style globs matching the device kind, as exposed by
|
|
||||||
<command>networkctl status <replaceable>INTERFACE</replaceable></command> or
|
|
||||||
<command>ip -d link show <replaceable>INTERFACE</replaceable></command>. If the list is
|
|
||||||
prefixed with a "!", the test is inverted. Some valid values are <literal>bond</literal>,
|
|
||||||
<literal>bridge</literal>, <literal>gre</literal>, <literal>tun</literal>,
|
|
||||||
<literal>veth</literal>. Valid kinds are given by netlink's <literal>IFLA_INFO_KIND</literal>
|
|
||||||
attribute, so this is not comprehensive.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry id='property'>
|
<varlistentry id='property'>
|
||||||
<term><varname>Property=</varname></term>
|
<term><varname>Property=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|||||||
@ -85,7 +85,6 @@
|
|||||||
<xi:include href="systemd.link.xml" xpointer="path" />
|
<xi:include href="systemd.link.xml" xpointer="path" />
|
||||||
<xi:include href="systemd.link.xml" xpointer="driver" />
|
<xi:include href="systemd.link.xml" xpointer="driver" />
|
||||||
<xi:include href="systemd.link.xml" xpointer="type" />
|
<xi:include href="systemd.link.xml" xpointer="type" />
|
||||||
<xi:include href="systemd.link.xml" xpointer="kind" />
|
|
||||||
<xi:include href="systemd.link.xml" xpointer="property" />
|
<xi:include href="systemd.link.xml" xpointer="property" />
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|||||||
@ -64,7 +64,6 @@ Packages=
|
|||||||
# Run `autoload -Uz compinit; compinit` from a zsh shell in the booted image to enable completions.
|
# Run `autoload -Uz compinit; compinit` from a zsh shell in the booted image to enable completions.
|
||||||
zsh
|
zsh
|
||||||
# Required to run systemd-networkd-tests.py
|
# Required to run systemd-networkd-tests.py
|
||||||
python
|
|
||||||
iproute
|
iproute
|
||||||
dnsmasq
|
dnsmasq
|
||||||
wireguard-tools
|
wireguard-tools
|
||||||
|
|||||||
@ -73,9 +73,3 @@ Packages=
|
|||||||
locales
|
locales
|
||||||
nano
|
nano
|
||||||
strace
|
strace
|
||||||
# Required to run systemd-networkd-tests.py
|
|
||||||
python3
|
|
||||||
iproute2
|
|
||||||
dnsmasq-base
|
|
||||||
wireguard-tools
|
|
||||||
isc-dhcp-server
|
|
||||||
|
|||||||
@ -76,7 +76,6 @@ Packages=
|
|||||||
e2fsprogs
|
e2fsprogs
|
||||||
compsize
|
compsize
|
||||||
# Required to run systemd-networkd-tests.py
|
# Required to run systemd-networkd-tests.py
|
||||||
python
|
|
||||||
iproute
|
iproute
|
||||||
iproute-tc
|
iproute-tc
|
||||||
dnsmasq
|
dnsmasq
|
||||||
|
|||||||
@ -71,9 +71,3 @@ Packages=
|
|||||||
locales
|
locales
|
||||||
nano
|
nano
|
||||||
strace
|
strace
|
||||||
# Required to run systemd-networkd-tests.py
|
|
||||||
python3
|
|
||||||
iproute2
|
|
||||||
dnsmasq-base
|
|
||||||
wireguard-tools
|
|
||||||
isc-dhcp-server
|
|
||||||
|
|||||||
@ -366,13 +366,11 @@ int rtnl_get_link_info(
|
|||||||
int ifindex,
|
int ifindex,
|
||||||
unsigned short *ret_iftype,
|
unsigned short *ret_iftype,
|
||||||
unsigned *ret_flags,
|
unsigned *ret_flags,
|
||||||
char **ret_kind,
|
|
||||||
struct hw_addr_data *ret_hw_addr,
|
struct hw_addr_data *ret_hw_addr,
|
||||||
struct hw_addr_data *ret_permanent_hw_addr) {
|
struct hw_addr_data *ret_permanent_hw_addr) {
|
||||||
|
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL, *reply = NULL;
|
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL, *reply = NULL;
|
||||||
struct hw_addr_data addr = HW_ADDR_NULL, perm_addr = HW_ADDR_NULL;
|
struct hw_addr_data addr = HW_ADDR_NULL, perm_addr = HW_ADDR_NULL;
|
||||||
_cleanup_free_ char *kind = NULL;
|
|
||||||
unsigned short iftype;
|
unsigned short iftype;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
int r;
|
int r;
|
||||||
@ -411,19 +409,6 @@ int rtnl_get_link_info(
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret_kind) {
|
|
||||||
r = sd_netlink_message_enter_container(reply, IFLA_LINKINFO);
|
|
||||||
if (r >= 0) {
|
|
||||||
r = sd_netlink_message_read_string_strdup(reply, IFLA_INFO_KIND, &kind);
|
|
||||||
if (r < 0 && r != -ENODATA)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = sd_netlink_message_exit_container(reply);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret_hw_addr) {
|
if (ret_hw_addr) {
|
||||||
r = netlink_message_read_hw_addr(reply, IFLA_ADDRESS, &addr);
|
r = netlink_message_read_hw_addr(reply, IFLA_ADDRESS, &addr);
|
||||||
if (r < 0 && r != -ENODATA)
|
if (r < 0 && r != -ENODATA)
|
||||||
@ -440,8 +425,6 @@ int rtnl_get_link_info(
|
|||||||
*ret_iftype = iftype;
|
*ret_iftype = iftype;
|
||||||
if (ret_flags)
|
if (ret_flags)
|
||||||
*ret_flags = flags;
|
*ret_flags = flags;
|
||||||
if (ret_kind)
|
|
||||||
*ret_kind = TAKE_PTR(kind);
|
|
||||||
if (ret_hw_addr)
|
if (ret_hw_addr)
|
||||||
*ret_hw_addr = addr;
|
*ret_hw_addr = addr;
|
||||||
if (ret_permanent_hw_addr)
|
if (ret_permanent_hw_addr)
|
||||||
|
|||||||
@ -94,7 +94,6 @@ int rtnl_get_link_info(
|
|||||||
int ifindex,
|
int ifindex,
|
||||||
unsigned short *ret_iftype,
|
unsigned short *ret_iftype,
|
||||||
unsigned *ret_flags,
|
unsigned *ret_flags,
|
||||||
char **ret_kind,
|
|
||||||
struct hw_addr_data *ret_hw_addr,
|
struct hw_addr_data *ret_hw_addr,
|
||||||
struct hw_addr_data *ret_permanent_hw_addr);
|
struct hw_addr_data *ret_permanent_hw_addr);
|
||||||
|
|
||||||
|
|||||||
@ -263,7 +263,7 @@ typedef struct VxLanInfo {
|
|||||||
|
|
||||||
typedef struct LinkInfo {
|
typedef struct LinkInfo {
|
||||||
char name[IFNAMSIZ+1];
|
char name[IFNAMSIZ+1];
|
||||||
char *netdev_kind;
|
char netdev_kind[NETDEV_KIND_MAX];
|
||||||
sd_device *sd_device;
|
sd_device *sd_device;
|
||||||
int ifindex;
|
int ifindex;
|
||||||
unsigned short iftype;
|
unsigned short iftype;
|
||||||
@ -364,7 +364,6 @@ static int link_info_compare(const LinkInfo *a, const LinkInfo *b) {
|
|||||||
static LinkInfo* link_info_array_free(LinkInfo *array) {
|
static LinkInfo* link_info_array_free(LinkInfo *array) {
|
||||||
for (unsigned i = 0; array && array[i].needs_freeing; i++) {
|
for (unsigned i = 0; array && array[i].needs_freeing; i++) {
|
||||||
sd_device_unref(array[i].sd_device);
|
sd_device_unref(array[i].sd_device);
|
||||||
free(array[i].netdev_kind);
|
|
||||||
free(array[i].ssid);
|
free(array[i].ssid);
|
||||||
free(array[i].qdisc);
|
free(array[i].qdisc);
|
||||||
strv_free(array[i].alternative_names);
|
strv_free(array[i].alternative_names);
|
||||||
@ -375,6 +374,7 @@ static LinkInfo* link_info_array_free(LinkInfo *array) {
|
|||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(LinkInfo*, link_info_array_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(LinkInfo*, link_info_array_free);
|
||||||
|
|
||||||
static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
||||||
|
const char *received_kind;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
@ -384,17 +384,15 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = sd_netlink_message_read_string_strdup(m, IFLA_INFO_KIND, &info->netdev_kind);
|
r = sd_netlink_message_read_string(m, IFLA_INFO_KIND, &received_kind);
|
||||||
if (r < 0) {
|
if (r < 0)
|
||||||
(void) sd_netlink_message_exit_container(m);
|
|
||||||
return r;
|
return r;
|
||||||
}
|
|
||||||
|
|
||||||
r = sd_netlink_message_enter_container(m, IFLA_INFO_DATA);
|
r = sd_netlink_message_enter_container(m, IFLA_INFO_DATA);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (streq(info->netdev_kind, "bridge")) {
|
if (streq(received_kind, "bridge")) {
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_BR_FORWARD_DELAY, &info->forward_delay);
|
(void) sd_netlink_message_read_u32(m, IFLA_BR_FORWARD_DELAY, &info->forward_delay);
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_BR_HELLO_TIME, &info->hello_time);
|
(void) sd_netlink_message_read_u32(m, IFLA_BR_HELLO_TIME, &info->hello_time);
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_BR_MAX_AGE, &info->max_age);
|
(void) sd_netlink_message_read_u32(m, IFLA_BR_MAX_AGE, &info->max_age);
|
||||||
@ -404,12 +402,12 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
|||||||
(void) sd_netlink_message_read_u16(m, IFLA_BR_PRIORITY, &info->priority);
|
(void) sd_netlink_message_read_u16(m, IFLA_BR_PRIORITY, &info->priority);
|
||||||
(void) sd_netlink_message_read_u8(m, IFLA_BR_MCAST_IGMP_VERSION, &info->mcast_igmp_version);
|
(void) sd_netlink_message_read_u8(m, IFLA_BR_MCAST_IGMP_VERSION, &info->mcast_igmp_version);
|
||||||
(void) sd_netlink_message_read_u8(m, IFLA_BRPORT_STATE, &info->port_state);
|
(void) sd_netlink_message_read_u8(m, IFLA_BRPORT_STATE, &info->port_state);
|
||||||
} if (streq(info->netdev_kind, "bond")) {
|
} if (streq(received_kind, "bond")) {
|
||||||
(void) sd_netlink_message_read_u8(m, IFLA_BOND_MODE, &info->mode);
|
(void) sd_netlink_message_read_u8(m, IFLA_BOND_MODE, &info->mode);
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_BOND_MIIMON, &info->miimon);
|
(void) sd_netlink_message_read_u32(m, IFLA_BOND_MIIMON, &info->miimon);
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_BOND_DOWNDELAY, &info->downdelay);
|
(void) sd_netlink_message_read_u32(m, IFLA_BOND_DOWNDELAY, &info->downdelay);
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_BOND_UPDELAY, &info->updelay);
|
(void) sd_netlink_message_read_u32(m, IFLA_BOND_UPDELAY, &info->updelay);
|
||||||
} else if (streq(info->netdev_kind, "vxlan")) {
|
} else if (streq(received_kind, "vxlan")) {
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_VXLAN_ID, &info->vxlan_info.vni);
|
(void) sd_netlink_message_read_u32(m, IFLA_VXLAN_ID, &info->vxlan_info.vni);
|
||||||
|
|
||||||
r = sd_netlink_message_read_in_addr(m, IFLA_VXLAN_GROUP, &info->vxlan_info.group.in);
|
r = sd_netlink_message_read_in_addr(m, IFLA_VXLAN_GROUP, &info->vxlan_info.group.in);
|
||||||
@ -439,12 +437,12 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
|||||||
(void) sd_netlink_message_read_u8(m, IFLA_VXLAN_L2MISS, &info->vxlan_info.l2miss);
|
(void) sd_netlink_message_read_u8(m, IFLA_VXLAN_L2MISS, &info->vxlan_info.l2miss);
|
||||||
(void) sd_netlink_message_read_u8(m, IFLA_VXLAN_TOS, &info->vxlan_info.tos);
|
(void) sd_netlink_message_read_u8(m, IFLA_VXLAN_TOS, &info->vxlan_info.tos);
|
||||||
(void) sd_netlink_message_read_u8(m, IFLA_VXLAN_TTL, &info->vxlan_info.ttl);
|
(void) sd_netlink_message_read_u8(m, IFLA_VXLAN_TTL, &info->vxlan_info.ttl);
|
||||||
} else if (streq(info->netdev_kind, "vlan"))
|
} else if (streq(received_kind, "vlan"))
|
||||||
(void) sd_netlink_message_read_u16(m, IFLA_VLAN_ID, &info->vlan_id);
|
(void) sd_netlink_message_read_u16(m, IFLA_VLAN_ID, &info->vlan_id);
|
||||||
else if (STR_IN_SET(info->netdev_kind, "ipip", "sit")) {
|
else if (STR_IN_SET(received_kind, "ipip", "sit")) {
|
||||||
(void) sd_netlink_message_read_in_addr(m, IFLA_IPTUN_LOCAL, &info->local.in);
|
(void) sd_netlink_message_read_in_addr(m, IFLA_IPTUN_LOCAL, &info->local.in);
|
||||||
(void) sd_netlink_message_read_in_addr(m, IFLA_IPTUN_REMOTE, &info->remote.in);
|
(void) sd_netlink_message_read_in_addr(m, IFLA_IPTUN_REMOTE, &info->remote.in);
|
||||||
} else if (streq(info->netdev_kind, "geneve")) {
|
} else if (streq(received_kind, "geneve")) {
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_GENEVE_ID, &info->vni);
|
(void) sd_netlink_message_read_u32(m, IFLA_GENEVE_ID, &info->vni);
|
||||||
|
|
||||||
r = sd_netlink_message_read_in_addr(m, IFLA_GENEVE_REMOTE, &info->remote.in);
|
r = sd_netlink_message_read_in_addr(m, IFLA_GENEVE_REMOTE, &info->remote.in);
|
||||||
@ -462,25 +460,27 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
|
|||||||
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, &info->csum6_rx);
|
(void) sd_netlink_message_read_u8(m, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, &info->csum6_rx);
|
||||||
(void) sd_netlink_message_read_u16(m, IFLA_GENEVE_PORT, &info->tunnel_port);
|
(void) sd_netlink_message_read_u16(m, IFLA_GENEVE_PORT, &info->tunnel_port);
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_GENEVE_LABEL, &info->label);
|
(void) sd_netlink_message_read_u32(m, IFLA_GENEVE_LABEL, &info->label);
|
||||||
} else if (STR_IN_SET(info->netdev_kind, "gre", "gretap", "erspan")) {
|
} else if (STR_IN_SET(received_kind, "gre", "gretap", "erspan")) {
|
||||||
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_LOCAL, &info->local.in);
|
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_LOCAL, &info->local.in);
|
||||||
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_REMOTE, &info->remote.in);
|
(void) sd_netlink_message_read_in_addr(m, IFLA_GRE_REMOTE, &info->remote.in);
|
||||||
} else if (STR_IN_SET(info->netdev_kind, "ip6gre", "ip6gretap", "ip6erspan")) {
|
} else if (STR_IN_SET(received_kind, "ip6gre", "ip6gretap", "ip6erspan")) {
|
||||||
(void) sd_netlink_message_read_in6_addr(m, IFLA_GRE_LOCAL, &info->local.in6);
|
(void) sd_netlink_message_read_in6_addr(m, IFLA_GRE_LOCAL, &info->local.in6);
|
||||||
(void) sd_netlink_message_read_in6_addr(m, IFLA_GRE_REMOTE, &info->remote.in6);
|
(void) sd_netlink_message_read_in6_addr(m, IFLA_GRE_REMOTE, &info->remote.in6);
|
||||||
} else if (streq(info->netdev_kind, "vti")) {
|
} else if (streq(received_kind, "vti")) {
|
||||||
(void) sd_netlink_message_read_in_addr(m, IFLA_VTI_LOCAL, &info->local.in);
|
(void) sd_netlink_message_read_in_addr(m, IFLA_VTI_LOCAL, &info->local.in);
|
||||||
(void) sd_netlink_message_read_in_addr(m, IFLA_VTI_REMOTE, &info->remote.in);
|
(void) sd_netlink_message_read_in_addr(m, IFLA_VTI_REMOTE, &info->remote.in);
|
||||||
} else if (streq(info->netdev_kind, "vti6")) {
|
} else if (streq(received_kind, "vti6")) {
|
||||||
(void) sd_netlink_message_read_in6_addr(m, IFLA_VTI_LOCAL, &info->local.in6);
|
(void) sd_netlink_message_read_in6_addr(m, IFLA_VTI_LOCAL, &info->local.in6);
|
||||||
(void) sd_netlink_message_read_in6_addr(m, IFLA_VTI_REMOTE, &info->remote.in6);
|
(void) sd_netlink_message_read_in6_addr(m, IFLA_VTI_REMOTE, &info->remote.in6);
|
||||||
} else if (STR_IN_SET(info->netdev_kind, "macvlan", "macvtap"))
|
} else if (STR_IN_SET(received_kind, "macvlan", "macvtap"))
|
||||||
(void) sd_netlink_message_read_u32(m, IFLA_MACVLAN_MODE, &info->macvlan_mode);
|
(void) sd_netlink_message_read_u32(m, IFLA_MACVLAN_MODE, &info->macvlan_mode);
|
||||||
else if (streq(info->netdev_kind, "ipvlan")) {
|
else if (streq(received_kind, "ipvlan")) {
|
||||||
(void) sd_netlink_message_read_u16(m, IFLA_IPVLAN_MODE, &info->ipvlan_mode);
|
(void) sd_netlink_message_read_u16(m, IFLA_IPVLAN_MODE, &info->ipvlan_mode);
|
||||||
(void) sd_netlink_message_read_u16(m, IFLA_IPVLAN_FLAGS, &info->ipvlan_flags);
|
(void) sd_netlink_message_read_u16(m, IFLA_IPVLAN_FLAGS, &info->ipvlan_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strncpy(info->netdev_kind, received_kind, IFNAMSIZ);
|
||||||
|
|
||||||
(void) sd_netlink_message_exit_container(m);
|
(void) sd_netlink_message_exit_container(m);
|
||||||
(void) sd_netlink_message_exit_container(m);
|
(void) sd_netlink_message_exit_container(m);
|
||||||
|
|
||||||
@ -1644,9 +1644,6 @@ static int link_status_one(
|
|||||||
TABLE_STRING, "Type:",
|
TABLE_STRING, "Type:",
|
||||||
TABLE_STRING, strna(t),
|
TABLE_STRING, strna(t),
|
||||||
TABLE_EMPTY,
|
TABLE_EMPTY,
|
||||||
TABLE_STRING, "Kind:",
|
|
||||||
TABLE_STRING, strna(info->netdev_kind),
|
|
||||||
TABLE_EMPTY,
|
|
||||||
TABLE_STRING, "State:");
|
TABLE_STRING, "State:");
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return table_log_add_error(r);
|
return table_log_add_error(r);
|
||||||
|
|||||||
@ -59,6 +59,7 @@
|
|||||||
#include "networkd-sysctl.h"
|
#include "networkd-sysctl.h"
|
||||||
#include "set.h"
|
#include "set.h"
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
|
#include "stat-util.h"
|
||||||
#include "stdio-util.h"
|
#include "stdio-util.h"
|
||||||
#include "string-table.h"
|
#include "string-table.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
@ -1168,7 +1169,6 @@ static int link_get_network(Link *link, Network **ret) {
|
|||||||
&link->permanent_hw_addr,
|
&link->permanent_hw_addr,
|
||||||
link->driver,
|
link->driver,
|
||||||
link->iftype,
|
link->iftype,
|
||||||
link->kind,
|
|
||||||
link->ifname,
|
link->ifname,
|
||||||
link->alternative_names,
|
link->alternative_names,
|
||||||
link->wlan_iftype,
|
link->wlan_iftype,
|
||||||
@ -1451,7 +1451,8 @@ static int link_check_initialized(Link *link) {
|
|||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
|
|
||||||
if (!udev_available())
|
if (path_is_read_only_fs("/sys") > 0)
|
||||||
|
/* no udev */
|
||||||
return link_initialized_and_synced(link);
|
return link_initialized_and_synced(link);
|
||||||
|
|
||||||
/* udev should be around */
|
/* udev should be around */
|
||||||
@ -2023,85 +2024,6 @@ static int link_update_master(Link *link, sd_netlink_message *message) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int link_update_driver(Link *link, sd_netlink_message *message) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(link->manager);
|
|
||||||
assert(message);
|
|
||||||
|
|
||||||
/* Driver is already read. Assuming the driver is never changed. */
|
|
||||||
if (link->driver)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* When udevd is running, read the driver after the interface is initialized by udevd.
|
|
||||||
* Otherwise, ethtool may not work correctly. See issue #22538.
|
|
||||||
* When udevd is not running, read the value when the interface is detected. */
|
|
||||||
if (link->state != (udev_available() ? LINK_STATE_INITIALIZED : LINK_STATE_PENDING))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
r = ethtool_get_driver(&link->manager->ethtool_fd, link->ifname, &link->driver);
|
|
||||||
if (r < 0) {
|
|
||||||
log_link_debug_errno(link, r, "Failed to get driver, continuing without: %m");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_link_debug(link, "Found driver: %s", strna(link->driver));
|
|
||||||
|
|
||||||
if (streq_ptr(link->driver, "dsa")) {
|
|
||||||
uint32_t dsa_master_ifindex = 0;
|
|
||||||
|
|
||||||
r = sd_netlink_message_read_u32(message, IFLA_LINK, &dsa_master_ifindex);
|
|
||||||
if (r < 0 && r != -ENODATA)
|
|
||||||
return log_link_debug_errno(link, r, "rtnl: failed to read ifindex of the DSA master interface: %m");
|
|
||||||
|
|
||||||
if (dsa_master_ifindex > INT_MAX) {
|
|
||||||
log_link_debug(link, "rtnl: received too large DSA master ifindex (%"PRIu32" > INT_MAX), ignoring.",
|
|
||||||
dsa_master_ifindex);
|
|
||||||
dsa_master_ifindex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
link->dsa_master_ifindex = (int) dsa_master_ifindex;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int link_update_permanent_hardware_address(Link *link, sd_netlink_message *message) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(link->manager);
|
|
||||||
assert(message);
|
|
||||||
|
|
||||||
if (link->permanent_hw_addr.length > 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* When udevd is running, read the permanent hardware address after the interface is
|
|
||||||
* initialized by udevd. Otherwise, ethtool may not work correctly. See issue #22538.
|
|
||||||
* When udevd is not running, read the value when the interface is detected. */
|
|
||||||
if (link->state != (udev_available() ? LINK_STATE_INITIALIZED : LINK_STATE_PENDING))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
r = netlink_message_read_hw_addr(message, IFLA_PERM_ADDRESS, &link->permanent_hw_addr);
|
|
||||||
if (r < 0) {
|
|
||||||
if (r != -ENODATA)
|
|
||||||
return log_link_debug_errno(link, r, "Failed to read IFLA_PERM_ADDRESS attribute: %m");
|
|
||||||
|
|
||||||
if (netlink_message_read_hw_addr(message, IFLA_ADDRESS, NULL) >= 0) {
|
|
||||||
/* Fallback to ethtool, if the link has a hardware address. */
|
|
||||||
r = ethtool_get_permanent_hw_addr(&link->manager->ethtool_fd, link->ifname, &link->permanent_hw_addr);
|
|
||||||
if (r < 0)
|
|
||||||
log_link_debug_errno(link, r, "Permanent hardware address not found, continuing without: %m");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (link->permanent_hw_addr.length > 0)
|
|
||||||
log_link_debug(link, "Saved permanent hardware address: %s", HW_ADDR_TO_STR(&link->permanent_hw_addr));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int link_update_hardware_address(Link *link, sd_netlink_message *message) {
|
static int link_update_hardware_address(Link *link, sd_netlink_message *message) {
|
||||||
struct hw_addr_data addr;
|
struct hw_addr_data addr;
|
||||||
int r;
|
int r;
|
||||||
@ -2389,14 +2311,6 @@ static int link_update(Link *link, sd_netlink_message *message) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = link_update_driver(link, message);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = link_update_permanent_hardware_address(link, message);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = link_update_hardware_address(link, message);
|
r = link_update_hardware_address(link, message);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
@ -2509,6 +2423,44 @@ static int link_new(Manager *manager, sd_netlink_message *message, Link **ret) {
|
|||||||
log_link_debug(link, "Saved new link: ifindex=%i, iftype=%s(%u), kind=%s",
|
log_link_debug(link, "Saved new link: ifindex=%i, iftype=%s(%u), kind=%s",
|
||||||
link->ifindex, strna(arphrd_to_name(link->iftype)), link->iftype, strna(link->kind));
|
link->ifindex, strna(arphrd_to_name(link->iftype)), link->iftype, strna(link->kind));
|
||||||
|
|
||||||
|
r = netlink_message_read_hw_addr(message, IFLA_PERM_ADDRESS, &link->permanent_hw_addr);
|
||||||
|
if (r < 0) {
|
||||||
|
if (r != -ENODATA)
|
||||||
|
log_link_debug_errno(link, r, "Failed to read IFLA_PERM_ADDRESS attribute, ignoring: %m");
|
||||||
|
|
||||||
|
if (netlink_message_read_hw_addr(message, IFLA_ADDRESS, NULL) >= 0) {
|
||||||
|
/* Fallback to ethtool, if the link has a hardware address. */
|
||||||
|
r = ethtool_get_permanent_hw_addr(&manager->ethtool_fd, link->ifname, &link->permanent_hw_addr);
|
||||||
|
if (r < 0)
|
||||||
|
log_link_debug_errno(link, r, "Permanent hardware address not found, continuing without: %m");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (link->permanent_hw_addr.length > 0)
|
||||||
|
log_link_debug(link, "Saved permanent hardware address: %s", HW_ADDR_TO_STR(&link->permanent_hw_addr));
|
||||||
|
|
||||||
|
r = ethtool_get_driver(&manager->ethtool_fd, link->ifname, &link->driver);
|
||||||
|
if (r < 0)
|
||||||
|
log_link_debug_errno(link, r, "Failed to get driver, continuing without: %m");
|
||||||
|
else
|
||||||
|
log_link_debug(link, "Found driver: %s", strna(link->driver));
|
||||||
|
|
||||||
|
if (streq_ptr(link->driver, "dsa")) {
|
||||||
|
uint32_t dsa_master_ifindex;
|
||||||
|
|
||||||
|
r = sd_netlink_message_read_u32(message, IFLA_LINK, &dsa_master_ifindex);
|
||||||
|
if (r < 0) {
|
||||||
|
dsa_master_ifindex = 0;
|
||||||
|
if (r != -ENODATA)
|
||||||
|
log_link_warning_errno(link, r, "rtnl: failed to read ifindex of the DSA master interface, ignoring: %m");
|
||||||
|
} else if (dsa_master_ifindex > INT_MAX) {
|
||||||
|
dsa_master_ifindex = 0;
|
||||||
|
log_link_warning(link, "rtnl: received too large DSA master ifindex (%"PRIu32" > INT_MAX), ignoring.",
|
||||||
|
dsa_master_ifindex);
|
||||||
|
}
|
||||||
|
|
||||||
|
link->dsa_master_ifindex = (int) dsa_master_ifindex;
|
||||||
|
}
|
||||||
|
|
||||||
*ret = TAKE_PTR(link);
|
*ret = TAKE_PTR(link);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,6 @@
|
|||||||
#include "sysctl-util.h"
|
#include "sysctl-util.h"
|
||||||
#include "tclass.h"
|
#include "tclass.h"
|
||||||
#include "tmpfile-util.h"
|
#include "tmpfile-util.h"
|
||||||
#include "udev-util.h"
|
|
||||||
|
|
||||||
/* use 128 MB for receive socket kernel queue. */
|
/* use 128 MB for receive socket kernel queue. */
|
||||||
#define RCVBUF_SIZE (128*1024*1024)
|
#define RCVBUF_SIZE (128*1024*1024)
|
||||||
@ -173,7 +172,7 @@ static int manager_connect_udev(Manager *m) {
|
|||||||
|
|
||||||
/* udev does not initialize devices inside containers, so we rely on them being already
|
/* udev does not initialize devices inside containers, so we rely on them being already
|
||||||
* initialized before entering the container. */
|
* initialized before entering the container. */
|
||||||
if (!udev_available())
|
if (path_is_read_only_fs("/sys") > 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = sd_device_monitor_new(&m->device_monitor);
|
r = sd_device_monitor_new(&m->device_monitor);
|
||||||
|
|||||||
@ -52,7 +52,6 @@ Match.PermanentMACAddress, config_parse_hw_addrs,
|
|||||||
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.iftype)
|
Match.Type, config_parse_match_strv, 0, offsetof(Network, match.iftype)
|
||||||
Match.Kind, config_parse_match_strv, 0, offsetof(Network, match.kind)
|
|
||||||
Match.WLANInterfaceType, config_parse_match_strv, 0, offsetof(Network, match.wlan_iftype)
|
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_ether_addrs, 0, offsetof(Network, match.bssid)
|
Match.BSSID, config_parse_ether_addrs, 0, offsetof(Network, match.bssid)
|
||||||
|
|||||||
@ -22,7 +22,6 @@ void net_match_clear(NetMatch *match) {
|
|||||||
match->path = strv_free(match->path);
|
match->path = strv_free(match->path);
|
||||||
match->driver = strv_free(match->driver);
|
match->driver = strv_free(match->driver);
|
||||||
match->iftype = strv_free(match->iftype);
|
match->iftype = strv_free(match->iftype);
|
||||||
match->kind = strv_free(match->kind);
|
|
||||||
match->ifname = strv_free(match->ifname);
|
match->ifname = strv_free(match->ifname);
|
||||||
match->property = strv_free(match->property);
|
match->property = strv_free(match->property);
|
||||||
match->wlan_iftype = strv_free(match->wlan_iftype);
|
match->wlan_iftype = strv_free(match->wlan_iftype);
|
||||||
@ -39,7 +38,6 @@ bool net_match_is_empty(const NetMatch *match) {
|
|||||||
strv_isempty(match->path) &&
|
strv_isempty(match->path) &&
|
||||||
strv_isempty(match->driver) &&
|
strv_isempty(match->driver) &&
|
||||||
strv_isempty(match->iftype) &&
|
strv_isempty(match->iftype) &&
|
||||||
strv_isempty(match->kind) &&
|
|
||||||
strv_isempty(match->ifname) &&
|
strv_isempty(match->ifname) &&
|
||||||
strv_isempty(match->property) &&
|
strv_isempty(match->property) &&
|
||||||
strv_isempty(match->wlan_iftype) &&
|
strv_isempty(match->wlan_iftype) &&
|
||||||
@ -128,7 +126,6 @@ int net_match_config(
|
|||||||
const struct hw_addr_data *permanent_hw_addr,
|
const struct hw_addr_data *permanent_hw_addr,
|
||||||
const char *driver,
|
const char *driver,
|
||||||
unsigned short iftype,
|
unsigned short iftype,
|
||||||
const char *kind,
|
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
char * const *alternative_names,
|
char * const *alternative_names,
|
||||||
enum nl80211_iftype wlan_iftype,
|
enum nl80211_iftype wlan_iftype,
|
||||||
@ -163,9 +160,6 @@ int net_match_config(
|
|||||||
if (!net_condition_test_strv(match->iftype, iftype_str))
|
if (!net_condition_test_strv(match->iftype, iftype_str))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!net_condition_test_strv(match->kind, kind))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!net_condition_test_ifname(match->ifname, ifname, alternative_names))
|
if (!net_condition_test_ifname(match->ifname, ifname, alternative_names))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@ -15,8 +15,7 @@ typedef struct NetMatch {
|
|||||||
Set *permanent_hw_addr;
|
Set *permanent_hw_addr;
|
||||||
char **path;
|
char **path;
|
||||||
char **driver;
|
char **driver;
|
||||||
char **iftype; /* udev's DEVTYPE field or ARPHRD_XXX, e.g. ether, wlan. */
|
char **iftype;
|
||||||
char **kind; /* IFLA_INFO_KIND attribute, e.g. gre, gretap, erspan. */
|
|
||||||
char **ifname;
|
char **ifname;
|
||||||
char **property;
|
char **property;
|
||||||
char **wlan_iftype;
|
char **wlan_iftype;
|
||||||
@ -34,7 +33,6 @@ int net_match_config(
|
|||||||
const struct hw_addr_data *permanent_hw_addr,
|
const struct hw_addr_data *permanent_hw_addr,
|
||||||
const char *driver,
|
const char *driver,
|
||||||
unsigned short iftype,
|
unsigned short iftype,
|
||||||
const char *kind,
|
|
||||||
const char *ifname,
|
const char *ifname,
|
||||||
char * const *alternative_names,
|
char * const *alternative_names,
|
||||||
enum nl80211_iftype wlan_iftype,
|
enum nl80211_iftype wlan_iftype,
|
||||||
|
|||||||
@ -20,7 +20,6 @@
|
|||||||
#include "path-util.h"
|
#include "path-util.h"
|
||||||
#include "signal-util.h"
|
#include "signal-util.h"
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
#include "stat-util.h"
|
|
||||||
#include "string-table.h"
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strxcpyx.h"
|
#include "strxcpyx.h"
|
||||||
@ -724,17 +723,3 @@ int on_ac_power(void) {
|
|||||||
|
|
||||||
return found_online || !found_offline;
|
return found_online || !found_offline;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool udev_available(void) {
|
|
||||||
static int cache = -1;
|
|
||||||
|
|
||||||
/* The service systemd-udevd is started only when /sys is read write.
|
|
||||||
* See systemd-udevd.service: ConditionPathIsReadWrite=/sys
|
|
||||||
* Also, our container interface (http://systemd.io/CONTAINER_INTERFACE/) states that /sys must
|
|
||||||
* be mounted in read-only mode in containers. */
|
|
||||||
|
|
||||||
if (cache >= 0)
|
|
||||||
return cache;
|
|
||||||
|
|
||||||
return (cache = path_is_read_only_fs("/sys/") <= 0);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -55,8 +55,6 @@ int udev_queue_init(void);
|
|||||||
|
|
||||||
int on_ac_power(void);
|
int on_ac_power(void);
|
||||||
|
|
||||||
bool udev_available(void);
|
|
||||||
|
|
||||||
#if HAVE_SYS_SDT_H
|
#if HAVE_SYS_SDT_H
|
||||||
|
|
||||||
/* Each trace point can have different number of additional arguments. Note that when the macro is used only
|
/* Each trace point can have different number of additional arguments. Note that when the macro is used only
|
||||||
|
|||||||
@ -28,7 +28,6 @@ Match.OriginalName, config_parse_match_ifnames,
|
|||||||
Match.Path, config_parse_match_strv, 0, offsetof(LinkConfig, match.path)
|
Match.Path, config_parse_match_strv, 0, offsetof(LinkConfig, match.path)
|
||||||
Match.Driver, config_parse_match_strv, 0, offsetof(LinkConfig, match.driver)
|
Match.Driver, config_parse_match_strv, 0, offsetof(LinkConfig, match.driver)
|
||||||
Match.Type, config_parse_match_strv, 0, offsetof(LinkConfig, match.iftype)
|
Match.Type, config_parse_match_strv, 0, offsetof(LinkConfig, match.iftype)
|
||||||
Match.Kind, config_parse_match_strv, 0, offsetof(LinkConfig, match.kind)
|
|
||||||
Match.Property, config_parse_match_property, 0, offsetof(LinkConfig, match.property)
|
Match.Property, config_parse_match_property, 0, offsetof(LinkConfig, match.property)
|
||||||
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(LinkConfig, conditions)
|
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(LinkConfig, conditions)
|
||||||
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(LinkConfig, conditions)
|
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(LinkConfig, conditions)
|
||||||
|
|||||||
@ -361,7 +361,6 @@ Link *link_free(Link *link) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sd_device_unref(link->device);
|
sd_device_unref(link->device);
|
||||||
free(link->kind);
|
|
||||||
free(link->driver);
|
free(link->driver);
|
||||||
return mfree(link);
|
return mfree(link);
|
||||||
}
|
}
|
||||||
@ -403,8 +402,7 @@ int link_new(LinkConfigContext *ctx, sd_netlink **rtnl, sd_device *device, Link
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_link_debug_errno(link, r, "Failed to get \"addr_assign_type\" attribute, ignoring: %m");
|
log_link_debug_errno(link, r, "Failed to get \"addr_assign_type\" attribute, ignoring: %m");
|
||||||
|
|
||||||
r = rtnl_get_link_info(rtnl, link->ifindex, &link->iftype, &link->flags,
|
r = rtnl_get_link_info(rtnl, link->ifindex, &link->iftype, &link->flags, &link->hw_addr, &link->permanent_hw_addr);
|
||||||
&link->kind, &link->hw_addr, &link->permanent_hw_addr);
|
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
@ -441,7 +439,6 @@ int link_get_config(LinkConfigContext *ctx, Link *link) {
|
|||||||
&link->permanent_hw_addr,
|
&link->permanent_hw_addr,
|
||||||
link->driver,
|
link->driver,
|
||||||
link->iftype,
|
link->iftype,
|
||||||
link->kind,
|
|
||||||
link->ifname,
|
link->ifname,
|
||||||
/* alternative_names = */ NULL,
|
/* alternative_names = */ NULL,
|
||||||
/* wlan_iftype = */ 0,
|
/* wlan_iftype = */ 0,
|
||||||
|
|||||||
@ -32,7 +32,6 @@ typedef struct Link {
|
|||||||
sd_device *device;
|
sd_device *device;
|
||||||
sd_device_action_t action;
|
sd_device_action_t action;
|
||||||
|
|
||||||
char *kind;
|
|
||||||
char *driver;
|
char *driver;
|
||||||
uint16_t iftype;
|
uint16_t iftype;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|||||||
@ -900,7 +900,7 @@ static int rename_netif(UdevEvent *event) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = rtnl_get_link_info(&event->rtnl, ifindex, NULL, &flags, NULL, NULL, NULL);
|
r = rtnl_get_link_info(&event->rtnl, ifindex, NULL, &flags, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_device_warning_errno(dev, r, "Failed to get link flags: %m");
|
return log_device_warning_errno(dev, r, "Failed to get link flags: %m");
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,6 @@ OriginalName=
|
|||||||
Path=
|
Path=
|
||||||
Driver=
|
Driver=
|
||||||
Type=
|
Type=
|
||||||
Kind=
|
|
||||||
Property=
|
Property=
|
||||||
Host=
|
Host=
|
||||||
Virtualization=
|
Virtualization=
|
||||||
|
|||||||
@ -17,7 +17,6 @@ MulticastRouter=
|
|||||||
[Match]
|
[Match]
|
||||||
KernelVersion=
|
KernelVersion=
|
||||||
Type=
|
Type=
|
||||||
Kind=
|
|
||||||
Driver=
|
Driver=
|
||||||
Architecture=
|
Architecture=
|
||||||
Firmware=
|
Firmware=
|
||||||
|
|||||||
@ -1168,16 +1168,11 @@ install_systemd() {
|
|||||||
|
|
||||||
# When built with gcov, disable ProtectSystem= and ProtectHome= in the test
|
# When built with gcov, disable ProtectSystem= and ProtectHome= in the test
|
||||||
# images, since it prevents gcov to write the coverage reports (*.gcda
|
# images, since it prevents gcov to write the coverage reports (*.gcda
|
||||||
# files)
|
# files). Similarly, set ReadWritePaths= to the $BUIL_DIR in the test image
|
||||||
|
# to make the coverage work with units utilizing DynamicUser=yes.
|
||||||
if get_bool "$IS_BUILT_WITH_COVERAGE"; then
|
if get_bool "$IS_BUILT_WITH_COVERAGE"; then
|
||||||
mkdir -p "$initdir/etc/systemd/system/service.d/"
|
mkdir -p "$initdir/etc/systemd/system/service.d/"
|
||||||
echo -e "[Service]\nProtectSystem=no\nProtectHome=no\n" >"$initdir/etc/systemd/system/service.d/99-gcov-override.conf"
|
echo -e "[Service]\nProtectSystem=no\nProtectHome=no\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/system/service.d/gcov-override.conf"
|
||||||
# Similarly, set ReadWritePaths= to the $BUILD_DIR in the test image
|
|
||||||
# to make the coverage work with units utilizing DynamicUser=yes. Do
|
|
||||||
# this only for services from TEST-20, as setting this system-wide
|
|
||||||
# has many undesirable side-effects
|
|
||||||
mkdir -p "$initdir/etc/systemd/system/test20-.service.d/"
|
|
||||||
echo -e "[Service]\nReadWritePaths=${BUILD_DIR:?}\n" >"$initdir/etc/systemd/system/test20-.service.d/99-gcov-rwpaths-override.conf"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If we're built with -Dportabled=false, tests with systemd-analyze
|
# If we're built with -Dportabled=false, tests with systemd-analyze
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user