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

Force return IPv4 address when probing network interface for listening address #3946

Merged
merged 1 commit into from
Oct 29, 2023

Conversation

TranceLove
Copy link
Collaborator

Description

NetworkUtil.getLocalInetAddress() didn't filter non-IPv4 address during probing, which may returns IPv6 address if the device/network supports. This can be inconvenient to some users running Amaze's FTP server. This PR fixes by filtering to return only when the InetAddress is an Inet4Address.

Issue tracker

Fixes #3928

Build tasks success

Successfully running following tasks on local:

  • ./gradlew assembledebug
  • ./gradlew spotlessCheck

@TranceLove TranceLove added Issue-Bug Related unexpected behavior or something worth investigating. Area-FTP Related to FTP Server. labels Sep 29, 2023
@TranceLove TranceLove self-assigned this Sep 29, 2023
@VishnuSanal
Copy link
Member

build test apk

@@ -115,7 +116,8 @@ object NetworkUtil {
netinterface.inetAddresses.iterator().forEach { address ->
// this is the condition that sometimes gives problems
if (!address.isLoopbackAddress &&
!address.isLinkLocalAddress
!address.isLinkLocalAddress &&
address is Inet4Address
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a type check, right? does this "force" Ipv4 address? 🤔 I'll send the APK to the reporter & ask them to check.

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

The requested APKs has been built. Please find them from the artifacts section of this PR.

Copy link
Member

@VishnuSanal VishnuSanal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works as expected #3928 (comment) 🥳

@VishalNehra VishalNehra merged commit f6a23f5 into release/4.0 Oct 29, 2023
4 checks passed
@VishalNehra VishalNehra deleted the bugfix/3928 branch October 29, 2023 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-FTP Related to FTP Server. Issue-Bug Related unexpected behavior or something worth investigating.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to set IPv4 address when using FTP server with hotspot?
3 participants