From 7340b1d6e3c9de607608a786b839001500a3348b Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 21:37:47 +0000 Subject: [PATCH 1/7] Fix hanging UI when `null` addr --- src/libui_sdl/LAN_PCap.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index c228f5e4..55b08914 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -257,12 +257,11 @@ bool Init(bool open_adapter) struct ifaddrs* curaddr = addrs; while (curaddr) { - if (strcmp(curaddr->ifa_name, adata->DeviceName)) + if (strcmp(curaddr->ifa_name, adata->DeviceName) || !curaddr->ifa_addr) { curaddr = curaddr->ifa_next; continue; } - if (!curaddr->ifa_addr) continue; u16 af = curaddr->ifa_addr->sa_family; if (af == AF_INET) From 7e07250652260657b0a78d66c556d6edc1175b27 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:19:30 +0000 Subject: [PATCH 2/7] Maybe better to log --- src/libui_sdl/LAN_PCap.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 55b08914..0682e61e 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -257,12 +257,18 @@ bool Init(bool open_adapter) struct ifaddrs* curaddr = addrs; while (curaddr) { - if (strcmp(curaddr->ifa_name, adata->DeviceName) || !curaddr->ifa_addr) + if (strcmp(curaddr->ifa_name, adata->DeviceName) { curaddr = curaddr->ifa_next; continue; } + if (!curaddr->ifa_addr){ + printf("Device does not have an address :/"); + curaddr = curaddr->ifa_next; + continue; + } + u16 af = curaddr->ifa_addr->sa_family; if (af == AF_INET) { From cdd60bb29822736bc7e0a0a3469e1aed33052e00 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:20:39 +0000 Subject: [PATCH 3/7] fix build --- src/libui_sdl/LAN_PCap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 0682e61e..e4078664 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -257,7 +257,7 @@ bool Init(bool open_adapter) struct ifaddrs* curaddr = addrs; while (curaddr) { - if (strcmp(curaddr->ifa_name, adata->DeviceName) + if (strcmp(curaddr->ifa_name, adata->DeviceName)) { curaddr = curaddr->ifa_next; continue; From c2a55bc2174daea687f865089af4e7a3fdc192f3 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:22:47 +0000 Subject: [PATCH 4/7] clean log --- src/libui_sdl/LAN_PCap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index e4078664..dd5a7002 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -264,7 +264,7 @@ bool Init(bool open_adapter) } if (!curaddr->ifa_addr){ - printf("Device does not have an address :/"); + printf("Device does not have an address :/\n"); curaddr = curaddr->ifa_next; continue; } From 477be1d1551fdd4925c95404b5af025ed9f30081 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:34:02 +0000 Subject: [PATCH 5/7] add device name --- src/libui_sdl/LAN_PCap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index dd5a7002..75a2e3cc 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -264,7 +264,7 @@ bool Init(bool open_adapter) } if (!curaddr->ifa_addr){ - printf("Device does not have an address :/\n"); + printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); curaddr = curaddr->ifa_next; continue; } From 7730e6c1e2086db4c73ecebaa140ca45c1383a9f Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Wed, 20 Nov 2019 23:24:16 +0000 Subject: [PATCH 6/7] Coding style + weird spacing --- src/libui_sdl/LAN_PCap.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 75a2e3cc..312af0ea 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -263,10 +263,11 @@ bool Init(bool open_adapter) continue; } - if (!curaddr->ifa_addr){ + if (!curaddr->ifa_addr) + { printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); curaddr = curaddr->ifa_next; - continue; + continue; } u16 af = curaddr->ifa_addr->sa_family; From 295404a5a696c158df2ddf9b9548c0a4b8c368c6 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Thu, 12 Dec 2019 09:03:01 +0000 Subject: [PATCH 7/7] Fix weird spacing --- src/libui_sdl/LAN_PCap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 312af0ea..44af0a36 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -263,12 +263,12 @@ bool Init(bool open_adapter) continue; } - if (!curaddr->ifa_addr) - { - printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); - curaddr = curaddr->ifa_next; - continue; - } + if (!curaddr->ifa_addr) + { + printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); + curaddr = curaddr->ifa_next; + continue; + } u16 af = curaddr->ifa_addr->sa_family; if (af == AF_INET)