Skip to content

Commit

Permalink
[Android] Fix NetworkInterface.GetAllNetworkInterfaces (#76370)
Browse files Browse the repository at this point in the history
* Revert "[Android] Port getifaddrs implementation from Xamarin.Android (#71943)"

This reverts commit 1de4a5c.

* Fix allocating memory block for interfaces and addresses on recent Android SDKs

* Detect loopback interface on Android

* Add comment with explanation

* Simplify the changes to be closer to the original code

* Fix build

* Fix typos

Co-authored-by: Alexander Köplinger <[email protected]>

* Improve comment

* Indent using spaces instead of tabs

* Remove check for ifaddrs.h

* Add ANDROID_GETIFADDRS_WORKAROUND

* Update comment

Co-authored-by: Alexander Köplinger <[email protected]>
  • Loading branch information
simonrozsival and akoeplinger authored Oct 3, 2022
1 parent a08d300 commit 81b70b1
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 816 deletions.
7 changes: 2 additions & 5 deletions src/native/libs/System.Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/extra_libs.cmake)
set(NATIVE_LIBS_EXTRA)
append_extra_system_libs(NATIVE_LIBS_EXTRA)

if (CLR_CMAKE_TARGET_ANDROID)
add_compile_options(-Wno-gnu-zero-variadic-macro-arguments)

list (APPEND NATIVE_LIBS_EXTRA -llog)
list (APPEND NATIVE_SOURCES pal_ifaddrs.c)
if (CLR_CMAKE_TARGET_ANDROID AND NOT HAVE_GETIFADDRS)
add_definitions(-DANDROID_GETIFADDRS_WORKAROUND)
endif ()

if (GEN_SHARED_LIB)
Expand Down
Loading

0 comments on commit 81b70b1

Please sign in to comment.