v4.0.x - DHCP - incomplete decoding of IPv4 attribute

Chaigneau, Nicolas nicolas.chaigneau at capgemini.com
Mon Feb 19 19:16:55 CET 2018


I know Arran is working on the DHCP code, so maybe it's already known.
Just in case...

In function fr_dhcpv4_packet_decode:

https://github.com/FreeRADIUS/freeradius-server/blob/ce6c2c641194a49b70d6c6e9335f900d5f0a699c/src/protocols/dhcpv4/packet.c#L162

                               case FR_TYPE_IPV4_ADDR:
                                               memcpy(&vp->vp_ipv4addr, p, 4);
                                               break;


I had to add the following two lines after the memcpy:

                                               vp->data.vb_ip.af = AF_INET;
                                               vp->data.vb_ip.prefix = 32;


Otherwise an assertion fails later, e.g.:
CONSISTENCY CHECK FAILED src/lib/util/pair_cursor.c[361]: VALUE_PAIR "DHCP-Gateway-IP-Address" address family is not set correctly for IPv4 address.  Expected 2 got 0
CONSISTENCY CHECK FAILED src/lib/util/pair_cursor.c[361]: VALUE_PAIR "DHCP-Client-IP-Address" address prefix set correctly for IPv4 address.  Expected 32 got 0



Regards,
Nicolas.

This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.


More information about the Freeradius-Devel mailing list