2 # ldd - DNS implementation in Python
3 # Copyright (C) 2006 Fredrik Tolf <fredrik@dolda2000.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 from ldd import server
30 cfname = "/etc/lddd/conf"
33 opts, args = getopt.getopt(sys.argv[1:], "ndc:p:")
36 logging.basicConfig(level = logging.DEBUG)
45 logger = logging.getLogger("ldd.daemon")
47 def diehandler(signum, frame):
51 for sig in [getattr(signal, "SIG" + s) for s in ["INT", "TERM"]]:
52 signal.signal(sig, diehandler)
54 srv = server.dnsserver()
56 cf = open(cfname, "r")
57 cmod = imp.load_module("servconf", cf, cfname, ("", "r", imp.PY_SOURCE))
61 if(len(srv.sockets) < 1):
62 sk = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
64 srv.addsock(socket.AF_INET6, sk)
65 logger.info("config OK, starting server")
77 logger.info("terminating")