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

Ordering of getipaddrs is inconsistent with system network interfaces #32179

Closed
omus opened this issue May 29, 2019 · 6 comments
Closed

Ordering of getipaddrs is inconsistent with system network interfaces #32179

omus opened this issue May 29, 2019 · 6 comments

Comments

@omus
Copy link
Member

omus commented May 29, 2019

Introduced in #30609 the output from getipaddrs is now sorted by IPAddr type and then IP address. Sorting this way ends up ignoring the network interface ordering of the system and may pick a less preferred interface.

For example on my system the current behaviour is:

julia> getipaddrs(IPv4)
2-element Array{IPv4,1}:
 ip"169.254.21.184"
 ip"192.168.1.63"

Where ip"192.168.1.63" is from my primary network interface "en0" and is my preferred address. The sorting also impacts getipaddr() which always returns the first address from getipaddrs:

julia> getipaddr()
ip"169.254.21.184"

The behaviour is different from previous versions of Julia and could cause issues when setting up a cluster.

We probably should avoid sorting the addresses from getipaddrs and at most only perform sorting of addresses that are from the same interface.

@omus omus added this to the 1.2 milestone May 29, 2019
@StefanKarpinski
Copy link
Sponsor Member

So would doing a stable sort by type be adequate?

@omus
Copy link
Member Author

omus commented May 30, 2019

I think so. The simplest solution would be to avoid the sort entirely.

@StefanKarpinski StefanKarpinski added the status:triage This should be discussed on a triage call label May 30, 2019
@StefanKarpinski
Copy link
Sponsor Member

The idea behind the sort was that getipaddr used to be guaranteed to return an IPv4 address so we wanted to favor those in general. But getipaddrs is new, so we can return values in whatever order we want to. What about getipaddr though? Should it continue to return the first IPv4 address or the first address regardless of type?

@omus
Copy link
Member Author

omus commented May 30, 2019

I would say that getipaddrs should return unsorted results and getipaddr could introduce a IPv4 bias internally.

@StefanKarpinski
Copy link
Sponsor Member

Triage is in favor. Would you mind making a PR, @omus?

@StefanKarpinski StefanKarpinski removed the status:triage This should be discussed on a triage call label Jun 6, 2019
@JeffBezanson
Copy link
Sponsor Member

Fixed by #32260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants