MCPcopy Index your code
hub / github.com/sshuttle/sshuttle / ipfw_rule_exists

Function ipfw_rule_exists

sshuttle/methods/ipfw.py:29–44  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

27
28
29def ipfw_rule_exists(n):
30 argv = ['ipfw', 'list', '%d' % n]
31 p = ssubprocess.Popen(argv, stdout=ssubprocess.PIPE, env=get_env())
32
33 found = False
34 for line in p.stdout:
35 if line.startswith(b'%05d ' % n):
36 if 'check-state :sshuttle' not in line:
37 log('non-sshuttle ipfw rule: %r' % line.strip())
38 raise Fatal('non-sshuttle ipfw rule #%d already exists!' % n)
39 found = True
40 break
41 rv = p.wait()
42 if rv:
43 raise Fatal('%r returned %d' % (argv, rv))
44 return found
45
46
47_oldctls = {}

Callers

nothing calls this directly

Calls 3

get_envFunction · 0.90
logFunction · 0.90
FatalClass · 0.90

Tested by

no test coverage detected