]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Don't encode giaddr on server messages
authorAlan T. DeKok <aland@freeradius.org>
Mon, 4 Mar 2013 16:00:58 +0000 (11:00 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 4 Mar 2013 16:00:58 +0000 (11:00 -0500)
It does nothing other than fingerpint FR as a DHCP server.
It's supposed to be zero in server packets

src/lib/dhcp.c

index dc9cb734a8010e6d9b7405cc0c537fc6d9e92e51..30a489965d9e20eacbf77c028fa66641e5227e16 100644 (file)
@@ -1201,8 +1201,14 @@ int fr_dhcp_encode(RADIUS_PACKET *packet)
        memcpy(p, &lvalue, 4);
        p += 4;
 
-       /* DHCP-Gateway-IP-Address */
-       if ((vp = pairfind(packet->vps, DHCP2ATTR(266)))) {
+       /*
+        *      DHCP-Gateway-IP-Address
+        *
+        *      It's only sent in client messages.  For responses from
+        *      the server, it is always zero.
+        */
+       if ((packet->data[0] == 1) &&
+           (vp = pairfind(packet->vps, DHCP2ATTR(266)))) {
                lvalue = vp->vp_ipaddr;
        } else {
                lvalue = htonl(INADDR_ANY);