dhcp server - some patches

Haralds Ulmanis ezh at telcobalt.lv
Mon Jun 23 02:18:00 CEST 2008


Sorry, i don't know (havn't read maybe :) ) how to submit patches.
I'll paste here
First one ... allows receive DHCP-Inform messages.

--- dhcp.c      2008-06-23 02:46:17.000000000 +0300
+++ dhcp_new.c  2008-06-23 02:45:26.000000000 +0300
@@ -190,7 +190,7 @@
        if ((packet->data[240] != 53) ||
            (packet->data[241] != 1) ||
            (packet->data[242] == 0) ||
-           (packet->data[242] >= 8)) {
+           (packet->data[242] > 8)) {
                fprintf(stderr, "Unknown, or badly formatted DHCP packet\n");
                rad_free(&packet);
                return NULL;


Second one ... patches for updating reply->code correctly depending on modules 
answer(last DHCP-Message-Type update will be in action). Actualy client 
must!!! supply in some update section DHCP-Message-Type. 
Otherwise i think no reply at all(not tested) :) .
And i think there no need to respond with NAK in reject, fail and other cases 
(and DECLINE response is client side only). There is no need for that garbage 
traffic. If module fails then fails. NAK message to client will not help in 
this case :) Or maybe i don't want to respond at all (ignore) :)

--- dhcpd.c     2008-06-23 02:38:57.000000000 +0300
+++ dhcpd_new.c 2008-06-23 02:43:19.000000000 +0300
@@ -46,17 +46,13 @@
        switch (rcode) {
        case RLM_MODULE_OK:
        case RLM_MODULE_UPDATED:
-               if (request->packet->code == (PW_DHCP_DISCOVER)) {
-                       request->reply->code = PW_DHCP_OFFER;
-                       break;
-
-               } else if (request->packet->code == PW_DHCP_REQUEST) {
-                       request->reply->code = PW_DHCP_ACK;
-                       break;
-               }
-
-               /* FALL-THROUGH */
+               vp = pairfind(request->reply->vps, DHCP2ATTR(53));
+               if (vp) {
+                   request->reply->code = vp->vp_integer + PW_DHCP_OFFSET;
+                   break;
+               }

+       break; /* no DHCP-Message-Type in reply, maybe other modules will 
update.*/
        default:
        case RLM_MODULE_REJECT:
        case RLM_MODULE_FAIL:



More information about the Freeradius-Users mailing list