! \brief returns 1 if ip & net.mask == net.ip ; 0 otherwise & -1 on error [ diff. address families ]) */
| 221 | /*! \brief returns 1 if ip & net.mask == net.ip ; 0 otherwise & -1 on error |
| 222 | [ diff. address families ]) */ |
| 223 | inline 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 |
no outgoing calls
no test coverage detected