static int testip_kernel(struct ip_set *set, const struct sk_buff *skb, ip_set_ip_t *hash_ip, const u_int32_t *flags, unsigned char index) { ip_set_ip_t port; if (flags[index+1] == 0) return -EINVAL; port = get_port(skb, flags[index+1]); DP("flag: %s src: %u.%u.%u.%u dst: %u.%u.%u.%u", flags[index] & IPSET_SRC ? "SRC" : "DST", NIPQUAD(skb->nh.iph->saddr), NIPQUAD(skb->nh.iph->daddr)); DP("flag %s port %u", flags[index+1] & IPSET_SRC ? "SRC" : "DST", port); if (port == INVALID_PORT) return 0; return __testip(set, ntohl(flags[index] & IPSET_SRC ? skb->nh.iph->saddr : skb->nh.iph->daddr), port, hash_ip); }
static int testip_kernel(struct ip_set *set, const struct sk_buff *skb, ip_set_ip_t *hash_ip, const u_int32_t *flags, unsigned char index) { return __testip(set, ntohl(flags[index] & IPSET_SRC ? ip_hdr(skb)->saddr : ip_hdr(skb)->daddr), hash_ip); }
static int testip(struct ip_set *set, const void *data, size_t size, ip_set_ip_t *hash_ip) { const struct ip_set_req_ipporthash *req = data; if (size != sizeof(struct ip_set_req_ipporthash)) { ip_set_printk("data length wrong (want %zu, have %zu)", sizeof(struct ip_set_req_ipporthash), size); return -EINVAL; } return __testip(set, req->ip, req->port, hash_ip); }
static int testip(struct ip_set *set, const void *data, size_t size, ip_set_ip_t *hash_ip) { struct ip_set_req_nethash *req = (struct ip_set_req_nethash *) data; if (size != sizeof(struct ip_set_req_nethash)) { ip_set_printk("data length wrong (want %zu, have %zu)", sizeof(struct ip_set_req_nethash), size); return -EINVAL; } return (req->cidr == 32 ? __testip(set, req->ip, hash_ip) : __testip_cidr(set, req->ip, req->cidr, hash_ip)); }