diff options
author | Florian Westphal <fw@strlen.de> | 2023-06-27 14:38:11 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-06-29 12:10:37 +0200 |
commit | b4ee93380b3c891fea996af8d1d3ca0e36ad31f0 (patch) | |
tree | 3147f0f3fe1f49a02b3debb3bef517babeb2adf2 /net/compat.c | |
parent | 6feb37b3b06e9049e20dcf7e23998f92c9c5be9a (diff) | |
download | lwn-b4ee93380b3c891fea996af8d1d3ca0e36ad31f0.tar.gz lwn-b4ee93380b3c891fea996af8d1d3ca0e36ad31f0.zip |
net/sched: act_ipt: add sanity checks on table name and hook locations
Looks like "tc" hard-codes "mangle" as the only supported table
name, but on kernel side there are no checks.
This is wrong. Not all xtables targets are safe to call from tc.
E.g. "nat" targets assume skb has a conntrack object assigned to it.
Normally those get called from netfilter nat core which consults the
nat table to obtain the address mapping.
"tc" userspace either sets PRE or POSTROUTING as hook number, but there
is no validation of this on kernel side, so update netlink policy to
reject bogus numbers. Some targets may assume skb_dst is set for
input/forward hooks, so prevent those from being used.
act_ipt uses the hook number in two places:
1. the state hook number, this is fine as-is
2. to set par.hook_mask
The latter is a bit mask, so update the assignment to make
xt_check_target() to the right thing.
Followup patch adds required checks for the skb/packet headers before
calling the targets evaluation function.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/compat.c')
0 files changed, 0 insertions, 0 deletions