mirror of
https://github.com/systemd/systemd
synced 2026-04-13 02:24:50 +02:00
Compare commits
7 Commits
8a592c6fc2
...
adc1b76c30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
adc1b76c30 | ||
|
|
cc8943b84a | ||
|
|
aac3efd24c | ||
|
|
e8f93a60a2 | ||
|
|
85d2f13b6f | ||
|
|
e135559d80 | ||
|
|
cfe1237f38 |
1
.github/workflows/unit_tests.sh
vendored
1
.github/workflows/unit_tests.sh
vendored
@ -9,6 +9,7 @@ ADDITIONAL_DEPS=(
|
||||
expect
|
||||
fdisk
|
||||
jekyll
|
||||
libbpf-dev
|
||||
libfdisk-dev
|
||||
libfido2-dev
|
||||
libp11-kit-dev
|
||||
|
||||
@ -34,6 +34,7 @@ Most generic unit settings are available for transient units.
|
||||
✓ PropagatesReloadTo=
|
||||
✓ ReloadPropagatedFrom=
|
||||
✓ PartOf=
|
||||
✓ Upholds=
|
||||
✓ JoinsNamespaceOf=
|
||||
✓ RequiresMountsFor=
|
||||
✓ StopWhenUnneeded=
|
||||
|
||||
@ -196,6 +196,13 @@
|
||||
by using the <keycap>f</keycap> key.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>beep</term>
|
||||
|
||||
<listitem><para>Beep once as soon as the boot menu is shown (default disabled). Currently,
|
||||
only x86 is supported, where it uses the PC speaker.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>reboot-for-bitlocker</term>
|
||||
|
||||
|
||||
@ -1649,6 +1649,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as PartOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as Upholds = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as RequiredBy = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as RequisiteOf = ['...', ...];
|
||||
@ -1657,6 +1659,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as BoundBy = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as UpheldBy = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as ConsistsOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as Conflicts = ['...', ...];
|
||||
@ -1667,14 +1671,14 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as After = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailure = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailureOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnSuccess = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnSuccessOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailure = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as OnFailureOf = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as Triggers = ['...', ...];
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("const")
|
||||
readonly as TriggeredBy = ['...', ...];
|
||||
@ -1820,16 +1824,20 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<!--property PartOf is not documented!-->
|
||||
|
||||
<!--property Upholds is not documented!-->
|
||||
|
||||
<!--property RequisiteOf is not documented!-->
|
||||
|
||||
<!--property ConsistsOf is not documented!-->
|
||||
<!--property UpheldBy is not documented!-->
|
||||
|
||||
<!--property OnFailureOf is not documented!-->
|
||||
<!--property ConsistsOf is not documented!-->
|
||||
|
||||
<!--property OnSuccess is not documented!-->
|
||||
|
||||
<!--property OnSuccessOf is not documented!-->
|
||||
|
||||
<!--property OnFailureOf is not documented!-->
|
||||
|
||||
<!--property ReloadPropagatedFrom is not documented!-->
|
||||
|
||||
<!--property PropagatesStopTo is not documented!-->
|
||||
@ -1948,6 +1956,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="PartOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Upholds"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="RequiredBy"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="RequisiteOf"/>
|
||||
@ -1956,6 +1966,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="BoundBy"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="UpheldBy"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="ConsistsOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Conflicts"/>
|
||||
@ -1966,14 +1978,14 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="After"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailure"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailureOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnSuccess"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnSuccessOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailure"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="OnFailureOf"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="Triggers"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="TriggeredBy"/>
|
||||
|
||||
@ -1575,14 +1575,14 @@
|
||||
<term><varname>RouteTable=</varname></term>
|
||||
<listitem>
|
||||
<para>The table identifier for the routes to the addresses specified in the
|
||||
<varname>AllowedIPs=</varname>. Takes the special value <literal>off</literal>, one of the
|
||||
predefined names <literal>default</literal>, <literal>main</literal>, and
|
||||
<literal>local</literal>, names defined in <varname>RouteTable=</varname> in
|
||||
<varname>AllowedIPs=</varname>. Takes a negative boolean value, one of the predefined names
|
||||
<literal>default</literal>, <literal>main</literal>, and <literal>local</literal>, names
|
||||
defined in <varname>RouteTable=</varname> in
|
||||
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
||||
or a number in the range 1…4294967295. When <literal>off</literal> the routes to the
|
||||
addresses specified in the <varname>AllowedIPs=</varname> setting will not be configured.
|
||||
Defaults to <literal>main</literal>. This setting will be ignored when the same setting is
|
||||
specified in the [WireGuardPeer] section.</para>
|
||||
Defaults to false. This setting will be ignored when the same setting is specified in the
|
||||
[WireGuardPeer] section.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@ -1682,9 +1682,9 @@
|
||||
<term><varname>RouteTable=</varname></term>
|
||||
<listitem>
|
||||
<para>The table identifier for the routes to the addresses specified in the
|
||||
<varname>AllowedIPs=</varname>. Takes the special value <literal>off</literal>, one of the
|
||||
predefined names <literal>default</literal>, <literal>main</literal>, and
|
||||
<literal>local</literal>, names defined in <varname>RouteTable=</varname> in
|
||||
<varname>AllowedIPs=</varname>. Takes a negative boolean value, one of the predefined names
|
||||
<literal>default</literal>, <literal>main</literal>, and <literal>local</literal>, names
|
||||
defined in <varname>RouteTable=</varname> in
|
||||
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
||||
or a number in the range 1…4294967295. Defaults to unset, and the value specified in the
|
||||
same setting in the [WireGuard] section will be used.</para>
|
||||
|
||||
@ -89,6 +89,7 @@ typedef struct {
|
||||
BOOLEAN force_menu;
|
||||
BOOLEAN use_saved_entry;
|
||||
BOOLEAN use_saved_entry_efivar;
|
||||
BOOLEAN beep;
|
||||
INT64 console_mode;
|
||||
INT64 console_mode_efivar;
|
||||
RandomSeedMode random_seed_mode;
|
||||
@ -497,6 +498,7 @@ static void print_status(Config *config, CHAR16 *loaded_image_path) {
|
||||
ps_bool(L" editor: %s\n", config->editor);
|
||||
ps_bool(L" auto-entries: %s\n", config->auto_entries);
|
||||
ps_bool(L" auto-firmware: %s\n", config->auto_firmware);
|
||||
ps_bool(L" beep: %s\n", config->beep);
|
||||
ps_bool(L" reboot-for-bitlocker: %s\n", config->reboot_for_bitlocker);
|
||||
ps_string(L" random-seed-mode: %s\n", random_seed_modes_table[config->random_seed_mode]);
|
||||
|
||||
@ -588,7 +590,7 @@ static BOOLEAN menu_run(
|
||||
_cleanup_freepool_ CHAR16 *clearline = NULL, *status = NULL;
|
||||
UINT32 timeout_efivar_saved = config->timeout_sec_efivar;
|
||||
UINT32 timeout_remain = config->timeout_sec == TIMEOUT_MENU_FORCE ? 0 : config->timeout_sec;
|
||||
BOOLEAN exit = FALSE, run = TRUE, firmware_setup = FALSE;
|
||||
BOOLEAN exit = FALSE, run = TRUE, firmware_setup = FALSE, do_beep = config->beep;
|
||||
INT64 console_mode_initial = ST->ConOut->Mode->Mode, console_mode_efivar_saved = config->console_mode_efivar;
|
||||
UINTN default_efivar_saved = config->idx_default_efivar;
|
||||
|
||||
@ -725,6 +727,11 @@ static BOOLEAN menu_run(
|
||||
ST->ConOut->OutputString(ST->ConOut, clearline + 1 + x + len);
|
||||
}
|
||||
|
||||
if (do_beep) {
|
||||
beep();
|
||||
do_beep = FALSE;
|
||||
}
|
||||
|
||||
err = console_key_read(&key, timeout_remain > 0 ? 1000 * 1000 : UINT64_MAX);
|
||||
if (err == EFI_TIMEOUT) {
|
||||
timeout_remain--;
|
||||
@ -1144,6 +1151,12 @@ static void config_defaults_load_from_file(Config *config, CHAR8 *content) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmpa((CHAR8 *)"beep", key) == 0) {
|
||||
err = parse_boolean(value, &config->beep);
|
||||
if (EFI_ERROR(err))
|
||||
log_error_stall(L"Error parsing 'beep' config option: %a", value);
|
||||
}
|
||||
|
||||
if (strcmpa((CHAR8 *)"reboot-for-bitlocker", key) == 0) {
|
||||
err = parse_boolean(value, &config->reboot_for_bitlocker);
|
||||
if (EFI_ERROR(err))
|
||||
|
||||
@ -757,3 +757,46 @@ __attribute__((noinline)) void debug_break(void) {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
static inline UINT8 inb(UINT16 port) {
|
||||
UINT8 value;
|
||||
asm volatile("inb %1, %0" : "=a"(value) : "Nd"(port));
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline void outb(UINT16 port, UINT8 value) {
|
||||
asm volatile("outb %0, %1" : : "a"(value), "Nd"(port));
|
||||
}
|
||||
|
||||
void beep(void) {
|
||||
enum {
|
||||
PITCH = 500,
|
||||
DURATION_USEC = 100 * 1000,
|
||||
|
||||
PIT_FREQUENCY = 0x1234dd,
|
||||
SPEAKER_CONTROL_PORT = 0x61,
|
||||
SPEAKER_ON_MASK = 0x03,
|
||||
TIMER_PORT_MAGIC = 0xB6,
|
||||
TIMER_CONTROL_PORT = 0x43,
|
||||
TIMER_CONTROL2_PORT = 0x42,
|
||||
};
|
||||
|
||||
/* Set frequency. */
|
||||
UINT32 counter = PIT_FREQUENCY / PITCH;
|
||||
outb(TIMER_CONTROL_PORT, TIMER_PORT_MAGIC);
|
||||
outb(TIMER_CONTROL2_PORT, counter & 0xFF);
|
||||
outb(TIMER_CONTROL2_PORT, (counter >> 8) & 0xFF);
|
||||
|
||||
/* Turn speaker on. */
|
||||
UINT8 value = inb(SPEAKER_CONTROL_PORT);
|
||||
value |= SPEAKER_ON_MASK;
|
||||
outb(SPEAKER_CONTROL_PORT, value);
|
||||
|
||||
BS->Stall(DURATION_USEC);
|
||||
|
||||
/* Turn speaker off. */
|
||||
value &= ~SPEAKER_ON_MASK;
|
||||
outb(SPEAKER_CONTROL_PORT, value);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -169,3 +169,9 @@ extern UINT8 _text, _data;
|
||||
#else
|
||||
# define debug_hook(identity)
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
void beep(void);
|
||||
#else
|
||||
static inline void beep(void) {}
|
||||
#endif
|
||||
|
||||
@ -872,19 +872,21 @@ const sd_bus_vtable bus_unit_vtable[] = {
|
||||
SD_BUS_PROPERTY("Wants", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("BindsTo", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("PartOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Upholds", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("RequiredBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("RequisiteOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("WantedBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("BoundBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("UpheldBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("ConsistsOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Conflicts", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("ConflictedBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Before", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("After", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailure", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailureOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnSuccess", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnSuccessOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailure", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("OnFailureOf", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("Triggers", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("TriggeredBy", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
SD_BUS_PROPERTY("PropagatesReloadTo", "as", property_get_dependencies, 0, SD_BUS_VTABLE_PROPERTY_CONST),
|
||||
|
||||
@ -19,9 +19,12 @@ static struct restrict_ifaces_bpf *restrict_ifaces_bpf_free(struct restrict_ifac
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(struct restrict_ifaces_bpf *, restrict_ifaces_bpf_free);
|
||||
|
||||
static int prepare_restrict_ifaces_bpf(Unit* u, bool is_allow_list,
|
||||
static int prepare_restrict_ifaces_bpf(
|
||||
Unit* u,
|
||||
bool is_allow_list,
|
||||
const Set *restrict_network_interfaces,
|
||||
struct restrict_ifaces_bpf **ret_object) {
|
||||
|
||||
_cleanup_(restrict_ifaces_bpf_freep) struct restrict_ifaces_bpf *obj = NULL;
|
||||
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
|
||||
char *iface;
|
||||
@ -50,9 +53,10 @@ static int prepare_restrict_ifaces_bpf(Unit* u, bool is_allow_list,
|
||||
SET_FOREACH(iface, restrict_network_interfaces) {
|
||||
uint8_t dummy = 0;
|
||||
int ifindex;
|
||||
|
||||
ifindex = rtnl_resolve_interface(&rtnl, iface);
|
||||
if (ifindex < 0) {
|
||||
log_unit_warning_errno(u, ifindex, "Couldn't find index of network interface: %m. Ignoring '%s'", iface);
|
||||
log_unit_warning_errno(u, ifindex, "Couldn't find index of network interface '%s', ignoring: %m", iface);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -895,13 +895,8 @@ int config_parse_wireguard_route_table(
|
||||
assert(data);
|
||||
assert(userdata);
|
||||
|
||||
if (isempty(rvalue)) {
|
||||
*table = RT_TABLE_MAIN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (streq(rvalue, "off")) {
|
||||
*table = 0;
|
||||
if (isempty(rvalue) || parse_boolean(rvalue) == 0) {
|
||||
*table = 0; /* Disabled. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -952,7 +947,7 @@ int config_parse_wireguard_peer_route_table(
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (streq(rvalue, "off")) {
|
||||
if (parse_boolean(rvalue) == 0) {
|
||||
peer->route_table = 0; /* Disabled. */
|
||||
peer->route_table_set = true;
|
||||
TAKE_PTR(peer);
|
||||
@ -1061,7 +1056,6 @@ static void wireguard_init(NetDev *netdev) {
|
||||
assert(w);
|
||||
|
||||
w->flags = WGDEVICE_F_REPLACE_PEERS;
|
||||
w->route_table = RT_TABLE_MAIN;
|
||||
}
|
||||
|
||||
static void wireguard_done(NetDev *netdev) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user