chiark
/
gitweb
/
~ian
/
hippotat.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
wip
[hippotat.git]
/
hippotat
/
__init__.py
diff --git
a/hippotat/__init__.py
b/hippotat/__init__.py
index 35c87f2e1ce2b494c24da44ca8d7911bfb2a5bac..6286f49bdeae63b1d3a4c1a50b3b95b6de934048 100644
(file)
--- a/
hippotat/__init__.py
+++ b/
hippotat/__init__.py
@@
-37,16
+37,18
@@
class DBG(twisted.python.constants.Names):
INIT = NamedConstant()
QUEUE = NamedConstant()
QUEUE_CTRL = NamedConstant()
INIT = NamedConstant()
QUEUE = NamedConstant()
QUEUE_CTRL = NamedConstant()
+ HTTP_FULL = NamedConstant()
_hex_codec = codecs.getencoder('hex_codec')
log = twisted.logger.Logger()
def log_debug(dflag, msg, idof=None, d=None):
_hex_codec = codecs.getencoder('hex_codec')
log = twisted.logger.Logger()
def log_debug(dflag, msg, idof=None, d=None):
+ #print('---------------->',repr((dflag, msg, idof, d)), file=sys.stderr)
if idof is not None:
msg = '[%d] %s' % (id(idof), msg)
if d is not None:
if idof is not None:
msg = '[%d] %s' % (id(idof), msg)
if d is not None:
- d = d[0:64]
+
#
d = d[0:64]
d = _hex_codec(d)[0].decode('ascii')
msg += ' ' + d
log.info('{dflag} {msgcore}', dflag=dflag, msgcore=msg)
d = _hex_codec(d)[0].decode('ascii')
msg += ' ' + d
log.info('{dflag} {msgcore}', dflag=dflag, msgcore=msg)
@@
-111,9
+113,9
@@
class ConfigResults:
c = ConfigResults()
c = ConfigResults()
-def log_discard(packet, saddr, daddr, why):
+def log_discard(packet,
iface,
saddr, daddr, why):
log_debug(DBG.DROP,
log_debug(DBG.DROP,
- 'discarded packet
%s -> %s (%s)' % (
saddr, daddr, why),
+ 'discarded packet
[%s] %s -> %s: %s' % (iface,
saddr, daddr, why),
d=packet)
#---------- packet parsing ----------
d=packet)
#---------- packet parsing ----------
@@
-184,7
+186,7
@@
class _IpifProcessProtocol(twisted.internet.protocol.ProcessProtocol):
def slip_on_packet(self, packet):
(saddr, daddr) = packet_addrs(packet)
if saddr.is_link_local or daddr.is_link_local:
def slip_on_packet(self, packet):
(saddr, daddr) = packet_addrs(packet)
if saddr.is_link_local or daddr.is_link_local:
- log_discard(packet, saddr, daddr, 'link-local')
+ log_discard(packet,
'ipif',
saddr, daddr, 'link-local')
return
self._router(packet, saddr, daddr)
def processEnded(self, status):
return
self._router(packet, saddr, daddr)
def processEnded(self, status):
@@
-208,6
+210,7
@@
def queue_inbound(packet):
class PacketQueue():
def __init__(self, desc, max_queue_time):
self._desc = desc
class PacketQueue():
def __init__(self, desc, max_queue_time):
self._desc = desc
+ assert(desc + '')
self._max_queue_time = max_queue_time
self._pq = collections.deque() # packets
self._max_queue_time = max_queue_time
self._pq = collections.deque() # packets