UBUNTU: SAUCE: ndiswrapper: convert multicast list to list_head
authorLeann Ogasawara <leann.ogasawara@canonical.com>
Thu, 3 Jun 2010 20:34:15 +0000 (13:34 -0700)
committerLeann Ogasawara <leann.ogasawara@canonical.com>
Mon, 28 Mar 2011 13:48:45 +0000 (06:48 -0700)
The following upstream commit removed mc_count from struct net_device
and converts multicast lists to list_head:

  commit 22bedad3ce112d5ca1eaf043d4990fa2ed698c87
  Author: Jiri Pirko <jpirko@redhat.com>
  Date:   Thu Apr 1 21:22:57 2010 +0000

    net: convert multicast list to list_head

Thus, we need to convert ndiscrapper to incorporate the same changes to
avoid build failures.

Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>

ubuntu/ndiswrapper/wrapndis.c

index 404e1e3..2ac89e7 100644 (file)
@@ -939,37 +939,38 @@ static void update_iw_stats(struct ndis_device *wnd)
 static void set_multicast_list(struct ndis_device *wnd)
 {
        struct net_device *net_dev;
+       int mc_count;
        ULONG packet_filter;
        NDIS_STATUS res;
 
        net_dev = wnd->net_dev;
        packet_filter = wnd->packet_filter;
+       mc_count = netdev_mc_count(net_dev);
 
        TRACE2("0x%08x", packet_filter);
        if (net_dev->flags & IFF_PROMISC) {
                packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS |
                        NDIS_PACKET_TYPE_ALL_LOCAL;
        } else if (net_dev->flags & IFF_ALLMULTI ||
-                  net_dev->mc_count > wnd->multicast_size) {
+                  mc_count > wnd->multicast_size) {
                packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
                TRACE2("0x%08x", packet_filter);
-       } else if (net_dev->mc_count > 0) {
+       } else if (mc_count > 0) {
                int i, size;
                char *buf;
-               struct dev_mc_list *mclist;
-               size = min(wnd->multicast_size, net_dev->mc_count);
-               TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count);
+               struct netdev_hw_addr *ha;
+               size = min(wnd->multicast_size, mc_count);
+               TRACE2("%d, %d", wnd->multicast_size, mc_count);
                buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
                if (!buf) {
                        WARNING("couldn't allocate memory");
                        EXIT2(return);
                }
-               mclist = net_dev->mc_list;
-               for (i = 0; i < size && mclist; mclist = mclist->next) {
-                       if (mclist->dmi_addrlen != ETH_ALEN)
+               netdev_for_each_mc_addr(ha, net_dev) {
+                       if (net_dev->addr_len != ETH_ALEN)
                                continue;
-                       memcpy(buf + i * ETH_ALEN, mclist->dmi_addr, ETH_ALEN);
-                       TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr));
+                       memcpy(buf + i * ETH_ALEN, ha->addr, ETH_ALEN);
+                       TRACE2(MACSTRSEP, MAC2STR(ha->addr));
                        i++;
                }
                res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN);