]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
udp: only choose unbound UDP socket for multicast when not in a VRF
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 4 Jun 2019 01:56:23 +0000 (13:56 +1200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:19:12 +0000 (12:19 +0200)
commit43ec962ddfc40070a0a9c3bbc8850bcad9bc1e19
tree8441c7d1ad665f09d38cfd98684eaaf1a702129c
parent7c3234ec92590d2768d99a0075c240301dec4b3e
udp: only choose unbound UDP socket for multicast when not in a VRF

[ Upstream commit 82ba25c6de200d7a9e9c970c998cdd6dfa8637ae ]

By default, packets received in another VRF should not be passed to an
unbound socket in the default VRF. This patch updates the IPv4 UDP
multicast logic to match the unicast VRF logic (in compute_score()),
as well as the IPv6 mcast logic (in __udp_v6_is_mcast_sock()).

The particular case I noticed was DHCP discover packets going
to the 255.255.255.255 address, which are handled by
__udp4_lib_mcast_deliver(). The previous code meant that running
multiple different DHCP server or relay agent instances across VRFs
did not work correctly - any server/relay agent in the default VRF
received DHCP discover packets for all other VRFs.

Fixes: 6da5b0f027a8 ("net: ensure unbound datagram socket to be chosen when not in a VRF")
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv4/udp.c