From 6f0eca14007d8d2c06dea9482adc3a0bd034fdb0 Mon Sep 17 00:00:00 2001 From: Holger Lubitz Date: Mon, 20 Aug 2007 20:30:11 +0200 Subject: use malloc attribute --- src/net/ipv4.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/net') 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 ) ); -- cgit v1.2.3-55-g7522 From bc9f960b66f40479153dfe632aff286f1d61d7ff Mon Sep 17 00:00:00 2001 From: Holger Lubitz Date: Mon, 20 Aug 2007 20:30:17 +0200 Subject: use malloc attribute --- src/net/ipv6.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/net') diff --git a/src/net/ipv6.c b/src/net/ipv6.c index 3b7429b86..c228f09c4 100644 --- a/src/net/ipv6.c +++ b/src/net/ipv6.c @@ -55,11 +55,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 ) ); -- cgit v1.2.3-55-g7522 From f92096d1800f3d9ec7e90cc9bb0e0874569fab50 Mon Sep 17 00:00:00 2001 From: Holger Lubitz Date: Mon, 20 Aug 2007 20:30:24 +0200 Subject: use malloc attribute --- src/net/tls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/net') 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; -- cgit v1.2.3-55-g7522 From 14e1d3cc4d7b7894fe5f8ed19329776cc79cf24e Mon Sep 17 00:00:00 2001 From: Marty Connor Date: Thu, 30 Aug 2007 13:51:38 -0400 Subject: TFTP default blocksize fix from Vampyre --- src/net/udp/tftp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/net') diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index 7f1c4ce64..6c1c51b01 100644 --- a/src/net/udp/tftp.c +++ b/src/net/udp/tftp.c @@ -647,6 +647,7 @@ int tftp_open ( struct xfer_interface *xfer, struct uri *uri ) { xfer_init ( &tftp->socket, &tftp_socket_operations, &tftp->refcnt ); tftp->state = -1; tftp->timer.expired = tftp_timer_expired; + tftp->blksize = TFTP_DEFAULT_BLKSIZE; /* Open socket */ memset ( &server, 0, sizeof ( server ) ); -- cgit v1.2.3-55-g7522 From 00d93c6dd90b00de6e354d22ddc188d08fabf0b9 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 6 Sep 2007 13:37:47 +0100 Subject: Minor style fix: structure fields are generally initialised in the order in which they occur. --- src/net/udp/tftp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index 6c1c51b01..74c8c0a5f 100644 --- a/src/net/udp/tftp.c +++ b/src/net/udp/tftp.c @@ -645,9 +645,9 @@ 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; - tftp->blksize = TFTP_DEFAULT_BLKSIZE; /* Open socket */ memset ( &server, 0, sizeof ( server ) ); -- cgit v1.2.3-55-g7522 From 972f293e46d936ade9613abfeb0953936f7389a5 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 8 Sep 2007 19:30:25 +0100 Subject: Check for correct block number in tftp_rx_data(). (Problem observed by Clay McClure in VMware Fusion.) --- src/net/udp/tftp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/net') diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c index 74c8c0a5f..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", -- cgit v1.2.3-55-g7522