1
0
mirror of https://github.com/systemd/systemd synced 2026-03-06 13:15:06 +01:00

Compare commits

...

13 Commits

Author SHA1 Message Date
Yu Watanabe
d1a61dfa69 tmpfiles: fix typo
Follow-up for 94566540e3863032df3a8a89f948b94d764ca2b4.
2020-12-19 00:58:22 +09:00
Yu Watanabe
8a5a01d19c
Merge pull request #18019 from yuwata/hostname-drop-libudev
hostname: fix build failure
2020-12-19 00:57:36 +09:00
Yu Watanabe
a4c3c5b751 man: update org.freedesktop.hostname1.xml 2020-12-18 23:25:43 +09:00
Yu Watanabe
3693cbacf7 memory-id: fix never hit condition
As sizeof(int64_t) is always 8.
2020-12-18 23:13:21 +09:00
Yu Watanabe
0be6dee2c2 hostname: fix build failure
Follow-up for b9d8069832425b34211a6812e06537e0c50d46b6.

libudev.h was dropped from most of our binaries.
2020-12-18 23:11:02 +09:00
Lennart Poettering
9bd6ee8d5d
Merge pull request #15531 from felipeborges/add-device-model-field-to-hostnamed
hostnamed: Add "Model" field
2020-12-18 14:26:32 +01:00
Devon Pringle
16c89e649d networkd: add RouteDenyList
Allow configuration for IPv6 discovered routes to be ignored instead of
adding them as a route. This can be used to block unwanted routes, for
example, you may wish to not receive some set of routes on an interface
if they are causing issues.
2020-12-18 21:44:32 +09:00
Yu Watanabe
af42881bf9
Merge pull request #18015 from keszybz/dmi-test-mesonification2
Dmi test mesonification2
2020-12-18 21:44:00 +09:00
Zbigniew Jędrzejewski-Szmek
7bbdef621f test: add one more dmidecode dump 2020-12-17 09:21:31 +01:00
Zbigniew Jędrzejewski-Szmek
2b7b142e97 meson: make each dmidecode a separate test
This allows them to be executed in parallel and also gives us
better reporting.

The dump files are renamed to avoid repeating "dmidecode-dump", since that
string is already present in the subdirectory name.
2020-12-17 09:21:29 +01:00
Felipe Borges
b9d8069832 hostnamed: Expose dmi "Vendor" and "Model" fields
See #15493
2020-12-04 11:22:49 +01:00
Felipe Borges
7341f6b58d rules.d: Add rule for the /sys/class/dmi/id device
See #15493
2020-12-04 11:22:49 +01:00
Felipe Borges
8723ddc7e5 hwdb: Add dmi-id database
See #15493
2020-12-04 11:22:49 +01:00
23 changed files with 279 additions and 54 deletions

6
hwdb.d/20-dmi-id.hwdb Normal file
View File

@ -0,0 +1,6 @@
# This file is part of systemd
# Fix "Lenovo" capitalization in /sys/class/dmi/id/sys_vendor
dmi:bvnLENOVO*
ID_SYSFS_ATTRIBUTE_MODEL=product_version
ID_VENDOR_FROM_DATABASE=Lenovo

View File

