+###--------------------------------------------------------------------------
+### Commands: check
+
+def cmd_check(args):
+ now = T.time()
+ thresh = int(conf['kx-warn-days']) * 86400
+ for krf in ['master', 'keyring.pub']:
+ if not OS.path.exists(krf): continue
+ kr = C.KeyFile(krf)
+ for k in kr.itervalues():
+ if k.exptime == C.KEXP_FOREVER: continue
+ elif k.exptime == C.KEXP_EXPIRE: left = -1
+ else: left = k.exptime - now
+ if left < 0:
+ print "key `%s' HAS EXPIRED" % k.tag
+ elif left < thresh:
+ if left >= 86400: n, u, uu = left // 86400, 'day', 'days'
+ else: n, u, uu = left // 3600, 'hour', 'hours'
+ print "key `%s' EXPIRES in %d %s" % (k.tag, n, n == 1 and u or uu)
+
+###--------------------------------------------------------------------------
+### Commands: mtu
+
+def cmd_mtu(args):
+ mtu, = (lambda mtu = '1500': (mtu,))(*args)
+ mtu = int(mtu)
+
+ blksz = C.gcciphers[conf['cipher']].blksz
+
+ index = conf['mac'].find('/')
+ if index == -1:
+ tagsz = C.gcmacs[conf['mac']].tagsz
+ else:
+ tagsz = int(conf['mac'][index + 1:])/8
+
+ mtu -= 20 # Minimum IP header
+ mtu -= 8 # UDP header
+ mtu -= 1 # TrIPE packet type octet
+ mtu -= tagsz # MAC tag
+ mtu -= 4 # Sequence number
+ mtu -= blksz # Initialization vector
+
+ print mtu
+