-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Display IPv6 Global Unicast Address In MOTD #10325
Conversation
|
||
# protocol from cmdline, then https | ||
protocol=${4:-https} | ||
|
||
hostname_url="${protocol}://${hostname}:${port}/" | ||
ip_url="${ip:+ or ${protocol}://${ip}:${port}/}" | ||
# if a ip6 global address is present use it for ip_url otherwise display the ip4 address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please flip this around? If there is an IPv4 address, it's much simpler to handle than an IPv6 one. Particularly on a VT where you don't have copy&paste, IPv6 addresses are rather unwieldy. (In general we want to present host names when possible, of course.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@martinpitt I agree hostname is the easiest and preferred method by far! I displayed the IPv6 address over the IPv4 address only when a global unicast address is present. This would mean either intentionally or not the system likely has a functional IPv6 stack and it's being preferred by the underlying operating system. This is the larger trend in the networking world. Additionally most organizations are assigned stable IPv6 prefixes. These will and are memorized by IT staff just like IPv4 address space is memorized today. This cuts down on the number of bytes the user has to remember on that sprint back to a GUI enabled terminal.
The focus of your point is on usability. In that regard I'd be a fool to say an IPv6 address is easier to remember by a glance at the console without copy and paste. That said, by displaying the IPv4 address over the IPv6 we'd be reversing the position of the rest of the network stack and the RFC world.
My preference would be to stay consistent and display useful IPv6 information when it's available by default.
Alternatively - we could display both IPv4 and IPv6 URLs.
Lastly - what's easier to remember: https://127.0.0.1:9090 or https://[::1]:9090 so not all IPv6 addresses are bad right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not implying that we should do this (see Martin's comments against) but, if we do it, I think the implementation could be simpler...
if [ ! -z $interface6 ]; then | ||
ip6=${3:-$(ip -o -6 addr show dev $interface6 scope global | sed -e 's/.*inet6 \([^ ]*\) .*/\1/' | sed -e 's/\/.*//')} | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unnecessarily complicated. Why not just adapt the ip4 line to something like:
ip route get 2001:: | sed -e 's/.*src \([^ ]*\) .*/\1/
That works for me.
Needs to rebase to master since #12367 changed tests names |
@timway this has been abandoned for some time. Are you still interested in this? |
@marusak, yes I'll take a look at updating to see if we can make some headway on it. |
Closing due to inactivity. We get enough pushback on littering motd already, I think we should really not put long IPv6 addresses in there. If anything we should drop the IPv4 as well -- even if your hostname can't be resolved, this should still get the idea to the user. |
The MOTD should display IPv6 addresses when available.