Skip to content

Commit 9a2f97b

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf
Pablo Neira Ayuso says: ==================== Netfilter fixes for net The following patchset contains Netfilter fixes for net: 1) Fix a deadlock when module is requested via netlink_bind() in nfnetlink, from Florian Westphal. 2) Fix ipt_rpfilter and ip6t_rpfilter with VRF, from Miaohe Lin. 3) Skip master comparison in SIP helper to fix expectation clash under two valid scenarios, from xiao ruizhu. 4) Remove obsolete comments in nf_conntrack codebase, from Yonatan Goldschmidt. 5) Fix redirect extension module autoload, from Christian Hesse. 6) Fix incorrect mssg option sent to client in synproxy, from Fernando Fernandez. 7) Fix incorrect window calculations in TCP conntrack, from Florian Westphal. 8) Don't bail out when updating basechain policy due to recent offload works, also from Florian. 9) Allow symhash to use modulus 1 as other hash extensions do, from Laura.Garcia. 10) Missing NAT chain module autoload for the inet family, from Phil Sutter. 11) Fix missing adjustment of TCP RST packet in synproxy, from Fernando Fernandez. 12) Skip EAGAIN path when nft_meta_bridge is built-in or not selected. 13) Conntrack bridge does not depend on nf_tables_bridge. 14) Turn NF_TABLES_BRIDGE into tristate to fix possible link break of nft_meta_bridge, from Arnd Bergmann. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 31cc088 + dfee0e9 commit 9a2f97b

44 files changed

Lines changed: 117 additions & 82 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎include/linux/netfilter/nf_conntrack_h323_asn1.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22
/****************************************************************************
3-
* ip_conntrack_h323_asn1.h - BER and PER decoding library for H.323
4-
* conntrack/NAT module.
3+
* BER and PER decoding library for H.323 conntrack/NAT module.
54
*
65
* Copyright (c) 2006 by Jing Min Zhao <zhaojingmin@users.sourceforge.net>
76
*

‎include/net/netfilter/nf_conntrack_expect.h‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ struct nf_conntrack_expect_policy {
7676
#define NF_CT_EXPECT_CLASS_DEFAULT 0
7777
#define NF_CT_EXPECT_MAX_CNT 255
7878

79+
/* Allow to reuse expectations with the same tuples from different master
80+
* conntracks.
81+
*/
82+
#define NF_CT_EXP_F_SKIP_MASTER 0x1
83+
7984
int nf_conntrack_expect_pernet_init(struct net *net);
8085
void nf_conntrack_expect_pernet_fini(struct net *net);
8186

@@ -122,10 +127,11 @@ void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, u_int8_t,
122127
u_int8_t, const __be16 *, const __be16 *);
123128
void nf_ct_expect_put(struct nf_conntrack_expect *exp);
124129
int nf_ct_expect_related_report(struct nf_conntrack_expect *expect,
125-
u32 portid, int report);
126-
static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect)
130+
u32 portid, int report, unsigned int flags);
131+
static inline int nf_ct_expect_related(struct nf_conntrack_expect *expect,
132+
unsigned int flags)
127133
{
128-
return nf_ct_expect_related_report(expect, 0, 0);
134+
return nf_ct_expect_related_report(expect, 0, 0, flags);
129135
}
130136

131137
#endif /*_NF_CONNTRACK_EXPECT_H*/

‎include/net/netfilter/nf_conntrack_synproxy.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct synproxy_options {
6868
u8 options;
6969
u8 wscale;
7070
u16 mss;
71+
u16 mss_encode;
7172
u32 tsval;
7273
u32 tsecr;
7374
};

‎net/bridge/netfilter/Kconfig‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
menuconfig NF_TABLES_BRIDGE
77
depends on BRIDGE && NETFILTER && NF_TABLES
88
select NETFILTER_FAMILY_BRIDGE
9-
bool "Ethernet Bridge nf_tables support"
9+
tristate "Ethernet Bridge nf_tables support"
1010

1111
if NF_TABLES_BRIDGE
1212

@@ -25,6 +25,8 @@ config NF_LOG_BRIDGE
2525
tristate "Bridge packet logging"
2626
select NF_LOG_COMMON
2727

28+
endif # NF_TABLES_BRIDGE
29+
2830
config NF_CONNTRACK_BRIDGE
2931
tristate "IPv4/IPV6 bridge connection tracking support"
3032
depends on NF_CONNTRACK
@@ -39,8 +41,6 @@ config NF_CONNTRACK_BRIDGE
3941

4042
To compile it as a module, choose M here. If unsure, say N.
4143

42-
endif # NF_TABLES_BRIDGE
43-
4444
menuconfig BRIDGE_NF_EBTABLES
4545
tristate "Ethernet Bridge tables (ebtables) support"
4646
depends on BRIDGE && NETFILTER && NETFILTER_XTABLES

‎net/ipv4/netfilter/ipt_CLUSTERIP.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ clusterip_tg(struct sk_buff *skb, const struct xt_action_param *par)
416416
ctinfo == IP_CT_RELATED_REPLY))
417417
return XT_CONTINUE;
418418

419-
/* ip_conntrack_icmp guarantees us that we only have ICMP_ECHO,
420-
* TIMESTAMP, INFO_REQUEST or ADDRESS type icmp packets from here
419+
/* nf_conntrack_proto_icmp guarantees us that we only have ICMP_ECHO,
420+
* TIMESTAMP, INFO_REQUEST or ICMP_ADDRESS type icmp packets from here
421421
* on, which all have an ID field [relevant for hashing]. */
422422

