Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Their actual solution for disabling AWDL is running this script in the background:

    while true; do
        if ifconfig awdl0 |grep -q "<UP"; then
            (set -x; ifconfig awdl0 down)
        fi
       sleep 1
    done
That just checks the awld0 interface every second and turns it off if it's on. Apple really doesn't offer any other way to disable awdl?

Note that setting AirDrop to "No One" doesn't fully disable awdl. It's used for other things like screen sharing, AirPlay, bonjour device/service discovery, etc. Though perhaps disabling AirPlay is enough to stop the WiFi issues. You can sniff awdl traffic with `sudo tcpdump -i awdl0`



I've been having this problem for months. The solution I settled on was a root cronjob that just does `ifconfig awdl0 down` every minute.

It makes shared clipboard not work as well with my iPhone, but at least I get 180Mbps/70ms on the work VPN instead of 4mbps/70-700ms.

The interface stays down till the laptop sleeps, so most of the time it's a no-op.


It appears the behavior has changed with Ventura. It now goes back active after a few seconds. I guess I will be doing something a bit more aggressive now.


You might also try something like:

   sudo /usr/libexec/airportd en0 prefs AWDLEnabled=YES
(Edit: see varenc's reply below)

Or you could create a kext (using deprecated KPIs) that continuously blocks the interface from coming up:

   errno_t awdlblock_ioctl_handler(void *cookie, ifnet_t interface, protocol_family_t protocol, unsigned long ioctl_cmd, void *ioctl_arg) {
    
    if (SIOCSIFFLAGS == ioctl_cmd) {
     struct ifreq *ifr = (struct ifreq*)ioctl_arg;
     
     if (ifr && ((ifr->ifr_flags) & IFF_UP) != 0) {
      return EJUSTRETURN;
     }
    }
    return ENOTSUP;
   }
   
   kern_return_t awdlblock_start(kmod_info_t * ki, void *d)
   {
       struct iff_filter filter = { 0 };
       errno_t err = ifnet_find_by_name("awdl0", &p_ifnet);
       if (err) {
           printf("interface awdl0 not found\n");
           return KERN_SUCCESS;
       }
       filter.iff_name     = "AWDLBlock";
       filter.iff_ioctl    = awdlblock_ioctl_handler;
       iflt_attach(p_ifnet, &filter, &p_filter);
       
       return KERN_SUCCESS;
   }


Wow I didn't know about that undocumented ability to change Airport prefs!

I was able to somewhat disable AWDL by doing this like you suggest:

    sudo /usr/libexec/airportd en0 prefs AWDLEnabled=YES
And then restarting airportd so that it picks up the change:

    sudo launchctl kickstart -k system/com.apple.airportd
This worked without having to disable SIP and modify com.apple.airportd.plist

It doesn't take the awdl0 interface down, and I still see some traffic on it, but I can confirm that it disables some awdl features like "Unlock with Watch" and Screen Sharing over awdl. (Screen Sharing will work over your wifi network instead, but normally it'll prefer a direct awdl link)


> I was able to somewhat disable AWDL by doing this like you suggest:

> sudo /usr/libexec/airportd en0 prefs AWDLEnabled=YES

Wait, why AWDLEnabled = YES? Is it like with those Cisco routers, where "do X" was usually done by negating "do inverse-of-X"? E.g. "no interface up foo" to bring down interface "foo".


Sorry, you're 100% right. It should be AWDLEnabled=NO! (and was in my testing)

Also you can check what your current prefs by just not passing any args after `prefs`:

    sudo /usr/libexec/airportd en0 prefs


I suspect that in this case, they're telling MacOS to use the physical Ethernet port for awdl, which can't do airtime slicing.

That prevents it from doing any WiFi direct things, but otherwise would leave it functional.


That's good to hear that's all it takes!

Yes, Bonjour name resolution, which Screen Sharing uses, can also run over AWDL, but of course it does not have to.

There was a bug in OS X Yosemite and older versions of iOS which caused any AWDL activity to severely increase network jitter and latency; this sounds like a regression.

https://medium.com/@mariociabarra/wifried-ios-8-wifi-perform...


There unfortunately is not a way to disable awdl in the UI apart from disabling bluetooth as well, which most don’t want. An increasing number of Apple services leverage awdl[1], and it’s unlikely they envision anyone wanting to turn it off.

[1] https://owlink.org/wiki/ — note, not exhaustive ex: tethering also leverages awdl.


I’ve been digging for a way to do this with defaults write and plists. So far I haven’t figured it out.


> It's used for other things like screen sharing

Intersting!

Starting a few weeks ago, I was screen sharing from a Monterey macbook to a Ventura Beta MacBook, using drag & drop to copy an app over for testing. Both macs were on WiFi. Worked great (~100MB/second).

But about every 5th time, the file transfer rate would drop from 100MB/S to under 100KB/S and stay there. No idea why.

I finally bought a USBC ethernet dongle and put both machines on Ethernet and the problem went away.

I'm now wondering if this is what I was seeing?

Edit to add: The WiFi is Peplink AP One Mini, in case vendor is relevant.


Came here to say this. It's unfortunately not a new problem. I use Shadow Tech on my M1 Macbook to play windows games, and this has been bugging me ever since. The irony is that this problem is non-existent on old Macbook pros.

Here's an example of SOF solution: https://apple.stackexchange.com/a/413735

But if you search around the internet you will see different solutions proposed for it, none worked for me except for this script.

This popping up on HN gives me hope that next versions give you at least a tool to disable Wifi direct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: