Compare commits

..

No commits in common. "0d0248c665e8352c250815a1685726de0769b36f" and "cc479760b4736082d26ec332f2423a9ab23d59c5" have entirely different histories.

14 changed files with 226 additions and 131 deletions

View File

@ -118,7 +118,7 @@ requires random numbers as well, including for the following uses:
* systemd maintains various hash tables internally. In order to harden them
against [collision
attacks](https://www.cs.auckland.ac.nz/~mcw/Teaching/refs/misc/denial-of-service.pdf)
attacks](https://rt.perl.org/Public/Bug/Display.html?CSRF_Token=165691af9ddaa95f653402f1b68de728)
they are seeded with random numbers.
* At various places systemd needs random bytes for temporary file name

View File

@ -670,8 +670,8 @@
</varlistentry>
<varlistentry>
<term><varname>IPIngressFilterPath=<replaceable>BPF_FS_PROGRAM_PATH</replaceable></varname></term>
<term><varname>IPEgressFilterPath=<replaceable>BPF_FS_PROGRAM_PATH</replaceable></varname></term>
<term><varname>IPIngressFilterPath=<replaceable>BPF_FS_PROGRAMM_PATH</replaceable></varname></term>
<term><varname>IPEgressFilterPath=<replaceable>BPF_FS_PROGRAMM_PATH</replaceable></varname></term>
<listitem>
<para>Add custom network traffic filters implemented as BPF programs, applying to all IP packets

View File

@ -707,14 +707,112 @@ static int bus_cgroup_set_boolean(
return 1; \
}
#define BUS_DEFINE_SET_CGROUP_PROTECTION(function, mask, scale) \
static int bus_cgroup_set_##function( \
Unit *u, \
const char *name, \
uint64_t *p, \
bool *s, \
sd_bus_message *message, \
UnitWriteFlags flags, \
sd_bus_error *error) { \
\
uint64_t v = CGROUP_LIMIT_MIN; \
bool nonempty = true; \
char type; \
int r; \
\
assert(p); \
assert(s); \
\
r = sd_bus_message_peek_type(message, &type, NULL); \
if (r < 0) \
return r; \
if (type == SD_BUS_TYPE_BOOLEAN) { \
r = sd_bus_message_read(message, "b", &nonempty); \
if (r < 0) \
return r; \
/* Bool is used to denote empty value only */ \
if (nonempty) \
return -EINVAL; \
} else if (type != SD_BUS_TYPE_UINT64) { \
return -EINVAL; \
} else { \
r = sd_bus_message_read(message, "t", &v); \
if (r < 0) \
return r; \
} \
\
if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \
*p = v; \
unit_invalidate_cgroup(u, mask); \
if (!nonempty) { \
*s = false; \
unit_write_settingf(u, flags, name, \
"%s=", name); \
} else if (v == CGROUP_LIMIT_MAX) { \
*s = true; \
unit_write_settingf(u, flags, name, \
"%s=infinity", name); \
} else { \
*s = true; \
unit_write_settingf(u, flags, name, \
"%s=%" PRIu64, name, v); \
} \
} \
\
return 1; \
} \
static int bus_cgroup_set_##function##_scale( \
Unit *u, \
const char *name, \
uint64_t *p, \
bool *s, \
sd_bus_message *message, \
UnitWriteFlags flags, \
sd_bus_error *error) { \
\
uint64_t v; \
uint32_t raw; \
int r; \
\
assert(p); \
assert(s); \
\
r = sd_bus_message_read(message, "u", &raw); \
if (r < 0) \
return r; \
\
v = scale(raw, UINT32_MAX); \
if (v >= UINT64_MAX) \
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, \
"Value specified in %s is out of range", name); \
\
if (!UNIT_WRITE_FLAGS_NOOP(flags)) { \
*p = v; \
unit_invalidate_cgroup(u, mask); \
\
/* Prepare to chop off suffix */ \
assert_se(endswith(name, "Scale")); \
\
uint32_t scaled = DIV_ROUND_UP((uint64_t) raw * 1000, (uint64_t) UINT32_MAX); \
unit_write_settingf(u, flags, name, "%.*s=%" PRIu32 ".%" PRIu32 "%%", \
(int)(strlen(name) - strlen("Scale")), name, \
scaled / 10, scaled % 10); \
} \
\
*s = true; \
return 1; \
}
DISABLE_WARNING_TYPE_LIMITS;
BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_weight, CGROUP_MASK_CPU, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID);
BUS_DEFINE_SET_CGROUP_WEIGHT(cpu_shares, CGROUP_MASK_CPU, CGROUP_CPU_SHARES_IS_OK, CGROUP_CPU_SHARES_INVALID);
BUS_DEFINE_SET_CGROUP_WEIGHT(io_weight, CGROUP_MASK_IO, CGROUP_WEIGHT_IS_OK, CGROUP_WEIGHT_INVALID);
BUS_DEFINE_SET_CGROUP_WEIGHT(blockio_weight, CGROUP_MASK_BLKIO, CGROUP_BLKIO_WEIGHT_IS_OK, CGROUP_BLKIO_WEIGHT_INVALID);
BUS_DEFINE_SET_CGROUP_LIMIT(memory, CGROUP_MASK_MEMORY, physical_memory_scale, 1);
BUS_DEFINE_SET_CGROUP_LIMIT(memory_protection, CGROUP_MASK_MEMORY, physical_memory_scale, 0);
BUS_DEFINE_SET_CGROUP_LIMIT(swap, CGROUP_MASK_MEMORY, physical_memory_scale, 0);
BUS_DEFINE_SET_CGROUP_PROTECTION(memory_protection, CGROUP_MASK_MEMORY, physical_memory_scale);
REENABLE_WARNING;
static int bus_cgroup_set_tasks_max(
@ -840,33 +938,17 @@ int bus_cgroup_set_property(
if (streq(name, "MemoryAccounting"))
return bus_cgroup_set_boolean(u, name, &c->memory_accounting, CGROUP_MASK_MEMORY, message, flags, error);
if (streq(name, "MemoryMin")) {
r = bus_cgroup_set_memory_protection(u, name, &c->memory_min, message, flags, error);
if (r > 0)
c->memory_min_set = true;
return r;
}
if (streq(name, "MemoryMin"))
return bus_cgroup_set_memory_protection(u, name, &c->memory_min, &c->memory_min_set, message, flags, error);
if (streq(name, "MemoryLow")) {
r = bus_cgroup_set_memory_protection(u, name, &c->memory_low, message, flags, error);
if (r > 0)
c->memory_low_set = true;
return r;
}
if (streq(name, "MemoryLow"))
return bus_cgroup_set_memory_protection(u, name, &c->memory_low, &c->memory_low_set, message, flags, error);
if (streq(name, "DefaultMemoryMin")) {
r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_min, message, flags, error);
if (r > 0)
c->default_memory_min_set = true;
return r;
}
if (streq(name, "DefaultMemoryMin"))
return bus_cgroup_set_memory_protection(u, name, &c->default_memory_min, &c->default_memory_min_set, message, flags, error);
if (streq(name, "DefaultMemoryLow")) {
r = bus_cgroup_set_memory_protection(u, name, &c->default_memory_low, message, flags, error);
if (r > 0)
c->default_memory_low_set = true;
return r;
}
if (streq(name, "DefaultMemoryLow"))
return bus_cgroup_set_memory_protection(u, name, &c->default_memory_low, &c->default_memory_low_set, message, flags, error);
if (streq(name, "MemoryHigh"))
return bus_cgroup_set_memory(u, name, &c->memory_high, message, flags, error);
@ -880,33 +962,17 @@ int bus_cgroup_set_property(
if (streq(name, "MemoryLimit"))
return bus_cgroup_set_memory(u, name, &c->memory_limit, message, flags, error);
if (streq(name, "MemoryMinScale")) {
r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_min, message, flags, error);
if (r > 0)
c->memory_min_set = true;
return r;
}
if (streq(name, "MemoryMinScale"))
return bus_cgroup_set_memory_protection_scale(u, name, &c->memory_min, &c->memory_min_set, message, flags, error);
if (streq(name, "MemoryLowScale")) {
r = bus_cgroup_set_memory_protection_scale(u, name, &c->memory_low, message, flags, error);
if (r > 0)
c->memory_low_set = true;
return r;
}
if (streq(name, "MemoryLowScale"))
return bus_cgroup_set_memory_protection_scale(u, name, &c->memory_low, &c->memory_low_set, message, flags, error);
if (streq(name, "DefaultMemoryMinScale")) {
r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_min, message, flags, error);
if (r > 0)
c->default_memory_min_set = true;
return r;
}
if (streq(name, "DefaultMemoryMinScale"))
return bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_min, &c->default_memory_min_set, message, flags, error);
if (streq(name, "DefaultMemoryLowScale")) {
r = bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_low, message, flags, error);
if (r > 0)
c->default_memory_low_set = true;
return r;
}
if (streq(name, "DefaultMemoryLowScale"))
return bus_cgroup_set_memory_protection_scale(u, name, &c->default_memory_low, &c->default_memory_low_set, message, flags, error);
if (streq(name, "MemoryHighScale"))
return bus_cgroup_set_memory_scale(u, name, &c->memory_high, message, flags, error);

