More relay oddness
authorAlan T. DeKok <aland@freeradius.org>
Tue, 23 Sep 2008 13:18:25 +0000 (15:18 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 23 Sep 2008 13:18:25 +0000 (15:18 +0200)
src/lib/dhcp.c

index 6718884..cc78947 100644 (file)
@@ -1134,13 +1134,11 @@ int fr_dhcp_encode(RADIUS_PACKET *packet, RADIUS_PACKET *original)
        if (dhcp->giaddr != htonl(INADDR_ANY)) {
                packet->dst_ipaddr.ipaddr.ip4addr.s_addr = dhcp->giaddr;
 
-               /*
-                *      Relays send FROM the server port, and we're
-                *      supposed to send responses back to that port.
-                *      If the relay sends FROM 68, and expects to see
-                *      the response back TO 67, then it's broken.
-                */
-               packet->dst_port = original->src_port;
+               if (dhcp->giaddr != htonl(INADDR_LOOPBACK)) {
+                       packet->dst_port = original->dst_port;
+               } else {
+                       packet->dst_port = original->src_port; /* debugging */
+               }
 
        } else if (packet->code == PW_DHCP_NAK) {
                packet->dst_ipaddr.ipaddr.ip4addr.s_addr = htonl(INADDR_BROADCAST);