void nm_backend_update_dns (void) { /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_EXECUTABLE | G_FILE_TEST_IS_REGULAR)) { nm_spawn_process ("/etc/init.d/nscd condrestart"); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } }
/* * nm_system_update_dns * * Invalidate the nscd host cache, if it exists, since * we changed resolv.conf. * */ void nm_system_update_dns (void) { if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } }
/* * nm_system_enable_loopback * * Bring up the loopback interface * */ void nm_system_enable_loopback (void) { /* ifupdown isn't always installed (bgo #625427) */ if (g_file_test ("/sbin/ifup", G_FILE_TEST_EXISTS)) nm_spawn_process ("/sbin/ifup lo"); else nm_generic_enable_loopback (); }
void nm_backend_update_dns (void) { /* Invalidate the nscd host cache, if it exists, since we changed resolv.conf */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } }
void nm_backend_update_dns (void) { /* Make glibc/nscd aware of any changes to the resolv.conf file by * restarting nscd. Only restart if already running. */ if (g_file_test ("/usr/sbin/nscd", G_FILE_TEST_IS_EXECUTABLE)) { nm_log_info (LOGD_DNS, "Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); } }
static gboolean update (NMDnsPlugin *plugin, const NMDnsIPConfigData **configs, const NMGlobalDnsConfig *global_config, const char *hostname) { /* TODO: We currently call a script installed with the dnssec-trigger * package that queries all information itself. Later, the dependency * on that package will be optional and the only hard dependency will * be unbound. * * Unbound configuration should be later handled by this plugin directly, * without calling custom scripts. The dnssec-trigger functionality * may be eventually merged into NetworkManager. */ return nm_spawn_process (DNSSEC_TRIGGER_SCRIPT " --async --update", NULL) == 0; }
static gboolean update (NMDnsPlugin *plugin, const GSList *vpn_configs, const GSList *dev_configs, const GSList *other_configs, const char *hostname) { /* TODO: We currently call a script installed with the dnssec-trigger * package that queries all information itself. Later, the dependency * on that package will be optional and the only hard dependency will * be unbound. * * Unbound configuration should be later handled by this plugin directly, * without calling custom scripts. The dnssec-trigger functionality * may be eventually merged into NetworkManager. */ return nm_spawn_process ("/usr/libexec/dnssec-trigger-script --async --update") == 0; }
static gboolean dispatch_resolvconf (const char *domain, char **searches, char **nameservers, const char *iface, GError **error) { char *cmd; FILE *f; gboolean retval = FALSE; if (! g_file_test (RESOLVCONF_PATH, G_FILE_TEST_IS_EXECUTABLE)) return FALSE; if (domain || searches || nameservers) { cmd = g_strconcat (RESOLVCONF_PATH, " -a ", "NetworkManager", NULL); nm_log_info (LOGD_DNS, "(%s): writing resolv.conf to %s", iface, RESOLVCONF_PATH); if ((f = popen (cmd, "w")) == NULL) g_set_error (error, NM_DNS_MANAGER_ERROR, NM_DNS_MANAGER_ERROR_SYSTEM, "Could not write to %s: %s\n", RESOLVCONF_PATH, g_strerror (errno)); else { retval = write_resolv_conf (f, domain, searches, nameservers, error); retval &= (pclose (f) == 0); } } else { cmd = g_strconcat (RESOLVCONF_PATH, " -d ", "NetworkManager", NULL); nm_log_info (LOGD_DNS, "(%s): removing resolv.conf from %s", iface, RESOLVCONF_PATH); if (nm_spawn_process (cmd) == 0) retval = TRUE; } g_free (cmd); return retval; }
static void openrc_start_lo_if_necessary() { /* No need to run net.lo if it is already running */ if (nm_spawn_process ("/etc/init.d/net.lo status") != 0) nm_spawn_process ("/etc/init.d/net.lo start"); }
/* * nm_system_update_dns * * Invalidate the nscd host cache, if it exists, since * we changed resolv.conf. * */ void nm_system_update_dns (void) { nm_info ("Clearing nscd hosts cache."); nm_spawn_process ("/usr/sbin/nscd -i hosts"); }