Project

General

Profile

Actions

Bug #837

closed

dhcpleases still not starting at boot time

Added by Marcus Brown over 13 years ago. Updated over 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
08/22/2010
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.0
Affected Architecture:

Description

We have a problem with the order of operations in the rc.bootup script
with respect to getting the dhcpleases program started.

From my system log on NanoBSD snapshot from Aug 22.

Aug 22 23:09:43 dhcpleases: lease file nees to exist before starting dhcpleases
Aug 22 16:09:44 php: : The command '/usr/local/sbin/dhcpleases -l
/var/dhcpd/var/db/dhcpd.leases -d home -p /var/run/dnsmasq.pid -h
/var/etc/hosts' returned exit code '1', the output was 'lease file
nees to exist before starting dhcpleases: No such file or directory'

Aug 22 23:09:44 dnsmasq31344: started, version 2.55 cachesize 10000
Aug 22 23:09:44 dnsmasq31344: compile time options: no-IPv6
GNU-getopt no-DBus I18N DHCP TFTP

Aug 22 23:09:48 dhcpd: Internet Systems Consortium DHCP Server V3.0.7
Aug 22 23:09:48 dhcpd: Copyright 2004-2008 Internet Systems Consortium.
Aug 22 23:09:48 dhcpd: All rights reserved.
Aug 22 23:09:48 dhcpd: For info, please visit http://www.isc.org/sw/dhcp/

*
the rc.bootup file calls system_hosts_generate() (which calls the
dhcpleases program) at line 202 and 229 of the rc.bootup file

/* re-make hosts file after configuring interfaces */
system_hosts_generate();

but the DHCP service is started at line 338

/* start DHCP service */
services_dhcpd_configure();

So, the dhcpleases program always fails to start at bootup because the
dhcp.leases file doesn't exist yet. I don't want to mess with the
bootup procedure because I don't feel that I know the considerations
and consequences of the booting order of services.

I do know that at lease one user has requested that the DHCP service
be started earlier in the bootup process, and I think that's a good
idea too.

Is there a good reason it is called near the end of the boot process?

However, we do need to do something different to get the dhcpleases
program started. Maybe the simplest thing to do is break the
dhcpleases start code out of the system_hosts_generate() into it's own
function so it can be called in rc.bootup after dhcp is started. ???

Actions #1

Updated by Chris Buechler over 13 years ago

  • Target version set to 2.0
  • Affected Version set to 2.0
Actions #2

Updated by Ermal Luçi over 13 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #3

Updated by Marcus Brown over 13 years ago

I've updated my testing box with these changes, and I still don't see dhcpleases starting. There's no error now, so thats good. I put some logging statements in the code, and it appears that it doesn't get past the
if(isset($config['dnsmasq']['regdhcp'])) check. I can't understand why.

In addition, I discovered that the services_dnsmasq_configure() function ( called in rc.bootup ) calls the system_hosts_generate function, so there's no need to break dhcpleases into a separate function and call it from rc.bootup separately.

from rc.bootup:

/* start DHCP service */
services_dhcpd_configure();

/* start dnsmasq service */
services_dnsmasq_configure();

Actions #4

Updated by Marcus Brown over 13 years ago

Okay, works now with changes I just commited.

Actions #5

Updated by Marcus Brown over 13 years ago

Okay, it starts at boot time and populates the /var/etc/hosts files with local host names properly. e.g. . . .

[2.0-BETA4][]/root(2): cat /var/etc/hosts
127.0.0.1 localhost localhost.home
192.168.5.1 pfsense.home pfsense
192.168.5.236 MiPod.home MiPod # dynamic entry from dhcpd.leases
192.168.5.235 mmac.home mmac # dynamic entry from dhcpd.leases
192.168.5.239 iPhone.home -iPhone # dynamic entry from dhcpd.leases
192.168.5.238 DiskStation.home DiskStation # dynamic entry from dhcpd.leases
192.168.5.231 amac.home amac # dynamic entry from dhcpd.leases
192.168.5.232 DNAS.home DNAS # dynamic entry from dhcpd.leases

However, if you go to Services -> DNS Forwarder and Save again you get this. Not really sure if this is a serious bug of not. Just FYI.

[2.0-BETA4][]/root(3): cat /var/etc/hosts
127.0.0.1 localhost localhost.home
192.168.5.1 pfsense.home pfsense
192.168.5.236 MiPod.home MiPod # dynamic entry from dhcpd.leases
192.168.5.235 mmac.home mmac # dynamic entry from dhcpd.leases
192.168.5.239 iPhone.home iPhone # dynamic entry from dhcpd.leases
192.168.5.238 DiskStation.home DiskStation # dynamic entry from dhcpd.leases
192.168.5.231 amac.home amac # dynamic entry from dhcpd.leases
192.168.5.232 DNAS.home DNAS # dynamic entry from dhcpd.leases
192.168.5.235 mmac.home mmac # dynamic entry from dhcpd.leases
192.168.5.239 iPhone.home iPhone # dynamic entry from dhcpd.leases
192.168.5.238 DiskStation.home DiskStation # dynamic entry from dhcpd.leases
192.168.5.231 amac.home amac # dynamic entry from dhcpd.leases
192.168.5.236 MiPod.home MiPod # dynamic entry from dhcpd.leases
192.168.5.232 DNAS.home DNAS # dynamic entry from dhcpd.leases
[2.0-BETA4][]/root(4):

Actions #6

Updated by Ermal Luçi over 13 years ago

I would not consider it critical because behaviour is the same.
that is expected on restart.

Actions #7

Updated by Marcus Brown over 13 years ago

This is resolved.

Actions #8

Updated by Chris Buechler over 13 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF