diff --git a/tools/client.py b/tools/client.py index c80e525..0e66137 100644 --- a/tools/client.py +++ b/tools/client.py @@ -134,7 +134,7 @@ class Client(object): def commit_rule(self): - rule = self.find_rule(self._ip_address, self.protocol) + rule = self.find_rule(self.ip_address, self.protocol) if not rule: rule = iptc.Rule() rule.src = self.ip_address diff --git a/tools/storage.py b/tools/storage.py index bef4d9d..7efa443 100644 --- a/tools/storage.py +++ b/tools/storage.py @@ -66,15 +66,15 @@ class StoragePostgres(object): 'enabled, last_packets, last_activity, expires) values ' '(%s, %s, %s, %s, %s, %s, %s, %s) on conflict (client_id, ' 'ip_address, protocol) do update set (enabled, last_packets, ' - 'last_activity) = (EXCLUDED.enabled, EXCLUDED.last_packets, ' - 'EXCLUDED.last_activity)' + 'last_activity, expires) = (EXCLUDED.enabled, EXCLUDED.last_packets, ' + 'EXCLUDED.last_activity, EXCLUDED.expires)' ) self.cur.execute( query, ( client.client_id, client.created, - client._ip_address, + client.ip_address, client.protocol, client.enabled, client.last_packets,