@ -4,6 +4,7 @@
# they are very long but quite repetitive and the parser is not very fast. # they are very long but quite repetitive and the parser is not very fast.
# So we don't "test" them. # So we don't "test" them.
hwdb_files_notest = files(''' hwdb_files_notest = files('''
20-dmi-id.hwdb
20-pci-vendor-model.hwdb 20-pci-vendor-model.hwdb
20-pci-classes.hwdb 20-pci-classes.hwdb
20-usb-vendor-model.hwdb 20-usb-vendor-model.hwdb

View File

@ -81,6 +81,10 @@ node /org/freedesktop/hostname1 {
readonly s OperatingSystemCPEName = '...'; readonly s OperatingSystemCPEName = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const") @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HomeURL = '...'; readonly s HomeURL = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HardwareVendor = '...';
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
readonly s HardwareModel = '...';
}; };
interface org.freedesktop.DBus.Peer { ... }; interface org.freedesktop.DBus.Peer { ... };
interface org.freedesktop.DBus.Introspectable { ... }; interface org.freedesktop.DBus.Introspectable { ... };
@ -88,6 +92,10 @@ node /org/freedesktop/hostname1 {
}; };
</programlisting> </programlisting>
<!--property HardwareVendor is not documented!-->
<!--property HardwareModel is not documented!-->
<!--Autogenerated cross-references for systemd.directives, do not edit--> <!--Autogenerated cross-references for systemd.directives, do not edit-->
<variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.hostname1"/> <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.hostname1"/>
@ -140,6 +148,10 @@ node /org/freedesktop/hostname1 {
<variablelist class="dbus-property" generated="True" extra-ref="HomeURL"/> <variablelist class="dbus-property" generated="True" extra-ref="HomeURL"/>
<variablelist class="dbus-property" generated="True" extra-ref="HardwareVendor"/>
<variablelist class="dbus-property" generated="True" extra-ref="HardwareModel"/>
<!--End of Autogenerated section--> <!--End of Autogenerated section-->
<para>Whenever the hostname or other metadata is changed via the daemon, <para>Whenever the hostname or other metadata is changed via the daemon,

View File

@ -2095,7 +2095,16 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
<varlistentry> <varlistentry>
<term><varname>DenyList=</varname></term> <term><varname>DenyList=</varname></term>
<listitem> <listitem>
<para>A whitespace-separated list of IPv6 prefixes. IPv6 prefixes supplied via router advertisements in the list are ignored.</para> <para>A whitespace-separated list of IPv6 prefixes. IPv6 prefixes supplied via router
advertisements in the list are ignored.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>RouteDenyList=</varname></term>
<listitem>
<para>A whitespace-separated list of IPv6 route prefixes. IPv6 route prefixes supplied via
router advertisements in the list are ignored.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -89,4 +89,7 @@ KERNEL=="udmabuf", GROUP="kvm"
SUBSYSTEM=="ptp", ATTR{clock_name}=="KVM virtual PTP", SYMLINK += "ptp_kvm" SUBSYSTEM=="ptp", ATTR{clock_name}=="KVM virtual PTP", SYMLINK += "ptp_kvm"
SUBSYSTEM=="dmi", ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="", ENV{ID_VENDOR}="$attr{sys_vendor}", ENV{ID_MODEL}="$attr{product_name}"
SUBSYSTEM=="dmi", ENV{ID_SYSFS_ATTRIBUTE_MODEL}=="product_version", ENV{ID_VENDOR}="$attr{sys_vendor}", ENV{ID_MODEL}="$attr{product_version}"
LABEL="default_end" LABEL="default_end"

View File

@ -43,6 +43,8 @@ typedef struct StatusInfo {
const char *virtualization; const char *virtualization;
const char *architecture; const char *architecture;
const char *home_url; const char *home_url;
const char *hardware_vendor;
const char *hardware_model;
} StatusInfo; } StatusInfo;
static void print_status_info(StatusInfo *i) { static void print_status_info(StatusInfo *i) {
@ -107,6 +109,11 @@ static void print_status_info(StatusInfo *i) {
if (!isempty(i->architecture)) if (!isempty(i->architecture))
printf(" Architecture: %s\n", i->architecture); printf(" Architecture: %s\n", i->architecture);
if (!isempty(i->hardware_vendor))
printf(" Hardware Vendor: %s\n", i->hardware_vendor);
if (!isempty(i->hardware_model))
printf(" Hardware Model: %s\n", i->hardware_model);
} }
static int show_one_name(sd_bus *bus, const char* attr) { static int show_one_name(sd_bus *bus, const char* attr) {
@ -150,6 +157,8 @@ static int show_all_names(sd_bus *bus, sd_bus_error *error) {
{ "OperatingSystemPrettyName", "s", NULL, offsetof(StatusInfo, os_pretty_name) }, { "OperatingSystemPrettyName", "s", NULL, offsetof(StatusInfo, os_pretty_name) },
{ "OperatingSystemCPEName", "s", NULL, offsetof(StatusInfo, os_cpe_name) }, { "OperatingSystemCPEName", "s", NULL, offsetof(StatusInfo, os_cpe_name) },
{ "HomeURL", "s", NULL, offsetof(StatusInfo, home_url) }, { "HomeURL", "s", NULL, offsetof(StatusInfo, home_url) },
{ "HardwareVendor", "s", NULL, offsetof(StatusInfo, hardware_vendor) },
{ "HardwareModel", "s", NULL, offsetof(StatusInfo, hardware_model) },
{} {}
}; };

View File

@ -27,6 +27,7 @@
#include "os-util.h" #include "os-util.h"
#include "parse-util.h" #include "parse-util.h"
#include "path-util.h" #include "path-util.h"
#include "sd-device.h"
#include "selinux-util.h" #include "selinux-util.h"
#include "service-util.h" #include "service-util.h"
#include "signal-util.h" #include "signal-util.h"
@ -50,6 +51,9 @@ enum {
PROP_DEPLOYMENT, PROP_DEPLOYMENT,
PROP_LOCATION, PROP_LOCATION,
PROP_HARDWARE_VENDOR,
PROP_HARDWARE_MODEL,
/* Read from /etc/os-release (or /usr/lib/os-release) */ /* Read from /etc/os-release (or /usr/lib/os-release) */
PROP_OS_PRETTY_NAME, PROP_OS_PRETTY_NAME,
PROP_OS_CPE_NAME, PROP_OS_CPE_NAME,
@ -426,6 +430,54 @@ static int context_write_data_machine_info(Context *c) {
return write_env_file_label("/etc/machine-info", l); return write_env_file_label("/etc/machine-info", l);
} }
static int property_get_hardware_vendor(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
const char *hardware_vendor = NULL;
int r;
r = sd_device_new_from_syspath(&device, "/sys/class/dmi/id");
if (r < 0) {
log_warning_errno(r, "Failed to open /sys/class/dmi/id device, ignoring: %m");
return sd_bus_message_append(reply, "s", NULL);
}
if (sd_device_get_property_value(device, "ID_VENDOR_FROM_DATABASE", &hardware_vendor) < 0)
(void) sd_device_get_property_value(device, "ID_VENDOR", &hardware_vendor);
return sd_bus_message_append(reply, "s", hardware_vendor);
}
static int property_get_hardware_model(
sd_bus *bus,
const char *path,
const char *interface,
const char *property,
sd_bus_message *reply,
void *userdata,
sd_bus_error *error) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
const char *hardware_model = NULL;
int r;
r = sd_device_new_from_syspath(&device, "/sys/class/dmi/id");
if (r < 0) {
log_warning_errno(r, "Failed to open /sys/class/dmi/id device, ignoring: %m");
return sd_bus_message_append(reply, "s", NULL);
}
if (sd_device_get_property_value(device, "ID_MODEL_FROM_DATABASE", &hardware_model) < 0)
(void) sd_device_get_property_value(device, "ID_MODEL", &hardware_model);
return sd_bus_message_append(reply, "s", hardware_model);
}
static int property_get_hostname( static int property_get_hostname(
sd_bus *bus, sd_bus *bus,
const char *path, const char *path,
@ -903,6 +955,8 @@ static const sd_bus_vtable hostname_vtable[] = {
SD_BUS_PROPERTY("OperatingSystemPrettyName", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_PRETTY_NAME, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("OperatingSystemPrettyName", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_PRETTY_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("OperatingSystemCPEName", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_CPE_NAME, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("OperatingSystemCPEName", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_CPE_NAME, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HomeURL", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_HOME_URL, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("HomeURL", "s", property_get_os_release_field, offsetof(Context, data) + sizeof(char*) * PROP_OS_HOME_URL, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HardwareVendor", "s", property_get_hardware_vendor, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("HardwareModel", "s", property_get_hardware_model, 0, SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_METHOD_WITH_NAMES("SetHostname", SD_BUS_METHOD_WITH_NAMES("SetHostname",
"sb", "sb",

View File

@ -839,6 +839,16 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
if (r < 0) if (r < 0)
return log_link_error_errno(link, r, "Failed to get gateway address from RA: %m"); return log_link_error_errno(link, r, "Failed to get gateway address from RA: %m");
if (set_contains(link->network->ndisc_deny_listed_route_prefix, &gateway.in6)) {
if (DEBUG_LOGGING) {
_cleanup_free_ char *buf = NULL;
(void) in_addr_to_string(AF_INET6, &gateway, &buf);
log_link_debug(link, "Route Prefix '%s' is deny-listed, ignoring", strnull(buf));
}
return 0;
}
if (link_has_ipv6_address(link, &gateway.in6) == 0) { if (link_has_ipv6_address(link, &gateway.in6) == 0) {
if (DEBUG_LOGGING) { if (DEBUG_LOGGING) {
_cleanup_free_ char *buf = NULL; _cleanup_free_ char *buf = NULL;
@ -1378,8 +1388,8 @@ int config_parse_ndisc_deny_listed_prefix(
void *data, void *data,
void *userdata) { void *userdata) {
Network *network = data; Set **list = data;
const char *p; bool is_route;
int r; int r;
assert(filename); assert(filename);
@ -1388,11 +1398,13 @@ int config_parse_ndisc_deny_listed_prefix(
assert(data); assert(data);
if (isempty(rvalue)) { if (isempty(rvalue)) {
network->ndisc_deny_listed_prefix = set_free_free(network->ndisc_deny_listed_prefix); *list = set_free_free(*list);
return 0; return 0;
} }
for (p = rvalue;;) { is_route = streq_ptr(lvalue, "RouteDenyList");
for (const char *p = rvalue;;) {
_cleanup_free_ char *n = NULL; _cleanup_free_ char *n = NULL;
_cleanup_free_ struct in6_addr *a = NULL; _cleanup_free_ struct in6_addr *a = NULL;
union in_addr_union ip; union in_addr_union ip;
@ -1402,8 +1414,8 @@ int config_parse_ndisc_deny_listed_prefix(
return log_oom(); return log_oom();
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse NDisc deny-listed prefix, ignoring assignment: %s", "Failed to parse NDisc deny-listed %sprefix, ignoring assignment: %s",
rvalue); is_route ? "route " : "", rvalue);
return 0; return 0;
} }
if (r == 0) if (r == 0)
@ -1412,20 +1424,24 @@ int config_parse_ndisc_deny_listed_prefix(
r = in_addr_from_string(AF_INET6, n, &ip); r = in_addr_from_string(AF_INET6, n, &ip);
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, log_syntax(unit, LOG_WARNING, filename, line, r,
"NDisc deny-listed prefix is invalid, ignoring assignment: %s", n); "NDisc deny-listed %sprefix is invalid, ignoring assignment: %s",
is_route ? "route " : "", n);
continue; continue;
} }
if (set_contains(network->ndisc_deny_listed_prefix, &ip.in6))
continue;
a = newdup(struct in6_addr, &ip.in6, 1); a = newdup(struct in6_addr, &ip.in6, 1);
if (!a) if (!a)
return log_oom(); return log_oom();
r = set_ensure_consume(&network->ndisc_deny_listed_prefix, &in6_addr_hash_ops, TAKE_PTR(a)); r = set_ensure_consume(list, &in6_addr_hash_ops, TAKE_PTR(a));
if (r < 0) if (r < 0)
return log_oom(); return log_oom();
if (r == 0)
log_syntax(unit, LOG_WARNING, filename, line, 0,
"NDisc deny-listed %sprefix entry %s is duplicated, ignoring assignment.",
is_route ? "route " : "", n);
if (r > 0)
TAKE_PTR(a);
} }
} }

View File

@ -237,8 +237,9 @@ IPv6AcceptRA.UseDNS, config_parse_bool,
IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains) IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
IPv6AcceptRA.DHCPv6Client, config_parse_ipv6_accept_ra_start_dhcp6_client, 0, offsetof(Network, ipv6_accept_ra_start_dhcp6_client) IPv6AcceptRA.DHCPv6Client, config_parse_ipv6_accept_ra_start_dhcp6_client, 0, offsetof(Network, ipv6_accept_ra_start_dhcp6_client)
IPv6AcceptRA.RouteTable, config_parse_section_route_table, 0, 0 IPv6AcceptRA.RouteTable, config_parse_section_route_table, 0, 0
IPv6AcceptRA.DenyList, config_parse_ndisc_deny_listed_prefix, 0, 0 IPv6AcceptRA.DenyList, config_parse_ndisc_deny_listed_prefix, 0, offsetof(Network, ndisc_deny_listed_prefix)
IPv6AcceptRA.BlackList, config_parse_ndisc_deny_listed_prefix, 0, 0 IPv6AcceptRA.BlackList, config_parse_ndisc_deny_listed_prefix, 0, offsetof(Network, ndisc_deny_listed_prefix)
IPv6AcceptRA.RouteDenyList, config_parse_ndisc_deny_listed_prefix, 0, offsetof(Network, ndisc_deny_listed_route_prefix)
DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec) DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec)
DHCPServer.DefaultLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_default_lease_time_usec) DHCPServer.DefaultLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_default_lease_time_usec)
DHCPServer.EmitDNS, config_parse_bool, 0, offsetof(Network, dhcp_server_emit[SD_DHCP_LEASE_DNS].emit) DHCPServer.EmitDNS, config_parse_bool, 0, offsetof(Network, dhcp_server_emit[SD_DHCP_LEASE_DNS].emit)

View File

@ -607,6 +607,7 @@ static Network *network_free(Network *network) {
ordered_set_free(network->router_search_domains); ordered_set_free(network->router_search_domains);
free(network->router_dns); free(network->router_dns);
set_free_free(network->ndisc_deny_listed_prefix); set_free_free(network->ndisc_deny_listed_prefix);
set_free_free(network->ndisc_deny_listed_route_prefix);
free(network->bridge_name); free(network->bridge_name);
free(network->bond_name); free(network->bond_name);

View File

@ -257,6 +257,7 @@ struct Network {
IPv6AcceptRAStartDHCP6Client ipv6_accept_ra_start_dhcp6_client; IPv6AcceptRAStartDHCP6Client ipv6_accept_ra_start_dhcp6_client;
uint32_t ipv6_accept_ra_route_table; uint32_t ipv6_accept_ra_route_table;
Set *ndisc_deny_listed_prefix; Set *ndisc_deny_listed_prefix;
Set *ndisc_deny_listed_route_prefix;
OrderedSet *ipv6_tokens; OrderedSet *ipv6_tokens;
/* LLDP support */ /* LLDP support */

View File

@ -1311,7 +1311,7 @@ static int fd_set_attribute(Item *item, int fd, const char *path, const struct s
unsigned previous, current; unsigned previous, current;
r = chattr_full(NULL, procfs_fd, f, item->attribute_mask, &previous, &current, true); r = chattr_full(NULL, procfs_fd, f, item->attribute_mask, &previous, &current, true);
if (r == -ENOANO) if (r == -ENOANO)
log_warning("Cannot set file attributes for '%s', maybe due to incompatiblity in specified attributes, " log_warning("Cannot set file attributes for '%s', maybe due to incompatibility in specified attributes, "
"previous=0x%08x, current=0x%08x, expected=0x%08x, ignoring.", "previous=0x%08x, current=0x%08x, expected=0x%08x, ignoring.",
path, previous, current, (previous & ~item->attribute_mask) | (f & item->attribute_mask)); path, previous, current, (previous & ~item->attribute_mask) | (f & item->attribute_mask));
else if (r < 0) else if (r < 0)

View File

@ -602,8 +602,11 @@ static int smbios3_decode(const uint8_t *buf, const char *devmem, bool no_file_o
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to verify checksum."); return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to verify checksum.");
offset = QWORD(buf + 0x10); offset = QWORD(buf + 0x10);
if (!no_file_offset && (offset >> 32) != 0 && sizeof(int64_t) < 8)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "64-bit addresses not supported."); #if __SIZEOF_SIZE_T__ != 8
if (!no_file_offset && (offset >> 32) != 0)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "64-bit addresses not supported on 32-bit systems.");
#endif
return dmi_table(offset, DWORD(buf + 0x0C), 0, devmem, no_file_offset); return dmi_table(offset, DWORD(buf + 0x0C), 0, devmem, no_file_offset);
} }

View File

@ -184,15 +184,23 @@ if dmi_arches.contains(host_machine.cpu_family())
endif endif
foreach prog : udev_id_progs foreach prog : udev_id_progs
executable(prog[0].split('/')[0], name = prog[0].split('/')[0]
prog,
include_directories : includes, exe = executable(
c_args : ['-DLOG_REALM=LOG_REALM_UDEV'], name,
dependencies : [versiondep], prog,
link_with : udev_link_with, include_directories : includes,
install_rpath : udev_rpath, c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
install : true, dependencies : [versiondep],
install_dir : udevlibexecdir) link_with : udev_link_with,
install_rpath : udev_rpath,
install : true,
install_dir : udevlibexecdir)
# TODO: let's use a dictionary instead as soon as we can depend on meson >= 0.47.
if name == 'dmi_memory_id'
dmi_memory_id_path = exe.full_path()
endif
endforeach endforeach
if install_sysconfdir if install_sysconfdir

Binary file not shown.

View File

@ -0,0 +1,94 @@
MEMORY_ARRAY_LOCATION=System Board Or Motherboard
MEMORY_ARRAY_EC_TYPE=Multi-bit ECC
MEMORY_ARRAY_MAX_CAPACITY=12884901888
MEMORY_ARRAY_NUM_DEVICES=3
MEMORY_ARRAY_LOCATION=System Board Or Motherboard
MEMORY_ARRAY_EC_TYPE=Multi-bit ECC
MEMORY_ARRAY_MAX_CAPACITY=12884901888
MEMORY_ARRAY_NUM_DEVICES=3
MEMORY_DEVICE_0_TOTAL_WIDTH=72
MEMORY_DEVICE_0_DATA_WIDTH=64
MEMORY_DEVICE_0_SIZE=8589934592
MEMORY_DEVICE_0_FORM_FACTOR=DIMM
MEMORY_DEVICE_0_LOCATOR=CPU0 DIMM1
MEMORY_DEVICE_0_BANK_LOCATOR=Not Specified
MEMORY_DEVICE_0_TYPE=DDR3
MEMORY_DEVICE_0_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
MEMORY_DEVICE_0_SPEED_MTS=1600
MEMORY_DEVICE_0_MANUFACTURER=JEDEC ID:80 AD
MEMORY_DEVICE_0_SERIAL_NUMBER=BC8A0E80
MEMORY_DEVICE_0_ASSET_TAG=Not Specified
MEMORY_DEVICE_0_PART_NUMBER=HMT41GU7AFR8C-PB
MEMORY_DEVICE_0_RANK=2
MEMORY_DEVICE_1_TOTAL_WIDTH=72
MEMORY_DEVICE_1_DATA_WIDTH=64
MEMORY_DEVICE_1_SIZE=8589934592
MEMORY_DEVICE_1_FORM_FACTOR=DIMM
MEMORY_DEVICE_1_LOCATOR=CPU0 DIMM2
MEMORY_DEVICE_1_BANK_LOCATOR=Not Specified
MEMORY_DEVICE_1_TYPE=DDR3
MEMORY_DEVICE_1_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
MEMORY_DEVICE_1_SPEED_MTS=1600
MEMORY_DEVICE_1_MANUFACTURER=JEDEC ID:80 AD
MEMORY_DEVICE_1_SERIAL_NUMBER=86A6934F
MEMORY_DEVICE_1_ASSET_TAG=Not Specified
MEMORY_DEVICE_1_PART_NUMBER=HMT41GU7AFR8C-PB
MEMORY_DEVICE_1_RANK=2
MEMORY_DEVICE_2_DATA_WIDTH=64
MEMORY_DEVICE_2_PRESENT=0
MEMORY_DEVICE_2_FORM_FACTOR=DIMM
MEMORY_DEVICE_2_LOCATOR=CPU0 DIMM3
MEMORY_DEVICE_2_BANK_LOCATOR=Not Specified
MEMORY_DEVICE_2_TYPE=DDR3
MEMORY_DEVICE_2_TYPE_DETAIL=Synchronous
MEMORY_DEVICE_2_MANUFACTURER=JEDEC ID:
MEMORY_DEVICE_2_ASSET_TAG=Not Specified
MEMORY_DEVICE_3_TOTAL_WIDTH=72
MEMORY_DEVICE_3_DATA_WIDTH=64
MEMORY_DEVICE_3_SIZE=8589934592
MEMORY_DEVICE_3_FORM_FACTOR=DIMM
MEMORY_DEVICE_3_LOCATOR=CPU1 DIMM1
MEMORY_DEVICE_3_BANK_LOCATOR=Not Specified
MEMORY_DEVICE_3_TYPE=DDR3
MEMORY_DEVICE_3_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
MEMORY_DEVICE_3_SPEED_MTS=1600
MEMORY_DEVICE_3_MANUFACTURER=JEDEC ID:80 AD
MEMORY_DEVICE_3_SERIAL_NUMBER=A18A0E80
MEMORY_DEVICE_3_ASSET_TAG=Not Specified
MEMORY_DEVICE_3_PART_NUMBER=HMT41GU7AFR8C-PB
MEMORY_DEVICE_3_RANK=2
MEMORY_DEVICE_4_TOTAL_WIDTH=72
MEMORY_DEVICE_4_DATA_WIDTH=64
MEMORY_DEVICE_4_SIZE=8589934592
MEMORY_DEVICE_4_FORM_FACTOR=DIMM
MEMORY_DEVICE_4_LOCATOR=CPU1 DIMM2
MEMORY_DEVICE_4_BANK_LOCATOR=Not Specified
MEMORY_DEVICE_4_TYPE=DDR3
MEMORY_DEVICE_4_TYPE_DETAIL=Synchronous Unbuffered (Unregistered)
MEMORY_DEVICE_4_SPEED_MTS=1600
MEMORY_DEVICE_4_MANUFACTURER=JEDEC ID:80 AD
MEMORY_DEVICE_4_SERIAL_NUMBER=7D8A0E80
MEMORY_DEVICE_4_ASSET_TAG=Not Specified
MEMORY_DEVICE_4_PART_NUMBER=HMT41GU7AFR8C-PB
MEMORY_DEVICE_4_RANK=2
MEMORY_DEVICE_5_DATA_WIDTH=64
MEMORY_DEVICE_5_PRESENT=0
MEMORY_DEVICE_5_FORM_FACTOR=DIMM
MEMORY_DEVICE_5_LOCATOR=CPU1 DIMM3
MEMORY_DEVICE_5_BANK_LOCATOR=Not Specified
MEMORY_DEVICE_5_TYPE=DDR3
MEMORY_DEVICE_5_TYPE_DETAIL=Synchronous
MEMORY_DEVICE_5_MANUFACTURER=JEDEC ID:
MEMORY_DEVICE_5_ASSET_TAG=Not Specified
MEMORY_DEVICE_6_TOTAL_WIDTH=2
MEMORY_DEVICE_6_DATA_WIDTH=2
MEMORY_DEVICE_6_SIZE=2097152
MEMORY_DEVICE_6_FORM_FACTOR=Chip
MEMORY_DEVICE_6_LOCATOR=SYSTEM ROM
MEMORY_DEVICE_6_BANK_LOCATOR=Not Specified
MEMORY_DEVICE_6_TYPE=Flash
MEMORY_DEVICE_6_TYPE_DETAIL=Non-Volatile
MEMORY_DEVICE_6_MANUFACTURER=Not Specified
MEMORY_DEVICE_6_SERIAL_NUMBER=Not Specified
MEMORY_DEVICE_6_ASSET_TAG=Not Specified
MEMORY_DEVICE_6_PART_NUMBER=Not Specified

View File

@ -312,6 +312,7 @@ UseAutonomousPrefix=
UseOnLinkPrefix= UseOnLinkPrefix=
DenyList= DenyList=
BlackList= BlackList=
RouteDenyList=
[DHCPServer] [DHCPServer]
EmitNTP= EmitNTP=
PoolSize= PoolSize=

View File

@ -124,6 +124,8 @@ else
message('Skipping udev-test because perl is not available') message('Skipping udev-test because perl is not available')
endif endif
############################################################
if conf.get('ENABLE_HWDB') == 1 if conf.get('ENABLE_HWDB') == 1
hwdb_test_sh = find_program('hwdb-test.sh') hwdb_test_sh = find_program('hwdb-test.sh')
if want_tests != 'false' if want_tests != 'false'
@ -133,11 +135,29 @@ if conf.get('ENABLE_HWDB') == 1
endif endif
endif endif
if want_tests != false and dmi_arches.contains(host_machine.cpu_family()) ############################################################
if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh') udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh')
test('udev-dmi-memory-id-test',
udev_dmi_memory_id_test, if git.found()
timeout : 90) out = run_command(
git,
'--git-dir=@0@/.git'.format(project_source_root),
'ls-files', ':/test/dmidecode-dumps/*.bin')
else
out = run_command(
'sh', '-c', 'ls @0@/test/dmidecode-dumps/*.bin'.format(project_source_root))
endif
foreach p : out.stdout().split()
source = join_paths(project_source_root, p)
name = 'dmidecode_' + p.split('/')[-1].split('.')[0]
test(name,
udev_dmi_memory_id_test,
args : [dmi_memory_id_path, source, source + '.txt'])
endforeach
endif endif
subdir('fuzz') subdir('fuzz')

View File

@ -1,31 +1,17 @@
#!/bin/sh #!/bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
#
set -e set -e
export SYSTEMD_LOG_LEVEL=info dmi_memory_id="$1"
ROOTDIR=$(dirname $(dirname $(readlink -f $0))) input="$2"
UDEV_DMI_MEMORY_ID=./src/udev/dmi_memory_id expected="$3"
if [ ! -x "$UDEV_DMI_MEMORY_ID" ]; then output=$(mktemp --tmpdir "test-udev-dmi-memory-id.XXXXXXXXXX")
echo "$UDEV_DMI_MEMORY_ID does not exist, please build first" trap "rm '$output'" EXIT INT QUIT PIPE
exit 1
fi
D=$(mktemp --tmpdir --directory "udev-dmi-memory-id.XXXXXXXXXX") (
trap "rm -rf '$D'" EXIT INT QUIT PIPE set -x
"$dmi_memory_id" -F "$input" >$output
for i in $ROOTDIR/test/dmidecode-dumps/*.bin ; do diff -u "$output" "$expected"
$("$UDEV_DMI_MEMORY_ID" -F "$i" 2>&1 > "$D"/out.txt) && rc= || rc=$? )
if [ -n "$rc" ]; then
echo "$UDEV_DMI_MEMORY_ID returned $rc"
exit $rc
fi
err=$(diff -u "$D"/out.txt "$i.txt" 2>&1) && rc= || rc=$?
if [ -n "$rc" ]; then
echo "Parsing DMI memory information from \"$i\" didn't match expected:"
echo "$err"
exit $rc
fi
done