[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Thu Sep 30 06:30:20 MDT 2010


The branch, master has been updated
       via  bad98e3 s3: Add "smbcontrol winbindd ip-dropped <local-ip>"
       via  10f0c78 s3: Re-introduce a procid_self()
      from  c7c4d84 s3: Fix a typo in dump-domain-list smbcontrol usage msg

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit bad98e37e7e4077a74c7b32d74499c78810192c5
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 29 12:17:05 2010 +0200

    s3: Add "smbcontrol winbindd ip-dropped <local-ip>"
    
    This is supposed to improve the winbind reconnect time after an ip address
    has been moved away from a box. Any kind of HA scenario will benefit from
    this, because winbindd does not have to wait for the TCP timeout to kick in
    when a local IP address has been dropped and DC replies are not received
    anymore.

commit 10f0c785c70b89e76f3a9cd3b319262affc9447e
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Sep 30 16:27:42 2010 +0200

    s3: Re-introduce a procid_self()
    
    Giving the parent pid to reinit_after_fork is not a good idea....
    None of the other callers do this, checked it.

-----------------------------------------------------------------------

Summary of changes:
 source3/librpc/idl/messaging.idl  |    1 +
 source3/utils/smbcontrol.c        |   17 +++++++++++++++++
 source3/winbindd/winbindd.c       |    4 ++++
 source3/winbindd/winbindd_cm.c    |   33 +++++++++++++++++++++++++++++++++
 source3/winbindd/winbindd_dual.c  |   24 +++++++++++++++++++++++-
 source3/winbindd/winbindd_proto.h |   10 ++++++++++
 6 files changed, 88 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/librpc/idl/messaging.idl b/source3/librpc/idl/messaging.idl
index 08caa59..9041d22 100644
--- a/source3/librpc/idl/messaging.idl
+++ b/source3/librpc/idl/messaging.idl
@@ -83,6 +83,7 @@ interface messaging
 		MSG_WINBIND_FAILED_TO_GO_ONLINE = 0x0407,
 		MSG_WINBIND_VALIDATE_CACHE	= 0x0408,
 		MSG_WINBIND_DUMP_DOMAIN_LIST	= 0x0409,
+		MSG_WINBIND_IP_DROPPED		= 0x040A,
 
 		/* event messages */
 		MSG_DUMP_EVENT_LIST		= 0x0500,
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index e24add0..998971d 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -726,6 +726,22 @@ static bool do_closeshare(struct messaging_context *msg_ctx,
 			    strlen(argv[1]) + 1);
 }
 
