]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/igmp.c
ipv4: Make rt->fl.iif tests lest obscure.
[net-next-2.6.git] / net / ipv4 / igmp.c
index 2a4bb76f2132957da25326ce98653b249d9ccaaf..08d0d81ffc15df97171958df6ef17048bd1127a9 100644 (file)
@@ -961,7 +961,7 @@ int igmp_rcv(struct sk_buff *skb)
        case IGMP_HOST_MEMBERSHIP_REPORT:
        case IGMPV2_HOST_MEMBERSHIP_REPORT:
                /* Is it our report looped back? */
-               if (skb_rtable(skb)->fl.iif == 0)
+               if (rt_is_output_route(skb_rtable(skb)))
                        break;
                /* don't rely on MC router hearing unicast reports */
                if (skb->pkt_type == PACKET_MULTICAST ||
@@ -1269,14 +1269,14 @@ void ip_mc_rejoin_group(struct ip_mc_list *im)
        if (im->multiaddr == IGMP_ALL_HOSTS)
                return;
 
-       if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev)) {
-               igmp_mod_timer(im, IGMP_Initial_Report_Delay);
-               return;
-       }
-       /* else, v3 */
-       im->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
-               IGMP_Unsolicited_Report_Count;
-       igmp_ifc_event(in_dev);
+       /* a failover is happening and switches
+        * must be notified immediately */
+       if (IGMP_V1_SEEN(in_dev))
+               igmp_send_report(in_dev, im, IGMP_HOST_MEMBERSHIP_REPORT);
+       else if (IGMP_V2_SEEN(in_dev))
+               igmp_send_report(in_dev, im, IGMPV2_HOST_MEMBERSHIP_REPORT);
+       else
+               igmp_send_report(in_dev, im, IGMPV3_HOST_MEMBERSHIP_REPORT);
 #endif
 }
 EXPORT_SYMBOL(ip_mc_rejoin_group);
@@ -1418,6 +1418,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
        write_unlock_bh(&in_dev->mc_list_lock);
 }
 
+/* RTNL is locked */
 static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
 {
        struct flowi fl = { .nl_u = { .ip4_u =
@@ -1428,15 +1429,12 @@ static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
 
        if (imr->imr_ifindex) {
                idev = inetdev_by_index(net, imr->imr_ifindex);
-               if (idev)
-                       __in_dev_put(idev);
                return idev;
        }
        if (imr->imr_address.s_addr) {
-               dev = ip_dev_find(net, imr->imr_address.s_addr);
+               dev = __ip_dev_find(net, imr->imr_address.s_addr, false);
                if (!dev)
                        return NULL;
-               dev_put(dev);
        }
 
        if (!dev && !ip_route_output_key(net, &rt, &fl)) {