loader: tftp: Don't let tftp timeout
When we load a kernel or module we open/close it a few times. Since we're using the same port number each time and that we requested the same file the ACK that we send are valid on the server side and the server send us the file multiple times. This makes tftp loading time very inconsistant due to the UDP "flood" that we have to process. Reviewed by: imp, tsoome MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33407
This commit is contained in:
parent
70661eaafa
commit
4f36ed513c
@ -114,6 +114,8 @@ struct tftp_handle {
|
|||||||
unsigned long tftp_tsize;
|
unsigned long tftp_tsize;
|
||||||
void *pkt;
|
void *pkt;
|
||||||
struct tftphdr *tftp_hdr;
|
struct tftphdr *tftp_hdr;
|
||||||
|
char *tftp_cache;
|
||||||
|
bool lastacksent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tftprecv_extra {
|
struct tftprecv_extra {
|
||||||
@ -378,6 +380,7 @@ tftp_makereq(struct tftp_handle *h)
|
|||||||
if (res < h->tftp_blksize) {
|
if (res < h->tftp_blksize) {
|
||||||
h->islastblock = 1; /* very short file */
|
h->islastblock = 1; /* very short file */
|
||||||
tftp_sendack(h, h->currblock);
|
tftp_sendack(h, h->currblock);
|
||||||
|
h->lastacksent = true;
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -594,7 +597,8 @@ tftp_close(struct open_file *f)
|
|||||||
struct tftp_handle *tftpfile;
|
struct tftp_handle *tftpfile;
|
||||||
tftpfile = f->f_fsdata;
|
tftpfile = f->f_fsdata;
|
||||||
|
|
||||||
/* let it time out ... */
|
if (tftpfile->lastacksent == false)
|
||||||
|
tftp_senderr(tftpfile, 0, "No error: file closed");
|
||||||
|
|
||||||
if (tftpfile) {
|
if (tftpfile) {
|
||||||
free(tftpfile->path);
|
free(tftpfile->path);
|
||||||
|
Loading…
Reference in New Issue
Block a user