save link activation policy to state file and display in networkctl

This commit is contained in:
Dan Streetman
2021-01-21 12:05:17 -05:00
parent 2236d75df9
commit a853652ae9
5 changed files with 41 additions and 1 deletions
+21
View File
@@ -212,6 +212,27 @@ _public_ int sd_network_link_get_required_operstate_for_online(int ifindex, char
return 0;
}
_public_ int sd_network_link_get_activation_policy(int ifindex, char **policy) {
_cleanup_free_ char *s = NULL;
int r;
assert_return(policy, -EINVAL);
r = network_link_get_string(ifindex, "ACTIVATION_POLICY", &s);
if (r < 0) {
if (r != -ENODATA)
return r;
/* For compatibility, assuming up. */
s = strdup("up");
if (!s)
return -ENOMEM;
}
*policy = TAKE_PTR(s);
return 0;
}
_public_ int sd_network_link_get_llmnr(int ifindex, char **llmnr) {
return network_link_get_string(ifindex, "LLMNR", llmnr);
}