• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
modified enetlognke causing not able to wake up after sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

modified enetlognke causing not able to wake up after sleep


  • Subject: modified enetlognke causing not able to wake up after sleep
  • From: Andy Huang <email@hidden>
  • Date: Wed, 12 May 2010 13:55:21 -0500

Hi,

I am trying to modify enetlognke and it mostly works fine except it causes MAC not able to wake up after sleep. Here is the code I modified:
kern_return_t com_dts_apple_kext_enetlognke_
start (kmod_info_t * ki, void * d)
{
    kern_return_t    retval;
    ifnet_t            enetifnet;
    ifnet_t *ifnetlist = 0, ifp;
    u_int32_t n, count;
    char en[32];
   
    printf("enetlognke_start entered\n");
    if (gFilterRegistered == TRUE)
        return KERN_SUCCESS;

    // set up the tag value associated with this NKE in preparation for swallowing packets and re-injecting them
    retval = mbuf_tag_id_find(MYBUNDLEID , &gidtag);
    if (retval != 0)
    {
        el_printf("mbuf_tag_id_find returned error %d\n", retval);
        goto error;
    }
               
    retval = ifnet_list_get(IFNET_FAMILY_ETHERNET, &ifnetlist, &count);
    if (retval != 0)
    {
        printf("ifnet_list_get failed %d\n", retval);
        goto error;
    }
    else
    {
        for (n = 0; n < count; n++)
        {
            ifp = ifnetlist[n];
            snprintf(en, sizeof(en), "%s%d", ifnet_name(ifp), ifnet_unit(ifp));
            retval = ifnet_find_by_name(en, &enetifnet);
            if (retval == KERN_SUCCESS)
            {
                retval = iflt_attach(enetifnet, &Enet_filter, &gEnetFilter);
                // release the reference on the interface name
                ifnet_release(enetifnet);
                if (retval == KERN_SUCCESS)
                {
                    printf("iflt_attach succeeded for %s\n", en);
                }
                else
                {
                    printf("iflt_attach for %s failed %d\n", en, retval);
                    goto error;
                }
            }
            else
            {
                printf("ifnet_find_by_name for %s failed %d\n", en, retval);
                goto error;
            }
        }
    }

    if (ifnetlist != 0)
        ifnet_list_free(ifnetlist);
   
    if (retval == KERN_SUCCESS)
        gFilterRegistered = TRUE;
    else
        goto error;
   
    return retval;

error:
    if (ifnetlist != 0)
        ifnet_list_free(ifnetlist);
   
    return KERN_FAILURE;
}

Basically, the code doesn't not use hard-coded ethernet name(gBuiltinEnetName), I just find all the ethernet interface and attach the filter.
Any help will be greatly appreciated.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: bluetooth solved...
  • Next by Date: How to disable keep-alive when using NSURLConnection?
  • Previous by thread: bluetooth solved...
  • Next by thread: How to disable keep-alive when using NSURLConnection?
  • Index(es):
    • Date
    • Thread