From 1f74024a301ec15421ff3aaad1691afe6edeb6fc Mon Sep 17 00:00:00 2001 From: David Smitmanis Date: Sat, 27 Jul 2024 07:22:25 +0200 Subject: [PATCH] windows: Only attempt to bind when the network interface is up (#1527) Previously if the system had an interface with a static IP configured, coturn would attempt to bind to that address, even if the interface was down. This would fail, and prevent coturn from starting (even if there were other usable interfaces) --- src/apps/relay/mainrelay.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/apps/relay/mainrelay.c b/src/apps/relay/mainrelay.c index 1a9c8ce..f0af5d8 100644 --- a/src/apps/relay/mainrelay.c +++ b/src/apps/relay/mainrelay.c @@ -327,6 +327,12 @@ static int make_local_listeners_list(void) { printf("\tIfIndex (IPv4 interface): %u\n", pCurrAddresses->IfIndex); printf("\tAdapter name: %s\n", pCurrAddresses->AdapterName);//*/ + if (pCurrAddresses->OperStatus != IfOperStatusUp) + { + pCurrAddresses = pCurrAddresses->Next; + continue; + } + pUnicast = pCurrAddresses->FirstUnicastAddress; if (pUnicast != NULL) { // printf("\tNumber of Unicast Addresses:\n"); @@ -596,6 +602,12 @@ static int make_local_relays_list(int allow_local, int family) { printf("\tIfIndex (IPv4 interface): %u\n", pCurrAddresses->IfIndex); printf("\tAdapter name: %s\n", pCurrAddresses->AdapterName);//*/ + if (pCurrAddresses->OperStatus != IfOperStatusUp) + { + pCurrAddresses = pCurrAddresses->Next; + continue; + } + pUnicast = pCurrAddresses->FirstUnicastAddress; if (pUnicast != NULL) { // printf("\tNumber of Unicast Addresses:\n");