Procházet zdrojové kódy

[pxe] Always reconstruct packet for PXENV_GET_CACHED_INFO

Avoid accidentally returning stale packets (e.g. for a previously
attempted network device) by always constructing a fresh DHCP packet.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown před 9 roky
rodič
revize
edf74df4ab
1 změnil soubory, kde provedl 8 přidání a 10 odebrání
  1. 8
    10
      src/arch/i386/interface/pxe/pxe_preboot.c

+ 8
- 10
src/arch/i386/interface/pxe/pxe_preboot.c Zobrazit soubor

@@ -178,18 +178,16 @@ pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO *get_cached_info ) {
178 178
 	}
179 179
 	info = &cached_info[idx];
180 180
 
181
-	/* Construct cached version of packet, if not already constructed. */
182
-	if ( ! info->dhcphdr.op ) {
183
-		/* Construct DHCP packet */
184
-		creator = &pxe_dhcp_packet_creators[idx];
185
-		if ( ( rc = creator->create ( pxe_netdev, info,
186
-					      sizeof ( *info ) ) ) != 0 ) {
187
-			DBGC ( &pxe_netdev, " failed to build packet: %s\n",
188
-			       strerror ( rc ) );
189
-			goto err;
190
-		}
181
+	/* Construct DHCP packet */
182
+	creator = &pxe_dhcp_packet_creators[idx];
183
+	if ( ( rc = creator->create ( pxe_netdev, info,
184
+				      sizeof ( *info ) ) ) != 0 ) {
185
+		DBGC ( &pxe_netdev, " failed to build packet: %s\n",
186
+		       strerror ( rc ) );
187
+		goto err;
191 188
 	}
192 189
 
190
+	/* Copy packet (if applicable) */
193 191
 	len = get_cached_info->BufferSize;
194 192
 	if ( len == 0 ) {
195 193
 		/* Point client at our cached buffer.

Načítá se…
Zrušit
Uložit