diff --git a/Makefile b/Makefile index ee9f541..0400c6b 100644 --- a/Makefile +++ b/Makefile @@ -185,6 +185,7 @@ src/edge: $(N2N_LIB) src/supernode: $(N2N_LIB) ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) +LDLIBS+=-ldnsapi N2N_OBJS+=src/win32/edge_utils_win32.o N2N_OBJS+=src/win32/getopt1.o N2N_OBJS+=src/win32/getopt.o diff --git a/src/edge.c b/src/edge.c index f8b7bdc..13de78c 100644 --- a/src/edge.c +++ b/src/edge.c @@ -579,6 +579,20 @@ static int setOption (int optkey, char *optargument, n2n_tuntap_priv_config_t *e case 'l': /* supernode-list */ { if(optargument) { +#ifdef _WIN32 +#include +#include + DNS_RECORDA* pDnsRecord = NULL; + DnsQuery_A(optargument, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD*)&pDnsRecord, NULL); + while (pDnsRecord != NULL) { + if (pDnsRecord->wType == DNS_TYPE_SRV) { + DNS_SRV_DATAA pSrvData = pDnsRecord->Data.SRV; + sprintf(optargument, "%s:%d\0", pSrvData.pNameTarget, pSrvData.wPort); + break; + } + pDnsRecord = pDnsRecord->pNext; + } +#endif if(edge_conf_add_supernode(conf, optargument) != 0) { traceEvent(TRACE_WARNING, "failed to add supernode '%s'", optargument); }