Skip to content

Commit 7bd2db4

Browse files
Dewi Morgandavem330
authored andcommitted
ipv6: do not drop vrf udp multicast packets
For bound udp sockets in a vrf, also check the sdif to get the index for ingress devices enslaved to an l3mdev. Signed-off-by: Dewi Morgan <[email protected]> Signed-off-by: Mike Manning <[email protected]> Reviewed-by: David Ahern <[email protected]> Tested-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5226b6a commit 7bd2db4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

net/ipv6/udp.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ static int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
637637
static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk,
638638
__be16 loc_port, const struct in6_addr *loc_addr,
639639
__be16 rmt_port, const struct in6_addr *rmt_addr,
640-
int dif, unsigned short hnum)
640+
int dif, int sdif, unsigned short hnum)
641641
{
642642
struct inet_sock *inet = inet_sk(sk);
643643

@@ -649,7 +649,7 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk,
649649
(inet->inet_dport && inet->inet_dport != rmt_port) ||
650650
(!ipv6_addr_any(&sk->sk_v6_daddr) &&
651651
!ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) ||
652-
(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) ||
652+
!udp_sk_bound_dev_eq(net, sk->sk_bound_dev_if, dif, sdif) ||
653653
(!ipv6_addr_any(&sk->sk_v6_rcv_saddr) &&
654654
!ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr)))
655655
return false;
@@ -683,6 +683,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
683683
unsigned int offset = offsetof(typeof(*sk), sk_node);
684684
unsigned int hash2 = 0, hash2_any = 0, use_hash2 = (hslot->count > 10);
685685
int dif = inet6_iif(skb);
686+
int sdif = inet6_sdif(skb);
686687
struct hlist_node *node;
687688
struct sk_buff *nskb;
688689

@@ -697,7 +698,8 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
697698

698699
sk_for_each_entry_offset_rcu(sk, node, &hslot->head, offset) {
699700
if (!__udp_v6_is_mcast_sock(net, sk, uh->dest, daddr,
700-
uh->source, saddr, dif, hnum))
701+
uh->source, saddr, dif, sdif,
702+
hnum))
701703
continue;
702704
/* If zero checksum and no_check is not on for
703705
* the socket then skip it.

0 commit comments

Comments
 (0)