forked from pool/systemd
.
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=811
This commit is contained in:
parent
1e1d6bd6e8
commit
0b30be62ea
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 7 09:45:20 UTC 2014 - werner@suse.de
|
||||
|
||||
- Add patch watch_resolv.conf_for_become_changed.patch to add an
|
||||
inotify watch on /etc/resolv.conf which enables the reload of
|
||||
a changed resolver configuration on the fly (bsc#902901)
|
||||
- Do not apply patch 0022-systemd-tmpfiles-ownerkeep.patch in case
|
||||
if the script /usr/bin/systemd-tmpfiles-keep is missed
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 3 14:23:02 UTC 2014 - werner@suse.de
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
%bcond_with udevsettle
|
||||
%endif
|
||||
%bcond_with systemgrps
|
||||
%{expand: %%global has_tmpkeep %(type -p systemd-tmpfiles-keep &>/dev/null && echo 1 || echo 0)}
|
||||
|
||||
Name: systemd-mini
|
||||
Url: http://www.freedesktop.org/wiki/Software/systemd
|
||||
@ -1005,6 +1006,8 @@ Patch487: 0012-manager-do-not-print-anything-while-passwords-are-be.patch
|
||||
Patch488: 0001-sd-bus-properly-handle-removals-of-non-existing-matc.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/10/31
|
||||
Patch489: 0002-keymap-Ignore-brightness-keys-on-Dell-Inspiron-1520-.patch
|
||||
# PATCH-FIX-SUSE added at 2014/11/05
|
||||
Patch490: watch_resolv.conf_for_become_changed.patch
|
||||
|
||||
# UDEV PATCHES
|
||||
# ============
|
||||
@ -1536,7 +1539,9 @@ cp %{SOURCE7} m4/
|
||||
%patch181 -p1
|
||||
%patch182 -p1
|
||||
%patch183 -p1
|
||||
%if 0%{?has_tmpkeep}
|
||||
%patch184 -p1
|
||||
%endif
|
||||
%patch185 -p1
|
||||
%patch186 -p1
|
||||
%patch187 -p1
|
||||
@ -1843,6 +1848,7 @@ cp %{SOURCE7} m4/
|
||||
%patch487 -p0
|
||||
%patch488 -p0
|
||||
%patch489 -p0
|
||||
%patch490 -p0
|
||||
|
||||
# udev patches
|
||||
%patch1001 -p1
|
||||
@ -2086,7 +2092,7 @@ cflags -Wl,--hash-size=8599 LDFLAGS
|
||||
%if 0%{?suse_version} <= 1310
|
||||
--with-firmware-path="%{_prefix}/lib/firmware:/lib/firmware" \
|
||||
%endif
|
||||
%if ! 0%{has_efi}
|
||||
%if ! 0%{?has_efi}
|
||||
--disable-efi \
|
||||
%endif
|
||||
--with-rc-local-script-path-start=/etc/init.d/boot.local \
|
||||
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Nov 7 09:45:20 UTC 2014 - werner@suse.de
|
||||
|
||||
- Add patch watch_resolv.conf_for_become_changed.patch to add an
|
||||
inotify watch on /etc/resolv.conf which enables the reload of
|
||||
a changed resolver configuration on the fly (bsc#902901)
|
||||
- Do not apply patch 0022-systemd-tmpfiles-ownerkeep.patch in case
|
||||
if the script /usr/bin/systemd-tmpfiles-keep is missed
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 3 14:23:02 UTC 2014 - werner@suse.de
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
%bcond_with udevsettle
|
||||
%endif
|
||||
%bcond_with systemgrps
|
||||
%{expand: %%global has_tmpkeep %(type -p systemd-tmpfiles-keep &>/dev/null && echo 1 || echo 0)}
|
||||
|
||||
Name: systemd
|
||||
Url: http://www.freedesktop.org/wiki/Software/systemd
|
||||
@ -1000,6 +1001,8 @@ Patch487: 0012-manager-do-not-print-anything-while-passwords-are-be.patch
|
||||
Patch488: 0001-sd-bus-properly-handle-removals-of-non-existing-matc.patch
|
||||
# PATCH-FIX-UPSTREAM added at 2014/10/31
|
||||
Patch489: 0002-keymap-Ignore-brightness-keys-on-Dell-Inspiron-1520-.patch
|
||||
# PATCH-FIX-SUSE added at 2014/11/05
|
||||
Patch490: watch_resolv.conf_for_become_changed.patch
|
||||
|
||||
# UDEV PATCHES
|
||||
# ============
|
||||
@ -1531,7 +1534,9 @@ cp %{SOURCE7} m4/
|
||||
%patch181 -p1
|
||||
%patch182 -p1
|
||||
%patch183 -p1
|
||||
%if 0%{?has_tmpkeep}
|
||||
%patch184 -p1
|
||||
%endif
|
||||
%patch185 -p1
|
||||
%patch186 -p1
|
||||
%patch187 -p1
|
||||
@ -1838,6 +1843,7 @@ cp %{SOURCE7} m4/
|
||||
%patch487 -p0
|
||||
%patch488 -p0
|
||||
%patch489 -p0
|
||||
%patch490 -p0
|
||||
|
||||
# udev patches
|
||||
%patch1001 -p1
|
||||
@ -2081,7 +2087,7 @@ cflags -Wl,--hash-size=8599 LDFLAGS
|
||||
%if 0%{?suse_version} <= 1310
|
||||
--with-firmware-path="%{_prefix}/lib/firmware:/lib/firmware" \
|
||||
%endif
|
||||
%if ! 0%{has_efi}
|
||||
%if ! 0%{?has_efi}
|
||||
--disable-efi \
|
||||
%endif
|
||||
--with-rc-local-script-path-start=/etc/init.d/boot.local \
|
||||
|
159
watch_resolv.conf_for_become_changed.patch
Normal file
159
watch_resolv.conf_for_become_changed.patch
Normal file
@ -0,0 +1,159 @@
|
||||
---
|
||||
src/core/manager.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
src/core/manager.h | 5 ++
|
||||
2 files changed, 108 insertions(+)
|
||||
|
||||
--- src/core/manager.c
|
||||
+++ src/core/manager.c 2014-11-07 11:12:58.334193988 +0000
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/timerfd.h>
|
||||
+#include <resolv.h>
|
||||
|
||||
#ifdef HAVE_AUDIT
|
||||
#include <libaudit.h>
|
||||
@@ -304,6 +305,101 @@ static int manager_check_ask_password(Ma
|
||||
return m->have_ask_password;
|
||||
}
|
||||
|
||||
+static int manager_setup_resolv_conf_change(Manager *);
|
||||
+
|
||||
+static int manager_dispatch_resolv_conf_fd(sd_event_source *source,
|
||||
+ int fd, uint32_t revents, void *userdata) {
|
||||
+ Manager *m = userdata;
|
||||
+
|
||||
+ assert(m);
|
||||
+ assert(m->resolv_conf_inotify_fd == fd);
|
||||
+
|
||||
+ if (revents != EPOLLIN) {
|
||||
+ log_warning("Got unexpected poll event for notify fd.");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (fd >= 0)
|
||||
+ flush_fd(fd);
|
||||
+
|
||||
+ m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source);
|
||||
+
|
||||
+ if (m->resolv_conf_inotify_fd >= 0)
|
||||
+ close_nointr_nofail(m->resolv_conf_inotify_fd);
|
||||
+ m->resolv_conf_inotify_fd = -1;
|
||||
+
|
||||
+ manager_setup_resolv_conf_change(m);
|
||||
+
|
||||
+ return m->resolv_conf_noent ? 0 : res_init();
|
||||
+}
|
||||
+
|
||||
+static int manager_setup_resolv_conf_change(Manager *m) {
|
||||
+ int r;
|
||||
+
|
||||
+ assert(m);
|
||||
+ assert(m->resolv_conf_inotify_fd < 0);
|
||||
+
|
||||
+ m->resolv_conf_inotify_fd = inotify_init1(IN_NONBLOCK|IN_CLOEXEC);
|
||||
+ if (m->resolv_conf_inotify_fd < 0) {
|
||||
+ log_error("inotify_init1() failed: %m");
|
||||
+ r = -errno;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ if (inotify_add_watch(m->resolv_conf_inotify_fd, "/etc/resolv.conf",
|
||||
+ IN_CLOSE_WRITE|IN_MODIFY|IN_ATTRIB|IN_DELETE_SELF) < 0) {
|
||||
+ if (errno == ENOENT) {
|
||||
+ m->resolv_conf_noent = true;
|
||||
+ if (inotify_add_watch(m->resolv_conf_inotify_fd, "/etc", IN_CREATE|IN_MOVED_TO) < 0) {
|
||||
+ log_error("Failed to add watch on /etc: %m");
|
||||
+ r = -errno;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ } else {
|
||||
+ log_error("Failed to add watch on /etc/resolv.conf: %m");
|
||||
+ r = -errno;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+ }
|
||||
+ if (inotify_add_watch(m->resolv_conf_inotify_fd, "/etc/host.conf",
|
||||
+ IN_CLOSE_WRITE|IN_MODIFY|IN_ATTRIB|IN_DELETE_SELF) < 0 && errno != ENOENT) {
|
||||
+ log_error("Failed to add watch on /etc/host.conf: %m");
|
||||
+ r = -errno;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ r = sd_event_add_io(m->event, &m->resolv_conf_event_source,
|
||||
+ m->resolv_conf_inotify_fd, EPOLLIN,
|
||||
+ manager_dispatch_resolv_conf_fd, m);
|
||||
+ if (r < 0) {
|
||||
+ log_error("Failed to add event source for resolver: %s", strerror(-r));
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ r = sd_event_source_set_priority(m->resolv_conf_event_source, -10);
|
||||
+ if (r < 0) {
|
||||
+ log_error("Failed to add event source for resolver: %s", strerror(-r));
|
||||
+ m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source);
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+fail:
|
||||
+ if (m->resolv_conf_inotify_fd >= 0)
|
||||
+ close_nointr_nofail(m->resolv_conf_inotify_fd);
|
||||
+ m->resolv_conf_inotify_fd = -1;
|
||||
+
|
||||
+ return 0; /* Ignore error here */
|
||||
+}
|
||||
+
|
||||
+static void manager_shutdown_resolv_conf_change(Manager *m) {
|
||||
+ assert(m);
|
||||
+
|
||||
+ m->resolv_conf_event_source = sd_event_source_unref(m->resolv_conf_event_source);
|
||||
+ if (m->resolv_conf_inotify_fd >= 0)
|
||||
+ close_nointr_nofail(m->resolv_conf_inotify_fd);
|
||||
+ m->resolv_conf_inotify_fd = -1;
|
||||
+}
|
||||
+
|
||||
static int manager_watch_idle_pipe(Manager *m) {
|
||||
int r;
|
||||
|
||||
@@ -562,6 +658,7 @@ int manager_new(SystemdRunningAs running
|
||||
m->pin_cgroupfs_fd = m->notify_fd = m->signal_fd = m->time_change_fd = m->dev_autofs_fd = m->private_listen_fd = m->kdbus_fd = -1;
|
||||
m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */
|
||||
|
||||
+ m->resolv_conf_inotify_fd = -1;
|
||||
m->ask_password_inotify_fd = -1;
|
||||
m->have_ask_password = -EINVAL; /* we don't know */
|
||||
|
||||
@@ -613,6 +710,10 @@ int manager_new(SystemdRunningAs running
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
+ r = manager_setup_resolv_conf_change(m);
|
||||
+ if (r < 0)
|
||||
+ goto fail;
|
||||
+
|
||||
m->udev = udev_new();
|
||||
if (!m->udev) {
|
||||
r = -ENOMEM;
|
||||
@@ -906,6 +1007,8 @@ void manager_free(Manager *m) {
|
||||
|
||||
assert(m);
|
||||
|
||||
+ manager_shutdown_resolv_conf_change(m);
|
||||
+
|
||||
manager_clear_jobs_and_units(m);
|
||||
|
||||
for (c = 0; c < _UNIT_TYPE_MAX; c++)
|
||||
--- src/core/manager.h
|
||||
+++ src/core/manager.h 2014-11-07 11:06:41.466019636 +0000
|
||||
@@ -157,6 +157,11 @@ struct Manager {
|
||||
FILE *proc_self_mountinfo;
|
||||
sd_event_source *mount_event_source;
|
||||
|
||||
+ /* Watch out any change of /etc/resolv.conf */
|
||||
+ int resolv_conf_inotify_fd;
|
||||
+ sd_event_source *resolv_conf_event_source;
|
||||
+ bool resolv_conf_noent;
|
||||
+
|
||||
/* Data specific to the swap filesystem */
|
||||
FILE *proc_swaps;
|
||||
sd_event_source *swap_event_source;
|
Loading…
Reference in New Issue
Block a user