]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Build without UDPFROMTO
authorAlan T. DeKok <aland@freeradius.org>
Thu, 17 Nov 2011 16:26:40 +0000 (17:26 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 17 Nov 2011 16:26:40 +0000 (17:26 +0100)
If it's defined, we do more sanity checks.  If it's not
defined, we might behave weirdly if DHCP servers on the network
are broken

src/main/dhcpd.c

index 402dd5f288d4cc1285fe3cd9bc4b3fc61f7bec55..3f6325cf4c70e589898ddd1cb8e9804b99650c8e 100644 (file)
@@ -148,21 +148,21 @@ static int dhcprelay_process_server_reply(REQUEST *request)
 
        sock = request->listener->data;
 
+#ifdef WITH_UDPFROMTO
        /*
-        * Check that packet is for us.
+        *      Check that packet is for us by looking at the
+        *      DHCP-Gateway-IP-Address.
         */
-       vp = pairfind(request->packet->vps, 266, DHCP_MAGIC_VENDOR); /* DHCP-Gateway-IP-Address */
+       vp = pairfind(request->packet->vps, 266, DHCP_MAGIC_VENDOR);
        rad_assert(vp != NULL);
 
-#ifndef WITH_UDPFROMTO
-#error "DHCP as a Relay requires WITH_UDPFROMTO compilation flag"
-#endif
        /* --with-udpfromto is needed just for the following test */
        if (!vp || vp->vp_ipaddr != request->packet->dst_ipaddr.ipaddr.ip4addr.s_addr) {
                DEBUG("DHCP: Packet received from server was not for us (was for 0x%x). Discarding packet",
                    ntohl(request->packet->dst_ipaddr.ipaddr.ip4addr.s_addr));
                return 1;
        }
+#endif
 
        /* set SRC ipaddr/port to the listener ipaddr/port */
        request->packet->src_ipaddr.af = AF_INET;