aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Wegener <sven.wegener@stealer.net>2014-05-29 16:27:06 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-05 19:23:08 -0400
commit9e89fd8b7db71038fd9f70f34e210963fa8fc980 (patch)
tree0fc40f6dc1653595f1dfcd56c78528e74779491a
parentf666f87b9423fb534d2116206ace04495080f2b5 (diff)
ipv6: Shrink udp_v6_mcast_next() to one socket variable
To avoid the confusion of having two variables, shrink the function to only use the parameter variable for looping. Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Sven Wegener <sven.wegener@stealer.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv6/udp.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 4180f54a948e..95c834799288 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -705,35 +705,34 @@ static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk,
705 int dif) 705 int dif)
706{ 706{
707 struct hlist_nulls_node *node; 707 struct hlist_nulls_node *node;
708 struct sock *s = sk;
709 unsigned short num = ntohs(loc_port); 708 unsigned short num = ntohs(loc_port);
710 709
711 sk_nulls_for_each_from(s, node) { 710 sk_nulls_for_each_from(sk, node) {
712 struct inet_sock *inet = inet_sk(s); 711 struct inet_sock *inet = inet_sk(sk);
713 712
714 if (!net_eq(sock_net(s), net)) 713 if (!net_eq(sock_net(sk), net))
715 continue; 714 continue;
716 715
717 if (udp_sk(s)->udp_port_hash == num && 716 if (udp_sk(sk)->udp_port_hash == num &&
718 s->sk_family == PF_INET6) { 717 sk->sk_family == PF_INET6) {
719 if (inet->inet_dport) { 718 if (inet->inet_dport) {
720 if (inet->inet_dport != rmt_port) 719 if (inet->inet_dport != rmt_port)
721 continue; 720 continue;
722 } 721 }
723 if (!ipv6_addr_any(&s->sk_v6_daddr) && 722 if (!ipv6_addr_any(&sk->sk_v6_daddr) &&
724 !ipv6_addr_equal(&s->sk_v6_daddr, rmt_addr)) 723 !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr))
725 continue; 724 continue;
726 725
727 if (s->sk_bound_dev_if && s->sk_bound_dev_if != dif) 726 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)
728 continue; 727 continue;
729 728
730 if (!ipv6_addr_any(&s->sk_v6_rcv_saddr)) { 729 if (!ipv6_addr_any(&sk->sk_v6_rcv_saddr)) {
731 if (!ipv6_addr_equal(&s->sk_v6_rcv_saddr, loc_addr)) 730 if (!ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr))
732 continue; 731 continue;
733 } 732 }
734 if (!inet6_mc_check(s, loc_addr, rmt_addr)) 733 if (!inet6_mc_check(sk, loc_addr, rmt_addr))
735 continue; 734 continue;
736 return s; 735 return sk;
737 } 736 }
738 } 737 }
739 return NULL; 738 return NULL;