summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-network
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-30 16:13:23 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-01-12 05:44:52 +0100
commita2640646f1bf30193a39a820268d86a33e08eeef (patch)
tree83f83143bd2a89dd670fc7efe36934c920e84e56 /src/libsystemd/sd-network
parentnetwork: fix race between RTM_NEWLINK and NL82011_CMD_NEW_INTERFACE (diff)
downloadsystemd-a2640646f1bf30193a39a820268d86a33e08eeef.tar.xz
systemd-a2640646f1bf30193a39a820268d86a33e08eeef.zip
network: Show network and link file dropins in networkctl status
Fixes #24428
Diffstat (limited to 'src/libsystemd/sd-network')
-rw-r--r--src/libsystemd/sd-network/sd-network.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c
index 56de3f965c..dd440a5d17 100644
--- a/src/libsystemd/sd-network/sd-network.c
+++ b/src/libsystemd/sd-network/sd-network.c
@@ -159,6 +159,25 @@ int sd_network_link_get_network_file(int ifindex, char **ret) {
return network_link_get_string(ifindex, "NETWORK_FILE", ret);
}
+int sd_network_link_get_network_file_dropins(int ifindex, char ***ret) {
+ _cleanup_free_ char **sv = NULL, *joined = NULL;
+ int r;
+
+ assert_return(ifindex > 0, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ r = network_link_get_string(ifindex, "NETWORK_FILE_DROPINS", &joined);
+ if (r < 0)
+ return r;
+
+ r = strv_split_full(&sv, joined, ":", EXTRACT_CUNESCAPE);
+ if (r < 0)
+ return r;
+
+ *ret = TAKE_PTR(sv);
+ return 0;
+}
+
int sd_network_link_get_operational_state(int ifindex, char **ret) {
return network_link_get_string(ifindex, "OPER_STATE", ret);
}