diff mbox series

[nf-next] nfqueue: enable to set skb->priority

Message ID 20220204102143.4010-1-nicolas.dichtel@6wind.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nf-next] nfqueue: enable to set skb->priority | expand

Commit Message

Nicolas Dichtel Feb. 4, 2022, 10:21 a.m. UTC
This is a follow up of the previous patch that enables to get
skb->priority. It's now posssible to set it also.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/netfilter/nfnetlink_queue.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Florian Westphal Feb. 4, 2022, 11:59 a.m. UTC | #1
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> This is a follow up of the previous patch that enables to get
> skb->priority. It's now posssible to set it also.

Seems reasonable.

Acked-by: Florian Westphal <fw@strlen.de>
kernel test robot Feb. 4, 2022, 5:18 p.m. UTC | #2
Hi Nicolas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on nf-next/master]

url:    https://github.com/0day-ci/linux/commits/Nicolas-Dichtel/nfqueue-enable-to-set-skb-priority/20220204-182222
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20220205/202202050128.hIk17NxG-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/6a71b6ea544796cb9976502dfd64361abb745cc5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Nicolas-Dichtel/nfqueue-enable-to-set-skb-priority/20220204-182222
        git checkout 6a71b6ea544796cb9976502dfd64361abb745cc5
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash arch/x86/kvm/ net/netfilter/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> net/netfilter/nfnetlink_queue.c:1017:3: error: 'NFQA_PRIORITY' undeclared here (not in a function); did you mean 'FRA_PRIORITY'?
    1017 |  [NFQA_PRIORITY]  = { .type = NLA_U32 },
         |   ^~~~~~~~~~~~~
         |   FRA_PRIORITY
>> net/netfilter/nfnetlink_queue.c:1017:3: error: array index in initializer not of integer type
   net/netfilter/nfnetlink_queue.c:1017:3: note: (near initialization for 'nfqa_verdict_policy')
   net/netfilter/nfnetlink_queue.c:1023:3: error: array index in initializer not of integer type
    1023 |  [NFQA_PRIORITY]  = { .type = NLA_U32 },
         |   ^~~~~~~~~~~~~
   net/netfilter/nfnetlink_queue.c:1023:3: note: (near initialization for 'nfqa_verdict_batch_policy')


vim +1017 net/netfilter/nfnetlink_queue.c

  1009	
  1010	static const struct nla_policy nfqa_verdict_policy[NFQA_MAX+1] = {
  1011		[NFQA_VERDICT_HDR]	= { .len = sizeof(struct nfqnl_msg_verdict_hdr) },
  1012		[NFQA_MARK]		= { .type = NLA_U32 },
  1013		[NFQA_PAYLOAD]		= { .type = NLA_UNSPEC },
  1014		[NFQA_CT]		= { .type = NLA_UNSPEC },
  1015		[NFQA_EXP]		= { .type = NLA_UNSPEC },
  1016		[NFQA_VLAN]		= { .type = NLA_NESTED },
> 1017		[NFQA_PRIORITY]		= { .type = NLA_U32 },
  1018	};
  1019	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Pablo Neira Ayuso Feb. 9, 2022, 11:04 a.m. UTC | #3
On Fri, Feb 04, 2022 at 11:21:43AM +0100, Nicolas Dichtel wrote:
> This is a follow up of the previous patch that enables to get
> skb->priority. It's now posssible to set it also.

Applied.
diff mbox series

Patch

diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 48d7a59c6482..8c15978d9258 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -1019,11 +1019,13 @@  static const struct nla_policy nfqa_verdict_policy[NFQA_MAX+1] = {
 	[NFQA_CT]		= { .type = NLA_UNSPEC },
 	[NFQA_EXP]		= { .type = NLA_UNSPEC },
 	[NFQA_VLAN]		= { .type = NLA_NESTED },
+	[NFQA_PRIORITY]		= { .type = NLA_U32 },
 };
 
 static const struct nla_policy nfqa_verdict_batch_policy[NFQA_MAX+1] = {
 	[NFQA_VERDICT_HDR]	= { .len = sizeof(struct nfqnl_msg_verdict_hdr) },
 	[NFQA_MARK]		= { .type = NLA_U32 },
+	[NFQA_PRIORITY]		= { .type = NLA_U32 },
 };
 
 static struct nfqnl_instance *
@@ -1104,6 +1106,9 @@  static int nfqnl_recv_verdict_batch(struct sk_buff *skb,
 		if (nfqa[NFQA_MARK])
 			entry->skb->mark = ntohl(nla_get_be32(nfqa[NFQA_MARK]));
 
+		if (nfqa[NFQA_PRIORITY])
+			entry->skb->priority = ntohl(nla_get_be32(nfqa[NFQA_PRIORITY]));
+
 		nfqnl_reinject(entry, verdict);
 	}
 	return 0;
@@ -1230,6 +1235,9 @@  static int nfqnl_recv_verdict(struct sk_buff *skb, const struct nfnl_info *info,
 	if (nfqa[NFQA_MARK])
 		entry->skb->mark = ntohl(nla_get_be32(nfqa[NFQA_MARK]));
 
+	if (nfqa[NFQA_PRIORITY])
+		entry->skb->priority = ntohl(nla_get_be32(nfqa[NFQA_PRIORITY]));
+
 	nfqnl_reinject(entry, verdict);
 	return 0;
 }