Add local only checking for ipv4

This commit is contained in:
Muaz Ahmad 2024-05-11 20:56:31 +05:00
parent 3be35fd803
commit 004aad9b3b

View file

@ -152,9 +152,11 @@ fn parse_mdns_response(response: []u8, ip_info: util.IPInfo) !util.IP {
continue; continue;
} }
if (ip_len == 4) { if (ip_len == 4) {
if (ip_bytes[0] == 192 and ip_bytes[1] == 168) {
var addr_buff = [_]u8{0x00} ** 4; var addr_buff = [_]u8{0x00} ** 4;
@memcpy(&addr_buff, ip_bytes); @memcpy(&addr_buff, ip_bytes);
addr = std.net.Address.initIp4(addr_buff, 0); addr = std.net.Address.initIp4(addr_buff, 0);
}
} else if (ip_len == 16) { } else if (ip_len == 16) {
if (ip_bytes[0] == 0xfd) { if (ip_bytes[0] == 0xfd) {
var addr_buff = [_]u8{0x00} ** 16; var addr_buff = [_]u8{0x00} ** 16;