Skip to content

Commit

Permalink
Warn if unexpect ip is bound in tw config
Browse files Browse the repository at this point in the history
Closed #51
  • Loading branch information
ChillerDragon committed Feb 16, 2025
1 parent 5600fb7 commit b825efd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/include/port.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ function port_status() {
echo "NOT IN USE"
}

function check_bindaddr() {
addr_used="$(get_tw_config bindaddr empty)"
if [ "$addr_used" = empty ]
then
return
fi
if ! ip a | grep -q "$addr_used"
then
wrn "Warning: your teeworlds config sets bindaddr to '$addr_used'"
wrn " but this address is not listed in the ip a command"
wrn " if you try to bind an invalid ip the server can fail to start"
fi
}

function check_port() {
port_used="$(get_tw_config sv_port 8303)"
if ! [[ $port_used =~ ^[0-9]+$ ]]
Expand Down
2 changes: 2 additions & 0 deletions lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ function check_duplicated_uuid() {
function check_warnings() {
local port
local num_cores
check_bindaddr
check_server_dir
twcfg.check_cfg_full
check_dir_size
Expand Down Expand Up @@ -570,6 +571,7 @@ function check_running() {
log "ignoring duplicated process..."
fi
check_port
check_bindaddr
}

function check_directory() {
Expand Down

0 comments on commit b825efd

Please sign in to comment.