summaryrefslogtreecommitdiff
path: root/src/char_sql/char.c
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-05 19:25:36 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-05 19:25:36 +0000
commit1b58858969f704d37b67278bf9a0acfea0aeae0a (patch)
treec812c42b96c7b9602793dd476202522494921c03 /src/char_sql/char.c
parent34be37c4999ba473601bf7330cb73984298e61b8 (diff)
downloadhercules-1b58858969f704d37b67278bf9a0acfea0aeae0a.tar.gz
hercules-1b58858969f704d37b67278bf9a0acfea0aeae0a.tar.bz2
hercules-1b58858969f704d37b67278bf9a0acfea0aeae0a.tar.xz
hercules-1b58858969f704d37b67278bf9a0acfea0aeae0a.zip
Changed how IP Bindings are handled
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1045 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char_sql/char.c')
-rw-r--r--src/char_sql/char.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c
index 22e1f78e1..a6c8d60b3 100644
--- a/src/char_sql/char.c
+++ b/src/char_sql/char.c
@@ -93,6 +93,8 @@ in_addr_t login_ip;
int login_port = 6900;
int char_ip_set_ = 0;
char char_ip_str[128];
+int bind_ip_set_ = 0;
+char bind_ip_str[128];
in_addr_t char_ip;
int char_port = 6121;
int char_maintenance;
@@ -3174,6 +3176,14 @@ int char_config_read(const char *cfgName) {
sprintf(char_ip_str, "%d.%d.%d.%d", (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
} else
memcpy(char_ip_str, w2, 16);
+ } else if (strcmpi(w1, "bind_ip") == 0) {
+ bind_ip_set_ = 1;
+ h = gethostbyname (w2);
+ if(h != NULL) {
+ printf("Character server binding IP address : %s -> %d.%d.%d.%d\n", w2, (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
+ sprintf(bind_ip_str, "%d.%d.%d.%d", (unsigned char)h->h_addr[0], (unsigned char)h->h_addr[1], (unsigned char)h->h_addr[2], (unsigned char)h->h_addr[3]);
+ } else
+ memcpy(bind_ip_str, w2, 16);
} else if (strcmpi(w1, "char_port") == 0) {
char_port = atoi(w2);
} else if (strcmpi(w1, "char_maintenance") == 0) {
@@ -3330,7 +3340,10 @@ int do_init(int argc, char **argv){
printf("open port %d.....\n",char_port);
//char_fd = make_listen_port(char_port);
- char_fd = make_listen_bind(char_ip,char_port);
+ if (bind_ip_set_)
+ char_fd = make_listen_bind(inet_addr(bind_ip_str),char_port);
+ else
+ char_fd = make_listen_bind(INADDR_ANY,char_port);
// send ALIVE PING to login server.
printf("add interval tic (check_connect_login_server)....\n");