rpcbind/0003-systemd-no-dualmode.patch
Ismail Dönmez c213227f60 Accepting request 264790 from home:kukuk:NIS
Update to rpcbind 0.2.2 and port most patches to it.
6 are still missing.

- Split off 0003-systemd-no-dualmode.patch from 
  0001-systemd-enhancements.patch for easier upstream submission.
- Split off 0004-systemd-sd_notify.patch from 
  0001-systemd-enhancements.patch for easier upstream submission.
- Rename 0001-systemd-enhancements.patch to 0001-systemd-unit-files.patch

- Update to latest rpcbind 0.2.2 upstream release.
- Following patches are upstream:
  - 0001-Fix-building-one-systems-w-out-nss.h.patch
  - 0002-Rename-configure.in-to-configure.ac.patch
  - 0003-rpcbind-rpcuser-not-being-set-in-Makefile.am.patch
  - 0004-Silence-a-warning-about-setgroups-being-implicitly-d.patch
- Adjust following patches:
  - 0005-Remove-obsolete-function-in6_fillscopeid.patch
  - 0006-In-init_transport-move-creation-of-COTS-sockets-clos.patch
  - 0018-configure-check-for-nss.h.patch
- Obsolete patches:
  - 0015-When-using-systemd-activation-make-rpcbind-notify-sy.patch
  - 0016-Notify-systemd-unconditionally.patch
  - 0012-Support-systemd-activation.patch
  - 0013-socket-activation-Fix-rpcbind.service-to-use-separat.patch
  - 0017-Pull-the-sysconfig-file-into-rpcbind.service-and-use.patch
  - 0025-rpcinfo-warmstat_no-warning-about-missing-file.patch
  - 0026-systemd-no-default-dep
  - 0027-socket-before-service.patch
  - 0028-rpcbind-after-var-run.patch
  - 0029-rpcbind-sd-notify-stupid-errmsg.patch
- New patches:
  - 0001-systemd-enhancements.patch
  - 0002-rpcinfo_warmstart-no_warning_about_missing_file.patch

OBS-URL: https://build.opensuse.org/request/show/264790
OBS-URL: https://build.opensuse.org/package/show/network/rpcbind?expand=0&rev=51
2014-12-11 18:00:24 +00:00

59 lines
1.7 KiB
Diff

Systemd will, by default, pass a socket that provides both IPv4 and
IPv6 services. RPC netconfig requires that sockets be either IPv4
or IPv6. Add a warning to rpcbind should the user encounter an issue.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
--- a/src/rpcbind.c
+++ b/src/rpcbind.c 2014/12/10 13:48:28
@@ -50,6 +50,7 @@
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/un.h>
+#include <netinet/in.h>
#include <rpc/rpc.h>
#include <rpc/rpc_com.h>
#ifdef PORTMAP
@@ -277,6 +285,31 @@
}
/*
+ * Normally systemd will open sockets in dual ipv4/ipv6 mode.
+ * That won't work with netconfig and we'll only match
+ * the ipv6 socket. Convert it to IPV6_V6ONLY and issue
+ * a warning for the user to fix their systemd config.
+ */
+static int
+handle_ipv6_socket(int fd)
+{
+ int opt;
+ socklen_t len = sizeof(opt);
+
+ if (getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &opt, &len)) {
+ syslog(LOG_ERR, "failed to get ipv6 socket opts: %m");
+ return -1;
+ }
+
+ if (opt) /* socket is already in V6ONLY mode */
+ return 0;
+
+ syslog(LOG_ERR, "systemd has passed an IPv4/IPv6 dual-mode socket.");
+ syslog(LOG_ERR, "Please fix your systemd config by specifying IPv4 and IPv6 sockets separately and using BindIPv6Only=ipv6-only.");
+ return -1;
+}
+
+/*
* Adds the entry into the rpcbind database.
* If PORTMAP, then for UDP and TCP, it adds the entries for version 2 also
* Returns 0 if succeeds, else fails
@@ -361,6 +394,9 @@
goto error;
}
+ if (sa.sa.sa_family == AF_INET6 && handle_ipv6_socket(fd))
+ goto error;
+
/* Copy the address */
taddr.addr.maxlen = taddr.addr.len = addrlen;
taddr.addr.buf = malloc(addrlen);