Skip to content

Commit

Permalink
nfqueue: enable to set skb->priority
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Florian Westphal <[email protected]>
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
  • Loading branch information
NicolasDichtel authored and ummakynes committed Feb 9, 2022
1 parent 23f68d4 commit 98eee88
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/netfilter/nfnetlink_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 98eee88

Please sign in to comment.