Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Dhcpleases: bad name in /var/dhcpd/var/db/dhcpd.leases

    Scheduled Pinned Locked Moved DHCP and DNS
    8 Posts 7 Posters 8.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sensemann
      last edited by

      Hello,

      I get a lot of times this in my log:

      dhcpleases: bad name in /var/dhcpd/var/db/dhcpd.leases

      How can I fix this?

      Cheers!

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Look at the hostnames that show up under Status > DHCP Leases. Odds are something has one that is not valid. Find it, fix the hostname. The rest will sort itself out.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • B
          botsug
          last edited by

          I saw the list… so many.... how do i know what to find and fix? Thanks

          1 Reply Last reply Reply Quote 0
          • B
            brasilnut
            last edited by

            @botsug:

            I saw the list… so many.... how do i know what to find and fix? Thanks

            Did anyone reply to you?
            I have the same issue.
            There is nothing obviously wrong, as my lease  names seem to be okay.
            Is there a document that states what is valid for a lease name?

            1 Reply Last reply Reply Quote 0
            • H
              huzbub
              last edited by

              Same trouble and is associated with another error as follows

              
              Last 50 General Log Entries. (Maximum 50)
              Time	Process	PID	Message
              Sep 17 00:34:22	dhcpleases		Could not deliver signal HUP to process because its pidfile (/var/run/dnsmasq.pid) does not exist, No such file or directory.
              Sep 17 00:36:37	dhcpleases		bad name in /var/dhcpd/var/db/dhcpd.leases
              
              

              To see content of these files, from the GUI go to Diagnostics/Edit File and load
              /var/dhcpd/var/db/dhcpd.leases~
              /var/dhcpd/var/db/dhcpd.leases

              Can view / Edit contents.  I don't know what to look for in there so I'm just looking so far!

              Found some hits about issues with unbound but nothing to help with troubleshooting / resolution.  Will keep rooting around in the forums but will come back here to update too if I have any success.

              Please help.

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

                "Use the source, Luke" - Obi WAN Code-obi

                								} else if (!canonicalise(hostname)) {
                									if (foreground)
                										printf("bad name(%s) in %s\n", hostname, leasefile);
                
                
                canonicalise(char *s) {
                [...]
                		else if (!legal_char(c) || (++dotgap > MAXLABEL))
                			return (0);
                
                
                static int
                legal_char(char c) {
                	if ((c >= 'A' && c <= 'Z') ||
                	    (c >= 'a' && c <= 'z') ||
                	    (c >= '0' && c <= '9') ||
                	    c == '-' || c == '/' || c == '_' || c == ' ')
                		return (1);
                	return (0);
                }
                
                

                So that routine will print that it's a bad name if any character is in the hostname that is not in the list it checks. It allows A-Z, a-z, 0-9, '-', '/', '_'. and ' ' and nothing else.

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • A
                  avvid
                  last edited by

                  I have the same problem, but upon inspection there are NO illegal characters at all.
                  The only thing 'weird' is that some of my appliances or boxes (ie: Sling media, Playstation, etc.) don't seem to have a hostname in the DHCP leases screen, it's empty.

                  Now, when I do a network scan, they certain pop up.  But I'm wondering if the blank hostname is producing the issue?  I also have the DNS responder running on the same box.

                  1 Reply Last reply Reply Quote 0
                  • R
                    Ronski
                    last edited by

                    I'm also getting the same error as the OP, and looking at my host names one of them is HS110(UK). So it's the brackets causing the issue, but I can't change the host name on the device. I've tried adding a static IP and giving it a different host name but it still uses the one with brackets.

                    Is there anyway around this?

                    Also, just a thought but if a particular host name is causing that error to be added, would it not be a good idea to add the actual host name to the error? Although looking at the code @jimp posted it looks like the host name should be in the error, but it's not??? Unless of course that codes from a newer version than mine (2.3.2-RELEASE-p1).

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.