++h->nets[cidr-1].nets;
- pr_debug("add_cidr added %u: %u", cidr, h->nets[cidr-1].nets);
+ pr_debug("add_cidr added %u: %u\n", cidr, h->nets[cidr-1].nets);
if (h->nets[cidr-1].nets > 1)
return;
--h->nets[cidr-1].nets;
- pr_debug("del_cidr deleted %u: %u", cidr, h->nets[cidr-1].nets);
+ pr_debug("del_cidr deleted %u: %u\n", cidr, h->nets[cidr-1].nets);
if (h->nets[cidr-1].nets != 0)
return;
/* Give time to other readers of the set */
synchronize_rcu_bh();
- pr_debug("set %s resized from %u (%p) to %u (%p)", set->name,
+ pr_debug("set %s resized from %u (%p) to %u (%p)\n", set->name,
orig->htable_bits, orig, t->htable_bits, t);
ahash_destroy(orig);
u32 key;
u8 host_mask = SET_HOST_MASK(set->family);
- pr_debug("test by nets");
+ pr_debug("test by nets\n");
for (; j < host_mask && h->nets[j].cidr; j++) {
type_pf_data_netmask(d, h->nets[j].cidr);
key = HKEY(d, h->initval, t->htable_bits);
atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
if (!atd)
return -EFAULT;
- pr_debug("list hash set %s", set->name);
+ pr_debug("list hash set %s\n", set->name);
for (; cb->args[2] < jhash_size(t->htable_bits); cb->args[2]++) {
incomplete = skb_tail_pointer(skb);
n = hbucket(t, cb->args[2]);
- pr_debug("cb->args[2]: %lu, t %p n %p", cb->args[2], t, n);
+ pr_debug("cb->args[2]: %lu, t %p n %p\n", cb->args[2], t, n);
for (i = 0; i < n->pos; i++) {
data = ahash_data(n, i);
- pr_debug("list hash %lu hbucket %p i %u, data %p",
+ pr_debug("list hash %lu hbucket %p i %u, data %p\n",
cb->args[2], n, i, data);
nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) {
for (j = 0; j < n->pos; j++) {
data = ahash_tdata(n, j);
if (type_pf_data_expired(data)) {
- pr_debug("expired %u/%u", i, j);
+ pr_debug("expired %u/%u\n", i, j);
#ifdef IP_SET_HASH_WITH_NETS
del_cidr(h, data->cidr, HOST_MASK);
#endif
ret = -IPSET_ERR_EXIST;
goto out;
}
- } else if (j == AHASH_MAX_SIZE + 1 &&
+ } else if (j == AHASH_MAX_SIZE + 1 &&
type_pf_data_expired(data))
j = i;
}
n = hbucket(t, cb->args[2]);
for (i = 0; i < n->pos; i++) {
data = ahash_tdata(n, i);
- pr_debug("list %p %u", n, i);
+ pr_debug("list %p %u\n", n, i);
if (type_pf_data_expired(data))
continue;
- pr_debug("do list %p %u", n, i);
+ pr_debug("do list %p %u\n", n, i);
nested = ipset_nest_start(skb, IPSET_ATTR_DATA);
if (!nested) {
if (cb->args[2] == first) {
struct ip_set *set = (struct ip_set *) ul_set;
struct ip_set_hash *h = set->data;
- pr_debug("called");
+ pr_debug("called\n");
write_lock_bh(&set->lock);
type_pf_expire(h);
write_unlock_bh(&set->lock);
h->gc.function = type_pf_gc;
h->gc.expires = jiffies + IPSET_GC_PERIOD(h->timeout) * HZ;
add_timer(&h->gc);
- pr_debug("gc initialized, run in every %u",
+ pr_debug("gc initialized, run in every %u\n",
IPSET_GC_PERIOD(h->timeout));
}
#ifndef _IP_SET_GETPORT_H
#define _IP_SET_GETPORT_H
-#define IPSET_INVALID_PORT 65536
-
extern bool ip_set_get_ip4_port(const struct sk_buff *skb, bool src,
__be16 *port, u8 *proto);
extern bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
netmask <= mask_bits)
return -IPSET_ERR_BITMAP_RANGE;
- pr_debug("mask_bits %u, netmask %u", mask_bits, netmask);
+ pr_debug("mask_bits %u, netmask %u\n", mask_bits, netmask);
hosts = 2 << (32 - netmask - 1);
elements = 2 << (netmask - mask_bits - 1);
}
if (elements > IPSET_BITMAP_MAX_RANGE + 1)
return -IPSET_ERR_BITMAP_RANGE_SIZE;
- pr_debug("hosts %u, elements %u", hosts, elements);
+ pr_debug("hosts %u, elements %u\n", hosts, elements);
if (tb[IPSET_ATTR_TIMEOUT]) {
struct bitmap_ip_timeout *map;
return -ENOMEM;
map->memsize = bitmap_bytes(0, last_port - first_port);
- pr_debug("memsize: %zu", map->memsize);
+ pr_debug("memsize: %zu\n", map->memsize);
if (!init_map_port(set, map, first_port, last_port)) {
kfree(map);
return -ENOMEM;
goto unlock;
}
list_add_rcu(&type->list, &ip_set_type_list);
- pr_debug("type %s, family %s, revision %u registered.",
+ pr_debug("type %s, family %s, revision %u registered.\n",
type->name, family_name(type->family), type->revision);
unlock:
ip_set_type_unlock();
goto unlock;
}
list_del_rcu(&type->list);
- pr_debug("type %s, family %s, revision %u unregistered.",
+ pr_debug("type %s, family %s, revision %u unregistered.\n",
type->name, family_name(type->family), type->revision);
unlock:
ip_set_type_unlock();
members = kzalloc(size, gfp_mask | __GFP_NOWARN);
if (members) {
- pr_debug("%p: allocated with kmalloc", members);
+ pr_debug("%p: allocated with kmalloc\n", members);
return members;
}
PAGE_KERNEL);
if (!members)
return NULL;
- pr_debug("%p: allocated with vmalloc", members);
+ pr_debug("%p: allocated with vmalloc\n", members);
return members;
}
void
ip_set_free(void *members)
{
- pr_debug("%p: free with %s", members,
+ pr_debug("%p: free with %s\n", members,
is_vmalloc_addr(members) ? "vfree" : "kfree");
if (is_vmalloc_addr(members))
vfree(members);
int ret = 0;
BUG_ON(set == NULL || atomic_read(&set->ref) == 0);
- pr_debug("set %s, index %u", set->name, index);
+ pr_debug("set %s, index %u\n", set->name, index);
if (dim < set->type->dimension ||
!(family == set->family || set->family == AF_UNSPEC))
if (ret == -EAGAIN) {
/* Type requests element to be completed */
- pr_debug("element must be competed, ADD is triggered");
+ pr_debug("element must be competed, ADD is triggered\n");
write_lock_bh(&set->lock);
set->variant->kadt(set, skb, IPSET_ADD, family, dim, flags);
write_unlock_bh(&set->lock);
int ret;
BUG_ON(set == NULL || atomic_read(&set->ref) == 0);
- pr_debug("set %s, index %u", set->name, index);
+ pr_debug("set %s, index %u\n", set->name, index);
if (dim < set->type->dimension ||
!(family == set->family || set->family == AF_UNSPEC))
int ret = 0;
BUG_ON(set == NULL || atomic_read(&set->ref) == 0);
- pr_debug("set %s, index %u", set->name, index);
+ pr_debug("set %s, index %u\n", set->name, index);
if (dim < set->type->dimension ||
!(family == set->family || set->family == AF_UNSPEC))
typename = nla_data(attr[IPSET_ATTR_TYPENAME]);
family = nla_get_u8(attr[IPSET_ATTR_FAMILY]);
revision = nla_get_u8(attr[IPSET_ATTR_REVISION]);
- pr_debug("setname: %s, typename: %s, family: %s, revision: %u",
+ pr_debug("setname: %s, typename: %s, family: %s, revision: %u\n",
name, typename, family_name(family), revision);
/*
* Without holding any locks, create private part.
*/
len = attr[IPSET_ATTR_DATA] ? nla_len(attr[IPSET_ATTR_DATA]) : 0;
- pr_debug("data len: %u", len);
+ pr_debug("data len: %u\n", len);
ret = set->type->create(set, attr[IPSET_ATTR_DATA] ?
nla_data(attr[IPSET_ATTR_DATA]) : NULL, len,
flags);
/*
* Finally! Add our shiny new set to the list, and be done.
*/
- pr_debug("create: '%s' created with index %u!", set->name, index);
+ pr_debug("create: '%s' created with index %u!\n", set->name, index);
ip_set_list[index] = set;
return ret;
{
struct ip_set *set = ip_set_list[index];
- pr_debug("set: %s", set->name);
+ pr_debug("set: %s\n", set->name);
ip_set_list[index] = NULL;
/* Must call it without holding any lock */
static void
ip_set_flush_set(struct ip_set *set)
{
- pr_debug("set: %s", set->name);
+ pr_debug("set: %s\n", set->name);
write_lock_bh(&set->lock);
set->variant->flush(set);
ip_set_dump_done(struct netlink_callback *cb)
{
if (cb->args[2]) {
- pr_debug("release set %s", ip_set_list[cb->args[1]]->name);
+ pr_debug("release set %s\n", ip_set_list[cb->args[1]]->name);
__ip_set_put((ip_set_id_t) cb->args[1]);
}
return 0;
const struct nlattr *attr;
int rem;
- pr_debug("dump nlmsg");
+ pr_debug("dump nlmsg\n");
nlmsg_for_each_attr(attr, nlh, sizeof(struct nfgenmsg), rem) {
- pr_debug("type: %u, len %u", nla_type(attr), attr->nla_len);
+ pr_debug("type: %u, len %u\n", nla_type(attr), attr->nla_len);
}
}
!((cb->args[0] == DUMP_ALL) ^
(set->type->features & IPSET_DUMP_LAST)))
continue;
- pr_debug("List set: %s", set->name);
+ pr_debug("List set: %s\n", set->name);
if (!cb->args[2]) {
/* Start listing: make sure set won't be destroyed */
- pr_debug("reference set");
+ pr_debug("reference set\n");
__ip_set_get(index);
}
nlh = start_msg(skb, NETLINK_CB(cb->skb).pid,
release_refcount:
/* If there was an error or set is done, release set */
if (ret || !cb->args[2]) {
- pr_debug("release set %s", ip_set_list[index]->name);
+ pr_debug("release set %s\n", ip_set_list[index]->name);
__ip_set_put(index);
}
out:
if (nlh) {
nlmsg_end(skb, nlh);
- pr_debug("nlmsg_len: %u", nlh->nlmsg_len);
+ pr_debug("nlmsg_len: %u\n", nlh->nlmsg_len);
dump_attrs(nlh);
}
NLA_PUT_U8(skb2, IPSET_ATTR_REVISION_MIN, min);
nlmsg_end(skb2, nlh2);
- pr_debug("Send TYPE, nlmsg_len: %u", nlh2->nlmsg_len);
+ pr_debug("Send TYPE, nlmsg_len: %u\n", nlh2->nlmsg_len);
ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).pid, MSG_DONTWAIT);
if (ret < 0)
return -EFAULT;
ip_set_list = kzalloc(sizeof(struct ip_set *) * ip_set_max,
GFP_KERNEL);
if (!ip_set_list) {
- pr_err("ip_set: Unable to create ip_set_list");
+ pr_err("ip_set: Unable to create ip_set_list\n");
return -ENOMEM;
}
ret = nfnetlink_subsys_register(&ip_set_netlink_subsys);
if (ret != 0) {
- pr_err("ip_set: cannot register with nfnetlink.");
+ pr_err("ip_set: cannot register with nfnetlink.\n");
kfree(ip_set_list);
return ret;
}
ret = nf_register_sockopt(&so_set);
if (ret != 0) {
- pr_err("SO_SET registry failed: %d", ret);
+ pr_err("SO_SET registry failed: %d\n", ret);
nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
kfree(ip_set_list);
return ret;
}
- pr_notice("ip_set: protocol %u", IPSET_PROTOCOL);
+ pr_notice("ip_set: protocol %u\n", IPSET_PROTOCOL);
return 0;
}
nf_unregister_sockopt(&so_set);
nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
kfree(ip_set_list);
- pr_debug("these are the famous last words");
+ pr_debug("these are the famous last words\n");
}
module_init(ip_set_init);
if (!(set->family == AF_INET || set->family == AF_INET6))
return -IPSET_ERR_INVALID_FAMILY;
netmask = set->family == AF_INET ? 32 : 128;
- pr_debug("Create set %s with family %s",
+ pr_debug("Create set %s with family %s\n",
set->name, set->family == AF_INET ? "inet" : "inet6");
if (nla_parse(tb, IPSET_ATTR_CREATE_MAX, head, len,
? &hash_ip4_variant : &hash_ip6_variant;
}
- pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)",
+ pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
set->name, jhash_size(h->table->htable_bits),
h->table->htable_bits, h->maxelem, set->data, h->table);
? &hash_ipport4_variant : &hash_ipport6_variant;
}
- pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)",
+ pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
set->name, jhash_size(h->table->htable_bits),
h->table->htable_bits, h->maxelem, set->data, h->table);
? &hash_ipportip4_variant : &hash_ipportip6_variant;
}
- pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)",
+ pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
set->name, jhash_size(h->table->htable_bits),
h->table->htable_bits, h->maxelem, set->data, h->table);
if (tb[IPSET_ATTR_PROTO]) {
data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
-
+
if (data.proto == 0)
return -IPSET_ERR_INVALID_PROTO;
} else
{
const struct ip_set_hash *x = a->data;
const struct ip_set_hash *y = b->data;
-
+
/* Resizing changes htable_bits, so we ignore it */
return x->maxelem == y->maxelem &&
x->timeout == y->timeout;
hash_ipportnet6_data_tlist(struct sk_buff *skb,
const struct hash_ipportnet6_elem *data)
{
- const struct hash_ipportnet6_telem *e =
+ const struct hash_ipportnet6_telem *e =
(const struct hash_ipportnet6_telem *)data;
-
+
NLA_PUT_IPADDR6(skb, IPSET_ATTR_IP, &e->ip);
NLA_PUT_IPADDR6(skb, IPSET_ATTR_IP2, &data->ip2);
NLA_PUT_NET16(skb, IPSET_ATTR_PORT, data->port);
if (tb[IPSET_ATTR_TIMEOUT]) {
h->timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
-
+
set->variant = set->family == AF_INET
? &hash_ipportnet4_tvariant
: &hash_ipportnet6_tvariant;
set->variant = set->family == AF_INET
? &hash_ipportnet4_variant : &hash_ipportnet6_variant;
}
-
- pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)",
+
+ pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
set->name, jhash_size(h->table->htable_bits),
h->table->htable_bits, h->maxelem, set->data, h->table);
-
+
return 0;
}
? &hash_net4_variant : &hash_net6_variant;
}
- pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)",
+ pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
set->name, jhash_size(h->table->htable_bits),
h->table->htable_bits, h->maxelem, set->data, h->table);
? &hash_netport4_variant : &hash_netport6_variant;
}
- pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)",
+ pr_debug("create %s hashsize %u (%u) maxelem %u: %p(%p)\n",
set->name, jhash_size(h->table->htable_bits),
h->table->htable_bits, h->maxelem, set->data, h->table);
index = ip_set_nfnl_get_byindex(info->match_set.index);
if (index == IPSET_INVALID_ID) {
- pr_warning("Cannot find set indentified by id %u to match",
+ pr_warning("Cannot find set indentified by id %u to match\n",
info->match_set.index);
return CHECK_FAIL; /* error */
}
if (info->match_set.u.flags[IPSET_DIM_MAX-1] != 0) {
- pr_warning("That's nasty!");
+ pr_warning("That's nasty!\n");
return CHECK_FAIL; /* error */
}
if (info->add_set.index != IPSET_INVALID_ID) {
index = ip_set_nfnl_get_byindex(info->add_set.index);
if (index == IPSET_INVALID_ID) {
- pr_warning("cannot find add_set index %u as target",
+ pr_warning("cannot find add_set index %u as target\n",
info->add_set.index);
return CHECK_FAIL; /* error */
}
if (info->del_set.index != IPSET_INVALID_ID) {
index = ip_set_nfnl_get_byindex(info->del_set.index);
if (index == IPSET_INVALID_ID) {
- pr_warning("cannot find del_set index %u as target",
+ pr_warning("cannot find del_set index %u as target\n",
info->del_set.index);
return CHECK_FAIL; /* error */
}
}
if (info->add_set.u.flags[IPSET_DIM_MAX-1] != 0 ||
info->del_set.u.flags[IPSET_DIM_MAX-1] != 0) {
- pr_warning("That's nasty!");
+ pr_warning("That's nasty!\n");
return CHECK_FAIL; /* error */
}
index = ip_set_nfnl_get_byindex(info->match_set.index);
if (index == IPSET_INVALID_ID) {
- pr_warning("Cannot find set indentified by id %u to match",
+ pr_warning("Cannot find set indentified by id %u to match\n",
info->match_set.index);
return CHECK_FAIL; /* error */
}
if (info->match_set.dim > IPSET_DIM_MAX) {
- pr_warning("That's nasty!");
+ pr_warning("That's nasty!\n");
return CHECK_FAIL; /* error */
}
if (info->add_set.index != IPSET_INVALID_ID) {
index = ip_set_nfnl_get_byindex(info->add_set.index);
if (index == IPSET_INVALID_ID) {
- pr_warning("cannot find add_set index %u as target",
+ pr_warning("cannot find add_set index %u as target\n",
info->add_set.index);
return CHECK_FAIL; /* error */
}
if (info->del_set.index != IPSET_INVALID_ID) {
index = ip_set_nfnl_get_byindex(info->del_set.index);
if (index == IPSET_INVALID_ID) {
- pr_warning("cannot find del_set index %u as target",
+ pr_warning("cannot find del_set index %u as target\n",
info->del_set.index);
return CHECK_FAIL; /* error */
}
}
if (info->add_set.dim > IPSET_DIM_MAX ||
info->del_set.flags > IPSET_DIM_MAX) {
- pr_warning("That's nasty!");
+ pr_warning("That's nasty!\n");
return CHECK_FAIL; /* error */
}