Revision 26ba9dba 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) |
|
82 | 83 |
|
83 | 84 |
[ipv6] |
84 | 85 |
enable_ipv6 = boolean(default=True) |
... | ... | |
293 | 294 |
rs_queue_num=None, ns_queue_num=None, |
294 | 295 |
dhcp_lease_lifetime=DEFAULT_LEASE_LIFETIME, |
295 | 296 |
dhcp_lease_renewal=DEFAULT_LEASE_RENEWAL, |
297 |
dhcp_domain='', |
|
296 | 298 |
dhcp_server_ip=DHCP_DUMMY_SERVER_IP, dhcp_nameservers=None, |
297 | 299 |
ra_period=DEFAULT_RA_PERIOD, ipv6_nameservers=None): |
298 | 300 |
|
299 | 301 |
self.data_path = data_path |
300 | 302 |
self.lease_lifetime = dhcp_lease_lifetime |
301 | 303 |
self.lease_renewal = dhcp_lease_renewal |
304 |
self.dhcp_domain = dhcp_domain |
|
302 | 305 |
self.dhcp_server_ip = dhcp_server_ip |
303 | 306 |
self.ra_period = ra_period |
304 | 307 |
if dhcp_nameservers is None: |
... | ... | |
558 | 561 |
logging.info("%s from %s on %s", DHCP_TYPES.get(req_type, "UNKNOWN"), |
559 | 562 |
binding.mac, iface) |
560 | 563 |
|
564 |
if self.dhcp_domain: |
|
565 |
domainname = self.dhcp_domain |
|
566 |
else: |
|
567 |
domainname = binding.hostname.split('.', 1)[-1] |
|
568 |
|
|
561 | 569 |
if req_type == DHCPREQUEST and requested_addr != binding.ip: |
562 | 570 |
resp_type = DHCPNAK |
563 | 571 |
logging.info("Sending DHCPNAK to %s on %s: requested %s" |
... | ... | |
569 | 577 |
resp.yiaddr = self.clients[mac].ip |
570 | 578 |
dhcp_options += [ |
571 | 579 |
("hostname", binding.hostname), |
572 |
("domain", binding.hostname.split('.', 1)[-1]),
|
|
580 |
("domain", domainname),
|
|
573 | 581 |
("router", subnet.gw), |
574 | 582 |
("broadcast_address", str(subnet.broadcast)), |
575 | 583 |
("subnet_mask", str(subnet.netmask)), |
... | ... | |
582 | 590 |
resp_type = DHCP_REQRESP[req_type] |
583 | 591 |
dhcp_options += [ |
584 | 592 |
("hostname", binding.hostname), |
585 |
("domain", binding.hostname.split('.', 1)[-1]),
|
|
593 |
("domain", domainname),
|
|
586 | 594 |
] |
587 | 595 |
dhcp_options += [("name_server", x) for x in self.dhcp_nameservers] |
588 | 596 |
|
... | ... | |
735 | 743 |
""" |
736 | 744 |
self.build_config() |
737 | 745 |
|
738 |
# Yes, we are accessing _fd directly, but it's the only way to have a
|
|
746 |
# Yes, we are accessing _fd directly, but it's the only way to have a |
|
739 | 747 |
# single select() loop ;-) |
740 | 748 |
iwfd = self.notifier._fd # pylint: disable=W0212 |
741 | 749 |
|
... | ... | |
883 | 891 |
"dhcp_lease_renewal": config["dhcp"].as_int("lease_renewal"), |
884 | 892 |
"dhcp_server_ip": config["dhcp"]["server_ip"], |
885 | 893 |
"dhcp_nameservers": config["dhcp"]["nameservers"], |
894 |
"dhcp_domain": config["dhcp"]["domain"], |
|
886 | 895 |
}) |
887 | 896 |
|
888 | 897 |
if config["ipv6"].as_bool("enable_ipv6"): |
Also available in: Unified diff