]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set opcode properly, and also hops
authorAlan T. DeKok <aland@freeradius.org>
Mon, 28 May 2018 20:59:56 +0000 (16:59 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 28 May 2018 20:59:56 +0000 (16:59 -0400)
src/modules/proto_dhcpv4/proto_dhcpv4_udp.c

index ce00be8eecdb665702e83ed2f6c259885ad60557..8b528e60c4b44fa3b4278870a5d0e87f95315e8a 100644 (file)
@@ -252,7 +252,10 @@ static ssize_t mod_write(void *instance, void *packet_ctx,
                         */
                        if ((code[2] == FR_DHCP_DISCOVER) ||
                            (code[2] == FR_DHCP_REQUEST)) {
-                               packet->hops++;
+                               packet->opcode = 1; /* client message */
+                               packet->hops = request->hops + 1;
+                       } else {
+                               packet->opcode = 2; /* server message */
                        }
 
                        goto send_reply;
@@ -267,6 +270,8 @@ static ssize_t mod_write(void *instance, void *packet_ctx,
                        return 0;
                }
 
+               packet->opcode = 2; /* server message */
+
                /*
                 *      The original packet requested a broadcast
                 *      reply, and CIADDR is empty, go broadcast the