opentibia / server

An open source server for the MMORPG Tibia.
GNU General Public License v2.0
416 stars 149 forks source link

(FreeBSD) IP parameter in config and worlds sql table is ignored #2

Closed stolendata closed 12 years ago

stolendata commented 12 years ago

Regardless of what you set the IP parameter in config.lua to, and regardless of what you set it to in the worlds sql table, OTServ changes the value in the sql table to 16777343 (0x100007F) when starting up, and then ignores the IPs supplied and instead chooses to do a reverse lookup on... something... and then tries binding to whatever the DNS responds with.

I'm curious, which IP setting does it even try to use? The one in the config or the one in the worlds table?

(ps. despite the project being CMake'd there are a few things that I had to fix in order for it to configure and build properly under FreeBSD 8.3 / GCC 4.2.2 - I'll get back with the details in another issue ticket when I have time, in hopes that you will adapt so that people can host on more platforms.)

hampusborgos commented 12 years ago

The worlds table IP is set by the server on startup to the value in config.lua. If the value in config.lua is "auto", it will do a reverse ip lookup and use that value.

The words table is intended to be read by login servers only to get the location & ports of different gameservers.

stolendata commented 12 years ago

Just in case it wasn't obvious... 0x100007F which the server always binds to regardless of what you specify in config.lua is the little-endian host byte order of localhost: 1.0.0.127.

I'm curious about the idea behind updating the IP in the worlds table each time the server starts up. If the IP the server binds to is gathered from config.lua anyway, what is the rationale behind storing it and keeping it updated in the worlds table as well? Future plans of multi-homed hosting?

stolendata commented 12 years ago

Found the issue after poking around in the source code: configmanager.cpp looks for parameter "server_ip", while the stock config.lua defines the parameter as just "ip".

ghost commented 12 years ago

Setting the property as "server_ip" solves the issue?