View File

@ -3456,6 +3456,8 @@ int config_parse_memory_limit(
}
}
/* Keep Memory{Low,Min} unset with empty assignment so that we fall back to DefaultMemory* which in
* contrast means zeroing the property. */
if (streq(lvalue, "DefaultMemoryLow")) {
c->default_memory_low = bytes;
c->default_memory_low_set = true;
@ -3464,10 +3466,10 @@ int config_parse_memory_limit(
c->default_memory_min_set = true;
} else if (streq(lvalue, "MemoryMin")) {
c->memory_min = bytes;
c->memory_min_set = true;
c->memory_min_set = !isempty(rvalue);
} else if (streq(lvalue, "MemoryLow")) {
c->memory_low = bytes;
c->memory_low_set = true;
c->memory_low_set = !isempty(rvalue);
} else if (streq(lvalue, "MemoryHigh"))
c->memory_high = bytes;
else if (streq(lvalue, "MemoryMax"))

View File

@ -82,3 +82,6 @@ int dhcp_lease_insert_private_option(sd_dhcp_lease *lease, uint8_t tag, const vo
int dhcp_lease_set_default_subnet_mask(sd_dhcp_lease *lease);
int dhcp_lease_set_client_id(sd_dhcp_lease *lease, const void *client_id, size_t client_id_len);
int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file);

View File

@ -61,13 +61,9 @@ int deserialize_in6_addrs(struct in6_addr **addresses, const char *string);
/* don't include "dhcp-lease-internal.h" as it causes conflicts between netinet/ip.h and linux/ip.h */
struct sd_dhcp_route;
struct sd_dhcp_lease;
void serialize_dhcp_routes(FILE *f, const char *key, sd_dhcp_route **routes, size_t size);
int deserialize_dhcp_routes(struct sd_dhcp_route **ret, size_t *ret_size, size_t *ret_allocated, const char *string);
/* It is not necessary to add deserialize_dhcp_option(). Use unhexmem() instead. */
int serialize_dhcp_option(FILE *f, const char *key, const void *data, size_t size);
int dhcp_lease_save(sd_dhcp_lease *lease, const char *lease_file);
int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file);

