chiark
/
gitweb
/
~mdw
/
tripe
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
11ab0da
)
svc/conntrack.in: Gather address hacking functions into a new section.
author
Mark Wooding
<mdw@distorted.org.uk>
Thu, 28 Sep 2017 18:20:35 +0000
(19:20 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Thu, 28 Jun 2018 23:29:23 +0000
(
00:29
+0100)
svc/conntrack.in
patch
|
blob
|
blame
|
history
diff --git
a/svc/conntrack.in
b/svc/conntrack.in
index 061d6d76f318e7270da97c50f78467053f08e569..ef042f78b54cd6d457152f48e5a9eb30a2c50db9 100644
(file)
--- a/
svc/conntrack.in
+++ b/
svc/conntrack.in
@@
-94,9
+94,18
@@
def toposort(cmp, things):
if done:
break
if done:
break
+###--------------------------------------------------------------------------
+### Address manipulation.
+
def parse_address(addrstr):
return unpack('>L', S.inet_aton(addrstr))[0]
def parse_address(addrstr):
return unpack('>L', S.inet_aton(addrstr))[0]
+def straddr(a): return a is None and '#<none>' or S.inet_ntoa(pack('>L', a))
+def strmask(m):
+ for i in xrange(33):
+ if m == 0xffffffff ^ ((1 << (32 - i)) - 1): return str(i)
+ return straddr(m)
+
###--------------------------------------------------------------------------
### Parse the configuration file.
###--------------------------------------------------------------------------
### Parse the configuration file.
@@
-197,12
+206,6
@@
class Config (object):
### This will be a configuration file.
CF = None
### This will be a configuration file.
CF = None
-def straddr(a): return a is None and '#<none>' or S.inet_ntoa(pack('>L', a))
-def strmask(m):
- for i in xrange(33):
- if m == 0xffffffff ^ ((1 << (32 - i)) - 1): return str(i)
- return straddr(m)
-
def cmd_showconfig():
T.svcinfo('test-addr=%s' % CF.testaddr)
def cmd_showgroups():
def cmd_showconfig():
T.svcinfo('test-addr=%s' % CF.testaddr)
def cmd_showgroups():