diff --git a/qubes/vm/mix/net.py b/qubes/vm/mix/net.py index ee9e20a2..4108abcd 100644 --- a/qubes/vm/mix/net.py +++ b/qubes/vm/mix/net.py @@ -368,7 +368,7 @@ class NetVMMixin(qubes.events.Emitter): '''Recursively resolve netvm until no netvm is set, order is important''' netpath = list() - netvm = self.netvm + netvm = self while netvm: netpath.append(netvm) netvm = netvm.netvm @@ -399,14 +399,22 @@ class NetVMMixin(qubes.events.Emitter): # write new forward rules for key, value in vm.firewall.qdb_forward_entries( addr_family=addr_family, type="internal").items(): - print() - # code here - # signal its done + self.untrusted_qdb.write(base_dir + key, value) + ''' + with open("/tmp/log.internal.txt", "a") as f: + f.write("VMName: {}\t\tPath: {}\t\tRule: {}\n".format(self.name, base_dir+key, value)) + ''' for key, value in vm.firewall.qdb_forward_entries( addr_family=addr_family, type="external").items(): - # to fix - for netvm in netpath: - self.untrusted_qdb.write(base_dir + key, value) + current_ip = ip + for netvm in netpath: + base_dir = '/qubes-firewall-forward/{}/'.format(current_ip) + netvm.untrusted_qdb.write(base_dir + key, value) + ''' + with open("/tmp/log.external.txt", "a") as f: + f.write("VMName: {}\t\tPath: {}\t\tRule: {}\n".format(netvm.name, base_dir+key, value)) + ''' + current_ip = netvm.ip # signal its done self.untrusted_qdb.write(base_dir[:-1], '')