iOS 14.5 Beta: UDP broadcast not working with "No route to host" error.

After updating my iphone to iOS 14.5 Beta, I am not able to broadcast UDP (using broadcasting IP 255.255.255.255) message on my local network and getting the error message: "No route to host".

Here is my code:
Code Block Objective-C
#import <arpa/inet.h>
#import <fcntl.h>
#import <ifaddrs.h>
#import <netdb.h>
#import <net/if.h>
#import <sys/socket.h>
#import <sys/types.h>
- (void)sendUDPBroadcast
{
  int sock = socket(AF_INET, SOCK_DGRAM, 0);
  if (sock == -1)
  {
    NSLog(@"socket create error");
    return;
  }
   
  if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0)
  {
    NSLog(@"socket set Nonblock error");
    goto CLEAN;
  }
   
  int reuseaddr = 1;
  if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr)) < 0)
  {
    NSLog(@"socket set SO_REUSEADDR error");
    goto CLEAN;
  }
   
  int nosigpipe = 1;
  if (setsockopt(sock, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)) < 0)
  {
    NSLog(@"socket set SO_NOSIGPIPE error");
    goto CLEAN;
  }
   
  int bBroadcast = 1;
  if (setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &bBroadcast, sizeof(bBroadcast)) < 0)
  {
    NSLog(@"socket set broadcast error");
    goto CLEAN;
  }
   
  char buffer[] = "Hello world";
  struct sockaddr_in sa;
  sa.sin_family = AF_INET;
  sa.sin_addr.s_addr = inet_addr("255.255.255.255");
  sa.sin_port = htons(50000);
   
  int res = sendto(sock, buffer, strlen(buffer), 0, &sa, sizeof(sa));
   
  if (res < 0)
  {
    NSLog(@"send error:%d msg:%s", errno, strerror(errno));
    goto CLEAN;
  }
   
CLEAN:
  close(sock);
}


When I run on an iPhone with iOS 14.5 Beta installed, I get the following error:

Line55: send error:65 msg:No route to host

Any help is appreciated. Thanks in advance.


I have the same error
We are also seeing this with SSDP broadcasting on iOS 14.5
Even we are facing the issue on ios 14.5 . Same thing works on ios 14.4
Do you have Multicast Networking Entitlement added to your app?

Can be requested via https://developer.apple.com/contact/request/networking-multicast
I have requested for the Entitlement. But Apple Network team replied as below,

"Thank you for your interest in Multicast Networking. Use of Bonjour doesn’t require any entitlement, as long as you can enumerate the types you use in your app’s Info.plist. Have you tried doing this?"

I have also added below lines in Info.Plist still not working.


<string>Looking for local tcp and Bonjour service</string>
<array>
<string>aliveNotifySocket.udp</string>
<string>udpSocket.udp</string>
<string>asyncTCPSocket.tcp</string>
</array>


I am getting below error.
Socket error Error Domain=NSPOSIXErrorDomain Code=65 "No route to host" UserInfo={NSLocalizedDescription=No route to host, NSLocalizedFailureReason=Error in send() function.}

As ios 14.5 is released to all the users, customer has started reporting discovery issue.Any one with a solution would be helpful


Our company has the multicast entitlement and is still facing this issue.

Huge number of customer reports of failed discovery issues this morning.
Same issue here. No one of devices available in the local network can't be discovered after 14.5 update with the same error message "No route to host".
I am using GCDAsyncUdpSocket to discover Roku devices over the local WiFi:

Code Block
NSString *const kSearch = @"M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: \"ssdp:discover\"\r\nST: roku:ecp\r\n";
GCDAsyncUdpSocket* clientSocket = [[GCDAsyncUdpSocket alloc] initWithDelegate:self delegateQueue:dispatch_get_main_queue()];
clientSocket sendData:[kSearch dataUsingEncoding:NSUTF8StringEncoding] toHost:@"239.255.255.250" port:1900 withTimeout:7.0 tag:0];
NSError* error;
[clientSocket beginReceiving:&error];


Stopped working after upgrade to iOS 14.5 (no response received). How to fix? Thanks in advance!
I have been seeing the below logs in the device console. Looks like it points to Entitlement permission.

default 14:41:36.811477+0530 Mavid 3M
MAVIDSDK getCommunicationSockets
default 14:41:36.811569+0530 Mavid 3M
MAVIDSDK getCommunicationSockets
default 14:41:36.811631+0530 Mavid 3M
MAVIDSDK getCommunicationSockets
default 14:41:36.811685+0530 Mavid 3M
MAVIDSDK refreshScan
default 14:41:36.811719+0530 kernel necp_check_restricted_multicast_drop: Dropping unentitled multicast (SDK 0xe0500, min 0xa0000)
default 14:41:36.811762+0530 Mavid 3M MAVIDSDK refreshScan wi-fi M-search dispatch
default 14:41:36.811777+0530 kernel necp_check_restricted_multicast_drop: Dropping unentitled multicast (SDK 0xe0500, min 0xa0000)
default 14:41:36.811803+0530 kernel necp_check_restricted_multicast_drop: Dropping unentitled multicast (SDK 0xe0500, min 0xa0000)
default 14:41:36.812830+0530 Mavid 3M end refreshScan
default 14:41:36.812896+0530 Mavid 3M MAVIDSDK a<--Socket error Error Domain=NSPOSIXErrorDomain Code=65 "No route to host" UserInfo={NSLocalizedDescription=No route to host, NSLocalizedFailureReason=Error in send() function.}

I discussed this with ewanm via a different channel and it seems that the issue in their case was that, even though they’d been granted access to the multicast special entitlement (com.apple.developer.networking.multicast) they hadn’t actually set it on their app. Thus, the app wasn’t running with the entitlement, which is bad because iOS 14.5 is better above enforcing that (see the discussion of 68104781 in FAQ-3 in the Local Network Privacy FAQ).

So, for everyone else (currently SensusTech, KalMudov, nfrombangalore):
  • Have you been granted access to the multicast special entitlement?

  • Have you double checked that you’re successfully setting it?

With regards the second point, do not just look at your .entitlements file. Rather, check that the entitlement is set your your code signature:

Code Block
% codesign -d --entitlements :- /path/to/your.app


and allowed by the provisioning profile embedded within your app:

Code Block
% security cms -D -i /path/to/your.app/embedded.mobileprovision


If you’re having troubles enabled this entitlement, see Using the Multicast Special Entitlement.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Thanks Eskimo! Yesterday I sent Multicast Networking Entitlement request. Do you know how long does it take to get approved?

Yesterday I sent Multicast Networking Entitlement request.

Cool.

Do you know how long does it take to get approved?

No.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Hi @eskimo ,

Thanks for the help.We were able to apply for the Multicast Network Entitlement and was granted last week.It was granted to the account instead of particular app.This is a great thing from apple.
Discovery is working on ios 14.5 above on local network using Multicast and Broad cast.

Thanks,
IOS Team @ Libre Wireless Technology

Hi, How long will take to approve "Multicast Network" Entitlement permission approval? our APP having issue to use with IOS-14.6, and submitted permission request, but no place to verify status and progress. Please share information more, to get shortly this permission approval.

How long will take to approve "Multicast Network" Entitlement permission approval?

DTS is not responsible for this approval process and thus I can’t offer any service guarantees. However, based on feedback from other developers it seems that the process is normally pretty quick.

but no place to verify status and progress

That is, alas, correct )-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS 14.5 Beta: UDP broadcast not working with "No route to host" error.
 
 
Q