Browse Source

[pxe] Always allow MAX_LL_HEADER_LEN for the link-layer header

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
fb78d086f1
1 changed files with 2 additions and 4 deletions
  1. 2
    4
      src/arch/i386/interface/pxe/pxe_undi.c

+ 2
- 4
src/arch/i386/interface/pxe/pxe_undi.c View File

228
 	struct ll_protocol *ll_protocol = pxe_netdev->ll_protocol;
228
 	struct ll_protocol *ll_protocol = pxe_netdev->ll_protocol;
229
 	char destaddr[MAX_LL_ADDR_LEN];
229
 	char destaddr[MAX_LL_ADDR_LEN];
230
 	const void *ll_dest;
230
 	const void *ll_dest;
231
-	size_t ll_hlen = ll_protocol->ll_header_len;
232
 	size_t len;
231
 	size_t len;
233
 	unsigned int i;
232
 	unsigned int i;
234
 	int rc;
233
 	int rc;
248
 	case P_RARP:	net_protocol = &rarp_protocol;	break;
247
 	case P_RARP:	net_protocol = &rarp_protocol;	break;
249
 	case P_UNKNOWN:
248
 	case P_UNKNOWN:
250
 		net_protocol = NULL;
249
 		net_protocol = NULL;
251
-		ll_hlen = 0;
252
 		break;
250
 		break;
253
 	default:
251
 	default:
254
 		DBG2 ( " %02x invalid protocol\n", undi_transmit->Protocol );
252
 		DBG2 ( " %02x invalid protocol\n", undi_transmit->Protocol );
271
 	}
269
 	}
272
 
270
 
273
 	/* Allocate and fill I/O buffer */
271
 	/* Allocate and fill I/O buffer */
274
-	iobuf = alloc_iob ( ll_hlen + len );
272
+	iobuf = alloc_iob ( MAX_LL_HEADER_LEN + len );
275
 	if ( ! iobuf ) {
273
 	if ( ! iobuf ) {
276
 		DBG2 ( " could not allocate iobuf\n" );
274
 		DBG2 ( " could not allocate iobuf\n" );
277
 		undi_transmit->Status = PXENV_STATUS_OUT_OF_RESOURCES;
275
 		undi_transmit->Status = PXENV_STATUS_OUT_OF_RESOURCES;
278
 		return PXENV_EXIT_FAILURE;
276
 		return PXENV_EXIT_FAILURE;
279
 	}
277
 	}
280
-	iob_reserve ( iobuf, ll_hlen );
278
+	iob_reserve ( iobuf, MAX_LL_HEADER_LEN );
281
 	copy_from_real ( iob_put ( iobuf, tbd.ImmedLength ), tbd.Xmit.segment,
279
 	copy_from_real ( iob_put ( iobuf, tbd.ImmedLength ), tbd.Xmit.segment,
282
 			 tbd.Xmit.offset, tbd.ImmedLength );
280
 			 tbd.Xmit.offset, tbd.ImmedLength );
283
 	for ( i = 0 ; i < tbd.DataBlkCount ; i++ ) {
281
 	for ( i = 0 ; i < tbd.DataBlkCount ; i++ ) {

Loading…
Cancel
Save