Andrew Boyson / net

Dependents:   oldheating gps motorhome heating

Revision:
174:60e5ab296671
Parent:
160:6a1d1d368f80
Child:
178:52714fef5ca1
--- a/udp/dhcp/dhcp.c	Wed Dec 23 09:52:47 2020 +0000
+++ b/udp/dhcp/dhcp.c	Wed Dec 23 19:43:09 2020 +0000
@@ -58,8 +58,12 @@
 char     DhcpHostName  [DNS_MAX_LABEL_LENGTH+1];
 
 bool DhcpIpNeedsToBeRouted(uint32_t ip)
-{
-    return (ip & DhcpSubnetMask) != (DhcpBroadcastIp & DhcpSubnetMask);
+{   
+    if ((ip & 0x000000FF) == 0xFF) return false; //Broadcast 255.xxx.xxx.xxx
+    if ((ip & 0x000000FF) == 0xE0) return false; //Multicast 224.xxx.xxx.xxx
+    if (ip == (DhcpLocalIp | 0xFF000000)) return false; //Local broadcast ip == 192.168.0.255
+    
+    return (ip & DhcpSubnetMask) != (DhcpLocalIp & DhcpSubnetMask); //ip != 192.168.0.xxx
 }
 
 static uint32_t readOption32(char** pp)