From 88a5d0cdda513357496b9d53878618e1620f47e8 Mon Sep 17 00:00:00 2001 From: ultramage Date: Thu, 5 Apr 2007 18:49:57 +0000 Subject: * Made a crazy attempt to at least partially synchronize login&char code * Major edit to the way the servers handle ip addresses, making them obey the "host byte order inside, network byte order outside" rule - hopefully covered all entry- and exit-points for IP address data - discovered several places where Gravity's client breaks the convention, will need to come up with a suitable countermeasure for that - other than that, the code should be portable, except for printing and ipban mask testing (those still assume a specific byte order) - tested both txt and sql in all usual situations; tested single- and multi-server setups, all seems to work (but watch out for hidden bugs!) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10162 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/map/map.c') diff --git a/src/map/map.c b/src/map/map.c index a28ac20c5..4c38c3754 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2077,9 +2077,9 @@ int map_mapindex2mapid(unsigned short mapindex) { /*========================================== * 他鯖map名からip,port?換 - *------------------------------------------ - */ -int map_mapname2ipport(unsigned short name,int *ip,int *port) { + *------------------------------------------*/ +int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port) +{ struct map_data_other_server *mdos=NULL; mdos = (struct map_data_other_server*)uidb_get(map_db,(unsigned int)name); @@ -2349,16 +2349,17 @@ static void* create_map_data_other_server(DBKey key, va_list args) { } /*========================================== * 他鯖管理のマップをdbに追加 - *------------------------------------------ - */ -int map_setipport(unsigned short mapindex,unsigned long ip,int port) { + *------------------------------------------*/ + +int map_setipport(unsigned short mapindex, uint32 ip, uint16 port) +{ struct map_data_other_server *mdos=NULL; mdos=(struct map_data_other_server *)uidb_ensure(map_db,(unsigned int)mapindex, create_map_data_other_server); if(mdos->gat) //Local map,Do nothing. Give priority to our own local maps over ones from another server. [Skotlex] return 0; - if(ip == clif_getip_long() && port == clif_getport()) { + if(ip == clif_getip() && port == clif_getport()) { //That's odd, we received info that we are the ones with this map, but... we don't have it. ShowFatalError("map_setipport : received info that this map-server SHOULD have map '%s', but it is not loaded.\n",mapindex_id2name(mapindex)); exit(1); @@ -2388,12 +2389,10 @@ int map_eraseallipport(void) { /*========================================== * 他鯖管理のマップをdbから削除 - *------------------------------------------ - */ -int map_eraseipport(unsigned short mapindex,unsigned long ip,int port) + *------------------------------------------*/ +int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port) { struct map_data_other_server *mdos; -// unsigned char *p=(unsigned char *)&ip; mdos = uidb_get(map_db,(unsigned int)mapindex); if(!mdos || mdos->gat) //Map either does not exists or is a local map. -- cgit v1.2.3-70-g09d2