Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: xt_set: Check hook mask correctly

Inserting rule before one with SET target we get error with warning in
dmesg(1) output:

# iptables -A FORWARD -t mangle -j SET --map-set test src --map-prio
# iptables -I FORWARD 1 -t mangle -j ACCEPT
iptables: Invalid argument. Run `dmesg' for more information.
# dmesg |tail -n1
[268578.026643] mapping of prio or/and queue is allowed only from \
OUTPUT/FORWARD/POSTROUTING chains

Rather than checking for supported hook bits for SET target check for
unsupported one as done in all rest of matches and targets.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

authored by

Serhey Popovych and committed by
Jozsef Kadlecsik
9dcceb13 6fcc02e3

+1 -1
+1 -1
net/netfilter/xt_set.c
··· 470 470 } 471 471 if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) | 472 472 (info->flags & IPSET_FLAG_MAP_SKBQUEUE)) && 473 - !(par->hook_mask & (1 << NF_INET_FORWARD | 473 + (par->hook_mask & ~(1 << NF_INET_FORWARD | 474 474 1 << NF_INET_LOCAL_OUT | 475 475 1 << NF_INET_POST_ROUTING))) { 476 476 pr_info_ratelimited("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n");