Bläddra i källkod

fix(ts3): query the ServerQuery address set in query_ip (#4975)

The monitor connects to the query port on each address in queryips.
When voice_ip was set to a specific address, queryips only held that
address and the public IP, so a ServerQuery bound to localhost
(query_ip=127.0.0.1) was never tried and monitor restarted the server.

Read query_ip from ts3server.ini (first address if several) and, when
it is a specific IPv4 address not already listed, query it first.

Fixes #4966
Daniel Gibbs 1 vecka sedan
förälder
incheckning
af8cb385c7

+ 6 - 0
lgsm/modules/check_ip.sh

@@ -61,3 +61,9 @@ else
 	httpip=("${ip}")
 	telnetip=("${ip}")
 fi
+
+# If the game config binds its query interface to a specific IPv4 address (e.g. TeamSpeak 3 query_ip),
+# query that address first. This also covers a query interface bound to localhost.
+if grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' <<< "${configqueryip}" && [ "${configqueryip}" != "0.0.0.0" ] && [[ " ${queryips[*]} " != *" ${configqueryip} "* ]]; then
+	queryips=("${configqueryip}" "${queryips[@]}")
+fi

+ 1 - 0
lgsm/modules/command_dev_parse_game_details.sh

@@ -84,6 +84,7 @@ declare -A server_details=(
 	['Query Enabled']="${queryenabled}"
 	['Query HTTP Port']="${httpqueryport}"
 	['Query HTTPS Port']="${httpsqueryport}"
+	['Query IP']="${configqueryip}"
 	['Query Mode']="${querymode}"
 	['Query Port GS']="${gamespyqueryport}"
 	['Query Port']="${queryport}"

+ 4 - 0
lgsm/modules/info_game.sh

@@ -757,8 +757,12 @@ fn_info_game_ts3() {
 		fn_info_game_ini "httpqueryport" "query_http_port"
 		fn_info_game_ini "httpsqueryport" "query_https_port"
 		fn_info_game_ini "queryport" "query_port"
+		fn_info_game_ini "configqueryip" "query_ip"
 		fn_info_game_ini "sshqueryport" "query_ssh_port"
 	fi
+	# query_ip can list several addresses (e.g. "0.0.0.0, ::"), use the first.
+	configqueryip="${configqueryip%%,*}"
+	configqueryip="${configqueryip// /}"
 	configip="${configip:-"0.0.0.0"}"
 	dbplugin="${dbplugin:-"NOT SET"}"
 	fileport="${fileport:-"0"}"