struct ip_set;
-typedef int (*ipset_adtfn)(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout);
+typedef int (*ipset_adtfn)(struct ip_set *set, void *value, u32 timeout);
/* Set type, variant-specific part */
struct ip_set_type_variant {
ipset_adtfn adt[IPSET_ADT_MAX];
/* When adding entries and set is full, try to resize the set */
- int (*resize)(struct ip_set *set, gfp_t gfp_flags, bool retried);
+ int (*resize)(struct ip_set *set, bool retried);
/* Destroy the set */
void (*destroy)(struct ip_set *set);
/* Flush the elements */
/* Add an element to the hash table when resizing the set:
* we spare the maintenance of the internal counters. */
static int
-type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value,
- gfp_t gfp_flags)
+type_pf_elem_add(struct hbucket *n, const struct type_pf_elem *value)
{
if (n->pos >= n->size) {
void *tmp;
tmp = kzalloc((n->size + AHASH_INIT_SIZE)
* sizeof(struct type_pf_elem),
- gfp_flags);
+ GFP_ATOMIC);
if (!tmp)
return -ENOMEM;
if (n->size) {
* and inserting the elements to it. Repeat until we succeed or
* fail due to memory pressures. */
static int
-type_pf_resize(struct ip_set *set, gfp_t gfp_flags, bool retried)
+type_pf_resize(struct ip_set *set, bool retried)
{
struct ip_set_hash *h = set->data;
struct htable *t, *orig = h->table;
for (j = 0; j < n->pos; j++) {
data = ahash_data(n, j);
m = hbucket(t, HKEY(data, h->initval, htable_bits));
- ret = type_pf_elem_add(m, data, gfp_flags);
+ ret = type_pf_elem_add(m, data);
if (ret < 0) {
read_unlock_bh(&set->lock);
ahash_destroy(t);
/* Add an element to a hash and update the internal counters when succeeded,
* otherwise report the proper error code. */
static int
-type_pf_add(struct ip_set *set, void *value, gfp_t gfp_flags, u32 timeout)
+type_pf_add(struct ip_set *set, void *value, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t;
goto out;
}
- ret = type_pf_elem_add(n, value, gfp_flags);
+ ret = type_pf_elem_add(n, value);
if (ret != 0)
goto out;
* and free up space if possible.
*/
static int
-type_pf_del(struct ip_set *set, void *value, gfp_t gfp_flags, u32 timeout)
+type_pf_del(struct ip_set *set, void *value, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t = h->table;
if (n->pos + AHASH_INIT_SIZE < n->size) {
void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
* sizeof(struct type_pf_elem),
- gfp_flags);
+ GFP_ATOMIC);
if (!tmp)
return 0;
n->size -= AHASH_INIT_SIZE;
/* Special test function which takes into account the different network
* sizes added to the set */
static inline int
-type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d,
- gfp_t gfp_flags, u32 timeout)
+type_pf_test_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t = h->table;
/* Test whether the element is added to the set */
static int
-type_pf_test(struct ip_set *set, void *value, gfp_t gfp_flags, u32 timeout)
+type_pf_test(struct ip_set *set, void *value, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t = h->table;
/* If we test an IP address and not a network address,
* try all possible network sizes */
if (d->cidr == SET_HOST_MASK(set->family))
- return type_pf_test_cidrs(set, d, gfp_flags, timeout);
+ return type_pf_test_cidrs(set, d, timeout);
#endif
key = HKEY(d, h->initval, t->htable_bits);
static int
type_pf_elem_tadd(struct hbucket *n, const struct type_pf_elem *value,
- gfp_t gfp_flags, u32 timeout)
+ u32 timeout)
{
struct type_pf_elem *data;
tmp = kzalloc((n->size + AHASH_INIT_SIZE)
* sizeof(struct type_pf_telem),
- gfp_flags);
+ GFP_ATOMIC);
if (!tmp)
return -ENOMEM;
if (n->size) {
}
static int
-type_pf_tresize(struct ip_set *set, gfp_t gfp_flags, bool retried)
+type_pf_tresize(struct ip_set *set, bool retried)
{
struct ip_set_hash *h = set->data;
struct htable *t, *orig = h->table;
for (j = 0; j < n->pos; j++) {
data = ahash_tdata(n, j);
m = hbucket(t, HKEY(data, h->initval, htable_bits));
- ret = type_pf_elem_tadd(m, data, gfp_flags,
+ ret = type_pf_elem_tadd(m, data,
type_pf_data_timeout(data));
if (ret < 0) {
read_unlock_bh(&set->lock);
}
static int
-type_pf_tadd(struct ip_set *set, void *value, gfp_t gfp_flags, u32 timeout)
+type_pf_tadd(struct ip_set *set, void *value, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t = h->table;
type_pf_data_timeout_set(data, timeout);
goto out;
}
- ret = type_pf_elem_tadd(n, d, gfp_flags, timeout);
+ ret = type_pf_elem_tadd(n, d, timeout);
if (ret != 0)
goto out;
}
static int
-type_pf_tdel(struct ip_set *set, void *value, gfp_t gfp_flags, u32 timeout)
+type_pf_tdel(struct ip_set *set, void *value, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t = h->table;
if (n->pos + AHASH_INIT_SIZE < n->size) {
void *tmp = kzalloc((n->size - AHASH_INIT_SIZE)
* sizeof(struct type_pf_telem),
- gfp_flags);
+ GFP_ATOMIC);
if (!tmp)
return 0;
n->size -= AHASH_INIT_SIZE;
#ifdef IP_SET_HASH_WITH_NETS
static inline int
-type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d,
- gfp_t gfp_flags, u32 timeout)
+type_pf_ttest_cidrs(struct ip_set *set, struct type_pf_elem *d, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t = h->table;
#endif
static int
-type_pf_ttest(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout)
+type_pf_ttest(struct ip_set *set, void *value, u32 timeout)
{
struct ip_set_hash *h = set->data;
struct htable *t = h->table;
#ifdef IP_SET_HASH_WITH_NETS
if (d->cidr == SET_HOST_MASK(set->family))
- return type_pf_ttest_cidrs(set, d, gfp_flags, timeout);
+ return type_pf_ttest_cidrs(set, d, timeout);
#endif
key = HKEY(d, h->initval, t->htable_bits);
n = hbucket(t, key);
write_unlock_bh(&set->lock);
} while (ret == -EAGAIN
&& set->variant->resize
- && (ret = set->variant->resize(set, GFP_ATOMIC,
- retried++)) == 0);
+ && (ret = set->variant->resize(set, retried++)) == 0);
if (!ret || (ret == -IPSET_ERR_EXIST && eexist))
return 0;
/* Base variant */
static int
-bitmap_ipmac_test(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout)
+bitmap_ipmac_test(struct ip_set *set, void *value, u32 timeout)
{
const struct bitmap_ipmac *map = set->data;
const struct ipmac *data = value;
}
static int
-bitmap_ipmac_add(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout)
+bitmap_ipmac_add(struct ip_set *set, void *value, u32 timeout)
{
struct bitmap_ipmac *map = set->data;
const struct ipmac *data = value;
}
static int
-bitmap_ipmac_del(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout)
+bitmap_ipmac_del(struct ip_set *set, void *value, u32 timeout)
{
struct bitmap_ipmac *map = set->data;
const struct ipmac *data = value;
/* Timeout variant */
static int
-bitmap_ipmac_ttest(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout)
+bitmap_ipmac_ttest(struct ip_set *set, void *value, u32 timeout)
{
const struct bitmap_ipmac *map = set->data;
const struct ipmac *data = value;
}
static int
-bitmap_ipmac_tadd(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout)
+bitmap_ipmac_tadd(struct ip_set *set, void *value, u32 timeout)
{
struct bitmap_ipmac *map = set->data;
const struct ipmac *data = value;
}
static int
-bitmap_ipmac_tdel(struct ip_set *set, void *value,
- gfp_t gfp_flags, u32 timeout)
+bitmap_ipmac_tdel(struct ip_set *set, void *value, u32 timeout)
{
struct bitmap_ipmac *map = set->data;
const struct ipmac *data = value;
data.id -= map->first_ip;
data.ether = eth_hdr(skb)->h_source;
- return adtfn(set, &data, GFP_ATOMIC, map->timeout);
+ return adtfn(set, &data, map->timeout);
}
static const struct nla_policy
data.id -= map->first_ip;
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
if (ip == 0)
return -EINVAL;
- return adtfn(set, &ip, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &ip, h->timeout);
}
static const struct nla_policy
}
if (adt == IPSET_TEST)
- return adtfn(set, &ip, GFP_ATOMIC, timeout);
+ return adtfn(set, &ip, timeout);
ip = ntohl(ip);
if (tb[IPSET_ATTR_IP_TO]) {
for (; !before(ip_to, ip); ip += hosts) {
nip = htonl(ip);
- ret = adtfn(set, &nip, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &nip, timeout);
if (ret && !ip_set_eexist(ret, flags))
return ret;
if (ipv6_addr_any(&ip.in6))
return -EINVAL;
- return adtfn(set, &ip, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &ip, h->timeout);
}
static const struct nla_policy
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &ip, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &ip, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static const struct nla_policy
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static int
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip);
ip4addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static const struct nla_policy
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
ip6addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2.in6);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static int
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip4addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2);
data.ip2 &= NETMASK(data.cidr);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static const struct nla_policy
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip6addrptr(skb, flags & IPSET_DIM_THREE_SRC, &data.ip2.in6);
ip6_netmask(&data.ip2, data.cidr);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static int
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip);
data.ip &= NETMASK(data.cidr);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static const struct nla_policy
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
ip6_netmask(&data.ip, data.cidr);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static int
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip4addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip);
data.ip &= NETMASK(data.cidr);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static const struct nla_policy
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}
ip6addrptr(skb, flags & IPSET_DIM_ONE_SRC, &data.ip.in6);
ip6_netmask(&data.ip, data.cidr);
- return adtfn(set, &data, GFP_ATOMIC, h->timeout);
+ return adtfn(set, &data, h->timeout);
}
static int
timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
}
- ret = adtfn(set, &data, GFP_ATOMIC, timeout);
+ ret = adtfn(set, &data, timeout);
return ip_set_eexist(ret, flags) ? 0 : ret;
}