From b46693e3ca4423181dc444ba2318d684c6d04813 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 Jul 2008 16:32:56 +0000 Subject: [PATCH] fix MODAPP-113 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9016 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_core.c | 2 ++ src/switch_utils.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/switch_core.c b/src/switch_core.c index 6d75542a23..e64fc049f3 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -700,6 +700,8 @@ SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip(const char *ip_str, c switch_mutex_lock(runtime.global_mutex); switch_inet_pton(AF_INET, ip_str, &ip); + ip = htonl(ip); + if ((list = switch_core_hash_find(IP_LIST.hash, list_name))) { ok = switch_network_list_validate_ip(list, ip); } else if (strchr(list_name, '/')) { diff --git a/src/switch_utils.c b/src/switch_utils.c index 346be5ada9..fb371517ce 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -169,7 +169,10 @@ SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t bits = atoi(bit_str); switch_inet_pton(AF_INET, host, ip); - *mask = 0xFFFFFFFF & ~(0xFFFFFFFF << bits); + *ip = htonl(*ip); + + *mask = 0xFFFFFFFF & ~(0xFFFFFFFF >> bits); + *bitp = bits; return 0;