diff options
author | Tom Gundersen <teg@jklm.no> | 2014-08-15 14:49:31 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-08-15 15:15:24 +0200 |
commit | 67272d157a35e5cda4e5c904eafdcc23d20541d1 (patch) | |
tree | 99befd9c7b29c91d355ed02b4236e58aefab7e5a /src/libsystemd/sd-network/sd-network.c | |
parent | 6192b846ca0d15602e94ddb5da4420b7c60d64a5 (diff) |
sd-network: add support for wildcard domains
Diffstat (limited to 'src/libsystemd/sd-network/sd-network.c')
-rw-r--r-- | src/libsystemd/sd-network/sd-network.c | 19 |
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 4d8b7e7b2c..e30fc3cbf4 100644 --- a/src/libsystemd/sd-network/sd-network.c +++ b/src/libsystemd/sd-network/sd-network.c @@ -210,6 +210,25 @@ _public_ int sd_network_link_get_domains(int ifindex, char ***ret) { return network_get_link_strv("DOMAINS", ifindex, ret); } +_public_ int sd_network_link_get_wildcard_domain(int ifindex) { + int r; + _cleanup_free_ char *p = NULL, *s = NULL; + + assert_return(ifindex > 0, -EINVAL); + + if (asprintf(&p, "/run/systemd/netif/links/%d", ifindex) < 0) + return -ENOMEM; + + r = parse_env_file(p, NEWLINE, "WILDCARD_DOMAIN", &s, NULL); + if (r < 0) + return r; + + if (!s) + return -EIO; + + return parse_boolean(s); +} + static inline int MONITOR_TO_FD(sd_network_monitor *m) { return (int) (unsigned long) m - 1; } |