Fix create_id_easy not parsing ipv4 addr correctly

This commit is contained in:
Stephen Seo 2019-12-17 12:52:10 +09:00
parent 58493ee936
commit aa59777f99

View file

@ -1702,7 +1702,8 @@ UDPC_ConnectionId UDPC_create_id_anyaddr(uint16_t port) {
UDPC_ConnectionId UDPC_create_id_easy(const char *addrString, uint16_t port) { UDPC_ConnectionId UDPC_create_id_easy(const char *addrString, uint16_t port) {
UDPC_ConnectionId conId{{0}, 0, port}; UDPC_ConnectionId conId{{0}, 0, port};
if(std::regex_match(addrString, ipv6_regex_nolink)) { if(std::regex_match(addrString, ipv6_regex_nolink)
|| std::regex_match(addrString, ipv4_regex)) {
conId.addr = UDPC_strtoa(addrString); conId.addr = UDPC_strtoa(addrString);
} else if(std::regex_match(addrString, ipv6_regex_linkonly)) { } else if(std::regex_match(addrString, ipv6_regex_linkonly)) {
conId.addr = UDPC_strtoa_link(addrString, &conId.scope_id); conId.addr = UDPC_strtoa_link(addrString, &conId.scope_id);