summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown2008-01-22 19:53:01 +0100
committerMichael Brown2008-01-22 19:53:01 +0100
commit122abb50af8fa823778e185961f65122ff7b4270 (patch)
tree6129b8d1e4084f5c5f89093031853eebb477e69d /src/net
parentAdd preliminary support for MTFTP. (diff)
parentMake seek information part of the xfer metadata, rather than an entirely (diff)
downloadipxe-122abb50af8fa823778e185961f65122ff7b4270.tar.gz
ipxe-122abb50af8fa823778e185961f65122ff7b4270.tar.xz
ipxe-122abb50af8fa823778e185961f65122ff7b4270.zip
Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe
Diffstat (limited to 'src/net')
-rw-r--r--src/net/tcp.c1
-rw-r--r--src/net/tcp/ftp.c3
-rw-r--r--src/net/tcp/http.c2
-rw-r--r--src/net/tcp/iscsi.c3
-rw-r--r--src/net/tls.c2
-rw-r--r--src/net/udp.c1
-rw-r--r--src/net/udp/dhcp.c16
-rw-r--r--src/net/udp/dns.c1
-rw-r--r--src/net/udp/tftp.c10
9 files changed, 15 insertions, 24 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c
index 2b9a97b0a..d6b44b02b 100644
--- a/src/net/tcp.c
+++ b/src/net/tcp.c
@@ -1022,7 +1022,6 @@ static int tcp_xfer_deliver_iob ( struct xfer_interface *xfer,
static struct xfer_interface_operations tcp_xfer_operations = {
.close = tcp_xfer_close,
.vredirect = ignore_xfer_vredirect,
- .seek = ignore_xfer_seek,
.window = tcp_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = tcp_xfer_deliver_iob,
diff --git a/src/net/tcp/ftp.c b/src/net/tcp/ftp.c
index 0e4d969f1..ffb2fbffc 100644
--- a/src/net/tcp/ftp.c
+++ b/src/net/tcp/ftp.c
@@ -299,7 +299,6 @@ static int ftp_control_deliver_raw ( struct xfer_interface *control,
static struct xfer_interface_operations ftp_control_operations = {
.close = ftp_control_close,
.vredirect = xfer_vopen,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
@@ -364,7 +363,6 @@ static int ftp_data_deliver_iob ( struct xfer_interface *data,
static struct xfer_interface_operations ftp_data_operations = {
.close = ftp_data_closed,
.vredirect = xfer_vopen,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = ftp_data_deliver_iob,
@@ -397,7 +395,6 @@ static void ftp_xfer_closed ( struct xfer_interface *xfer, int rc ) {
static struct xfer_interface_operations ftp_xfer_operations = {
.close = ftp_xfer_closed,
.vredirect = ignore_xfer_vredirect,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
diff --git a/src/net/tcp/http.c b/src/net/tcp/http.c
index 2a5450eda..db92e9eba 100644
--- a/src/net/tcp/http.c
+++ b/src/net/tcp/http.c
@@ -426,7 +426,6 @@ static void http_socket_close ( struct xfer_interface *socket, int rc ) {
static struct xfer_interface_operations http_socket_operations = {
.close = http_socket_close,
.vredirect = xfer_vopen,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = http_socket_deliver_iob,
@@ -453,7 +452,6 @@ static void http_xfer_close ( struct xfer_interface *xfer, int rc ) {
static struct xfer_interface_operations http_xfer_operations = {
.close = http_xfer_close,
.vredirect = ignore_xfer_vredirect,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
diff --git a/src/net/tcp/iscsi.c b/src/net/tcp/iscsi.c
index 2416089ad..ff1478e46 100644
--- a/src/net/tcp/iscsi.c
+++ b/src/net/tcp/iscsi.c
@@ -684,7 +684,7 @@ static int iscsi_handle_chap_c_value ( struct iscsi_session *iscsi,
/* Process challenge an octet at a time */
for ( ; ( value[0] && value[1] ) ; value += 2 ) {
memcpy ( buf, value, 2 );
- buf[3] = 0;
+ buf[2] = 0;
byte = strtoul ( buf, &endp, 16 );
if ( *endp != '\0' ) {
DBGC ( iscsi, "iSCSI %p saw invalid CHAP challenge "
@@ -1322,7 +1322,6 @@ static int iscsi_vredirect ( struct xfer_interface *socket, int type,
static struct xfer_interface_operations iscsi_socket_operations = {
.close = iscsi_socket_close,
.vredirect = iscsi_vredirect,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
diff --git a/src/net/tls.c b/src/net/tls.c
index f67bdd46d..834686fb7 100644
--- a/src/net/tls.c
+++ b/src/net/tls.c
@@ -1460,7 +1460,6 @@ static int tls_plainstream_deliver_raw ( struct xfer_interface *xfer,
static struct xfer_interface_operations tls_plainstream_operations = {
.close = tls_plainstream_close,
.vredirect = ignore_xfer_vredirect,
- .seek = filter_seek,
.window = tls_plainstream_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
@@ -1600,7 +1599,6 @@ static int tls_cipherstream_deliver_raw ( struct xfer_interface *xfer,
static struct xfer_interface_operations tls_cipherstream_operations = {
.close = tls_cipherstream_close,
.vredirect = xfer_vopen,
- .seek = filter_seek,
.window = filter_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
diff --git a/src/net/udp.c b/src/net/udp.c
index eb241496d..89a5b8682 100644
--- a/src/net/udp.c
+++ b/src/net/udp.c
@@ -415,7 +415,6 @@ static int udp_xfer_deliver_iob ( struct xfer_interface *xfer,
static struct xfer_interface_operations udp_xfer_operations = {
.close = udp_xfer_close,
.vredirect = ignore_xfer_vredirect,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = udp_alloc_iob,
.deliver_iob = udp_xfer_deliver_iob,
diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c
index 2fdb943c3..2521f9ac9 100644
--- a/src/net/udp/dhcp.c
+++ b/src/net/udp/dhcp.c
@@ -368,11 +368,11 @@ static size_t dhcp_field_len ( const void *data, size_t max_len ) {
* @v max_len Field length
* @v tag DHCP option tag, or 0
*
- * If @c tag is non-zero, the field will be treated as a
- * NUL-terminated string representing the value of the specified DHCP
- * option. If @c tag is zero, the field will be treated as a block of
- * DHCP options, and simply appended to the existing options in the
- * option block.
+ * If @c tag is non-zero (and the field is not empty), the field will
+ * be treated as a NUL-terminated string representing the value of the
+ * specified DHCP option. If @c tag is zero, the field will be
+ * treated as a block of DHCP options, and simply appended to the
+ * existing options in the option block.
*
* The caller must ensure that there is enough space in the options
* block to perform the merge.
@@ -385,7 +385,9 @@ static void merge_dhcp_field ( struct dhcp_option_block *options,
struct dhcp_option *end;
if ( tag ) {
- set_dhcp_option ( options, tag, data, strlen ( data ) );
+ len = strlen ( data );
+ if ( len )
+ set_dhcp_option ( options, tag, data, len );
} else {
len = dhcp_field_len ( data, max_len );
dest = ( options->data + options->len - 1 );
@@ -925,8 +927,8 @@ static int dhcp_deliver_raw ( struct xfer_interface *xfer,
static struct xfer_interface_operations dhcp_xfer_operations = {
.close = ignore_xfer_close,
.vredirect = xfer_vopen,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
+ .alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
.deliver_raw = dhcp_deliver_raw,
};
diff --git a/src/net/udp/dns.c b/src/net/udp/dns.c
index f32b2e055..d82d124b6 100644
--- a/src/net/udp/dns.c
+++ b/src/net/udp/dns.c
@@ -435,7 +435,6 @@ static void dns_xfer_close ( struct xfer_interface *socket, int rc ) {
static struct xfer_interface_operations dns_socket_operations = {
.close = dns_xfer_close,
.vredirect = xfer_vopen,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,
diff --git a/src/net/udp/tftp.c b/src/net/udp/tftp.c
index d5f02a08a..e96980042 100644
--- a/src/net/udp/tftp.c
+++ b/src/net/udp/tftp.c
@@ -703,6 +703,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;
+ struct xfer_metadata meta;
int block;
off_t offset;
size_t data_len;
@@ -729,8 +730,10 @@ static int tftp_rx_data ( struct tftp_request *tftp,
}
/* Deliver data */
- xfer_seek ( &tftp->xfer, offset, SEEK_SET );
- rc = xfer_deliver_iob ( &tftp->xfer, iobuf );
+ memset ( &meta, 0, sizeof ( meta ) );
+ meta.whence = SEEK_SET;
+ meta.offset = offset;
+ rc = xfer_deliver_iob_meta ( &tftp->xfer, iobuf, &meta );
iobuf = NULL;
if ( rc != 0 ) {
DBGC ( tftp, "TFTP %p could not deliver data: %s\n",
@@ -909,7 +912,6 @@ static int tftp_socket_deliver_iob ( struct xfer_interface *socket,
static struct xfer_interface_operations tftp_socket_operations = {
.close = ignore_xfer_close,
.vredirect = xfer_vopen,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = tftp_socket_deliver_iob,
@@ -937,7 +939,6 @@ static int tftp_mc_socket_deliver_iob ( struct xfer_interface *mc_socket,
static struct xfer_interface_operations tftp_mc_socket_operations = {
.close = ignore_xfer_close,
.vredirect = xfer_vopen,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = tftp_mc_socket_deliver_iob,
@@ -964,7 +965,6 @@ static void tftp_xfer_close ( struct xfer_interface *xfer, int rc ) {
static struct xfer_interface_operations tftp_xfer_operations = {
.close = tftp_xfer_close,
.vredirect = ignore_xfer_vredirect,
- .seek = ignore_xfer_seek,
.window = unlimited_xfer_window,
.alloc_iob = default_xfer_alloc_iob,
.deliver_iob = xfer_deliver_as_raw,