Commit 5913beaf authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nfnetlink: pass down netns pointer to commit() and abort() callbacks

Adapt callsites to avoid recurrent lookup of the netns pointer.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 7b8002a1
...@@ -26,8 +26,8 @@ struct nfnetlink_subsystem { ...@@ -26,8 +26,8 @@ struct nfnetlink_subsystem {
__u8 subsys_id; /* nfnetlink subsystem ID */ __u8 subsys_id; /* nfnetlink subsystem ID */
__u8 cb_count; /* number of callbacks */ __u8 cb_count; /* number of callbacks */
const struct nfnl_callback *cb; /* callback for individual types */ const struct nfnl_callback *cb; /* callback for individual types */
int (*commit)(struct sk_buff *skb); int (*commit)(struct net *net, struct sk_buff *skb);
int (*abort)(struct sk_buff *skb); int (*abort)(struct net *net, struct sk_buff *skb);
}; };
int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
......
...@@ -3865,9 +3865,8 @@ static void nf_tables_commit_release(struct nft_trans *trans) ...@@ -3865,9 +3865,8 @@ static void nf_tables_commit_release(struct nft_trans *trans)
kfree(trans); kfree(trans);
} }
static int nf_tables_commit(struct sk_buff *skb) static int nf_tables_commit(struct net *net, struct sk_buff *skb)
{ {
struct net *net = sock_net(skb->sk);
struct nft_trans *trans, *next; struct nft_trans *trans, *next;
struct nft_trans_elem *te; struct nft_trans_elem *te;
...@@ -4002,9 +4001,8 @@ static void nf_tables_abort_release(struct nft_trans *trans) ...@@ -4002,9 +4001,8 @@ static void nf_tables_abort_release(struct nft_trans *trans)
kfree(trans); kfree(trans);
} }
static int nf_tables_abort(struct sk_buff *skb) static int nf_tables_abort(struct net *net, struct sk_buff *skb)
{ {
struct net *net = sock_net(skb->sk);
struct nft_trans *trans, *next; struct nft_trans *trans, *next;
struct nft_trans_elem *te; struct nft_trans_elem *te;
......
...@@ -425,15 +425,15 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -425,15 +425,15 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
} }
done: done:
if (status & NFNL_BATCH_REPLAY) { if (status & NFNL_BATCH_REPLAY) {
ss->abort(oskb); ss->abort(net, oskb);
nfnl_err_reset(&err_list); nfnl_err_reset(&err_list);
nfnl_unlock(subsys_id); nfnl_unlock(subsys_id);
kfree_skb(skb); kfree_skb(skb);
goto replay; goto replay;
} else if (status == NFNL_BATCH_DONE) { } else if (status == NFNL_BATCH_DONE) {
ss->commit(oskb); ss->commit(net, oskb);
} else { } else {
ss->abort(oskb); ss->abort(net, oskb);
} }
nfnl_err_deliver(&err_list, oskb); nfnl_err_deliver(&err_list, oskb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment