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;
}
sd_network_link_get_dns(ifindex, &dns);
sd_network_link_get_ntp(ifindex, &ntp);
sd_network_link_get_domains(ifindex, &domains);
+ r = sd_network_link_get_wildcard_domain(ifindex);
+ if (r > 0) {
+ char *wildcard;
+
+ wildcard = strdup("*");
+ strv_push(&domains, wildcard);
+ }
sprintf(devid, "n%i", ifindex);
d = udev_device_new_from_device_id(udev, devid);
fputs("\n", f);
+ fprintf(f, "WILDCARD_DOMAIN=%s\n",
+ yes_no(link->network->wildcard_domain));
+
fprintf(f, "LLMNR=%s\n",
llmnr_support_to_string(link->network->llmnr));
}
const char *rvalue,
void *data,
void *userdata) {
+ Network *network = userdata;
char ***domains = data;
char **domain;
int r;
strv_uniq(*domains);
+ if (strv_isempty(*domains))
+ network->wildcard_domain = false;
+ else if (strv_find(*domains, "*"))
+ network->wildcard_domain = true;
+
STRV_FOREACH(domain, *domains)
if (is_localhost(*domain) || !hostname_is_valid(*domain))
strv_remove(*domains, *domain);
Hashmap *addresses_by_section;
Hashmap *routes_by_section;
+ bool wildcard_domain;
char **domains, **dns, **ntp;
LLMNRSupport llmnr;
/* Get the DNS domain names for a given link. */
int sd_network_link_get_domains(int ifindex, char ***domains);
+/* Returns whether or not domains that don't match any link should be resolved
+ * on this link. 1 for yes, 0 for no and negative value for error */
+int sd_network_link_get_wildcard_domain(int ifindex);
+
/* Monitor object */
typedef struct sd_network_monitor sd_network_monitor;