mirror of
https://github.com/systemd/systemd
synced 2026-03-06 05:04:45 +01:00
Compare commits
13 Commits
9f62de5762
...
d1a61dfa69
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d1a61dfa69 | ||
|
|
8a5a01d19c | ||
|
|
a4c3c5b751 | ||
|
|
3693cbacf7 | ||
|
|
0be6dee2c2 | ||
|
|
9bd6ee8d5d | ||
|
|
16c89e649d | ||
|
|
af42881bf9 | ||
|
|
7bbdef621f | ||
|
|
2b7b142e97 | ||
|
|
b9d8069832 | ||
|
|
7341f6b58d | ||
|
|
8723ddc7e5 |
6
hwdb.d/20-dmi-id.hwdb
Normal file
6
hwdb.d/20-dmi-id.hwdb
Normal 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
|
||||
@ -4,6 +4,7 @@
|
||||
# they are very long but quite repetitive and the parser is not very fast.
|
||||
# So we don't "test" them.
|
||||
hwdb_files_notest = files('''
|
||||
20-dmi-id.hwdb
|
||||
20-pci-vendor-model.hwdb
|
||||
20-pci-classes.hwdb
|
||||
20-usb-vendor-model.hwdb
|
||||
|
||||
@ -81,6 +81,10 @@ node /org/freedesktop/hostname1 {
|
||||
readonly s OperatingSystemCPEName = '...';
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
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.Introspectable { ... };
|
||||
@ -88,6 +92,10 @@ node /org/freedesktop/hostname1 {
|
||||
};
|
||||
</programlisting>
|
||||
|
||||
<!--property HardwareVendor is not documented!-->
|
||||
|
||||
<!--property HardwareModel is not documented!-->
|
||||
|
||||
<!--Autogenerated cross-references for systemd.directives, do not edit-->
|
||||
|
||||
<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="HardwareVendor"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="HardwareModel"/>
|
||||
|
||||
<!--End of Autogenerated section-->
|
||||
|
||||
<para>Whenever the hostname or other metadata is changed via the daemon,
|
||||
|
||||
@ -2095,7 +2095,16 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
<varlistentry>
|
||||
<term><varname>DenyList=</varname></term>
|
||||
<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>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@ -89,4 +89,7 @@ KERNEL=="udmabuf", GROUP="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"
|
||||
|
||||
@ -43,6 +43,8 @@ typedef struct StatusInfo {
|
||||
const char *virtualization;
|
||||
const char *architecture;
|
||||
const char *home_url;
|
||||
const char *hardware_vendor;
|
||||
const char *hardware_model;
|
||||
} StatusInfo;
|
||||
|
||||
static void print_status_info(StatusInfo *i) {
|
||||
@ -107,6 +109,11 @@ static void print_status_info(StatusInfo *i) {
|
||||
if (!isempty(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) {
|
||||
@ -150,6 +157,8 @@ static int show_all_names(sd_bus *bus, sd_bus_error *error) {
|
||||
{ "OperatingSystemPrettyName", "s", NULL, offsetof(StatusInfo, os_pretty_name) },
|
||||
{ "OperatingSystemCPEName", "s", NULL, offsetof(StatusInfo, os_cpe_name) },
|
||||
{ "HomeURL", "s", NULL, offsetof(StatusInfo, home_url) },
|
||||
{ "HardwareVendor", "s", NULL, offsetof(StatusInfo, hardware_vendor) },
|
||||
{ "HardwareModel", "s", NULL, offsetof(StatusInfo, hardware_model) },
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "os-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "sd-device.h"
|
||||
#include "selinux-util.h"
|
||||
#include "service-util.h"
|
||||
#include "signal-util.h"
|
||||
@ -50,6 +51,9 @@ enum {
|
||||
PROP_DEPLOYMENT,
|
||||
PROP_LOCATION,
|
||||
|
||||
PROP_HARDWARE_VENDOR,
|
||||
PROP_HARDWARE_MODEL,
|
||||
|
||||
/* Read from /etc/os-release (or /usr/lib/os-release) */
|
||||
PROP_OS_PRETTY_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);
|
||||
}
|
||||
|
||||
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(
|
||||
sd_bus *bus,
|
||||
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("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("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",
|
||||
"sb",
|
||||
|
||||
@ -839,6 +839,16 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
|
||||
if (r < 0)
|
||||
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 (DEBUG_LOGGING) {
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
@ -1378,8 +1388,8 @@ int config_parse_ndisc_deny_listed_prefix(
|
||||
void *data,
|
||||
void *userdata) {
|
||||
|
||||
Network *network = data;
|
||||
const char *p;
|
||||
Set **list = data;
|
||||
bool is_route;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
@ -1388,11 +1398,13 @@ int config_parse_ndisc_deny_listed_prefix(
|
||||
assert(data);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
network->ndisc_deny_listed_prefix = set_free_free(network->ndisc_deny_listed_prefix);
|
||||
*list = set_free_free(*list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (p = rvalue;;) {
|
||||
is_route = streq_ptr(lvalue, "RouteDenyList");
|
||||
|
||||
for (const char *p = rvalue;;) {
|
||||
_cleanup_free_ char *n = NULL;
|
||||
_cleanup_free_ struct in6_addr *a = NULL;
|
||||
union in_addr_union ip;
|
||||
@ -1402,8 +1414,8 @@ int config_parse_ndisc_deny_listed_prefix(
|
||||
return log_oom();
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse NDisc deny-listed prefix, ignoring assignment: %s",
|
||||
rvalue);
|
||||
"Failed to parse NDisc deny-listed %sprefix, ignoring assignment: %s",
|
||||
is_route ? "route " : "", rvalue);
|
||||
return 0;
|
||||
}
|
||||
if (r == 0)
|
||||
@ -1412,20 +1424,24 @@ int config_parse_ndisc_deny_listed_prefix(
|
||||
r = in_addr_from_string(AF_INET6, n, &ip);
|
||||
if (r < 0) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (set_contains(network->ndisc_deny_listed_prefix, &ip.in6))
|
||||
continue;
|
||||
|
||||
a = newdup(struct in6_addr, &ip.in6, 1);
|
||||
if (!a)
|
||||
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)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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.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.DenyList, config_parse_ndisc_deny_listed_prefix, 0, 0
|
||||
IPv6AcceptRA.BlackList, 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, 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.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)
|
||||
|
||||
@ -607,6 +607,7 @@ static Network *network_free(Network *network) {
|
||||
ordered_set_free(network->router_search_domains);
|
||||
free(network->router_dns);
|
||||
set_free_free(network->ndisc_deny_listed_prefix);
|
||||
set_free_free(network->ndisc_deny_listed_route_prefix);
|
||||
|
||||
free(network->bridge_name);
|
||||
free(network->bond_name);
|
||||
|
||||
@ -257,6 +257,7 @@ struct Network {
|
||||
IPv6AcceptRAStartDHCP6Client ipv6_accept_ra_start_dhcp6_client;
|
||||
uint32_t ipv6_accept_ra_route_table;
|
||||
Set *ndisc_deny_listed_prefix;
|
||||
Set *ndisc_deny_listed_route_prefix;
|
||||
OrderedSet *ipv6_tokens;
|
||||
|
||||
/* LLDP support */
|
||||
|
||||
@ -1311,7 +1311,7 @@ static int fd_set_attribute(Item *item, int fd, const char *path, const struct s
|
||||
unsigned previous, current;
|
||||
r = chattr_full(NULL, procfs_fd, f, item->attribute_mask, &previous, ¤t, true);
|
||||
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.",
|
||||
path, previous, current, (previous & ~item->attribute_mask) | (f & item->attribute_mask));
|
||||
else if (r < 0)
|
||||
|
||||
@ -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.");
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -184,15 +184,23 @@ if dmi_arches.contains(host_machine.cpu_family())
|
||||
endif
|
||||
|
||||
foreach prog : udev_id_progs
|
||||
executable(prog[0].split('/')[0],
|
||||
prog,
|
||||
include_directories : includes,
|
||||
c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
|
||||
dependencies : [versiondep],
|
||||
link_with : udev_link_with,
|
||||
install_rpath : udev_rpath,
|
||||
install : true,
|
||||
install_dir : udevlibexecdir)
|
||||
name = prog[0].split('/')[0]
|
||||
|
||||
exe = executable(
|
||||
name,
|
||||
prog,
|
||||
include_directories : includes,
|
||||
c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
|
||||
dependencies : [versiondep],
|
||||
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
|
||||
|
||||
if install_sysconfdir
|
||||
|
||||
BIN
test/dmidecode-dumps/HP-Z600.bin
Normal file
BIN
test/dmidecode-dumps/HP-Z600.bin
Normal file
Binary file not shown.
94
test/dmidecode-dumps/HP-Z600.bin.txt
Normal file
94
test/dmidecode-dumps/HP-Z600.bin.txt
Normal 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
|
||||
@ -312,6 +312,7 @@ UseAutonomousPrefix=
|
||||
UseOnLinkPrefix=
|
||||
DenyList=
|
||||
BlackList=
|
||||
RouteDenyList=
|
||||
[DHCPServer]
|
||||
EmitNTP=
|
||||
PoolSize=
|
||||
|
||||
@ -124,6 +124,8 @@ else
|
||||
message('Skipping udev-test because perl is not available')
|
||||
endif
|
||||
|
||||
############################################################
|
||||
|
||||
if conf.get('ENABLE_HWDB') == 1
|
||||
hwdb_test_sh = find_program('hwdb-test.sh')
|
||||
if want_tests != 'false'
|
||||
@ -133,11 +135,29 @@ if conf.get('ENABLE_HWDB') == 1
|
||||
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')
|
||||
test('udev-dmi-memory-id-test',
|
||||
udev_dmi_memory_id_test,
|
||||
timeout : 90)
|
||||
|
||||
if git.found()
|
||||
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
|
||||
|
||||
subdir('fuzz')
|
||||
|
||||
@ -1,31 +1,17 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
export SYSTEMD_LOG_LEVEL=info
|
||||
ROOTDIR=$(dirname $(dirname $(readlink -f $0)))
|
||||
UDEV_DMI_MEMORY_ID=./src/udev/dmi_memory_id
|
||||
dmi_memory_id="$1"
|
||||
input="$2"
|
||||
expected="$3"
|
||||
|
||||
if [ ! -x "$UDEV_DMI_MEMORY_ID" ]; then
|
||||
echo "$UDEV_DMI_MEMORY_ID does not exist, please build first"
|
||||
exit 1
|
||||
fi
|
||||
output=$(mktemp --tmpdir "test-udev-dmi-memory-id.XXXXXXXXXX")
|
||||
trap "rm '$output'" EXIT INT QUIT PIPE
|
||||
|
||||
D=$(mktemp --tmpdir --directory "udev-dmi-memory-id.XXXXXXXXXX")
|
||||
trap "rm -rf '$D'" EXIT INT QUIT PIPE
|
||||
|
||||
for i in $ROOTDIR/test/dmidecode-dumps/*.bin ; do
|
||||
$("$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
|
||||
(
|
||||
set -x
|
||||
"$dmi_memory_id" -F "$input" >$output
|
||||
diff -u "$output" "$expected"
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user