+/* Tell winbindd an IP got dropped */
+
+static bool do_ip_dropped(struct messaging_context *msg_ctx,
+			  const struct server_id pid,
+			  const int argc, const char **argv)
+{
+	if (argc != 2) {
+		fprintf(stderr, "Usage: smbcontrol <dest> ip-dropped "
+			"<ip-address>\n");
+		return False;
+	}
+
+	return send_message(msg_ctx, pid, MSG_WINBIND_IP_DROPPED, argv[1],
+			    strlen(argv[1]) + 1);
+}
+
 /* force a blocking lock retry */
 
 static bool do_lockretry(struct messaging_context *msg_ctx,
@@ -1196,6 +1212,7 @@ static const struct {
 	{ "debuglevel", do_debuglevel, "Display current debuglevels" },
 	{ "printnotify", do_printnotify, "Send a print notify message" },
 	{ "close-share", do_closeshare, "Forcibly disconnect a share" },
+	{ "ip-dropped", do_ip_dropped, "Tell winbind that an IP got dropped" },
 	{ "lockretry", do_lockretry, "Force a blocking lock retry" },
 	{ "brl-revalidate", do_brl_revalidate, "Revalidate all brl entries" },
         { "samsync", do_samsync, "Initiate SAM synchronisation" },
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 9c0a1fb..0c9cdcf 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1062,6 +1062,10 @@ void winbindd_register_handlers(void)
 			   MSG_WINBIND_DUMP_DOMAIN_LIST,
 			   winbind_msg_dump_domain_list);
 
+	messaging_register(winbind_messaging_context(), NULL,
+			   MSG_WINBIND_IP_DROPPED,
+			   winbind_msg_ip_dropped_parent);
+
 	/* Register handler for MSG_DEBUG. */
 	messaging_register(winbind_messaging_context(), NULL,
 			   MSG_DEBUG,
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 4ab2d94..3d84b62 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -2567,3 +2567,36 @@ NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
 	*cli = conn->netlogon_pipe;
 	return NT_STATUS_OK;
 }
+
+void winbind_msg_ip_dropped(struct messaging_context *msg_ctx,
+			    void *private_data,
+			    uint32_t msg_type,
+			    struct server_id server_id,
+			    DATA_BLOB *data)
+{
+	struct winbindd_domain *domain;
+
+	if ((data == NULL)
+	    || (data->data == NULL)
+	    || (data->length == 0)
+	    || (data->data[data->length-1] != '\0')
+	    || !is_ipaddress((char *)data->data)) {
+		DEBUG(1, ("invalid msg_ip_dropped message\n"));
+		return;
+	}
+	for (domain = domain_list(); domain != NULL; domain = domain->next) {
+		char sockaddr[INET6_ADDRSTRLEN];
+		if (domain->conn.cli == NULL) {
+			continue;
+		}
+		if (domain->conn.cli->fd == -1) {
+			continue;
+		}
+		client_socket_addr(domain->conn.cli->fd, sockaddr,
+				   sizeof(sockaddr));
+		if (strequal(sockaddr, (char *)data->data)) {
+			close(domain->conn.cli->fd);
+			domain->conn.cli->fd = -1;
+		}
+	}
+}
diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c
index 4cec7c2..a6cc64a 100644
--- a/source3/winbindd/winbindd_dual.c
+++ b/source3/winbindd/winbindd_dual.c
@@ -1133,7 +1133,7 @@ bool winbindd_reinit_after_fork(const char *logfilename)
 	status = reinit_after_fork(
 		winbind_messaging_context(),
 		winbind_event_context(),
-		messaging_server_id(winbind_messaging_context()),
+		procid_self(),
 		true);
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(0,("reinit_after_fork() failed\n"));
@@ -1295,6 +1295,10 @@ static bool fork_domain_child(struct winbindd_child *child)
 			   MSG_DUMP_EVENT_LIST, child_msg_dump_event_list);
 	messaging_register(winbind_messaging_context(), NULL,
 			   MSG_DEBUG, debug_message);
+	messaging_register(winbind_messaging_context(), NULL,
+			   MSG_WINBIND_IP_DROPPED,
+			   winbind_msg_ip_dropped);
+
 
 	primary_domain = find_our_domain();
 
@@ -1486,3 +1490,21 @@ static bool fork_domain_child(struct winbindd_child *child)
 		TALLOC_FREE(frame);
 	}
 }
+
+void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx,
+				   void *private_data,
+				   uint32_t msg_type,
+				   struct server_id server_id,
+				   DATA_BLOB *data)
+{
+	struct winbindd_child *child;
+
+	winbind_msg_ip_dropped(msg_ctx, private_data, msg_type,
+			       server_id, data);
+
+
+	for (child = winbindd_children; child != NULL; child = child->next) {
+		messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
+				   msg_type, data->data, data->length);
+	}
+}
diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h
index fa3cc10..3588af1 100644
--- a/source3/winbindd/winbindd_proto.h
+++ b/source3/winbindd/winbindd_proto.h
@@ -296,6 +296,16 @@ void winbind_msg_dump_domain_list(struct messaging_context *msg_ctx,
 				  uint32_t msg_type,
 				  struct server_id server_id,
 				  DATA_BLOB *data);
+void winbind_msg_ip_dropped(struct messaging_context *msg_ctx,
+			    void *private_data,
+			    uint32_t msg_type,
+			    struct server_id server_id,
+			    DATA_BLOB *data);
+void winbind_msg_ip_dropped_parent(struct messaging_context *msg_ctx,
+				   void *private_data,
+				   uint32_t msg_type,
+				   struct server_id server_id,
+				   DATA_BLOB *data);
 bool winbindd_reinit_after_fork(const char *logfilename);
 struct winbindd_domain *wb_child_domain(void);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list