! \brief comp_scriptvar helping function */
| 393 | |
| 394 | /*! \brief comp_scriptvar helping function */ |
| 395 | inline static int comp_ip(int op, str *ip_str, struct net *ipnet) |
| 396 | { |
| 397 | struct ip_addr *ip_tmp = NULL; |
| 398 | |
| 399 | ip_tmp = str2ip(ip_str); |
| 400 | if (!ip_tmp) { |
| 401 | ip_tmp = str2ip6(ip_str); |
| 402 | if (!ip_tmp) { |
| 403 | LM_DBG("Var value is not an IP\n"); |
| 404 | return -1; |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | if (op == EQUAL_OP) { |
| 409 | return (matchnet(ip_tmp, ipnet) == 1); |
| 410 | } else if (op == DIFF_OP) { |
| 411 | return (matchnet(ip_tmp, ipnet) != 1); |
| 412 | } else { |
| 413 | LM_CRIT("invalid operator %d\n", op); |
| 414 | return -1; |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | /*! \brief compare str to str */ |
| 419 | inline static int comp_s2s(int op, str *s1, str *s2) |
no test coverage detected