greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.88k stars 475 forks source link

net block: `OpenConnect` vpn not detected #1850

Open neunato opened 1 year ago

neunato commented 1 year ago

When connected to a VPN via OpenConnect client, the net block does not use the net_vpn icon.

ammgws commented 1 year ago

What does ip a show when connected to OpenConnect vpn?

This is the logic used to determine the icon: https://github.com/greshake/i3status-rust/blob/5f7febee59bd86d41ec0aeef3ee57713d3f702de/src/netlink.rs#L98-L111

schober-ch commented 11 months ago

I've just stumbled over the same question and I checked the code: I believe this happens because the "if-clause" defining the icon is greedy.

I'm no Rust-programmer and am not 100% sure what wifi_info.is_some() returns, but I assume it is true.

In the case of additional VPN connection the tun-flag is never processed because the value of icon is already defined as net_wireless.

I'm not sure what exactly to do with that, because any change here would break the current behavior of showing WIFI instead of the VPN symbol - not sure if a change is desired.

Perhaps it would be nice to expose another placeholder for the block that one could use in addition to icon?

EDIT: for sake of completeness, ip a shows the tun interface and should be matched by the logic in the code

6: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1380 qdisc fq_codel state UNKNOWN group default qlen 500
    link/none
    inet 1xxxxx scope global tun0
       valid_lft forever preferred_lft forever
    inet6 fe80:xxxx scope link stable-privacy proto kernel_ll
       valid_lft forever preferred_lft forever