From 7e1f3fc5c05cd3aed0a52f0de70a6810f03ad788 Mon Sep 17 00:00:00 2001 From: Neil Greatorex Date: Sat, 2 Nov 2024 02:51:35 +0000 Subject: [PATCH] [network] Modify iOS port knock to use a valid mDNS packet Signed-off-by: Neil Greatorex --- .../openhab/binding/network/internal/utils/NetworkUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/utils/NetworkUtils.java b/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/utils/NetworkUtils.java index f86f00964183d..a8bfc3202cee5 100644 --- a/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/utils/NetworkUtils.java +++ b/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/utils/NetworkUtils.java @@ -446,7 +446,8 @@ public PingResult javaPing(Duration timeout, InetAddress destinationAddress) { public void wakeUpIOS(InetAddress address) throws IOException { int port = 5353; try (DatagramSocket s = new DatagramSocket()) { - byte[] buffer = new byte[0]; + // Send a valid mDNS packet (12 bytes of zeroes) + byte[] buffer = new byte[12]; s.send(new DatagramPacket(buffer, buffer.length, address, port)); logger.trace("Sent packet to {}:{} to wake up iOS device", address, port); } catch (PortUnreachableException e) {