mirror of
https://github.com/Rudd-O/qubes-network-server.git
synced 2025-06-06 18:08:33 +02:00
Do not run spurious commands that are empty.
This commit is contained in:
parent
7cdbfb43b6
commit
8f66a0c5c1
@ -281,12 +281,11 @@ class QubesVm(OriginalQubesVm):
|
||||
def _add(self, ip, dev, netmask, typ):
|
||||
netmask = sum([bin(int(x)).count('1') for x in netmask.split('.')])
|
||||
dev = dev.replace("+", "0")
|
||||
text = self.addrule
|
||||
text = ""
|
||||
if typ == "forward":
|
||||
text += "addfwrules %s/%s\n" % (pipes.quote(ip), netmask)
|
||||
elif typ == "postrouting":
|
||||
text += "addprrules %s/%s %s\n" % (pipes.quote(ip), netmask, pipes.quote(dev))
|
||||
self.addrule = ""
|
||||
if not self.rules:
|
||||
self.rules = []
|
||||
self.rules.append(text)
|
||||
@ -299,8 +298,8 @@ class QubesVm(OriginalQubesVm):
|
||||
|
||||
def commit(self):
|
||||
if not self.rules:
|
||||
return self.addrule + "\ncommitrules\n"
|
||||
return "\n".join(self.rules) + "\ncommitrules\n"
|
||||
return ""
|
||||
return self.addrule + "\n".join(self.rules) + "\ncommitrules\n"
|
||||
|
||||
programs = []
|
||||
staticipvms = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user