vm/net: fix IP address calculation
7 is not the same as 7 bits...
This commit is contained in:
parent
4d6d6c913a
commit
e5daf902b3
@ -143,11 +143,12 @@ class NetVMMixin(qubes.events.Emitter):
|
||||
'''
|
||||
import qubes.vm.dispvm # pylint: disable=redefined-outer-name
|
||||
if isinstance(vm, qubes.vm.dispvm.DispVM):
|
||||
return '10.138.{}.{}'.format((vm.dispid >> 8) & 7, vm.dispid & 7)
|
||||
return '10.138.{}.{}'.format((vm.dispid >> 8) & 0xff,
|
||||
vm.dispid & 0xff)
|
||||
|
||||
# VM technically can get address which ends in '.0'. This currently
|
||||
# does not happen, because qid < 253, but may happen in the future.
|
||||
return '10.137.{}.{}'.format((vm.qid >> 8) & 7, vm.qid & 7)
|
||||
return '10.137.{}.{}'.format((vm.qid >> 8) & 0xff, vm.qid & 0xff)
|
||||
|
||||
@qubes.stateless_property
|
||||
def gateway(self):
|
||||
|
Loading…
Reference in New Issue
Block a user