Skip to content

Commit d753a05

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf
Pablo Neira Ayuso says: ==================== Netfilter fixes for net 1) Missing flowi uid field in nft_fib expression, from Guillaume Nault. This is broken since the creation of the fib expression. 2) Relax sanity check to fix bogus EINVAL error when deleting elements belonging set intervals. Broken since 6.0-rc. * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf: netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements netfilter: rpfilter/fib: Set ->flowic_uid correctly for user namespaces. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents a1a824f + 96df836 commit d753a05

File tree

5 files changed

+8
-2
lines changed

5 files changed

+8
-2
lines changed

net/ipv4/netfilter/ipt_rpfilter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par)
7878
flow.flowi4_tos = iph->tos & IPTOS_RT_MASK;
7979
flow.flowi4_scope = RT_SCOPE_UNIVERSE;
8080
flow.flowi4_l3mdev = l3mdev_master_ifindex_rcu(xt_in(par));
81+
flow.flowi4_uid = sock_net_uid(xt_net(par), NULL);
8182

8283
return rpfilter_lookup_reverse(xt_net(par), &flow, xt_in(par), info->flags) ^ invert;
8384
}

net/ipv4/netfilter/nft_fib_ipv4.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
6565
struct flowi4 fl4 = {
6666
.flowi4_scope = RT_SCOPE_UNIVERSE,
6767
.flowi4_iif = LOOPBACK_IFINDEX,
68+
.flowi4_uid = sock_net_uid(nft_net(pkt), NULL),
6869
};
6970
const struct net_device *oif;
7071
const struct net_device *found;

net/ipv6/netfilter/ip6t_rpfilter.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,
4040
.flowi6_l3mdev = l3mdev_master_ifindex_rcu(dev),
4141
.flowlabel = (* (__be32 *) iph) & IPV6_FLOWINFO_MASK,
4242
.flowi6_proto = iph->nexthdr,
43+
.flowi6_uid = sock_net_uid(net, NULL),
4344
.daddr = iph->saddr,
4445
};
4546
int lookup_flags;

net/ipv6/netfilter/nft_fib_ipv6.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static u32 __nft_fib6_eval_type(const struct nft_fib *priv,
6666
struct flowi6 fl6 = {
6767
.flowi6_iif = LOOPBACK_IFINDEX,
6868
.flowi6_proto = pkt->tprot,
69+
.flowi6_uid = sock_net_uid(nft_net(pkt), NULL),
6970
};
7071
u32 ret = 0;
7172

@@ -163,6 +164,7 @@ void nft_fib6_eval(const struct nft_expr *expr, struct nft_regs *regs,
163164
struct flowi6 fl6 = {
164165
.flowi6_iif = LOOPBACK_IFINDEX,
165166
.flowi6_proto = pkt->tprot,
167+
.flowi6_uid = sock_net_uid(nft_net(pkt), NULL),
166168
};
167169
struct rt6_info *rt;
168170
int lookup_flags;

net/netfilter/nf_tables_api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5865,8 +5865,9 @@ static bool nft_setelem_valid_key_end(const struct nft_set *set,
58655865
(NFT_SET_CONCAT | NFT_SET_INTERVAL)) {
58665866
if (flags & NFT_SET_ELEM_INTERVAL_END)
58675867
return false;
5868-
if (!nla[NFTA_SET_ELEM_KEY_END] &&
5869-
!(flags & NFT_SET_ELEM_CATCHALL))
5868+
5869+
if (nla[NFTA_SET_ELEM_KEY_END] &&
5870+
flags & NFT_SET_ELEM_CATCHALL)
58705871
return false;
58715872
} else {
58725873
if (nla[NFTA_SET_ELEM_KEY_END])

0 commit comments

Comments
 (0)