Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkInterface.list not implemented on Android #26329

Closed
abarth opened this issue Apr 25, 2016 · 10 comments
Closed

NetworkInterface.list not implemented on Android #26329

abarth opened this issue Apr 25, 2016 · 10 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. customer-flutter library-io type-enhancement A request for a change that isn't a bug

Comments

@abarth
Copy link
Contributor

abarth commented Apr 25, 2016

This API is not implemented in Dart for Android. See Socket::ListInterfaces in dart/runtime/bin/socket_android.cc.

Socket::ListInterfaces is also not setting the OSError. CObject::NewOSError then consumes the null OSError, resulting in a segfault.

See flutter/flutter#205

@johnmccutchan
Copy link
Contributor

@zanderso FYI

@mit-mit mit-mit added the area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. label Apr 25, 2016
@sethladd
Copy link
Contributor

cc @iposva-google

@zanderso zanderso self-assigned this Apr 25, 2016
@zanderso
Copy link
Member

zanderso commented Apr 25, 2016

https://codereview.chromium.org/1916223003/

ifaddrs.h still does not exist in the NDK, so to support this API, we'll have to implement as suggested in the comment in socket_android.cc. In the meantime, I've fixed the crash, and added NetworkInterface.listSupported.

zanderso added a commit that referenced this issue Apr 26, 2016
Previously, Socket::ListInterfaces failed to set the os_error out
parameter causing a crash in the caller. This change sets an error here.

I've also added NetworkInterface.listSupported, which returns false on
Android, and true everywhere else. ifaddrs.h continues not to exist in
the NDK, so in order to support NetworkInterface.list, we'd have to
reimplement it, or find a suitable reimplementation somewhere.

related #26329

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1916223003 .
@sethladd
Copy link
Contributor

It looks like we landed @zanderso 's patch. Can we close this issue?

@sortie
Copy link
Contributor

sortie commented Feb 28, 2019

Reopening since it appears ifaddrs.h is available as of Android API level 24 (August 2016). If we can take advantage of that API level, then we can implement this feature.

@sortie sortie added the type-enhancement A request for a change that isn't a bug label Feb 28, 2019
@dnfield
Copy link
Contributor

dnfield commented Mar 18, 2019

It would be ideal if we could do this in a way that supports <API24 as well. WebRTC has an implementation that does this, for example.

@sortie
Copy link
Contributor

sortie commented Mar 18, 2019

Can you link to that implementation? I guess that would require making a raw system call.

@dnfield
Copy link
Contributor

dnfield commented Mar 18, 2019

@dnfield
Copy link
Contributor

dnfield commented Mar 18, 2019

My preference would be to see something like

#ifdef API_24 // or whatever the right name is?
// Use NDK implementation
#else
// Use system calls
#endif // API_24

Flutter, for example, currently supports down to API 16. I'd like to use this call in Flutter, but wouldn't be able to if it requires API 24 (which for Dart VM and the Engine, is a compile time flag).

@dnfield
Copy link
Contributor

dnfield commented Apr 9, 2019

The #if should probably be more like this:

#if __ANDROID_API__ >= 24
  // use NDK
#else
  // use system calls, e.g. the way that WebRTC does it
#endif // __ANDROID_API__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. customer-flutter library-io type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

7 participants