From: Alan T. DeKok Date: Thu, 17 Nov 2011 16:26:40 +0000 (+0100) Subject: Build without UDPFROMTO X-Git-Tag: release_3_0_0_beta0~497 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f731d51a2c899aa750e8640f8c87759d3732eee0;p=thirdparty%2Ffreeradius-server.git Build without UDPFROMTO 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 --- diff --git a/src/main/dhcpd.c b/src/main/dhcpd.c index 402dd5f288d..3f6325cf4c7 100644 --- a/src/main/dhcpd.c +++ b/src/main/dhcpd.c @@ -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;