chiark / gitweb /
new ipif interpolation
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 21 Mar 2017 00:33:26 +0000 (00:33 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 21 Mar 2017 00:33:26 +0000 (00:33 +0000)
server

diff --git a/server b/server
index 62f5374..a34cc3c 100755 (executable)
--- a/server
+++ b/server
@@ -22,6 +22,7 @@ max_batch_down = 65536
 max_queue_time = 10
 max_request_time = 54
 target_requests_outstanding = 3
+ipif = userv root ipif %(local)s,%(peer)s,%(mtu)s,slip %(rnets)s
 
 [virtual]
 mtu = 1500
@@ -30,7 +31,6 @@ mtu = 1500
 # [relay]
 
 [server]
-ipif = userv root ipif %(host)s,%(relay)s,%(mtu)s,slip %(network)s
 addrs = 127.0.0.1 ::1
 port = 8099
 
@@ -222,6 +222,13 @@ def process_cfg():
       raise ValueError('multiple client cfg sections for %s' % ci)
     clients[ci] = Client(ci, cs)
 
+  for d, s in (('local', 'host'),
+               ('peer','relay'),
+               ('rnets','network')):
+    try: v = getattr(c, s)
+    except KeyError: pass
+    setattr(c, d, v)
+
   print(repr(c))
 
   c.ipif_command = cfg.get('server','ipif', vars=c.__dict__)