david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

I have no idea how this ever worked before.

This commit is contained in:
Michael Brown 2006-05-27 13:43:56 +00:00
parent 6c50564724
commit 69b1f24a97
1 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,6 @@
#include <string.h> #include <string.h>
#include <stdint.h> #include <stdint.h>
#include <errno.h>
#include <byteswap.h> #include <byteswap.h>
#include <vsprintf.h> #include <vsprintf.h>
#include <gpxe/in.h> #include <gpxe/in.h>
@ -24,6 +25,8 @@
* *
*/ */
struct net_protocol ipv4_protocol;
/** An IPv4 routing table entry */ /** An IPv4 routing table entry */
struct ipv4_route { struct ipv4_route {
/** Network address */ /** Network address */
@ -156,16 +159,18 @@ static int ipv4_rx ( struct pk_buff *pkb ) {
*/ */
uip_len = pkb_len ( pkb ); uip_len = pkb_len ( pkb );
memcpy ( uip_buf, pkb->data, uip_len ); memcpy ( uip_buf, pkb->data, uip_len );
free_pkb ( pkb );
/* Hand to uIP for processing */ /* Hand to uIP for processing */
uip_input (); uip_input ();
if ( uip_len > 0 ) { if ( uip_len > 0 ) {
pkb_empty ( pkb ); pkb = alloc_pkb ( MAX_LL_HEADER_LEN + uip_len );
pkb_put ( pkb, uip_len ); if ( ! pkb )
memcpy ( pkb->data, uip_buf, uip_len ); return -ENOMEM;
pkb->net_protocol = &ipv4_protocol;
pkb_reserve ( pkb, MAX_LL_HEADER_LEN );
memcpy ( pkb_put ( pkb, uip_len ), uip_buf, uip_len );
net_transmit ( pkb ); net_transmit ( pkb );
} else {
free_pkb ( pkb );
} }
return 0; return 0;
} }