From: Stefan Metzmacher Date: Thu, 25 Jun 2020 13:32:11 +0000 (+0200) Subject: s3:smbd: skip ctdb public ips in fsctl_network_iface_info() X-Git-Tag: samba-4.13.0rc1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3afdf2a8618ef9ca7cfba279e87ab59c8ae3d662;p=thirdparty%2Fsamba.git s3:smbd: skip ctdb public ips in fsctl_network_iface_info() Multi-Channel clients should not connect to ctdb public ip addresses (which move between nodes). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11898 Signed-off-by: Stefan Metzmacher Reviewed-by: Günther Deschner Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Wed Jul 8 17:16:40 UTC 2020 on sn-devel-184 --- diff --git a/source3/smbd/smb2_ioctl_network_fs.c b/source3/smbd/smb2_ioctl_network_fs.c index 8154fa3f92e..f202cddd29c 100644 --- a/source3/smbd/smb2_ioctl_network_fs.c +++ b/source3/smbd/smb2_ioctl_network_fs.c @@ -30,6 +30,8 @@ #include "librpc/gen_ndr/ndr_ioctl.h" #include "smb2_ioctl_private.h" #include "../lib/tsocket/tsocket.h" +#include "lib/messages_ctdb.h" +#include "ctdbd_conn.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_SMB2 @@ -302,6 +304,7 @@ static NTSTATUS fsctl_network_iface_info(TALLOC_CTX *mem_ctx, size_t i; size_t num_ifaces = iface_count(); enum ndr_err_code ndr_err; + struct ctdb_public_ip_list_old *ips = NULL; if (in_input->length != 0) { return NT_STATUS_INVALID_PARAMETER; @@ -309,6 +312,18 @@ static NTSTATUS fsctl_network_iface_info(TALLOC_CTX *mem_ctx, *out_output = data_blob_null; + if (lp_clustering()) { + int ret; + + ret = ctdbd_control_get_public_ips(messaging_ctdb_connection(), + 0, /* flags */ + mem_ctx, + &ips); + if (ret != 0) { + return NT_STATUS_INTERNAL_ERROR; + } + } + array = talloc_zero_array(mem_ctx, struct fsctl_net_iface_info, num_ifaces); @@ -345,6 +360,19 @@ static NTSTATUS fsctl_network_iface_info(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } + if (ips != NULL) { + bool is_public_ip; + + is_public_ip = ctdbd_find_in_public_ips(ips, ifss); + if (is_public_ip) { + DBG_DEBUG("Interface [%s] - " + "has public ip - " + "skipping address [%s].\n", + iface->name, addr); + continue; + } + } + cur->ifindex = iface->if_index; if (cur->ifindex == 0) { /*