Skip to content

Commit e0abdad

Browse files
kaberummakynes
authored andcommitted
netfilter: nf_tables: accept QUEUE/DROP verdict parameters
Allow userspace to specify the queue number or the errno code for QUEUE and DROP verdicts. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 67a8fc2 commit e0abdad

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3174,9 +3174,16 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
31743174
data->verdict = ntohl(nla_get_be32(tb[NFTA_VERDICT_CODE]));
31753175

31763176
switch (data->verdict) {
3177-
case NF_ACCEPT:
3178-
case NF_DROP:
3179-
case NF_QUEUE:
3177+
default:
3178+
switch (data->verdict & NF_VERDICT_MASK) {
3179+
case NF_ACCEPT:
3180+
case NF_DROP:
3181+
case NF_QUEUE:
3182+
break;
3183+
default:
3184+
return -EINVAL;
3185+
}
3186+
/* fall through */
31803187
case NFT_CONTINUE:
31813188
case NFT_BREAK:
31823189
case NFT_RETURN:
@@ -3197,8 +3204,6 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,
31973204
data->chain = chain;
31983205
desc->len = sizeof(data);
31993206
break;
3200-
default:
3201-
return -EINVAL;
32023207
}
32033208

32043209
desc->type = NFT_DATA_VERDICT;

0 commit comments

Comments
 (0)