Skip to content

Commit

Permalink
ipops: mask subnet address when comparing
Browse files Browse the repository at this point in the history
- allow using full ip address when specifying subnet parameter
- more flexibility on using values from sip message
- GH #1250

(cherry picked from commit 1f675c6)
  • Loading branch information
miconda committed Apr 22, 2018
1 parent 300c0f4 commit d7c1754
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/ipops/ipops_mod.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}

0 comments on commit d7c1754

Please sign in to comment.