aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-21 17:44:03 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2020-01-22 13:16:36 +0400
commite62c1706217740154704961e0c0235182a2ebef3 (patch)
tree12b78d0bfda22c678f6dd3b8bcd46d46638f50e1 /src
parent524971e5b6c673a654f7b5fc04f3d9e2dfe63763 (diff)
downloadslirp-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.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/tftp.c b/src/tftp.c
index e52e71b..4d9ee1f 100644
--- a/src/tftp.c
+++ b/src/tftp.c
@@ -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;