Revision feaba806 nfdhcpd

b/nfdhcpd
79 79
server_ip = ip_addr()
80 80
dhcp_queue = integer(min=0, max=65535)
81 81
nameservers = ip_addr_list(family=4)
82
domain = string(default=None)
83

  
84 82

  
85 83
[ipv6]
86 84
enable_ipv6 = boolean(default=True)
......
295 293
                 rs_queue_num=None, ns_queue_num=None,
296 294
                 dhcp_lease_lifetime=DEFAULT_LEASE_LIFETIME,
297 295
                 dhcp_lease_renewal=DEFAULT_LEASE_RENEWAL,
298
                 dhcp_domain='',
299 296
                 dhcp_server_ip=DHCP_DUMMY_SERVER_IP, dhcp_nameservers=None,
300 297
                 ra_period=DEFAULT_RA_PERIOD, ipv6_nameservers=None):
301 298

  
302 299
        self.data_path = data_path
303 300
        self.lease_lifetime = dhcp_lease_lifetime
304 301
        self.lease_renewal = dhcp_lease_renewal
305
        self.dhcp_domain = dhcp_domain
306 302
        self.dhcp_server_ip = dhcp_server_ip
307 303
        self.ra_period = ra_period
308 304
        if dhcp_nameservers is None:
......
562 558
        logging.info("%s from %s on %s", DHCP_TYPES.get(req_type, "UNKNOWN"),
563 559
                     binding.mac, iface)
564 560

  
565
        if self.dhcp_domain:
566
            domainname = self.dhcp_domain
567
        else:
568
            domainname = binding.hostname.split('.', 1)[-1]
569

  
570 561
        if req_type == DHCPREQUEST and requested_addr != binding.ip:
571 562
            resp_type = DHCPNAK
572 563
            logging.info("Sending DHCPNAK to %s on %s: requested %s"
......
578 569
            resp.yiaddr = self.clients[mac].ip
579 570
            dhcp_options += [
580 571
                 ("hostname", binding.hostname),
581
                 ("domain", domainname),
572
                 ("domain", binding.hostname.split('.', 1)[-1]),
582 573
                 ("router", subnet.gw),
583 574
                 ("broadcast_address", str(subnet.broadcast)),
584 575
                 ("subnet_mask", str(subnet.netmask)),
......
591 582
            resp_type = DHCP_REQRESP[req_type]
592 583
            dhcp_options += [
593 584
                 ("hostname", binding.hostname),
594
                 ("domain", domainname),
595

  
585
                 ("domain", binding.hostname.split('.', 1)[-1]),
596 586
            ]
597 587
            dhcp_options += [("name_server", x) for x in self.dhcp_nameservers]
598 588

  
......
893 883
            "dhcp_lease_renewal": config["dhcp"].as_int("lease_renewal"),
894 884
            "dhcp_server_ip": config["dhcp"]["server_ip"],
895 885
            "dhcp_nameservers": config["dhcp"]["nameservers"],
896
            "dhcp_domain": config["dhcp"]["domain"],
897 886
        })
898 887

  
899 888
    if config["ipv6"].as_bool("enable_ipv6"):

Also available in: Unified diff