-
-
Notifications
You must be signed in to change notification settings - Fork 765
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
Provide an option to show ipv4, ipv6 or both #3959
base: master
Are you sure you want to change the base?
Conversation
src/modules/network.cpp
Outdated
} else if (addr_pref_ == ip_addr_pref::IPV4_6) { | ||
final_ipaddr_ = ipaddr_; | ||
final_ipaddr_ += " | "; | ||
final_ipaddr_ += ipaddr6_; | ||
} |
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.
Would it be possible to put each address family on each own line?
I've just tried the patch out, and
- the first line gets really long with both in there, esp. since IPv6 address tend to be long.
- on dual-stack, the netmask is displayed incorrectly, as it takes the one from legacy IPv4 for both. E.g. it displays
192.168.0.10 | fc00::1/24 via 192.168.0.1
if your interface has both192.168.0.10/24
andfc00::1/64
as address. - on dual-stack, only the gateway for the legacy IPv4 net is displayed.
Putting each address family on its own line would fix both problems.
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.
- Something like this? Would a newline be good, or some other character?
else if (addr_pref_ == ip_addr_pref::IPV4_6) {
final_ipaddr_ = ipaddr_;
final_ipaddr_ += "\n";
final_ipaddr_ += ipaddr6_;
}
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.
- Something like this? Would a newline be good, or some other character?
Yes, that's what I had in mind too. 👍
I see. I'd say that this is out of scope for this PR then. I might also look into this in the future, after this has been merged - to fix the immediate issues first.
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 you check the changes and verify that they work as intended?
a111762
to
5e4dac1
Compare
Could you add different My use case is that I want only the ipv4 address in the bar but both addresses in the tooltip. |
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.
One more, small change :^)
The format (apart from the broken netmask as already discussed) now seems fine. It's kinda sad that still only a minority of people care about IPv6, seeing the state of this module.
Anyway; one more thing I noticed: when a legacy v4 address is added, the module updates fine. But if the legacy address is removed again, it completely disappears from the bar.
final_ipaddr_ = ipaddr_; | ||
final_ipaddr_ += '\n'; |
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.
final_ipaddr_ = ipaddr_; | |
final_ipaddr_ += '\n'; | |
if (!ipaddr_.empty()) { | |
final_ipaddr_ = ipaddr_; | |
final_ipaddr_ += '\n'; | |
} |
Small nit; to avoid an unnecessary newline/empty line.
I think you can just display |
How would I do this? As far a I see, setting |
Oh yeah, sorry. Didn't think about that. Maybe you can create a separate pr for that if you don't mind. |
Fixes #3956.
Users can now set
family
toipv4
,ipv6
,ipv4_6
to show the IPv4, IPv6, or both. With the default beingipv4
.