]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jun 2019 01:34:03 +0000 (18:34 -0700)
commit4728667858778522fb8c47586f8375271ea3ee43
tree5b4f7bb5ed725c4a8d40304e96d732a98f5b3ab5
parent73b542ac98cc75fb73e61ee0818ce4da3a1db313
udp: only choose unbound UDP socket for multicast when not in a VRF

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: 4810a2cd76ff ("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>
net/ipv4/udp.c