Module: kamailio
Branch: master
Commit: 1f675c68b3ed2b2e0a497fecd942c9213f0de058
URL:
https://github.com/kamailio/kamailio/commit/1f675c68b3ed2b2e0a497fecd942c92…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-04-03T09:11:37+02:00
ipops: mask subnet address when comparing
- allow using full ip address when specifying subnet parameter
- more flexibility on using values from sip message
- GH #1250
---
Modified: src/modules/ipops/ipops_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1f675c68b3ed2b2e0a497fecd942c92…
Patch:
https://github.com/kamailio/kamailio/commit/1f675c68b3ed2b2e0a497fecd942c92…
---
diff --git a/src/modules/ipops/ipops_mod.c b/src/modules/ipops/ipops_mod.c
index 2e1e990613..dd783180a6 100644
--- a/src/modules/ipops/ipops_mod.c
+++ b/src/modules/ipops/ipops_mod.c
@@ -390,7 +390,7 @@ int _ip_is_in_subnet_v4(struct in_addr *ip, char *net, size_t netlen,
if (netmask == 32) ipv4_mask = 0xFFFFFFFF;
else ipv4_mask = htonl(~(0xFFFFFFFF >> netmask));
- if ((ip->s_addr & ipv4_mask) == net_addr.s_addr)
+ if ((ip->s_addr & ipv4_mask) == (net_addr.s_addr & ipv4_mask))
return 1;
return 0;
}
@@ -1456,4 +1456,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
{
sr_kemi_modules_add(sr_kemi_ipops_exports);
return 0;
-}
\ No newline at end of file
+}