don't access netvm if it's None in visible_gateway/netmask

Causes an unnecessary exception
This commit is contained in:
qubesuser 2017-11-09 18:42:44 +01:00
parent 682d9503ee
commit 9cc86b3be2

View File

@ -123,13 +123,13 @@ class NetVMMixin(qubes.events.Emitter):
def visible_gateway(self): def visible_gateway(self):
'''Default gateway of this domain as seen by the domain.''' '''Default gateway of this domain as seen by the domain.'''
return self.features.check_with_template('net.fake-gateway', None) or \ return self.features.check_with_template('net.fake-gateway', None) or \
self.netvm.gateway (self.netvm.gateway if self.netvm else None)
@qubes.stateless_property @qubes.stateless_property
def visible_netmask(self): def visible_netmask(self):
'''Netmask as seen by the domain.''' '''Netmask as seen by the domain.'''
return self.features.check_with_template('net.fake-netmask', None) or \ return self.features.check_with_template('net.fake-netmask', None) or \
self.netvm.netmask (self.netvm.netmask if self.netvm else None)
# #
# used in netvms (provides_network=True) # used in netvms (provides_network=True)