Changed how IP Bindings are handled
git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1045 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
bf3ebabb8e
commit
3108e8fef2
@ -1,6 +1,11 @@
|
|||||||
Date Added
|
Date Added
|
||||||
|
|
||||||
02/05
|
02/05
|
||||||
|
* Changed interface binding to use a bind_ip instead of using
|
||||||
|
the login_ip, char_ip, or map_ip. This lets you still be
|
||||||
|
able to set your WAN IP seperate from what interface you
|
||||||
|
wish to bind to. Also, the default is back to binding to
|
||||||
|
all interfaces on the machine. [1045: MouseJstr]
|
||||||
* optimizing OnTouch event name generation [Shinomori]
|
* optimizing OnTouch event name generation [Shinomori]
|
||||||
* fixing Celests Sharp Shooting [Shinomori]
|
* fixing Celests Sharp Shooting [Shinomori]
|
||||||
* Updated Sharp Shooting AoE code, thanks to Neodis / k-Athena [celest]
|
* Updated Sharp Shooting AoE code, thanks to Neodis / k-Athena [celest]
|
||||||
|
@ -18,6 +18,10 @@ wisp_server_name: Server
|
|||||||
//
|
//
|
||||||
// login_ip:127.0.0.1
|
// login_ip:127.0.0.1
|
||||||
|
|
||||||
|
// What interface should we bind to.. if you have multiple IP's on one
|
||||||
|
// machine, this lets you put multiple servers on the same ports
|
||||||
|
// bind_ip:127.0.0.1
|
||||||
|
|
||||||
// Login Server Port
|
// Login Server Port
|
||||||
login_port: 6900
|
login_port: 6900
|
||||||
|
|
||||||
|
@ -8,6 +8,10 @@
|
|||||||
// you need to specify the IP address you wish to export to the entire world.
|
// you need to specify the IP address you wish to export to the entire world.
|
||||||
//
|
//
|
||||||
//login_ip:127.0.0.1
|
//login_ip:127.0.0.1
|
||||||
|
|
||||||
|
// What interface should we bind to.. if you have multiple IP's on one
|
||||||
|
// machine, this lets you put multiple servers on the same ports
|
||||||
|
// bind_ip:127.0.0.1
|
||||||
|
|
||||||
// Login Server Port
|
// Login Server Port
|
||||||
login_port: 6900
|
login_port: 6900
|
||||||
|
@ -30,6 +30,10 @@ passwd: p1
|
|||||||
//
|
//
|
||||||
//char_ip:127.0.0.1
|
//char_ip:127.0.0.1
|
||||||
|
|
||||||
|
// What interface should we bind to.. if you have multiple IP's on one
|
||||||
|
// machine, this lets you put multiple servers on the same ports
|
||||||
|
// bind_ip:127.0.0.1
|
||||||
|
|
||||||
// Character Server Port
|
// Character Server Port
|
||||||
char_port: 6121
|
char_port: 6121
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ in_addr_t login_ip;
|
|||||||
int login_port = 6900;
|
int login_port = 6900;
|
||||||
int char_ip_set_ = 0;
|
int char_ip_set_ = 0;
|
||||||
char char_ip_str[16];
|
char char_ip_str[16];
|
||||||
|
int bind_ip_set_ = 0;
|
||||||
|
char bind_ip_str[16];
|
||||||
in_addr_t char_ip;
|
in_addr_t char_ip;
|
||||||
int char_port = 6121;
|
int char_port = 6121;
|
||||||
int char_maintenance;
|
int char_maintenance;
|
||||||
@ -3219,6 +3221,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]);
|
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
|
} else
|
||||||
memcpy(char_ip_str, w2, 16);
|
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) {
|
} else if (strcmpi(w1, "char_port") == 0) {
|
||||||
char_port = atoi(w2);
|
char_port = atoi(w2);
|
||||||
} else if (strcmpi(w1, "char_maintenance") == 0) {
|
} else if (strcmpi(w1, "char_maintenance") == 0) {
|
||||||
@ -3436,8 +3446,10 @@ int do_init(int argc, char **argv) {
|
|||||||
set_termfunc(do_final);
|
set_termfunc(do_final);
|
||||||
set_defaultparse(parse_char);
|
set_defaultparse(parse_char);
|
||||||
|
|
||||||
//char_fd = make_listen_port(char_port);
|
if (bind_ip_set_)
|
||||||
char_fd = make_listen_bind(char_ip,char_port);
|
char_fd = make_listen_bind(inet_addr(bind_ip_str),char_port);
|
||||||
|
else
|
||||||
|
char_fd = make_listen_bind(INADDR_ANY,char_port);
|
||||||
|
|
||||||
add_timer_func_list(check_connect_login_server, "check_connect_login_server");
|
add_timer_func_list(check_connect_login_server, "check_connect_login_server");
|
||||||
add_timer_func_list(send_users_tologin, "send_users_tologin");
|
add_timer_func_list(send_users_tologin, "send_users_tologin");
|
||||||
|
@ -93,6 +93,8 @@ in_addr_t login_ip;
|
|||||||
int login_port = 6900;
|
int login_port = 6900;
|
||||||
int char_ip_set_ = 0;
|
int char_ip_set_ = 0;
|
||||||
char char_ip_str[128];
|
char char_ip_str[128];
|
||||||
|
int bind_ip_set_ = 0;
|
||||||
|
char bind_ip_str[128];
|
||||||
in_addr_t char_ip;
|
in_addr_t char_ip;
|
||||||
int char_port = 6121;
|
int char_port = 6121;
|
||||||
int char_maintenance;
|
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]);
|
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
|
} else
|
||||||
memcpy(char_ip_str, w2, 16);
|
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) {
|
} else if (strcmpi(w1, "char_port") == 0) {
|
||||||
char_port = atoi(w2);
|
char_port = atoi(w2);
|
||||||
} else if (strcmpi(w1, "char_maintenance") == 0) {
|
} 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);
|
printf("open port %d.....\n",char_port);
|
||||||
//char_fd = make_listen_port(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.
|
// send ALIVE PING to login server.
|
||||||
printf("add interval tic (check_connect_login_server)....\n");
|
printf("add interval tic (check_connect_login_server)....\n");
|
||||||
|
@ -55,8 +55,8 @@ void Gettimeofday(struct timeval *timenow)
|
|||||||
int account_id_count = START_ACCOUNT_NUM;
|
int account_id_count = START_ACCOUNT_NUM;
|
||||||
int server_num;
|
int server_num;
|
||||||
int new_account_flag = 0;
|
int new_account_flag = 0;
|
||||||
char login_ip_str[16];
|
char bind_ip_str[16];
|
||||||
in_addr_t login_ip;
|
in_addr_t bind_ip;
|
||||||
int login_port = 6900;
|
int login_port = 6900;
|
||||||
char lan_char_ip[16];
|
char lan_char_ip[16];
|
||||||
int subneti[4];
|
int subneti[4];
|
||||||
@ -3367,6 +3367,8 @@ int login_config_read(const char *cfgName) {
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct hostent *h = NULL;
|
struct hostent *h = NULL;
|
||||||
|
|
||||||
|
bind_ip_str[0] = '\0';
|
||||||
|
|
||||||
if ((fp = fopen(cfgName, "r")) == NULL) {
|
if ((fp = fopen(cfgName, "r")) == NULL) {
|
||||||
printf("Configuration file (%s) not found.\n", cfgName);
|
printf("Configuration file (%s) not found.\n", cfgName);
|
||||||
return 1;
|
return 1;
|
||||||
@ -3421,14 +3423,14 @@ int login_config_read(const char *cfgName) {
|
|||||||
level_new_gm = atoi(w2);
|
level_new_gm = atoi(w2);
|
||||||
} else if (strcmpi(w1, "new_account") == 0) {
|
} else if (strcmpi(w1, "new_account") == 0) {
|
||||||
new_account_flag = config_switch(w2);
|
new_account_flag = config_switch(w2);
|
||||||
} else if (strcmpi(w1, "login_ip") == 0) {
|
} else if (strcmpi(w1, "bind_ip") == 0) {
|
||||||
//login_ip_set_ = 1;
|
//bind_ip_set_ = 1;
|
||||||
h = gethostbyname (w2);
|
h = gethostbyname (w2);
|
||||||
if (h != NULL) {
|
if (h != NULL) {
|
||||||
printf("Login server 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]);
|
printf("Login server 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(login_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]);
|
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
|
} else
|
||||||
memcpy(login_ip_str,w2,16);
|
memcpy(bind_ip_str,w2,16);
|
||||||
} else if (strcmpi(w1, "login_port") == 0) {
|
} else if (strcmpi(w1, "login_port") == 0) {
|
||||||
login_port = atoi(w2);
|
login_port = atoi(w2);
|
||||||
} else if (strcmpi(w1, "account_filename") == 0) {
|
} else if (strcmpi(w1, "account_filename") == 0) {
|
||||||
@ -3955,9 +3957,14 @@ int do_init(int argc, char **argv) {
|
|||||||
read_gm_account();
|
read_gm_account();
|
||||||
// set_termfunc(mmo_auth_sync);
|
// set_termfunc(mmo_auth_sync);
|
||||||
set_defaultparse(parse_login);
|
set_defaultparse(parse_login);
|
||||||
login_ip = inet_addr(login_ip_str);
|
|
||||||
|
if (bind_ip_str[0] != '\0')
|
||||||
|
bind_ip = inet_addr(bind_ip_str);
|
||||||
|
else
|
||||||
|
bind_ip = INADDR_ANY;
|
||||||
|
|
||||||
//login_fd = make_listen_port(login_port);
|
//login_fd = make_listen_port(login_port);
|
||||||
login_fd = make_listen_bind(login_ip,login_port);
|
login_fd = make_listen_bind(bind_ip,login_port);
|
||||||
|
|
||||||
if(anti_freeze_enable > 0) {
|
if(anti_freeze_enable > 0) {
|
||||||
add_timer_func_list(char_anti_freeze_system, "char_anti_freeze_system");
|
add_timer_func_list(char_anti_freeze_system, "char_anti_freeze_system");
|
||||||
|
@ -82,8 +82,8 @@ void Gettimeofday(struct timeval *timenow)
|
|||||||
int account_id_count = START_ACCOUNT_NUM;
|
int account_id_count = START_ACCOUNT_NUM;
|
||||||
int server_num;
|
int server_num;
|
||||||
int new_account_flag = 0;
|
int new_account_flag = 0;
|
||||||
char login_ip_str[16];
|
char bind_ip_str[16];
|
||||||
in_addr_t login_ip;
|
in_addr_t bind_ip;
|
||||||
int login_port = 6900;
|
int login_port = 6900;
|
||||||
char lan_char_ip[128]; // Lan char ip added by kashy
|
char lan_char_ip[128]; // Lan char ip added by kashy
|
||||||
int subnetmaski[4]; // Subnetmask added by kashy
|
int subnetmaski[4]; // Subnetmask added by kashy
|
||||||
@ -1580,6 +1580,8 @@ int login_config_read(const char *cfgName){
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct hostent *h = NULL;
|
struct hostent *h = NULL;
|
||||||
|
|
||||||
|
bind_ip_str[0] = '\0';
|
||||||
|
|
||||||
fp=fopen(cfgName,"r");
|
fp=fopen(cfgName,"r");
|
||||||
|
|
||||||
if(fp==NULL){
|
if(fp==NULL){
|
||||||
@ -1594,15 +1596,14 @@ int login_config_read(const char *cfgName){
|
|||||||
i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2);
|
i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2);
|
||||||
if(i!=2)
|
if(i!=2)
|
||||||
continue;
|
continue;
|
||||||
|
else if (strcmpi(w1, "bind_ip") == 0) {
|
||||||
else if (strcmpi(w1, "login_ip") == 0) {
|
|
||||||
//login_ip_set_ = 1;
|
//login_ip_set_ = 1;
|
||||||
h = gethostbyname (w2);
|
h = gethostbyname (w2);
|
||||||
if (h != NULL) {
|
if (h != NULL) {
|
||||||
printf("Login server 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]);
|
printf("Login server 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(login_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]);
|
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
|
} else
|
||||||
memcpy(login_ip_str,w2,16);
|
memcpy(bind_ip_str,w2,16);
|
||||||
} else if(strcmpi(w1,"login_port")==0){
|
} else if(strcmpi(w1,"login_port")==0){
|
||||||
login_port=atoi(w2);
|
login_port=atoi(w2);
|
||||||
printf ("set login_port : %s\n",w2);
|
printf ("set login_port : %s\n",w2);
|
||||||
@ -1816,10 +1817,13 @@ int do_init(int argc,char **argv){
|
|||||||
printf ("set max servers complete\n");
|
printf ("set max servers complete\n");
|
||||||
//server port open & binding
|
//server port open & binding
|
||||||
|
|
||||||
login_ip = inet_addr(login_ip_str);
|
if (bind_ip_str[0] != '\0')
|
||||||
|
bind_ip = inet_addr(bind_ip_str);
|
||||||
|
else
|
||||||
|
bind_ip = INADDR_ANY;
|
||||||
|
|
||||||
//login_fd=make_listen_port(login_port);
|
//login_fd=make_listen_port(login_port);
|
||||||
login_fd=make_listen_bind(login_ip,login_port);
|
login_fd=make_listen_bind(bind_ip,login_port);
|
||||||
|
|
||||||
//Auth start
|
//Auth start
|
||||||
printf ("Running mmo_auth_sqldb_init()\n");
|
printf ("Running mmo_auth_sqldb_init()\n");
|
||||||
|
@ -153,6 +153,7 @@ enum {
|
|||||||
|
|
||||||
static char map_ip_str[16];
|
static char map_ip_str[16];
|
||||||
static in_addr_t map_ip;
|
static in_addr_t map_ip;
|
||||||
|
static in_addr_t bind_ip = INADDR_ANY;
|
||||||
static int map_port = 5121;
|
static int map_port = 5121;
|
||||||
int map_fd;
|
int map_fd;
|
||||||
char talkie_mes[80];
|
char talkie_mes[80];
|
||||||
@ -167,6 +168,11 @@ void clif_setip(char *ip)
|
|||||||
map_ip = inet_addr(map_ip_str);
|
map_ip = inet_addr(map_ip_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clif_setbindip(char *ip)
|
||||||
|
{
|
||||||
|
bind_ip = inet_addr(ip);
|
||||||
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* mapŽI‚Ìport<EFBFBD>Ý’è
|
* mapŽI‚Ìport<EFBFBD>Ý’è
|
||||||
*------------------------------------------
|
*------------------------------------------
|
||||||
@ -11357,14 +11363,14 @@ int do_init_clif(void) {
|
|||||||
set_defaultparse(clif_parse);
|
set_defaultparse(clif_parse);
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
//if (!make_listen_port(map_port)) {
|
//if (!make_listen_port(map_port)) {
|
||||||
if (!make_listen_bind(map_ip,map_port)) {
|
if (!make_listen_bind(bind_ip,map_port)) {
|
||||||
printf("cant bind game port\n");
|
printf("cant bind game port\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for(i = 0; i < 10; i++) {
|
for(i = 0; i < 10; i++) {
|
||||||
//if (make_listen_port(map_port))
|
//if (make_listen_port(map_port))
|
||||||
if (make_listen_bind(map_ip,map_port))
|
if (make_listen_bind(bind_ip,map_port))
|
||||||
break;
|
break;
|
||||||
sleep(20);
|
sleep(20);
|
||||||
}
|
}
|
||||||
|
@ -2132,6 +2132,7 @@ int map_delmap(char *mapname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int map_ip_set_ = 0;
|
static int map_ip_set_ = 0;
|
||||||
|
static int bind_ip_set_ = 0;
|
||||||
static int char_ip_set_ = 0;
|
static int char_ip_set_ = 0;
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
|
Loading…
x
Reference in New Issue
Block a user