diff options
author | Mathieu Trudel-Lapierre <mathieu.tl@gmail.com> | 2017-11-30 12:03:50 -0500 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-11-30 18:03:50 +0100 |
commit | c1a3890410f043fe09af8b139eb6bfe2832089be (patch) | |
tree | a241ae07b084806bcb5d4f2b1d2bab884388c120 /src/libsystemd/sd-network | |
parent | 9d4f242a5322cd055201b8f7d127db77870b5b2e (diff) | |
download | systemd-c1a3890410f043fe09af8b139eb6bfe2832089be.tar.gz |
Add a "RequiredForOnline=" Link attribute for .network files (#7347)
RequiredForOnline= denotes a link/network that does/does not require being up
for systemd-networkd-wait-online to consider the system online; this makes it
possible to ignore devices without modifying parameters to wait-online.
Diffstat (limited to 'src/libsystemd/sd-network')
-rw-r--r-- | src/libsystemd/sd-network/sd-network.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c index e0f38b62aa..f6460b9f7c 100644 --- a/src/libsystemd/sd-network/sd-network.c +++ b/src/libsystemd/sd-network/sd-network.c @@ -172,6 +172,21 @@ _public_ int sd_network_link_get_operational_state(int ifindex, char **state) { return network_link_get_string(ifindex, "OPER_STATE", state); } +_public_ int sd_network_link_get_required_for_online(int ifindex) { + _cleanup_free_ char *s = NULL; + int r; + + r = network_link_get_string(ifindex, "REQUIRED_FOR_ONLINE", &s); + if (r < 0) { + /* Handle -ENODATA as RequiredForOnline=yes, for compatibility */ + if (r == -ENODATA) + return true; + return r; + } + + return parse_boolean(s); +} + _public_ int sd_network_link_get_llmnr(int ifindex, char **llmnr) { return network_link_get_string(ifindex, "LLMNR", llmnr); } |