|
@@ -149,8 +149,6 @@ enum {
|
149
|
149
|
TFTP_FL_RRQ_MULTICAST = 0x0004,
|
150
|
150
|
/** Perform MTFTP recovery on timeout */
|
151
|
151
|
TFTP_FL_MTFTP_RECOVERY = 0x0008,
|
152
|
|
- /** Only get filesize and then abort the transfer */
|
153
|
|
- TFTP_FL_SIZEONLY = 0x0010,
|
154
|
152
|
};
|
155
|
153
|
|
156
|
154
|
/** Maximum number of MTFTP open requests before falling back to TFTP */
|
|
@@ -759,14 +757,6 @@ static int tftp_rx_oack ( struct tftp_request *tftp, void *buf, size_t len ) {
|
759
|
757
|
goto done;
|
760
|
758
|
}
|
761
|
759
|
|
762
|
|
- /* Abort request if only trying to determine file size */
|
763
|
|
- if ( tftp->flags & TFTP_FL_SIZEONLY ) {
|
764
|
|
- rc = 0;
|
765
|
|
- tftp_send_error ( tftp, 0, "TFTP Aborted" );
|
766
|
|
- tftp_done ( tftp, rc );
|
767
|
|
- return rc;
|
768
|
|
- }
|
769
|
|
-
|
770
|
760
|
/* Request next data block */
|
771
|
761
|
tftp_send_packet ( tftp );
|
772
|
762
|
|
|
@@ -794,13 +784,6 @@ static int tftp_rx_data ( struct tftp_request *tftp,
|
794
|
784
|
size_t data_len;
|
795
|
785
|
int rc;
|
796
|
786
|
|
797
|
|
- if ( tftp->flags & TFTP_FL_SIZEONLY ) {
|
798
|
|
- /* If we get here then server doesn't support SIZE option */
|
799
|
|
- rc = -ENOTSUP;
|
800
|
|
- tftp_send_error ( tftp, 0, "TFTP Aborted" );
|
801
|
|
- goto done;
|
802
|
|
- }
|
803
|
|
-
|
804
|
787
|
/* Sanity check */
|
805
|
788
|
if ( iob_len ( iobuf ) < sizeof ( *data ) ) {
|
806
|
789
|
DBGC ( tftp, "TFTP %p received underlength DATA packet "
|
|
@@ -1036,10 +1019,25 @@ static size_t tftp_xfer_window ( struct tftp_request *tftp ) {
|
1036
|
1019
|
return tftp->blksize;
|
1037
|
1020
|
}
|
1038
|
1021
|
|
|
1022
|
+/**
|
|
1023
|
+ * Terminate download
|
|
1024
|
+ *
|
|
1025
|
+ * @v tftp TFTP connection
|
|
1026
|
+ * @v rc Reason for close
|
|
1027
|
+ */
|
|
1028
|
+static void tftp_close ( struct tftp_request *tftp, int rc ) {
|
|
1029
|
+
|
|
1030
|
+ /* Abort download */
|
|
1031
|
+ tftp_send_error ( tftp, 0, "TFTP Aborted" );
|
|
1032
|
+
|
|
1033
|
+ /* Close TFTP request */
|
|
1034
|
+ tftp_done ( tftp, rc );
|
|
1035
|
+}
|
|
1036
|
+
|
1039
|
1037
|
/** TFTP data transfer interface operations */
|
1040
|
1038
|
static struct interface_operation tftp_xfer_operations[] = {
|
1041
|
1039
|
INTF_OP ( xfer_window, struct tftp_request *, tftp_xfer_window ),
|
1042
|
|
- INTF_OP ( intf_close, struct tftp_request *, tftp_done ),
|
|
1040
|
+ INTF_OP ( intf_close, struct tftp_request *, tftp_close ),
|
1043
|
1041
|
};
|
1044
|
1042
|
|
1045
|
1043
|
/** TFTP data transfer interface descriptor */
|
|
@@ -1125,26 +1123,6 @@ struct uri_opener tftp_uri_opener __uri_opener = {
|
1125
|
1123
|
.open = tftp_open,
|
1126
|
1124
|
};
|
1127
|
1125
|
|
1128
|
|
-/**
|
1129
|
|
- * Initiate TFTP-size request
|
1130
|
|
- *
|
1131
|
|
- * @v xfer Data transfer interface
|
1132
|
|
- * @v uri Uniform Resource Identifier
|
1133
|
|
- * @ret rc Return status code
|
1134
|
|
- */
|
1135
|
|
-static int tftpsize_open ( struct interface *xfer, struct uri *uri ) {
|
1136
|
|
- return tftp_core_open ( xfer, uri, TFTP_PORT, NULL,
|
1137
|
|
- ( TFTP_FL_RRQ_SIZES |
|
1138
|
|
- TFTP_FL_SIZEONLY ) );
|
1139
|
|
-
|
1140
|
|
-}
|
1141
|
|
-
|
1142
|
|
-/** TFTP URI opener */
|
1143
|
|
-struct uri_opener tftpsize_uri_opener __uri_opener = {
|
1144
|
|
- .scheme = "tftpsize",
|
1145
|
|
- .open = tftpsize_open,
|
1146
|
|
-};
|
1147
|
|
-
|
1148
|
1126
|
/**
|
1149
|
1127
|
* Initiate TFTM download
|
1150
|
1128
|
*
|