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

[WIP] Include IPv6 addresses for getipaddr and getipaddrs #30609

Merged
merged 1 commit into from
Apr 3, 2019

Conversation

jpsamaroo
Copy link
Member

Fixes #30604

I chose the path of least breakage here, so that getipaddr() isn't changed. I'm happy to take another approach to the API if desired.

@mgkuhn
Copy link
Contributor

mgkuhn commented Jan 8, 2019

As mentioned at #30604: this is not the desired solution. There should instead be a single multi-protocol function getipaddrs()::Vector{IPAddr} rather than any new functions specific to IPv4 or IPv6, or any more functions that assume hosts have just a single IP address.

@jpsamaroo
Copy link
Member Author

Right, sorry, I got busy and didn't have a chance to address the updates in that issue. I'll mark this as WIP.

@jpsamaroo jpsamaroo changed the title Added getipaddr6 and getipaddrs6 to Sockets [WIP] Added getipaddr6 and getipaddrs6 to Sockets Jan 8, 2019
@jpsamaroo jpsamaroo changed the title [WIP] Added getipaddr6 and getipaddrs6 to Sockets [WIP] Add getipaddrs to Sockets, and optionally include IPv6 addresses for getipaddr and getipaddrs Jan 17, 2019
@jpsamaroo
Copy link
Member Author

Having issues testing this locally, so I'm gonna rely on CI to test it for me. I'll rebase and clean up old code once we're done here.

@jpsamaroo jpsamaroo changed the title [WIP] Add getipaddrs to Sockets, and optionally include IPv6 addresses for getipaddr and getipaddrs [WIP] Include IPv6 addresses for getipaddr and getipaddrs Jan 17, 2019
@jpsamaroo
Copy link
Member Author

As far as I can tell, the OSX build error is just a network error, unrelated to this PR.

@jpsamaroo
Copy link
Member Author

Not sure how to request a review, so @StefanKarpinski do you like the approach I took here? If so, I'll cleanup and squash.

@StefanKarpinski
Copy link
Member

StefanKarpinski commented Jan 18, 2019

I do like the overall direction. However, I think this:

getipaddrs() function returns all the IPv4 addresses of the local machine ([#30349])

Should be "getipaddrs() function returns all the IP addresses of the local machine ([#30349])."

Since getipaddrs() is a new function, there's no point in favoring IPv4. Having getipaddr() preferentially return an IPv4 address if there is one seems like enough for compatibility.

@jpsamaroo
Copy link
Member Author

I updated that same line to indicate that it returns IPv4 sorted first, hopefully the language is OK.

Get an IP address of the local machine, preferring IPv4 over IPv6. Throws if no
addresses are available.

getipaddr(addr_type::Type{T}) where T<:IPAddr -> IPAddr
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
getipaddr(addr_type::Type{T}) where T<:IPAddr -> IPAddr
getipaddr(addr_type::Type{T}) where T<:IPAddr -> T

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch!

end
end
ccall(:uv_free_interface_addresses, Cvoid, (Ptr{UInt8}, Int32), addr, count)
return lo_present ? localhost : error("No networking interface available")
=#
Copy link
Member

Choose a reason for hiding this comment

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

This commented out code should just be deleted rather than commented out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, was just keeping it around so that I don't have to fish it out of git again if I found I needed it 😄

@jpsamaroo
Copy link
Member Author

Circling back to this since I just remembered this existed. Is there anything else I've missed in this PR that should be addressed?

@StefanKarpinski StefanKarpinski added the triage This should be discussed on a triage call label Mar 22, 2019
@StefanKarpinski
Copy link
Member

Have marked for triage to discuss if the API is good, if everyone is ok with it we’ll merge.

@StefanKarpinski
Copy link
Member

Triage is in favor. One suggestion (see comments): make getipaddrs(T) :: Vector{T} since we know the type. Otherwise looks good to go with a rebase.

@jpsamaroo
Copy link
Member Author

Ok, sounds good. Has someone marked the extraneous extra curly braces that I should remove? Or is that addressed by current reviews?

Also, squash to single commit, or is some other split desired?

@StefanKarpinski
Copy link
Member

I don't think there's curlies that need changing. Squash to a single commit, please, although that can be done when this is merged too but since you're rebasing anyway...

@StefanKarpinski StefanKarpinski removed the triage This should be discussed on a triage call label Mar 28, 2019
@StefanKarpinski StefanKarpinski added this to the 1.2 milestone Mar 28, 2019
@jpsamaroo
Copy link
Member Author

I'm not sure what's up with the mixed bag of failures, but it seems like this is passing in general. Anyway, let me know if there was anything else I should do!

@StefanKarpinski
Copy link
Member

@staticfloat, are the failures here expected?

@staticfloat
Copy link
Member

Appveyor and Travis I cant speak for, but the Mac buildbot is a failure that’s already fixed on master, so you just need to rebase on top to get that sorted.

@jpsamaroo
Copy link
Member Author

Everything seems mostly green, but did my changes actually manage to hang MacOS bootstrap?

@StefanKarpinski
Copy link
Member

That timeout looks unrelated to me. @staticfloat, can I get a professional opinion?

@staticfloat
Copy link
Member

Yeah no that's weird. I restarted it just in case.

@staticfloat
Copy link
Member

Looks like a mysterious failure. The rebuild made it through bootstrap, so you've got the 👍 from me

@StefanKarpinski StefanKarpinski merged commit e8a88c9 into JuliaLang:master Apr 3, 2019
@StefanKarpinski
Copy link
Member

Ok, so I'm glad we got this merged, but after playing around with it for a bit (which I did before too but it didn't hit me until now), I realize that the boolean argument should be a keyword. I would call it loopback. I can make a PR.

@StefanKarpinski
Copy link
Member

Also, this fails tests locally for me on macOS.

@StefanKarpinski
Copy link
Member

However, it doesn't seem to be any worse than it was before this commit, so it's a separate issue.

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

Successfully merging this pull request may close these issues.

5 participants