MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / matchnet

Function matchnet

ip_addr.h:223–240  ·  view source on GitHub ↗

! \brief returns 1 if ip & net.mask == net.ip ; 0 otherwise & -1 on error [ diff. address families ]) */

Source from the content-addressed store, hash-verified

221/*! \brief returns 1 if ip & net.mask == net.ip ; 0 otherwise & -1 on error
222 [ diff. address families ]) */
223inline static int matchnet(struct ip_addr* ip, struct net* net)
224{
225 unsigned int r;
226/* int ret;
227
228 ret=-1; */
229 if (ip->af == net->ip.af){
230 for(r=0; r<ip->len/4; r++){ /* ipv4 & ipv6 addresses are
231 all multiple of 4*/
232 if ((ip->u.addr32[r]&net->mask.u.addr32[r])!=
233 net->ip.u.addr32[r]){
234 return 0;
235 }
236 }
237 return 1;
238 };
239 return -1;
240}
241
242
243

Callers 6

comp_ipFunction · 0.85
tr_eval_ipFunction · 0.85
match_bl_ruleFunction · 0.85
match_addressFunction · 0.85
pm_hash_find_groupFunction · 0.85
tcp_mgm_get_profileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected