def handleKilling(signal, frame):
dbgLog(LOG_INFO, "SIG " + str(signal) + " caught, exiting")
if LOG_OUTPUT == 'file':
LOG_HANDLE.close()
# Kill all timer threads
for thr in threading.enumerate():
if isinstance(thr, threading._Timer):
try:
thr.cancel()
except:
pass
# Clean up iptables
ipt('-D FORWARD -j ' + IPT_CHAIN)
subChains = re.findall(re.compile(IPT_CHAIN + '_[a-z,0-9]{20}'), ipt('-L ' + IPT_CHAIN))
ipt('-F ' + IPT_CHAIN)
for chain in subChains:
ipt('-F ' + chain)
ipt('-X ' + chain)
ipt('-X ' + IPT_CHAIN)
if IP6_SUPPORT:
ipt6('-D FORWARD -j ' + IPT_CHAIN)
ipt6('-F ' + IPT_CHAIN)
for chain in subChains:
ipt6('-F ' + chain)
ipt6('-X ' + chain)
ipt6('-X ' + IPT_CHAIN)
sys.exit(0)
# Logs message to LOG_FNAME or tty
评论列表
文章目录