[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(usagi-users 00675) IPv6 multicast address leak



[same bug from mainline kernel, patch is slightly different for USAGI]
     When joining a multicast group with ifindex == 0, we get to
ipv6_sock_mc_join() which uses the routing table to find an interface when
the index doesn't specify one.
     The code also saves the interface index (as passed by the user) in
mc_list.

     When leaving a multicast group, we call ipv6_sock_mc_drop(), which
has this code

>                     if ((dev = dev_get_by_index(mc_lst->ifindex)) != NULL) {
>                               ipv6_dev_mc_dec(dev, &mc_lst->addr);
>                               dev_put(dev);
>                      }

     In the case where ifindex passed was 0, this won't find the interface
we added the multicast address to, won't remove the reference, etc.

                              +-DLS

Fix:
     In ipv6_sock_mc_join(), set the mc_list index based on the device we
actually use:

--- mcast.c    2001/08/14 23:28:12 1.1
+++ mcast.c    2001/08/14 23:28:38
@@ -141,7 +141,7 @@
          return -ENODEV;
     }

-    mc_lst->ifindex = ifindex;
+    mc_lst->ifindex = dev->ifindex;

     /*
      *   now add/increase the group membership on the device