[SCM] Samba Shared Repository - branch v4-3-test updated
Karolin Seeger
kseeger at samba.org
Tue Feb 16 11:14:03 UTC 2016
The branch, v4-3-test has been updated
via 6c6599c ctdb-scripts: Drop use of "smbcontrol winbindd ip-dropped ..."
via f8618dc lib/tsocket: workaround sockets not supporting FIONREAD
from 6c1a5f0 param: Fix str_list_v3 to accept ; again
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-3-test
- Log -----------------------------------------------------------------
commit 6c6599cf1ce45e0582e01b206c99e0b143bbfdc4
Author: Martin Schwenke <martin at meltin.net>
Date: Mon Feb 8 15:55:17 2016 +1100
ctdb-scripts: Drop use of "smbcontrol winbindd ip-dropped ..."
This is unnecessary in Samba >= 4.0 because winbindd monitors IP
address itself and no longer needs to be told when they are dropped.
The smbcontrol commands can hang if a node has recovery mode active
because smbcontrol is unable to connect to the registry. Therefore,
the smbcontrol commands should be removed.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11719
Signed-off-by: Martin Schwenke <martin at meltin.net>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Feb 10 14:08:17 CET 2016 on sn-devel-144
(cherry picked from commit 519564bb35a0f840bc4d7c8c5a92441c97b49791)
Autobuild-User(v4-3-test): Karolin Seeger <kseeger at samba.org>
Autobuild-Date(v4-3-test): Tue Feb 16 12:13:06 CET 2016 on sn-devel-104
commit f8618dc2d6014bd710883ff195915c89f1959054
Author: Ralph Boehme <slow at samba.org>
Date: Thu Feb 4 15:35:06 2016 +0100
lib/tsocket: workaround sockets not supporting FIONREAD
Netlink sockets don't support querying pending bytes with ioctl(fd,
FIONREAD, ...) and would return EOPNOTSUPP, so use recvmsg() with
MSG_PEEK|MSG_TRUNC as a fallback.
The MSG_TRUNC flag to recvmsg() is Linux only, but netlink is as well,
so we're safe for now.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11714
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: Martin Schwenke <martin at meltin.net>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Wed Feb 10 10:30:24 CET 2016 on sn-devel-144
(cherry picked from commit 574313a1e11d521ba3f7232ff0b4186b49658199)
-----------------------------------------------------------------------
Summary of changes:
ctdb/config/events.d/11.natgw | 4 ---
ctdb/config/events.d/49.winbind | 7 -----
lib/tsocket/tsocket_bsd.c | 62 ++++++++++++++++++++++++++++++++++++++++-
3 files changed, 61 insertions(+), 12 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/config/events.d/11.natgw b/ctdb/config/events.d/11.natgw
index 54e6cd9..29339f4 100755
--- a/ctdb/config/events.d/11.natgw
+++ b/ctdb/config/events.d/11.natgw
@@ -149,10 +149,6 @@ natgw_set_slave ()
_net="${_net_gw%@*}"
ip route add "$_net" via "$_natgwip" metric 10
done
-
- # Make sure winbindd does not stay bound to this address if we are
- # no longer NATGW master
- smbcontrol winbindd ip-dropped $CTDB_NATGW_PUBLIC_IP >/dev/null 2>&1
}
natgw_ensure_master ()
diff --git a/ctdb/config/events.d/49.winbind b/ctdb/config/events.d/49.winbind
index dee3c90..a1ea787 100755
--- a/ctdb/config/events.d/49.winbind
+++ b/ctdb/config/events.d/49.winbind
@@ -55,13 +55,6 @@ case "$1" in
ctdb_check_command wbinfo -p
;;
- takeip|releaseip)
- iface=$2
- ip=$3
- maskbits=$4
-
- smbcontrol winbindd ip-dropped $ip >/dev/null 2>/dev/null
- ;;
*)
ctdb_standard_event_handler "$@"
;;
diff --git a/lib/tsocket/tsocket_bsd.c b/lib/tsocket/tsocket_bsd.c
index 8203755..0756fb3 100644
--- a/lib/tsocket/tsocket_bsd.c
+++ b/lib/tsocket/tsocket_bsd.c
@@ -132,6 +132,43 @@ static int tsocket_bsd_common_prepare_fd(int fd, bool high_fd)
return -1;
}
+#ifdef HAVE_LINUX_RTNETLINK_H
+/**
+ * Get the amount of pending bytes from a netlink socket
+ *
+ * For some reason netlink sockets don't support querying the amount of pending
+ * data via ioctl with FIONREAD, which is what we use in tsocket_bsd_pending()
+ * below.
+ *
+ * We know we are on Linux as we're using netlink, which means we have a working
+ * MSG_TRUNC flag to recvmsg() as well, so we use that together with MSG_PEEK.
+ **/
+static ssize_t tsocket_bsd_netlink_pending(int fd)
+{
+ struct iovec iov;
+ struct msghdr msg;
+ char buf[1];
+
+ iov = (struct iovec) {
+ .iov_base = buf,
+ .iov_len = sizeof(buf)
+ };
+
+ msg = (struct msghdr) {
+ .msg_iov = &iov,
+ .msg_iovlen = 1
+ };
+
+ return recvmsg(fd, &msg, MSG_PEEK | MSG_TRUNC);
+}
+#else
+static ssize_t tsocket_bsd_netlink_pending(int fd)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif
+
static ssize_t tsocket_bsd_pending(int fd)
{
int ret, error;
@@ -640,6 +677,7 @@ struct tdgram_bsd {
void *event_ptr;
struct tevent_fd *fde;
bool optimize_recvfrom;
+ bool netlink;
void *readable_private;
void (*readable_handler)(void *private_data);
@@ -892,7 +930,12 @@ static void tdgram_bsd_recvfrom_handler(void *private_data)
int err;
bool retry;
- ret = tsocket_bsd_pending(bsds->fd);
+ if (bsds->netlink) {
+ ret = tsocket_bsd_netlink_pending(bsds->fd);
+ } else {
+ ret = tsocket_bsd_pending(bsds->fd);
+ }
+
if (state->first_try && ret == 0) {
state->first_try = false;
/* retry later */
@@ -1395,6 +1438,11 @@ int _tdgram_bsd_existing_socket(TALLOC_CTX *mem_ctx,
{
struct tdgram_context *dgram;
struct tdgram_bsd *bsds;
+#ifdef HAVE_LINUX_RTNETLINK_H
+ int result;
+ struct sockaddr sa;
+ socklen_t sa_len = sizeof(struct sockaddr);
+#endif
dgram = tdgram_context_create(mem_ctx,
&tdgram_bsd_ops,
@@ -1409,6 +1457,18 @@ int _tdgram_bsd_existing_socket(TALLOC_CTX *mem_ctx,
talloc_set_destructor(bsds, tdgram_bsd_destructor);
*_dgram = dgram;
+
+#ifdef HAVE_LINUX_RTNETLINK_H
+ /*
+ * Try to determine the protocol family and remember if it's
+ * AF_NETLINK. We don't care if this fails.
+ */
+ result = getsockname(fd, &sa, &sa_len);
+ if (result == 0 && sa.sa_family == AF_NETLINK) {
+ bsds->netlink = true;
+ }
+#endif
+
return 0;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list