assert(m);
- /* First, subscibe to interfaces coming and going */
+ /* First, subscribe to interfaces coming and going */
r = sd_rtnl_open(&m->rtnl, 3, RTNLGRP_LINK, RTNLGRP_IPV4_IFADDR, RTNLGRP_IPV6_IFADDR);
if (r < 0)
return r;
if (s->marked)
dns_server_free(s);
+ /* Whenever /etc/resolv.conf changes, start using the first
+ * DNS server of it. This is useful to deal with broken
+ * network managing implementations (like NetworkManager),
+ * that when connecting to a VPN place both the VPN DNS
+ * servers and the local ones in /etc/resolv.conf. Without
+ * resetting the DNS server to use back to the first entry we
+ * will continue to use the local one thus being unable to
+ * resolve VPN domains. */
+ manager_set_dns_server(m, m->dns_servers);
+
return 0;
clear:
mh.msg_control = &control;
mh.msg_controllen = sizeof(control);
- l = recvmsg(fd, &mh, 0);
+ l = recvmsg(fd, &mh, MSG_CMSG_CLOEXEC);
if (l < 0) {
if (errno == EAGAIN || errno == EINTR)
return 0;