Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 135495
b: refs/heads/master
c: f0a3c08
h: refs/heads/master
i:
  135493: bfa1575
  135491: 2ff1562
  135487: d1ecd8f
v: v3
  • Loading branch information
Pablo Neira Ayuso authored and Patrick McHardy committed Mar 16, 2009
1 parent a192c81 commit 29cea48
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 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: e098360f159b3358f085543eb6dc2eb500d6667c
refs/heads/master: f0a3c0869f3b0ef93d9df044e9a41e40086d4c97
41 changes: 23 additions & 18 deletions trunk/net/netfilter/nf_conntrack_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,12 +1128,10 @@ ctnetlink_event_report(struct nf_conn *ct, u32 pid, int report)
report);
}

static int
static struct nf_conn *
ctnetlink_create_conntrack(struct nlattr *cda[],
struct nf_conntrack_tuple *otuple,
struct nf_conntrack_tuple *rtuple,
u32 pid,
int report,
u8 u3)
{
struct nf_conn *ct;
Expand All @@ -1142,7 +1140,7 @@ ctnetlink_create_conntrack(struct nlattr *cda[],

ct = nf_conntrack_alloc(&init_net, otuple, rtuple, GFP_ATOMIC);
if (IS_ERR(ct))
return -ENOMEM;
return ERR_PTR(-ENOMEM);

if (!cda[CTA_TIMEOUT])
goto err;
Expand Down Expand Up @@ -1265,18 +1263,14 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
ct->master = master_ct;
}

nf_conntrack_get(&ct->ct_general);
add_timer(&ct->timeout);
nf_conntrack_hash_insert(ct);
rcu_read_unlock();
ctnetlink_event_report(ct, pid, report);
nf_ct_put(ct);

return 0;

return ct;
err:
nf_conntrack_free(ct);
return err;
return ERR_PTR(err);
}

static int
Expand Down Expand Up @@ -1309,14 +1303,25 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,

if (h == NULL) {
err = -ENOENT;
if (nlh->nlmsg_flags & NLM_F_CREATE)
err = ctnetlink_create_conntrack(cda,
&otuple,
&rtuple,
NETLINK_CB(skb).pid,
nlmsg_report(nlh),
u3);
spin_unlock_bh(&nf_conntrack_lock);
if (nlh->nlmsg_flags & NLM_F_CREATE) {
struct nf_conn *ct;

ct = ctnetlink_create_conntrack(cda, &otuple,
&rtuple, u3);
if (IS_ERR(ct)) {
err = PTR_ERR(ct);
goto out_unlock;
}
err = 0;
nf_conntrack_get(&ct->ct_general);
spin_unlock_bh(&nf_conntrack_lock);
ctnetlink_event_report(ct,
NETLINK_CB(skb).pid,
nlmsg_report(nlh));
nf_ct_put(ct);
} else
spin_unlock_bh(&nf_conntrack_lock);

return err;
}
/* implicit 'else' */
Expand Down

0 comments on commit 29cea48

Please sign in to comment.