From e5daf902b3e159e242d57b3e5a328296e85ec9ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 17 May 2017 02:14:46 +0200 Subject: [PATCH] vm/net: fix IP address calculation 7 is not the same as 7 bits... --- qubes/vm/mix/net.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qubes/vm/mix/net.py b/qubes/vm/mix/net.py index abf400d5..ad27a86b 100644 --- a/qubes/vm/mix/net.py +++ b/qubes/vm/mix/net.py @@ -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):