Bug description
vpn_status crashes when a libvirt virtual network interface exists.
Instead of the VPN status, the literal vpn_status string is printed on the bar.
It seems the cause is that the network interface created by libvirt is of type "tun".
Version
py3status installed from Debian 13 (trixie) repository.
$ py3status --version
py3status version 3.61 (python 3.13.5) on sway
Log report
2026-04-08 16:47:20 WARNING Instance `vpn_status`, user method `vpn_status` failed.
2026-04-08 16:47:20 INFO Traceback
KeyError: 'ipv4'
File "/usr/lib/python3/dist-packages/py3status/module.py", line 943, in run
response = method()
File "/usr/lib/python3/dist-packages/py3status/modules/vpn_status.py", line 175, in vpn_status
vpn_info = self._get_vpn_status()
File "/usr/lib/python3/dist-packages/py3status/modules/vpn_status.py", line 129, in _get_vpn_status
ipv4, ipv6 = self._get_ips(bus, properties["Connection"])
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/py3status/modules/vpn_status.py", line 142, in _get_ips
ipv4 = self._get_ip(settings["ipv4"])
~~~~~~~~^^^^^^^^
Steps to reproduce
- Have libvirt/QEMU installed with a virtual network (
default NAT network creates the bridge virbr0)
- Start a VM, which creates the
vnet tun interface
- Add
vpn_status module with default config
- Module fails, showing literal "vpn_status" text in the bar
Expected behavior
Module should ignore non-VPN tun interfaces and show "VPN: no" when no VPN is active.
Additional context
The active interface:
$ nmcli --fields NAME,TYPE,DEVICE connection show --active | grep "tun"
vnet1 tun vnet1
Preliminary fix
Removing the tun check from https://github.com/ultrabug/py3status/blob/fe39761/py3status/modules/vpn_status.py#L128 seems to work, although I don't know if there are valid VPNs which would have properties.get("Vpn") as False and be of type tun.
- if properties.get("Vpn") or properties.get("Type") in ("wireguard", "tun"):
+ if properties.get("Vpn") or properties.get("Type") == "wireguard":
Also, from the log traceback, it seems the settings["ipv4"] field is assumed to always exist, but that may not be the case.
Bug description
vpn_statuscrashes when alibvirtvirtual network interface exists.Instead of the VPN status, the literal
vpn_statusstring is printed on the bar.It seems the cause is that the network interface created by
libvirtis of type"tun".Version
py3statusinstalled from Debian 13 (trixie) repository.Log report
Steps to reproduce
defaultNAT network creates the bridgevirbr0)vnet tuninterfacevpn_statusmodule with default configExpected behavior
Module should ignore non-VPN
tuninterfaces and show "VPN: no" when no VPN is active.Additional context
The active interface:
Preliminary fix
Removing the
tuncheck from https://github.com/ultrabug/py3status/blob/fe39761/py3status/modules/vpn_status.py#L128 seems to work, although I don't know if there are valid VPNs which would haveproperties.get("Vpn")asFalseand be of typetun.Also, from the log traceback, it seems the
settings["ipv4"]field is assumed to always exist, but that may not be the case.