chiark / gitweb /
mtu: Add mtu parameter to SlipStreamDecoder and start_ipif
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 18 Jun 2019 17:40:29 +0000 (18:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 18 Jun 2019 17:40:29 +0000 (18:40 +0100)
These don't take a config, so we must pass this as a parameter.
Change all call sites.  Not used yet so no functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
hippotat
hippotatd
hippotatlib/__init__.py

index 6aa3121c7ad68a72367930015817a9d91955e460..d7a4daa12b03e55a19cbfc8afff8b6b2d92b242d 100755 (executable)
--- a/hippotat
+++ b/hippotat
@@ -55,7 +55,8 @@ class ResponseConsumer(GeneralResponseConsumer):
   def __init__(self, cl, req, resp):
     super().__init__(cl, req, resp, 'RC')
     ssddesc = '[%s] %s' % (id(req), self._desc)
-    self._ssd = SlipStreamDecoder(ssddesc, partial(queue_inbound, cl.ipif))
+    self._ssd = SlipStreamDecoder(ssddesc, partial(queue_inbound, cl.ipif),
+                                  cl.c.mtu)
     self._log(DBG.HTTP_CTRL, '__init__')
 
   def dataReceived(self, data):
@@ -302,7 +303,7 @@ common_startup(process_cfg)
 
 for cl in clients:
   cl.start()
-  cl.ipif = start_ipif(cl.c.ipif_command, cl.outbound)
+  cl.ipif = start_ipif(cl.c.ipif_command, cl.outbound, cl.c.mtu)
   cl.check_outbound()
 
 common_run()
index 05c51bcb58a1c57a682221ad9f5873364a19e5d4..e5e01e27c92cedb59811812767002fe807c5aa91 100755 (executable)
--- a/hippotatd
+++ b/hippotatd
@@ -475,5 +475,7 @@ common_startup(process_cfg)
 catch_termination()
 start_http()
 daemonise()
-ipif = start_ipif(c.ipif_command, (lambda p,s,d: route(p,"[ipif]",s,d)))
+ipif = start_ipif(c.ipif_command,
+                  (lambda p,s,d: route(p,"[ipif]",s,d)),
+                  c.mtu)
 common_run()
index 6c60eefc9cd410453d741ab047db0041ec00b099..6423ba346f77fbdc3d5ce332dcc2eb295177f648 100644 (file)
@@ -228,7 +228,7 @@ def ipnetwork(input):
 #---------- ipif (SLIP) subprocess ----------
 
 class SlipStreamDecoder():
-  def __init__(self, desc, on_packet):
+  def __init__(self, desc, on_packet, mtu):
     self._buffer = b''
     self._on_packet = on_packet
     self._desc = desc
@@ -261,9 +261,9 @@ class SlipStreamDecoder():
     self._maybe_packet(packets[0])
 
 class _IpifProcessProtocol(twisted.internet.protocol.ProcessProtocol):
-  def __init__(self, router):
+  def __init__(self, router, mtu):
     self._router = router
-    self._decoder = SlipStreamDecoder('ipif', self.slip_on_packet)
+    self._decoder = SlipStreamDecoder('ipif', self.slip_on_packet, mtu)
   def connectionMade(self): pass
   def outReceived(self, data):
     self._decoder.inputdata(data)
@@ -276,8 +276,8 @@ class _IpifProcessProtocol(twisted.internet.protocol.ProcessProtocol):
   def processEnded(self, status):
     status.raiseException()
 
-def start_ipif(command, router):
-  ipif = _IpifProcessProtocol(router)
+def start_ipif(command, router, mtu):
+  ipif = _IpifProcessProtocol(router, mtu)
   reactor.spawnProcess(ipif,
                        '/bin/sh',['sh','-xc', command],
                        childFDs={0:'w', 1:'r', 2:2},