-
Notifications
You must be signed in to change notification settings - Fork 8.2k
net: refactor tftp library #36579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: refactor tftp library #36579
Conversation
jukkar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this fixing any issues mentioned in #34131?
subsys/net/lib/tftp/tftp_client.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra () around sizeof are not needed.
subsys/net/lib/tftp/tftp_client.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better would be set the values using the .field = value, notation, then there are no errors if the fields are reorganized in the struct
Sorry, I missed the issue. Yes, this PR is fixing the problem described in #34131 including
I will wait a bit for additional reviews before cleaning up this PR. |
rlubos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, not much to comment.
- bugfix: Accept initial tftp server reply from a port different than the one used to establish the connection (typically 69) as mandated by RFC 1350. Previous implementation was not standard compliant. - bugfix: close socket in case of error or timeout. - bugfix: Reset retransmit counter after receipt of a good packet. - bugfix: Use CONFIG_TFTP_LOG_LEVEL to set log level. - api: upon successful receipt of the file set `client.user_buf_size` to the size of the file received. - Restructure the code, comments. - Limit usage of global variables. - Limit usage of `goto`. Signed-off-by: Piotr Mienkowski <[email protected]>
mnkp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All pending issues were fixed. I've updated include/net/tftp.h to mention that upon successful transfer client->user_buf_size will contain received file size.
rlubos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
sha 4d712a5 net: refactor tftp library zephyrproject-rtos#36579
the one used to establish the connection (typically 69) as mandated
by RFC 1350. Previous implementation was not standard compliant.
client.user_buf_sizeto the size of the file received.
goto.This PR, apart from one necessary exception, does not attempt to modify TFTP API. Consequently not all issues are fixed:
tftp_getfunction call has to be large enough to fit the full file, i.e. to receive a file of size up to 64 kB user is forced to reserve 64 kB of RAM.Fixes #34131