Commit cc88cada authored by Ad Schellevis's avatar Ad Schellevis

(captiveportal, new) work in progress script base

parent 518f6cc1
...@@ -139,11 +139,12 @@ class IPFW(object): ...@@ -139,11 +139,12 @@ class IPFW(object):
break break
# add accounting rule # add accounting rule
DEVNULL = open(os.devnull, 'w') if newRuleid != -1:
subprocess.call(['/sbin/ipfw', 'add', 'count','ip','from', address, 'to', 'any'], DEVNULL = open(os.devnull, 'w')
stdout=DEVNULL, stderr=DEVNULL) subprocess.call(['/sbin/ipfw', 'add', str(newRuleid), 'count','ip','from', address, 'to', 'any'],
subprocess.call(['/sbin/ipfw', 'add', 'count','ip','from', 'any', 'to', address], stdout=DEVNULL, stderr=DEVNULL)
stdout=DEVNULL, stderr=DEVNULL) subprocess.call(['/sbin/ipfw', 'add', str(newRuleid), 'count','ip','from', 'any', 'to', address],
stdout=DEVNULL, stderr=DEVNULL)
def del_accounting(self, address): def del_accounting(self, address):
""" remove ip address from accounting rules """ remove ip address from accounting rules
...@@ -153,5 +154,5 @@ class IPFW(object): ...@@ -153,5 +154,5 @@ class IPFW(object):
acc_info = self.list_accounting_info() acc_info = self.list_accounting_info()
if address in acc_info: if address in acc_info:
DEVNULL = open(os.devnull, 'w') DEVNULL = open(os.devnull, 'w')
subprocess.call(['/sbin/ipfw', 'delete', acc_info[address]['rule']], subprocess.call(['/sbin/ipfw', 'delete', str(acc_info[address]['rule'])],
stdout=DEVNULL, stderr=DEVNULL) stdout=DEVNULL, stderr=DEVNULL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment