Browse Source

firewall: start watches before initial load

This should avoid a race condition where we miss an update to QubesDB
that happens right after the initial load, but before the watch start.

Instead, we might now install the same stuff twice - but that's no
problem.
3hhh 2 years ago
parent
commit
795bec8038
1 changed files with 3 additions and 3 deletions
  1. 3 3
      qubesagent/firewall.py

+ 3 - 3
qubesagent/firewall.py

@@ -211,14 +211,14 @@ class FirewallWorker(object):
         self.run_firewall_dir()
         self.run_user_script()
         self.sd_notify('READY=1')
+        self.qdb.watch('/qubes-firewall/')
+        self.qdb.watch('/connected-ips')
+        self.qdb.watch('/connected-ips6')
         # initial load
         for source_addr in self.list_targets():
             self.handle_addr(source_addr)
         self.update_connected_ips(4)
         self.update_connected_ips(6)
-        self.qdb.watch('/qubes-firewall/')
-        self.qdb.watch('/connected-ips')
-        self.qdb.watch('/connected-ips6')
         try:
             for watch_path in iter(self.qdb.read_watch, None):
                 if watch_path == '/connected-ips':