[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/dhcp/FC-4 dhcp-3.0.2-bz167028-ibm-unicast-bootp.patch, NONE, 1.1



Author: jvdias

Update of /cvs/dist/rpms/dhcp/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv22024

Added Files:
	dhcp-3.0.2-bz167028-ibm-unicast-bootp.patch 
Log Message:
fix bug 167028: apply IBM's unicast bootp patch

dhcp-3.0.2-bz167028-ibm-unicast-bootp.patch:
 bootp.c |   13 ++++++++++++-
 dhcp.c  |   38 ++++++++++++++++++++++++++++++--------
 2 files changed, 42 insertions(+), 9 deletions(-)

--- NEW FILE dhcp-3.0.2-bz167028-ibm-unicast-bootp.patch ---
--- dhcp-3.0.3/server/bootp.c.bz167028	2005-05-18 15:54:17.000000000 -0400
+++ dhcp-3.0.3/server/bootp.c	2005-11-15 12:04:29.000000000 -0500
@@ -62,6 +62,7 @@
 	char msgbuf [1024];
 	int ignorep;
 	int peer_has_leases = 0;
+	int norelay = 0;
 
 	if (packet -> raw -> op != BOOTREQUEST)
 		return;
@@ -77,7 +78,7 @@
 		 ? inet_ntoa (packet -> raw -> giaddr)
 		 : packet -> interface -> name);
 
-	if (!locate_network (packet)) {
+	if ((norelay = locate_network (packet)) == 0) {
 		log_info ("%s: network unknown", msgbuf);
 		return;
 	}
@@ -357,6 +358,16 @@
 					      from, &to, &hto);
 			goto out;
 		}
+	} else if (norelay == 2) {
+		to.sin_addr = raw.ciaddr;
+		to.sin_port = remote_port;
+		if (fallback_interface) {
+			result = send_packet (fallback_interface,
+					      (struct packet *)0,
+					      &raw, outgoing.packet_length,
+					      from, &to, &hto);
+			goto out;                
+		}
 
 	/* If it comes from a client that already knows its address
 	   and is not requesting a broadcast response, and we can
--- dhcp-3.0.3/server/dhcp.c.bz167028	2005-11-15 12:00:35.000000000 -0500
+++ dhcp-3.0.3/server/dhcp.c	2005-11-15 12:04:29.000000000 -0500
@@ -3787,6 +3787,7 @@
 	struct data_string data;
 	struct subnet *subnet = (struct subnet *)0;
 	struct option_cache *oc;
+	int norelay = 0;
 
 	/* See if there's a subnet selection option. */
 	oc = lookup_option (&dhcp_universe, packet -> options,
@@ -3796,12 +3797,27 @@
 	   from the interface, if there is one.   If not, fail. */
 	if (!oc && !packet -> raw -> giaddr.s_addr) {
 		if (packet -> interface -> shared_network) {
-			shared_network_reference
-				(&packet -> shared_network,
-				 packet -> interface -> shared_network, MDL);
-			return 1;
-		}
-		return 0;
+			struct in_addr any_addr;
+			any_addr.s_addr = INADDR_ANY;
+			if (!packet -> packet_type &&
+			    memcmp(&packet -> raw -> ciaddr, &any_addr, 4)) {
+				struct iaddr cip;
+				memcpy(cip.iabuf, &packet -> raw -> ciaddr, 4);
+				cip.len = 4;
+				if (!find_grouped_subnet(&subnet,
+				    packet -> interface -> shared_network, 
+				    cip, MDL)) 
+					norelay = 2;
+			}
+			if (!norelay) {
+				shared_network_reference
+					(&packet -> shared_network,
+					 packet -> interface -> shared_network,
+					 MDL);
+				return 1;
+			}
+		} else
+			return 0;
 	}
 
 	/* If there's an SSO, and it's valid, use it to figure out the
@@ -3823,7 +3839,10 @@
 		data_string_forget (&data, MDL);
 	} else {
 		ia.len = 4;
-		memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
+		if (norelay)
+			memcpy (ia.iabuf, &packet -> raw -> ciaddr, 4);
+		else
+			memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
 	}
 
 	/* If we know the subnet on which the IP address lives, use it. */
@@ -3831,7 +3850,10 @@
 		shared_network_reference (&packet -> shared_network,
 					  subnet -> shared_network, MDL);
 		subnet_dereference (&subnet, MDL);
-		return 1;
+		if (norelay)
+			return norelay;
+		else
+			return 1;
 	}
 
 	/* Otherwise, fail. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]