1/*
2 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
--- 10 unchanged lines hidden (view full) ---
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-transfer.c 224536 2011-07-31 03:12:20Z rodrigc $");
28
29#include <sys/types.h>
30#include <sys/param.h>
31#include <sys/ioctl.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
34
35#include <netinet/in.h>
--- 88 unchanged lines hidden (view full) ---
124 }
125 }
126
127 }
128 oldblock = *block;
129 (*block)++;
130 if (oldblock > *block) {
131 if (options[OPT_ROLLOVER].o_request == NULL) {
132 /*
133 * "rollover" option not specified in
134 * tftp client. Default to rolling block
135 * counter to 0.
136 */
137 *block = 0;
138 } else {
139 *block = atoi(options[OPT_ROLLOVER].o_request);
140 }
141
142 ts->rollovers++;
143 }
144 gettimeofday(&(ts->tstop), NULL);
145 } while (size == segsize);
146abort:
147 return;
148}
149
--- 43 unchanged lines hidden (view full) ---
193 }
194
195 rp = (struct tftphdr *)recvbuffer;
196 do {
197 oldblock = *block;
198 (*block)++;
199 if (oldblock > *block) {
200 if (options[OPT_ROLLOVER].o_request == NULL) {
201 /*
202 * "rollover" option not specified in
203 * tftp client. Default to rolling block
204 * counter to 0.
205 */
206 *block = 0;
207 } else {
208 *block = atoi(options[OPT_ROLLOVER].o_request);
209 }
210
211 ts->rollovers++;
212 }
213
214 for (retry = 0; ; retry++) {
215 if (debug&DEBUG_SIMPLE)
216 tftp_log(LOG_DEBUG,
217 "Receiving DATA block %d", *block);
218
--- 104 unchanged lines hidden ---
2 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
--- 10 unchanged lines hidden (view full) ---
19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-transfer.c 224536 2011-07-31 03:12:20Z rodrigc $");
28
29#include <sys/types.h>
30#include <sys/param.h>
31#include <sys/ioctl.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
34
35#include <netinet/in.h>
--- 88 unchanged lines hidden (view full) ---
124 }
125 }
126
127 }
128 oldblock = *block;
129 (*block)++;
130 if (oldblock > *block) {
131 if (options[OPT_ROLLOVER].o_request == NULL) {
132 /*
133 * "rollover" option not specified in
134 * tftp client. Default to rolling block
135 * counter to 0.
136 */
137 *block = 0;
138 } else {
139 *block = atoi(options[OPT_ROLLOVER].o_request);
140 }
141
142 ts->rollovers++;
143 }
144 gettimeofday(&(ts->tstop), NULL);
145 } while (size == segsize);
146abort:
147 return;
148}
149
--- 43 unchanged lines hidden (view full) ---
193 }
194
195 rp = (struct tftphdr *)recvbuffer;
196 do {
197 oldblock = *block;
198 (*block)++;
199 if (oldblock > *block) {
200 if (options[OPT_ROLLOVER].o_request == NULL) {
201 /*
202 * "rollover" option not specified in
203 * tftp client. Default to rolling block
204 * counter to 0.
205 */
206 *block = 0;
207 } else {
208 *block = atoi(options[OPT_ROLLOVER].o_request);
209 }
210
211 ts->rollovers++;
212 }
213
214 for (retry = 0; ; retry++) {
215 if (debug&DEBUG_SIMPLE)
216 tftp_log(LOG_DEBUG,
217 "Receiving DATA block %d", *block);
218
--- 104 unchanged lines hidden ---