From 4b9cf7319b54f35ded9b86ff3b87bd6c73ca6995 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Wed, 20 Jan 2016 15:27:33 -0800
Subject: [PATCH] Make it so daemons also support TopologyParam=NoInAddrAny

---
 NEWS                                          |  1 +
 src/common/slurm_protocol_api.c               | 28 +------------------
 src/common/slurm_protocol_interface.h         |  8 ------
 .../slurm_protocol_socket_implementation.c    |  9 ------
 4 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/NEWS b/NEWS
index f75894671d2..cb67f0488f6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ documents those changes that are of interest to users and administrators.
  -- Backfill scheduling properly synchronized with Cray Node Health Check.
     Prior logic could result in highest priority job getting improperly
     postponed.
+ -- Make it so daemons also support TopologyParam=NoInAddrAny
 
 * Changes in Slurm 15.08.7
 ==========================
diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c
index c5db879778b..7aa79347f8a 100644
--- a/src/common/slurm_protocol_api.c
+++ b/src/common/slurm_protocol_api.c
@@ -99,7 +99,6 @@ static char *_global_auth_key(void);
 static void  _remap_slurmctld_errno(void);
 static int   _unpack_msg_uid(Buf buffer);
 static bool  _is_port_ok(int, uint16_t);
-static void _slurm_set_addr_any(slurm_addr_t * slurm_address, uint16_t port);
 
 #if _DEBUG
 static void _print_data(char *data, int len);
@@ -2777,26 +2776,11 @@ slurm_init_msg_engine_ports(uint16_t *ports)
 slurm_fd_t slurm_init_msg_engine_addrname_port(char *addr_name, uint16_t port)
 {
 	slurm_addr_t addr;
-	static uint32_t bind_addr = NO_VAL;
-
-	if (bind_addr == NO_VAL) {
-#ifdef BIND_SPECIFIC_ADDR
-		bind_addr = 1;
-#else
-		char *topology_params = slurm_get_topology_param();
-		if (topology_params &&
-		    slurm_strcasestr(topology_params, "NoInAddrAny"))
-			bind_addr = 1;
-		else
-			bind_addr = 0;
-		xfree(topology_params);
-#endif
-	}
 
 	if (addr_name)
 		slurm_set_addr(&addr, port, addr_name);
 	else
-		_slurm_set_addr_any(&addr, port);
+		slurm_setup_sockaddr(&addr, port);
 
 	return slurm_init_msg_engine(&addr);
 }
@@ -3733,16 +3717,6 @@ size_t slurm_read_stream_timeout(slurm_fd_t open_fd, char *buffer,
  * address conversion and management functions
 \**********************************************************************/
 
-/* slurm_set_addr_any
- * initialized the slurm_address with the supplied port on INADDR_ANY
- * OUT slurm_address	- slurm_addr_t to be filled in
- * IN port		- port in host order
- */
-static void _slurm_set_addr_any(slurm_addr_t * slurm_address, uint16_t port)
-{
-	slurm_set_addr_uint(slurm_address, port, SLURM_INADDR_ANY);
-}
-
 /* slurm_set_addr
  * initializes the slurm_address with the supplied port and host name
  * OUT slurm_address	- slurm_addr_t to be filled in
diff --git a/src/common/slurm_protocol_interface.h b/src/common/slurm_protocol_interface.h
index 72089526ba2..b3b2fef8e45 100644
--- a/src/common/slurm_protocol_interface.h
+++ b/src/common/slurm_protocol_interface.h
@@ -171,14 +171,6 @@ extern int slurm_recv_timeout ( slurm_fd_t open_fd, char *buffer ,
 /***************************/
 /* slurm address functions */
 /***************************/
-/* build a slurm address bassed upon ip address and port number
- * OUT slurm_address - the constructed slurm_address
- * IN port - port to be used
- * IN ip_address - the IP address to connect with
- */
-extern void slurm_set_addr_uint ( slurm_addr_t * slurm_address ,
-				  uint16_t port , uint32_t ip_address ) ;
-
 /* build a slurm address bassed upon host name and port number
  * OUT slurm_address - the constructed slurm_address
  * IN port - port to be used
diff --git a/src/common/slurm_protocol_socket_implementation.c b/src/common/slurm_protocol_socket_implementation.c
index b938f44fcc3..597fa564ff6 100644
--- a/src/common/slurm_protocol_socket_implementation.c
+++ b/src/common/slurm_protocol_socket_implementation.c
@@ -710,15 +710,6 @@ static int _slurm_vfcntl(int fd, int cmd, va_list va )
 	}
 }
 
-/* sets the fields of a slurm_addr_t */
-extern void slurm_set_addr_uint (slurm_addr_t *addr, uint16_t port,
-				 uint32_t ipaddr)
-{
-	addr->sin_family      = AF_SLURM ;
-	addr->sin_port	= htons(port);
-	addr->sin_addr.s_addr = htonl(ipaddr);
-}
-
 extern void slurm_set_addr_char (slurm_addr_t * addr, uint16_t port, char *host)
 {
 	struct hostent * he    = NULL;
-- 
GitLab