Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43152
b: refs/heads/master
c: 94b9bb5
h: refs/heads/master
v: v3
  • Loading branch information
Jamal Hadi Salim authored and David S. Miller committed Dec 7, 2006
1 parent 5c107d2 commit 1aaae00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: baf5d743d1b8783fdbd5c1260ada2926e5bbaaee
refs/heads/master: 94b9bb5480e73cec4552b19fc3f809742b4ebf67
24 changes: 11 additions & 13 deletions trunk/net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,32 +1099,30 @@ int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*),
void *data)
{
int i;
struct xfrm_state *x;
struct xfrm_state *x, *last = NULL;
struct hlist_node *entry;
int count = 0;
int err = 0;

spin_lock_bh(&xfrm_state_lock);
for (i = 0; i <= xfrm_state_hmask; i++) {
hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
if (xfrm_id_proto_match(x->id.proto, proto))
count++;
if (!xfrm_id_proto_match(x->id.proto, proto))
continue;
if (last) {
err = func(last, count, data);
if (err)
goto out;
}
last = x;
count++;
}
}
if (count == 0) {
err = -ENOENT;
goto out;
}

for (i = 0; i <= xfrm_state_hmask; i++) {
hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
if (!xfrm_id_proto_match(x->id.proto, proto))
continue;
err = func(x, --count, data);
if (err)
goto out;
}
}
err = func(last, 0, data);
out:
spin_unlock_bh(&xfrm_state_lock);
return err;
Expand Down

0 comments on commit 1aaae00

Please sign in to comment.