423423
hash = clusterip_hashfn(skb, cipinfo->config);

‎net/ipv4/netfilter/ipt_SYNPROXY.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ synproxy_tg4(struct sk_buff *skb, const struct xt_action_param *par)
3636
opts.options |= XT_SYNPROXY_OPT_ECN;
3737

3838
opts.options &= info->options;
39+
opts.mss_encode = opts.mss;
40+
opts.mss = info->mss;
3941
if (opts.options & XT_SYNPROXY_OPT_TIMESTAMP)
4042
synproxy_init_timestamp_cookie(info, &opts);
4143
else

‎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_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0;
7979
flow.flowi4_tos = RT_TOS(iph->tos);
8080
flow.flowi4_scope = RT_SCOPE_UNIVERSE;
81+
flow.flowi4_oif = l3mdev_master_ifindex_rcu(xt_in(par));
8182

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

‎net/ipv4/netfilter/nf_nat_h323.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,11 @@ static int nat_rtp_rtcp(struct sk_buff *skb, struct nf_conn *ct,
221221
int ret;
222222

223223
rtp_exp->tuple.dst.u.udp.port = htons(nated_port);
224-
ret = nf_ct_expect_related(rtp_exp);
224+
ret = nf_ct_expect_related(rtp_exp, 0);
225225
if (ret == 0) {
226226
rtcp_exp->tuple.dst.u.udp.port =
227227
htons(nated_port + 1);
228-
ret = nf_ct_expect_related(rtcp_exp);
228+
ret = nf_ct_expect_related(rtcp_exp, 0);
229229
if (ret == 0)
230230
break;
231231
else if (ret == -EBUSY) {
@@ -296,7 +296,7 @@ static int nat_t120(struct sk_buff *skb, struct nf_conn *ct,
296296
int ret;
297297

298298
exp->tuple.dst.u.tcp.port = htons(nated_port);
299-
ret = nf_ct_expect_related(exp);
299+
ret = nf_ct_expect_related(exp, 0);
300300
if (ret == 0)
301301
break;
302302
else if (ret != -EBUSY) {
@@ -352,7 +352,7 @@ static int nat_h245(struct sk_buff *skb, struct nf_conn *ct,
352352
int ret;
353353

354354
exp->tuple.dst.u.tcp.port = htons(nated_port);
355-
ret = nf_ct_expect_related(exp);
355+
ret = nf_ct_expect_related(exp, 0);
356356
if (ret == 0)
357357
break;
358358
else if (ret != -EBUSY) {
@@ -444,7 +444,7 @@ static int nat_q931(struct sk_buff *skb, struct nf_conn *ct,
444444
int ret;
445445

446446
exp->tuple.dst.u.tcp.port = htons(nated_port);
447-
ret = nf_ct_expect_related(exp);
447+
ret = nf_ct_expect_related(exp, 0);
448448
if (ret == 0)
449449
break;
450450
else if (ret != -EBUSY) {
@@ -537,7 +537,7 @@ static int nat_callforwarding(struct sk_buff *skb, struct nf_conn *ct,
537537
int ret;
538538

539539
exp->tuple.dst.u.tcp.port = htons(nated_port);
540-
ret = nf_ct_expect_related(exp);
540+
ret = nf_ct_expect_related(exp, 0);
541541
if (ret == 0)
542542
break;
543543
else if (ret != -EBUSY) {

‎net/ipv6/netfilter/ip6t_SYNPROXY.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ synproxy_tg6(struct sk_buff *skb, const struct xt_action_param *par)
3636
opts.options |= XT_SYNPROXY_OPT_ECN;
3737

3838
opts.options &= info->options;
39+
opts.mss_encode = opts.mss;
40+
opts.mss = info->mss;
3941
if (opts.options & XT_SYNPROXY_OPT_TIMESTAMP)
4042
synproxy_init_timestamp_cookie(info, &opts);
4143
else

‎net/ipv6/netfilter/ip6t_rpfilter.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,
5555
if (rpfilter_addr_linklocal(&iph->saddr)) {
5656
lookup_flags |= RT6_LOOKUP_F_IFACE;
5757
fl6.flowi6_oif = dev->ifindex;
58-
} else if ((flags & XT_RPFILTER_LOOSE) == 0)
58+
/* Set flowi6_oif for vrf devices to lookup route in l3mdev domain. */
59+
} else if (netif_is_l3_master(dev) || netif_is_l3_slave(dev) ||
60+
(flags & XT_RPFILTER_LOOSE) == 0)
5961
fl6.flowi6_oif = dev->ifindex;
6062

6163
rt = (void *)ip6_route_lookup(net, &fl6, skb, lookup_flags);
@@ -70,7 +72,9 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,
7072
goto out;
7173
}
7274

73-
if (rt->rt6i_idev->dev == dev || (flags & XT_RPFILTER_LOOSE))
75+
if (rt->rt6i_idev->dev == dev ||
76+
l3mdev_master_ifindex_rcu(rt->rt6i_idev->dev) == dev->ifindex ||
77+
(flags & XT_RPFILTER_LOOSE))
7478
ret = true;
7579
out:
7680
ip6_rt_put(rt);

0 commit comments

Comments
 (0)