Closed mexmer closed 1 year ago
Have you checked if get_primary_mac_address
function works with your change?
@nikias it works when compiling under msys2 didn't test other windows cygwin enviroments
tbh. msys2 is currently one of few still managed enviroments that works properly under windows 10.
i've been using cygwin for years and still have it on computer, but switched to msys few years ago, when compiling stuff, because it works better.
ok, just tested under cygwin (either gcc-core or mingw64-gcc-core) and without my patch i get
socket.c:746:2: error: #error get_primary_mac_address is not supported on this platform.
746 | #error get_primary_mac_address is not supported on this platform.
with patch it compiles and works.
i can post full list of packages intalled in either environment if needed (for cygwin and msys2 that is)
I know that it compiles, but I want to know if the function is actually able to get the mac address.
well, it does return some mac address
Primary mac address: 00:00:00:ff:ea:7c
closest match is VPN adapter mac 00-FF-EA-7C-C6-57
after expanding to 8 chars, it fully matches VPN adapter MAC, with addition of 00:00: at begining
Primary mac address: 00:00:00:ff:ea:7c:c6:57
tested with simple code
#include "libimobiledevice-glue/socket.h"
#include <stdio.h>
main ()
{
unsigned char primary_mac_addr[6] = { 0, 0, 0, 0, 0, 0 };
if (get_primary_mac_address(primary_mac_addr) != 0)
fprintf(stderr, "Cannot get primary mac");
fprintf(stdout, "Primary mac address: %02x:%02x:%02x:%02x:%02x:%02x\n", primary_mac_addr[0], primary_mac_addr[1], primary_mac_addr[2], primary_mac_addr[3], primary_mac_addr[4], primary_mac_addr[5]);
}
@nikias i can do more tests, and fix behavior of this function if needed. not sure if it's cygwin or 64bit windows thing, that it's 8 bytes, but it is, what it is.
this PR missed few point so i changed code in better way that match getiffaddr function output on cygwin
when compiling on msys2, gcc doesn't define WIN32 (unless you use windows SDK, which i don't), i'm using default environment with cygwin64 compiler, therefore CYGWIN macro is defined.