View File

@ -1076,7 +1076,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
"ADDRESS", &address,
"ROUTER", &router,
"NETMASK", &netmask,
"SERVER_ADDRESS", &server_address,
"SERVER_IDENTIFIER", &server_address,
"NEXT_SERVER", &next_server,
"BROADCAST", &broadcast,
"DNS", &dns,

View File

@ -168,6 +168,10 @@ _public_ int sd_network_link_get_address_state(int ifindex, char **state) {
return network_link_get_string(ifindex, "ADDRESS_STATE", state);
}
_public_ int sd_network_link_get_dhcp4_client_id_string(int ifindex, char **client_id) {
return network_link_get_string(ifindex, "DHCP4_CLIENT_ID", client_id);
}
_public_ int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **iaid) {
return network_link_get_string(ifindex, "DHCP6_CLIENT_IAID", iaid);
}
@ -232,6 +236,14 @@ _public_ int sd_network_link_get_dnssec_negative_trust_anchors(int ifindex, char
return network_link_get_strv(ifindex, "DNSSEC_NTA", nta);
}
_public_ int sd_network_link_get_timezone(int ifindex, char **ret) {
return network_link_get_string(ifindex, "TIMEZONE", ret);
}
_public_ int sd_network_link_get_dhcp4_address(int ifindex, char **ret) {
return network_link_get_string(ifindex, "DHCP4_ADDRESS", ret);
}
_public_ int sd_network_link_get_dns(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "DNS", ret);
}

