From 67272d157a35e5cda4e5c904eafdcc23d20541d1 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Fri, 15 Aug 2014 14:49:31 +0200 Subject: sd-network: add support for wildcard domains --- src/libsystemd/sd-network/sd-network.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/libsystemd') 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; } -- cgit v1.2.3-54-g00ecf