multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.38k stars 422 forks source link

Refactor functions which work with IP addresses #1988

Open Disinterpreter opened 3 years ago

Disinterpreter commented 3 years ago

Describe the solution you'd like Need to refactor these lines and replace all inet_addr and inet_ntoa

Additional context https://github.com/multitheftauto/mtasa-blue/blob/a0410c68945b6b3d9225c8c90af2bb6b1cda5eaa/Server/mods/deathmatch/logic/CBanManager.cpp#L519-L551 https://github.com/multitheftauto/mtasa-blue/blob/650fed6a0b55b0334b21db9d7d48e5f77606d1d4/Server/mods/deathmatch/logic/CGame.cpp#L731-L734

Server\mods\deathmatch\logic\CGame.cpp(728,27): warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
Shared\mods\deathmatch\logic\Utils.cpp(1009,12): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
Server\mods\deathmatch\logic\ASE.cpp(99,40): warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
Server\mods\deathmatch\logic\ASE.cpp(166,50): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
Shared\mods\deathmatch\logic\Utils.cpp(1009,12): warning C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings

https://github.com/multitheftauto/mtasa-blue/search?l=C%2B%2B&q=inet_addr

Pirulax commented 3 years ago

What about the BanManager part?

Disinterpreter commented 3 years ago

What about the BanManager part?

by the rules, BanManager must work with subnet masks like 125.22.4.0/24

botder commented 3 years ago

FYI, I already started working on this in my fork.

Disinterpreter commented 3 years ago

FYI, I already started working on this in my fork.

Can you do it compatible with IPv6? (For future)

botder commented 3 years ago

Can you do it compatible with IPv6? (For future)

Yes, that is my plan.