Skip to content

Commit

Permalink
netfilter: xt_connlimit: use rb_entry()
Browse files Browse the repository at this point in the history
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Geliang Tang authored and Pablo Neira Ayuso committed Jan 5, 2017
1 parent cf6e007 commit 4cc4b72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/xt_connlimit.c
Original file line number Diff line number Diff line change
@@ -218,7 +218,7 @@ count_tree(struct net *net, struct rb_root *root,
int diff;
bool addit;

rbconn = container_of(*rbnode, struct xt_connlimit_rb, node);
rbconn = rb_entry(*rbnode, struct xt_connlimit_rb, node);

parent = *rbnode;
diff = same_source_net(addr, mask, &rbconn->addr, family);
@@ -398,7 +398,7 @@ static void destroy_tree(struct rb_root *r)
struct rb_node *node;

while ((node = rb_first(r)) != NULL) {
rbconn = container_of(node, struct xt_connlimit_rb, node);
rbconn = rb_entry(node, struct xt_connlimit_rb, node);

rb_erase(node, r);

0 comments on commit 4cc4b72

Please sign in to comment.