TXID mismatch between DHCP Request-Offer (devel version)

Chinnapaiyan, Nagamani Nagamani.Chinnapaiyan at viasat.com
Thu Nov 22 14:54:17 CET 2018


It works after changing the code in my local repo... Thanks... We are storing TXID as it is(without ntohl). But while sending we are doing htonl. Corrected that also.
# git diff
diff --git a/src/modules/proto_dhcpv4/proto_dhcpv4.c b/src/modules/proto_dhcpv4/proto_dhcpv4.c
index 465a3ea..3a80a8f 100644
--- a/src/modules/proto_dhcpv4/proto_dhcpv4.c
+++ b/src/modules/proto_dhcpv4/proto_dhcpv4.c
@@ -416,7 +416,7 @@ static ssize_t mod_encode(void const *instance, REQUEST *request, uint8_t *buffe
        }
        data_len = fr_dhcpv4_encode(buffer, buffer_len,
-                                   request->reply->code, original->xid, request->reply->vps);
+                                   request->reply->code, ntohl(original->xid), request->reply->vps);
        if (data_len < 0) {
                RPEDEBUG("Failed encoding DHCPV4 reply");
                return -1;
diff --git a/src/protocols/dhcpv4/packet.c b/src/protocols/dhcpv4/packet.c
index 5460041..38790f9 100644
--- a/src/protocols/dhcpv4/packet.c
+++ b/src/protocols/dhcpv4/packet.c
@@ -218,6 +218,12 @@ int fr_dhcpv4_packet_decode(RADIUS_PACKET *packet)
                        }
                        p += len;
                }
+//Decode message type from the option.
+VALUE_PAIR *message_type = NULL;
+message_type = fr_pair_find_by_da(head, attr_dhcp_message_type, TAG_ANY);
+if(message_type) {
+packet->code = message_type->vp_uint8;
+}
                /*
                 *      If option Overload is present in the 'options' field, then fields 'file' and/or 'sname'

Regards,
Nagamani Chinnapaiyan



More information about the Freeradius-Users mailing list