diff options
author | Susant Sahani <susant@redhat.com> | 2014-12-11 09:59:55 +0530 |
---|---|---|
committer | Susant Sahani <susant@redhat.com> | 2014-12-19 08:15:05 +0530 |
commit | 49699bac94d24b444274f91f85c82e6fad04d029 (patch) | |
tree | 617cd733775e4b23bcabc37de590f4f6ff8ef916 /src/libsystemd | |
parent | ce43e484465050c619ea9a1991d49b3d6215028b (diff) |
LLDP: Add support for networkctl
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-network/sd-network.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c index d63e6f9dfa..c735cac3b1 100644 --- a/src/libsystemd/sd-network/sd-network.c +++ b/src/libsystemd/sd-network/sd-network.c @@ -192,6 +192,32 @@ _public_ int sd_network_link_get_llmnr(int ifindex, char **llmnr) { return 0; } +_public_ int sd_network_link_get_lldp(int ifindex, char **lldp) { + _cleanup_free_ char *s = NULL, *p = NULL; + size_t size; + int r; + + assert_return(ifindex > 0, -EINVAL); + assert_return(lldp, -EINVAL); + + if (asprintf(&p, "/run/systemd/netif/lldp/%d", ifindex) < 0) + return -ENOMEM; + + r = read_full_file(p, &s, &size); + if (r == -ENOENT) + return -ENODATA; + if (r < 0) + return r; + if (size <= 0) + return -ENODATA; + + *lldp = s; + s = NULL; + + return 0; +} + + static int network_get_link_strv(const char *key, int ifindex, char ***ret) { _cleanup_free_ char *p = NULL, *s = NULL; _cleanup_strv_free_ char **a = NULL; |