chiark / gitweb /
syslog handling: print tracebacks when logging failure objects
[hippotat.git] / hippotatd
index fe10eec..b08ce66 100755 (executable)
--- a/hippotatd
+++ b/hippotatd
@@ -64,7 +64,7 @@ def route(packet, iface, saddr, daddr):
   elif daddr == c.vaddr or daddr not in c.vnetwork:
     lt('inbound')
     queue_inbound(ipif, packet)
-  elif daddr == c.relay:
+  elif daddr == c.vrelay:
     lt('discard relay')
     log_discard(packet, iface, saddr, daddr, 'relay')
   else:
@@ -320,6 +320,9 @@ def process_cfg(_opts, putative_servers, putative_clients):
       c.vrelay = search
       break
 
+  try: c.ifname = cfg.get(c.server, 'ifname_server', raw=True)
+  except NoOptionError: pass
+
   cfg_process_ipif(c,
                    [c.server, 'DEFAULT'],
                    (('local','vaddr'),
@@ -372,6 +375,10 @@ def daemonise():
       elif level == LogLevel.warn             : sl = syslog.LOG_WARNING
       else                                    : sl = syslog.LOG_INFO
       syslog.syslog(sl,m)
+      failure = event.get('log_failure')
+      if failure is not None:
+        for l in failure.getTraceback().split('\n'):
+          syslog.syslog(sl,l)
     glp = twisted.logger.globalLogPublisher
     glp.addObserver(emit)
     log_debug(DBG.INIT, 'starting to log to syslog')