Returns 1 if the given address is a multicast address */
| 209 | |
| 210 | /* Returns 1 if the given address is a multicast address */ |
| 211 | int is_mcast(struct ip_addr* ip) |
| 212 | { |
| 213 | if (!ip){ |
| 214 | LM_ERR("invalid parameter value\n"); |
| 215 | return -1; |
| 216 | } |
| 217 | |
| 218 | if (ip->af==AF_INET){ |
| 219 | return IN_MULTICAST(htonl(ip->u.addr32[0])); |
| 220 | } else if (ip->af==AF_INET6){ |
| 221 | return IN6_IS_ADDR_MULTICAST((struct in6_addr *)(void *)ip->u.addr); |
| 222 | } else { |
| 223 | LM_ERR("unsupported protocol family\n"); |
| 224 | return -1; |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | int mk_net_cidr(const str *cidr, struct net *out_net) |
| 229 | { |