Commit 7dab8ee3 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso
Browse files

netfilter: nfnetlink: pass struct nfnl_info to batch callbacks



Update batch callbacks to use the nfnl_info structure. Rename one
clashing info variable to expr_info.

Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 797d4980
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -19,10 +19,8 @@ struct nfnl_callback {
		    const struct nlattr * const cda[]);
	int (*call_rcu)(struct sk_buff *skb, const struct nfnl_info *info,
			const struct nlattr * const cda[]);
	int (*call_batch)(struct net *net, struct sock *nl, struct sk_buff *skb,
			  const struct nlmsghdr *nlh,
			  const struct nlattr * const cda[],
			  struct netlink_ext_ack *extack);
	int (*call_batch)(struct sk_buff *skb, const struct nfnl_info *info,
			  const struct nlattr * const cda[]);
	const struct nla_policy *policy;	/* netlink attribute policy */
	const u_int16_t attr_count;		/* number of nlattr's */
};
+171 −167

File changed.

Preview size limit exceeded, changes collapsed.

+9 −5
Original line number Diff line number Diff line
@@ -469,10 +469,17 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,

		{
			int min_len = nlmsg_total_size(sizeof(struct nfgenmsg));
			struct nfnl_net *nfnlnet = nfnl_pernet(net);
			u8 cb_id = NFNL_MSG_TYPE(nlh->nlmsg_type);
			struct nlattr *cda[NFNL_MAX_ATTR_COUNT + 1];
			struct nlattr *attr = (void *)nlh + min_len;
			int attrlen = nlh->nlmsg_len - min_len;
			struct nfnl_info info = {
				.net	= net,
				.sk	= nfnlnet->nfnl,
				.nlh	= nlh,
				.extack	= &extack,
			};

			/* Sanity-check NFTA_MAX_ATTR */
			if (ss->cb[cb_id].attr_count > NFNL_MAX_ATTR_COUNT) {
@@ -488,11 +495,8 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
				goto ack;

			if (nc->call_batch) {
				struct nfnl_net *nfnlnet = nfnl_pernet(net);

				err = nc->call_batch(net, nfnlnet->nfnl, skb, nlh,
						     (const struct nlattr **)cda,
						     &extack);
				err = nc->call_batch(skb, &info,
						     (const struct nlattr **)cda);
			}

			/* The lock was released to autoload some module, we