diff options
| author | Michael Brown | 2007-09-11 16:42:17 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-09-11 16:42:17 +0200 |
| commit | 5f6439c828c1de42ba83593040842b30e86d6b29 (patch) | |
| tree | 112970ab2eede1a23f57742a3c60f25fe8371688 /src/net | |
| parent | Force MAC address for testing purposes (diff) | |
| parent | Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe (diff) | |
| download | ipxe-5f6439c828c1de42ba83593040842b30e86d6b29.tar.gz ipxe-5f6439c828c1de42ba83593040842b30e86d6b29.tar.xz ipxe-5f6439c828c1de42ba83593040842b30e86d6b29.zip | |
Merge branch 'master' into 3leaf-rewrite
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/ipv4.c | 7 | ||||
| -rw-r--r-- | src/net/ipv6.c | 9 | ||||
| -rw-r--r-- | src/net/tls.c | 2 | ||||
| -rw-r--r-- | src/net/udp/tftp.c | 11 |
4 files changed, 18 insertions, 11 deletions
diff --git a/src/net/ipv4.c b/src/net/ipv4.c index 35341b3d7..2f50f0e4e 100644 --- a/src/net/ipv4.c +++ b/src/net/ipv4.c @@ -39,10 +39,9 @@ static LIST_HEAD ( frag_buffers ); * @v gateway Gateway address (or @c INADDR_NONE for no gateway) * @ret miniroute Routing table entry, or NULL */ -static struct ipv4_miniroute * add_ipv4_miniroute ( struct net_device *netdev, - struct in_addr address, - struct in_addr netmask, - struct in_addr gateway ) { +static struct ipv4_miniroute * __malloc +add_ipv4_miniroute ( struct net_device *netdev, struct in_addr address, + struct in_addr netmask, struct in_addr gateway ) { struct ipv4_miniroute *miniroute; DBG ( "IPv4 add %s", inet_ntoa ( address ) ); diff --git a/src/net/ipv6.c b/src/net/ipv6.c index a91cb0690..c07ff94cc 100644 --- a/src/net/ipv6.c +++ b/src/net/ipv6.c @@ -52,11 +52,10 @@ static LIST_HEAD ( miniroutes ); * @v gateway Gateway address (or ::0 for no gateway) * @ret miniroute Routing table entry, or NULL */ -static struct ipv6_miniroute * add_ipv6_miniroute ( struct net_device *netdev, - struct in6_addr prefix, - int prefix_len, - struct in6_addr address, - struct in6_addr gateway ) { +static struct ipv6_miniroute * __malloc +add_ipv6_miniroute ( struct net_device *netdev, struct in6_addr prefix, + int prefix_len, struct in6_addr address, + struct in6_addr gateway ) { struct ipv6_miniroute *miniroute; miniroute = malloc ( sizeof ( *miniroute ) ); diff --git a/src/net/tls.c b/src/net/tls.c index 64e44b55d..5c201b32f 100644 --- a/src/net/tls.c +++ b/src/net/tls.c @@ -1044,7 +1044,7 @@ static void tls_hmac ( struct tls_session *tls __unused, * @ret plaintext_len Length of plaintext record * @ret plaintext Allocated plaintext record */ -static void * tls_assemble_stream ( struct tls_session *tls, +static void * __malloc tls_assemble_stream ( struct tls_session *tls, const void *data, size_t len, void *digest, size_t *plaintext_len ) { size_t mac_len = tls->tx_cipherspec.digest->digestsize; diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index 7f1c4ce64..194c533d6 100644 --- a/src/net/udp/tftp.c +++ b/src/net/udp/tftp.c @@ -415,7 +415,7 @@ static int tftp_rx_oack ( struct tftp_request *tftp, void *buf, size_t len ) { static int tftp_rx_data ( struct tftp_request *tftp, struct io_buffer *iobuf ) { struct tftp_data *data = iobuf->data; - unsigned int block; + int block; size_t data_len; int rc; @@ -432,6 +432,14 @@ static int tftp_rx_data ( struct tftp_request *tftp, iob_pull ( iobuf, sizeof ( *data ) ); data_len = iob_len ( iobuf ); + /* Check for correct block */ + if ( block != ( tftp->state + 1 ) ) { + DBGC ( tftp, "TFTP %p received out-of-order block %d " + "(expecting %d)\n", tftp, block, ( tftp->state + 1 ) ); + free_iob ( iobuf ); + return 0; + } + /* Deliver data */ if ( ( rc = xfer_deliver_iob ( &tftp->xfer, iobuf ) ) != 0 ) { DBGC ( tftp, "TFTP %p could not deliver data: %s\n", @@ -645,6 +653,7 @@ int tftp_open ( struct xfer_interface *xfer, struct uri *uri ) { xfer_init ( &tftp->xfer, &tftp_xfer_operations, &tftp->refcnt ); tftp->uri = uri_get ( uri ); xfer_init ( &tftp->socket, &tftp_socket_operations, &tftp->refcnt ); + tftp->blksize = TFTP_DEFAULT_BLKSIZE; tftp->state = -1; tftp->timer.expired = tftp_timer_expired; |
