From 004aad9b3bcabe8629cf0f94e2839ad8530ffa56 Mon Sep 17 00:00:00 2001 From: Muaz Ahmad Date: Sat, 11 May 2024 20:56:31 +0500 Subject: [PATCH] Add local only checking for ipv4 --- src/mdns.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mdns.zig b/src/mdns.zig index f64ba03..f5c8521 100644 --- a/src/mdns.zig +++ b/src/mdns.zig @@ -152,9 +152,11 @@ fn parse_mdns_response(response: []u8, ip_info: util.IPInfo) !util.IP { continue; } if (ip_len == 4) { - var addr_buff = [_]u8{0x00} ** 4; - @memcpy(&addr_buff, ip_bytes); - addr = std.net.Address.initIp4(addr_buff, 0); + if (ip_bytes[0] == 192 and ip_bytes[1] == 168) { + var addr_buff = [_]u8{0x00} ** 4; + @memcpy(&addr_buff, ip_bytes); + addr = std.net.Address.initIp4(addr_buff, 0); + } } else if (ip_len == 16) { if (ip_bytes[0] == 0xfd) { var addr_buff = [_]u8{0x00} ** 16;