diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-01-21 17:44:03 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-01-22 13:16:36 +0400 |
commit | e62c1706217740154704961e0c0235182a2ebef3 (patch) | |
tree | 12b78d0bfda22c678f6dd3b8bcd46d46638f50e1 /src | |
parent | 524971e5b6c673a654f7b5fc04f3d9e2dfe63763 (diff) | |
download | slirp-e62c1706217740154704961e0c0235182a2ebef3.zip slirp-e62c1706217740154704961e0c0235182a2ebef3.tar.gz slirp-e62c1706217740154704961e0c0235182a2ebef3.tar.bz2 |
tftp: clarify what is actually OACK m_len
The current computation is a bit convoluted, and doesn't reflect >0.
What is actually computed is sizeof():
struct tftp_t {
struct udphdr udp;
uint16_t tp_op;
union {
...
char tp_buf[TFTP_BLOCKSIZE_MAX + 2];
} x;
}
- sizeof(struct udphdr) == udp field
- (TFTP_BLOCKSIZE_MAX + 2) == tp_buf field
+ n
What remains is: G_SIZEOF_MEMBER(struct tftp_t, tp_op) + n.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/tftp.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -193,8 +193,7 @@ static int tftp_send_oack(struct tftp_session *spt, const char *keys[], 1; } - m->m_len = sizeof(struct tftp_t) - (TFTP_BLOCKSIZE_MAX + 2) + n - - sizeof(struct udphdr); + m->m_len = G_SIZEOF_MEMBER(struct tftp_t, tp_op) + n; tftp_udp_output(spt, m, recv_tp); return 0; |