diff options
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 69b146843a20..6001948600f3 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -405,9 +405,8 @@ static struct sock *udp_v6_mcast_next(struct sock *sk, | |||
405 | continue; | 405 | continue; |
406 | 406 | ||
407 | if (!ipv6_addr_any(&np->rcv_saddr)) { | 407 | if (!ipv6_addr_any(&np->rcv_saddr)) { |
408 | if (ipv6_addr_equal(&np->rcv_saddr, loc_addr)) | 408 | if (!ipv6_addr_equal(&np->rcv_saddr, loc_addr)) |
409 | return s; | 409 | continue; |
410 | continue; | ||
411 | } | 410 | } |
412 | if(!inet6_mc_check(s, loc_addr, rmt_addr)) | 411 | if(!inet6_mc_check(s, loc_addr, rmt_addr)) |
413 | continue; | 412 | continue; |
@@ -640,6 +639,7 @@ static int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
640 | int tclass = -1; | 639 | int tclass = -1; |
641 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; | 640 | int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; |
642 | int err; | 641 | int err; |
642 | int connected = 0; | ||
643 | 643 | ||
644 | /* destination address check */ | 644 | /* destination address check */ |
645 | if (sin6) { | 645 | if (sin6) { |
@@ -749,6 +749,7 @@ do_udp_sendmsg: | |||
749 | fl->fl_ip_dport = inet->dport; | 749 | fl->fl_ip_dport = inet->dport; |
750 | daddr = &np->daddr; | 750 | daddr = &np->daddr; |
751 | fl->fl6_flowlabel = np->flow_label; | 751 | fl->fl6_flowlabel = np->flow_label; |
752 | connected = 1; | ||
752 | } | 753 | } |
753 | 754 | ||
754 | if (!fl->oif) | 755 | if (!fl->oif) |
@@ -771,6 +772,7 @@ do_udp_sendmsg: | |||
771 | } | 772 | } |
772 | if (!(opt->opt_nflen|opt->opt_flen)) | 773 | if (!(opt->opt_nflen|opt->opt_flen)) |
773 | opt = NULL; | 774 | opt = NULL; |
775 | connected = 0; | ||
774 | } | 776 | } |
775 | if (opt == NULL) | 777 | if (opt == NULL) |
776 | opt = np->opt; | 778 | opt = np->opt; |
@@ -788,10 +790,13 @@ do_udp_sendmsg: | |||
788 | ipv6_addr_copy(&final, &fl->fl6_dst); | 790 | ipv6_addr_copy(&final, &fl->fl6_dst); |
789 | ipv6_addr_copy(&fl->fl6_dst, rt0->addr); | 791 | ipv6_addr_copy(&fl->fl6_dst, rt0->addr); |
790 | final_p = &final; | 792 | final_p = &final; |
793 | connected = 0; | ||
791 | } | 794 | } |
792 | 795 | ||
793 | if (!fl->oif && ipv6_addr_is_multicast(&fl->fl6_dst)) | 796 | if (!fl->oif && ipv6_addr_is_multicast(&fl->fl6_dst)) { |
794 | fl->oif = np->mcast_oif; | 797 | fl->oif = np->mcast_oif; |
798 | connected = 0; | ||
799 | } | ||
795 | 800 | ||
796 | err = ip6_dst_lookup(sk, &dst, fl); | 801 | err = ip6_dst_lookup(sk, &dst, fl); |
797 | if (err) | 802 | if (err) |
@@ -847,7 +852,7 @@ do_append_data: | |||
847 | else if (!corkreq) | 852 | else if (!corkreq) |
848 | err = udp_v6_push_pending_frames(sk, up); | 853 | err = udp_v6_push_pending_frames(sk, up); |
849 | 854 | ||
850 | if (dst) | 855 | if (dst && connected) |
851 | ip6_dst_store(sk, dst, | 856 | ip6_dst_store(sk, dst, |
852 | ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ? | 857 | ipv6_addr_equal(&fl->fl6_dst, &np->daddr) ? |
853 | &np->daddr : NULL); | 858 | &np->daddr : NULL); |