View File

@ -1,6 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <arpa/inet.h>
#include <getopt.h>
#include <linux/if_addrlabel.h>
#include <net/if.h>
@ -931,13 +930,12 @@ static int dump_gateways(
static int dump_addresses(
sd_netlink *rtnl,
sd_dhcp_lease *lease,
Table *table,
int ifindex) {
_cleanup_free_ struct local_address *local = NULL;
_cleanup_free_ char *dhcp4_address = NULL;
_cleanup_strv_free_ char **buf = NULL;
struct in_addr dhcp4_address = {};
int r, n, i;
assert(rtnl);
@ -947,8 +945,7 @@ static int dump_addresses(
if (n <= 0)
return n;
if (lease)
(void) sd_dhcp_lease_get_address(lease, &dhcp4_address);
(void) sd_network_link_get_dhcp4_address(ifindex, &dhcp4_address);
for (i = 0; i < n; i++) {
_cleanup_free_ char *pretty = NULL;
@ -958,19 +955,13 @@ static int dump_addresses(
if (r < 0)
return r;
if (local[i].family == AF_INET && in4_addr_equal(&local[i].address.in, &dhcp4_address)) {
struct in_addr server_address;
char *p, s[INET_ADDRSTRLEN];
if (dhcp4_address && streq(pretty, dhcp4_address)) {
_cleanup_free_ char *p = NULL;
r = sd_dhcp_lease_get_server_identifier(lease, &server_address);
if (r >= 0 && inet_ntop(AF_INET, &server_address, s, sizeof(s)))
p = strjoin(pretty, " (DHCP4 via ", s, ")");
else
p = strjoin(pretty, " (DHCP4)");
if (!p)
p = pretty;
pretty = strjoin(pretty , " (DHCP4)");
if (!pretty)
return log_oom();
free_and_replace(pretty, p);
}
r = strv_extendf(&buf, "%s%s%s",
@ -1388,12 +1379,12 @@ static int link_status_one(
const LinkInfo *info) {
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL;
_cleanup_free_ char *t = NULL, *network = NULL, *iaid = NULL, *duid = NULL,
*setup_state = NULL, *operational_state = NULL, *lease_file = NULL;
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL,
*on_color_operational, *off_color_operational, *on_color_setup, *off_color_setup;
_cleanup_free_ char *t = NULL, *network = NULL, *client_id = NULL, *iaid = NULL, *duid = NULL;
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
const char *on_color_operational, *off_color_operational,
*on_color_setup, *off_color_setup;
_cleanup_free_ int *carrier_bound_to = NULL, *carrier_bound_by = NULL;
_cleanup_(sd_dhcp_lease_unrefp) sd_dhcp_lease *lease = NULL;
_cleanup_(table_unrefp) Table *table = NULL;
TableCell *cell;
int r;
@ -1434,11 +1425,6 @@ static int link_status_one(
(void) sd_network_link_get_carrier_bound_to(info->ifindex, &carrier_bound_to);
(void) sd_network_link_get_carrier_bound_by(info->ifindex, &carrier_bound_by);
if (asprintf(&lease_file, "/run/systemd/netif/leases/%d", info->ifindex) < 0)
return log_oom();
(void) dhcp_lease_load(&lease, lease_file);
table = table_new("dot", "key", "value");
if (!table)
return log_oom();
@ -2036,7 +2022,7 @@ static int link_status_one(
}
}
r = dump_addresses(rtnl, lease, table, info->ifindex);
r = dump_addresses(rtnl, table, info->ifindex);
if (r < 0)
return r;
r = dump_gateways(rtnl, hwdb, table, info->ifindex);
@ -2064,35 +2050,24 @@ static int link_status_one(
if (r < 0)
return r;
if (lease) {
const void *client_id;
size_t client_id_len;
const char *tz;
(void) sd_network_link_get_timezone(info->ifindex, &tz);
if (tz) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "Time Zone:",
TABLE_STRING, tz);
if (r < 0)
return table_log_add_error(r);
}
r = sd_dhcp_lease_get_timezone(lease, &tz);
if (r >= 0) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "Time Zone:",
TABLE_STRING, tz);
if (r < 0)
return table_log_add_error(r);
}
r = sd_dhcp_lease_get_client_id(lease, &client_id, &client_id_len);
if (r >= 0) {
_cleanup_free_ char *id = NULL;
r = sd_dhcp_client_id_to_string(client_id, client_id_len, &id);
if (r >= 0) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "DHCP4 Client ID:",
TABLE_STRING, id);
if (r < 0)
return table_log_add_error(r);
}
}
r = sd_network_link_get_dhcp4_client_id_string(info->ifindex, &client_id);
if (r >= 0) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "DHCP4 Client ID:",
TABLE_STRING, client_id);
if (r < 0)
return table_log_add_error(r);
}
r = sd_network_link_get_dhcp6_client_iaid_string(info->ifindex, &iaid);
@ -2172,7 +2147,7 @@ static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
if (r < 0)
return table_log_add_error(r);
r = dump_addresses(rtnl, NULL, table, 0);
r = dump_addresses(rtnl, table, 0);
if (r < 0)
return r;
r = dump_gateways(rtnl, hwdb, table, 0);

View File

@ -4351,6 +4351,33 @@ int link_save(Link *link) {
print_link_hashmap(f, "CARRIER_BOUND_BY=", link->bound_by_links);
if (link->dhcp_lease) {
struct in_addr address;
const char *tz = NULL;
size_t client_id_len;
const void *client_id;
assert(link->network);
r = sd_dhcp_lease_get_timezone(link->dhcp_lease, &tz);
if (r >= 0)
fprintf(f, "TIMEZONE=%s\n", tz);
r = sd_dhcp_lease_get_address(link->dhcp_lease, &address);
if (r >= 0) {
fputs("DHCP4_ADDRESS=", f);
serialize_in_addrs(f, &address, 1, NULL, NULL);
fputc('\n', f);
}
r = sd_dhcp_lease_get_client_id(link->dhcp_lease, &client_id, &client_id_len);
if (r >= 0) {
_cleanup_free_ char *id = NULL;
r = sd_dhcp_client_id_to_string(client_id, client_id_len, &id);
if (r >= 0)
fprintf(f, "DHCP4_CLIENT_ID=%s\n", id);
}
r = dhcp_lease_save(link->dhcp_lease, link->lease_file);
if (r < 0)
goto fail;

View File

@ -496,16 +496,18 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons
if (r < 0)
return bus_log_create_error(r);
return 1;
} else if (isempty(eq) && STR_IN_SET(field, "DefaultMemoryLow",
"DefaultMemoryMin",
"MemoryLow",
"MemoryMin")) {
/* We can't use CGROUP_LIMIT_MIN nor CGROUP_LIMIT_MAX to convey the empty assignment
* so marshall specially as a boolean. */
r = sd_bus_message_append(m, "(sv)", field, "b", 0);
if (r < 0)
return bus_log_create_error(r);
return 1;
} else if (isempty(eq)) {
uint64_t empty_value = STR_IN_SET(field,
"DefaultMemoryLow",
"DefaultMemoryMin",
"MemoryLow",
"MemoryMin") ?
CGROUP_LIMIT_MIN :
CGROUP_LIMIT_MAX;
r = sd_bus_message_append(m, "(sv)", field, "t", empty_value);
r = sd_bus_message_append(m, "(sv)", field, "t", CGROUP_LIMIT_MAX);
if (r < 0)
return bus_log_create_error(r);
return 1;

View File

@ -110,6 +110,10 @@ int sd_network_link_get_network_file(int ifindex, char **filename);
* IP addresses */
int sd_network_link_get_dns(int ifindex, char ***ret);
/* Get DHCP4 address for a given link. This is string representations of
* IPv4 address */
int sd_network_link_get_dhcp4_address(int ifindex, char **ret);
/* Get NTP entries for a given link. These are domain names or string
* representations of IP addresses */
int sd_network_link_get_ntp(int ifindex, char ***ret);
@ -169,6 +173,12 @@ int sd_network_link_get_carrier_bound_to(int ifindex, int **ifindexes);
/* Get the CARRIERS that are bound to current link. */
int sd_network_link_get_carrier_bound_by(int ifindex, int **ifindexes);
/* Get the timezone that was learnt on a specific link. */
int sd_network_link_get_timezone(int ifindex, char **timezone);
/* Get DHCPv4 client id for a given link. */
int sd_network_link_get_dhcp4_client_id_string(int ifindex, char **client_id);
/* Get DHCPv6 client IAID for a given link. */
int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **iaid);

View File

@ -496,7 +496,7 @@ int xdg_autostart_service_generate_unit(
/* Nothing to do if type is not Application. */
if (!streq_ptr(service->type, "Application")) {
log_info("Not generating service for XDG autostart %s, only Type=Application is supported.", service->name);
log_info("Not generating service for XDG autostart %s, it is hidden.", service->name);
return 0;
}
@ -527,9 +527,8 @@ int xdg_autostart_service_generate_unit(
return 0;
}
if (service->gnome_autostart_phase) {
/* There is no explicit value for the "Application" phase. */
log_info("Not generating service for XDG autostart %s, startup phases are not supported.",
if (streq_ptr(service->gnome_autostart_phase, "EarlyInitialization")) {
log_info("Not generating service for XDG autostart %s, EarlyInitialization needs to be handled separately.",
service->name);
return 0;
}
@ -564,7 +563,10 @@ int xdg_autostart_service_generate_unit(
fprintf(f, "Description=%s\n", t);
}
/* Only start after the session is ready. */
/* Only start after the session is ready.
* XXX: GNOME has an autostart order which we may want to support.
* It is not clear how this can be implemented reliably, which
* is why it is skipped for now. */
fprintf(f,
"After=graphical-session.target\n");

View File

@ -12,13 +12,13 @@ for entry in chromiumos.gen_autosuspend_rules.PCI_IDS:
vendor, device = entry.split(':')
vendor = int(vendor, 16)
device = int(device, 16)
print('pci:v{:08X}d{:08X}*'.format(vendor, device))
print(f'pci:v{vendor:08X}d{device:08X}*')
print('# usb:v<VEND>p<PROD> (4 uppercase hexadecimal digits twice')
for entry in chromiumos.gen_autosuspend_rules.USB_IDS:
vendor, product = entry.split(':')
vendor = int(vendor, 16)
product = int(product, 16)
print('usb:v{:04X}p{:04X}*'.format(vendor, product))
print(f'usb:v{vendor:04X}p{product:04X}*')
print(' ID_AUTOSUSPEND=1')