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 <nicolas.dichtel@6wind.com>
  • Loading branch information
NicolasDichtel authored and intel-lab-lkp committed Feb 4, 2022
1 parent e7d7863 commit 6a71b6e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/netfilter/nfnetlink_queue.c
Expand Up @@ -1014,11 +1014,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 @@ -1099,6 +1101,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 @@ -1225,6 +1230,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 6a71b6e

Please sign in to comment.