Revision 8d2b51b008c25240914984208b2ced57d1dd25a5 authored by Guillaume Nault on 16 January 2021, 10:44:22 UTC, committed by Jakub Kicinski on 19 January 2021, 21:54:30 UTC
udp_v4_early_demux() is the only function that calls ip_mc_validate_source() with a TOS that hasn't been masked with IPTOS_RT_MASK. This results in different behaviours for incoming multicast UDPv4 packets, depending on if ip_mc_validate_source() is called from the early-demux path (udp_v4_early_demux) or from the regular input path (ip_route_input_noref). ECN would normally not be used with UDP multicast packets, so the practical consequences should be limited on that side. However, IPTOS_RT_MASK is used to also masks the TOS' high order bits, to align with the non-early-demux path behaviour. Reproducer: Setup two netns, connected with veth: $ ip netns add ns0 $ ip netns add ns1 $ ip -netns ns0 link set dev lo up $ ip -netns ns1 link set dev lo up $ ip link add name veth01 netns ns0 type veth peer name veth10 netns ns1 $ ip -netns ns0 link set dev veth01 up $ ip -netns ns1 link set dev veth10 up $ ip -netns ns0 address add 192.0.2.10 peer 192.0.2.11/32 dev veth01 $ ip -netns ns1 address add 192.0.2.11 peer 192.0.2.10/32 dev veth10 In ns0, add route to multicast address 224.0.2.0/24 using source address 198.51.100.10: $ ip -netns ns0 address add 198.51.100.10/32 dev lo $ ip -netns ns0 route add 224.0.2.0/24 dev veth01 src 198.51.100.10 In ns1, define route to 198.51.100.10, only for packets with TOS 4: $ ip -netns ns1 route add 198.51.100.10/32 tos 4 dev veth10 Also activate rp_filter in ns1, so that incoming packets not matching the above route get dropped: $ ip netns exec ns1 sysctl -wq net.ipv4.conf.veth10.rp_filter=1 Now try to receive packets on 224.0.2.11: $ ip netns exec ns1 socat UDP-RECVFROM:1111,ip-add-membership=224.0.2.11:veth10,ignoreeof - In ns0, send packet to 224.0.2.11 with TOS 4 and ECT(0) (that is, tos 6 for socat): $ echo test0 | ip netns exec ns0 socat - UDP-DATAGRAM:224.0.2.11:1111,bind=:1111,tos=6 The "test0" message is properly received by socat in ns1, because early-demux has no cached dst to use, so source address validation is done by ip_route_input_mc(), which receives a TOS that has the ECN bits masked. Now send another packet to 224.0.2.11, still with TOS 4 and ECT(0): $ echo test1 | ip netns exec ns0 socat - UDP-DATAGRAM:224.0.2.11:1111,bind=:1111,tos=6 The "test1" message isn't received by socat in ns1, because, now, early-demux has a cached dst to use and calls ip_mc_validate_source() immediately, without masking the ECN bits. Fixes: bc044e8db796 ("udp: perform source validation for mcast early demux") Signed-off-by: Guillaume Nault <gnault@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f7b9820
File | Mode | Size |
---|---|---|
ib.h | -rw-r--r-- | 2.1 KB |
ib_addr.h | -rw-r--r-- | 7.7 KB |
ib_cache.h | -rw-r--r-- | 4.2 KB |
ib_cm.h | -rw-r--r-- | 16.9 KB |
ib_hdrs.h | -rw-r--r-- | 6.9 KB |
ib_mad.h | -rw-r--r-- | 24.6 KB |
ib_marshall.h | -rw-r--r-- | 778 bytes |
ib_pack.h | -rw-r--r-- | 7.7 KB |
ib_pma.h | -rw-r--r-- | 4.2 KB |
ib_sa.h | -rw-r--r-- | 20.2 KB |
ib_smi.h | -rw-r--r-- | 4.2 KB |
ib_umem.h | -rw-r--r-- | 4.3 KB |
ib_umem_odp.h | -rw-r--r-- | 3.4 KB |
ib_verbs.h | -rw-r--r-- | 136.5 KB |
iba.h | -rw-r--r-- | 5.5 KB |
ibta_vol1_c12.h | -rw-r--r-- | 12.9 KB |
iw_cm.h | -rw-r--r-- | 7.1 KB |
iw_portmap.h | -rw-r--r-- | 2.2 KB |
lag.h | -rw-r--r-- | 530 bytes |
mr_pool.h | -rw-r--r-- | 568 bytes |
opa_addr.h | -rw-r--r-- | 2.4 KB |
opa_port_info.h | -rw-r--r-- | 13.4 KB |
opa_smi.h | -rw-r--r-- | 3.0 KB |
opa_vnic.h | -rw-r--r-- | 2.0 KB |
rdma_cm.h | -rw-r--r-- | 12.7 KB |
rdma_cm_ib.h | -rw-r--r-- | 797 bytes |
rdma_counter.h | -rw-r--r-- | 1.7 KB |
rdma_netlink.h | -rw-r--r-- | 4.0 KB |
rdma_vt.h | -rw-r--r-- | 14.2 KB |
rdmavt_cq.h | -rw-r--r-- | 1.7 KB |
rdmavt_mr.h | -rw-r--r-- | 3.9 KB |
rdmavt_qp.h | -rw-r--r-- | 28.0 KB |
restrack.h | -rw-r--r-- | 4.1 KB |
rw.h | -rw-r--r-- | 2.2 KB |
signature.h | -rw-r--r-- | 2.9 KB |
tid_rdma_defs.h | -rw-r--r-- | 2.1 KB |
uverbs_ioctl.h | -rw-r--r-- | 29.9 KB |
uverbs_named_ioctl.h | -rw-r--r-- | 4.7 KB |
uverbs_std_types.h | -rw-r--r-- | 5.2 KB |
uverbs_types.h | -rw-r--r-- | 6.1 KB |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...