[modules/nic] Too many addresses per interface

Addresses were not cleared correctly, resulting in too many IPs being
displayed for the second, third, etc. interface.
This commit is contained in:
Tobias Witek 2016-11-06 08:21:33 +01:00
parent 749a9761b2
commit 89f49856d9

View file

@ -17,9 +17,9 @@ class Module(bumblebee.module.Module):
def widgets(self): def widgets(self):
result = [] result = []
interfaces = [ i for i in netifaces.interfaces() if not i.startswith(self._exclude) ] interfaces = [ i for i in netifaces.interfaces() if not i.startswith(self._exclude) ]
addr = []
state = "down" state = "down"
for intf in interfaces: for intf in interfaces:
addr = []
try: try:
if netifaces.AF_INET in netifaces.ifaddresses(intf): if netifaces.AF_INET in netifaces.ifaddresses(intf):
for ip in netifaces.ifaddresses(intf)[netifaces.AF_INET]: for ip in netifaces.ifaddresses(intf)[netifaces.AF_INET]: