]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Notes about lease queries
authorAlan T. DeKok <aland@freeradius.org>
Thu, 3 Sep 2015 19:13:09 +0000 (15:13 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 3 Sep 2015 19:13:09 +0000 (15:13 -0400)
raddb/sites-available/dhcp

index bfca95a5e08bd40bee12e3069454ed5ffb6f8292..595b1c29acd6ff1bee8478a00771ff774a3fc51a 100644 (file)
@@ -263,6 +263,72 @@ dhcp DHCP-Release {
 }
 
 
+dhcp DHCP-Lease-Query {
+       #  The thing being queried for is implicit
+       #  in the packets.
+
+       # has MAC, asking for IP, etc.
+       if (&DHCP-Client-Hardware-Address) {
+               # look up MAC in database
+       }
+
+       # has IP, asking for MAC, etc.
+       elsif (&DHCP-Your-IP-Address) {
+               # look up IP in database
+       }
+
+       # has host name, asking for IP, MAC, etc.
+       elsif (&DHCP-Client-Identifier) {
+               # look up identifier in database
+       }
+       else {
+               update reply {
+                       &DHCP-Message-Type = DHCP-Lease-Unknown
+               }
+
+               ok
+
+               # stop processing
+               return
+       }
+
+       #
+       #  We presume that the database lookup returns "notfound"
+       #  if it can't find anything.
+       #
+       if (notfound) {
+               update reply {
+                       &DHCP-Message-Type = DHCP-Lease-Unknown
+               }
+               ok
+               return
+       }
+
+       #
+       #       Add more logic here.  Is the lease inactive?
+       #       If so, respond with DHCP-Lease-Unassigned.
+       #
+       #       Otherwise, respond with DHCP-Lease-Active
+       #
+
+       #
+       #       Also be sure to return ALL information about
+       #       the lease.
+       #
+
+       #
+       #       The reply types are:
+       #
+       #       DHCP-Lease-Unknown
+       #       DHCP-Lease-Active
+       #       DHCP-Lease-Unassigned
+       #
+       update reply {
+               &DHCP-Message-Type = DHCP-Lease-Unassigned
+       }
+
+}
+
 }
 
 ######################################################################