diff options
author | Thomas Huth <thuth@redhat.com> | 2016-01-14 00:10:34 +0100 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-01-14 11:25:44 +1100 |
commit | caf83092499fd07035b05a108c423f0cda17caae (patch) | |
tree | 2f09eb921d5618d7a3d41c71ebe31254ad9992f4 | |
parent | 568fb49625feaaf60d8ec8ef6f1bf540e5fba90c (diff) | |
download | SLOF-caf83092499fd07035b05a108c423f0cda17caae.zip SLOF-caf83092499fd07035b05a108c423f0cda17caae.tar.gz SLOF-caf83092499fd07035b05a108c423f0cda17caae.tar.bz2 |
net-snk: Remove junk at the end of IPv6 TFTP ACK and error packets
While looking at the network traffic from SLOF with Wireshark, I
noticed that there are some junk bytes at the end of TFTP ACK
packets. The problem is that send_ack() adds sizeof(struct ethhdr)
to the length of the packet that it wants to transmit. But adding
the sizeof(struct ethhdr) to the length of the packet is done
within send_ipv6() already, so this value got added twice.
Removing it from send_ack() fixes this issue - the packets then
look fine in Wireshark again.
send_error() apparently suffers from the same issue, so let's
also remove the sizeof(struct ethhdr) from that function.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r-- | clients/net-snk/app/netlib/tftp.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clients/net-snk/app/netlib/tftp.c b/clients/net-snk/app/netlib/tftp.c index 0a7c0ec..0dfd23f 100644 --- a/clients/net-snk/app/netlib/tftp.c +++ b/clients/net-snk/app/netlib/tftp.c @@ -182,8 +182,7 @@ send_ack(int fd, int blckno, unsigned short dport) ip6 = (struct ip6hdr *) packet; udph = (struct udphdr *) (ip6 + 1); ip6_payload_len = sizeof(struct udphdr) + 4; - ip_len = sizeof(struct ethhdr) + sizeof(struct ip6hdr) + - ip6_payload_len; + ip_len = sizeof(struct ip6hdr) + ip6_payload_len; fill_ip6hdr ((uint8_t *) ip6, ip6_payload_len, IPTYPE_UDP, get_ipv6_address(), &(fn_ip->server_ip6)); } @@ -234,8 +233,7 @@ send_error(int fd, int error_code, unsigned short dport) ip6 = (struct ip6hdr *) packet; udph = (struct udphdr *) (ip6 + 1); ip6_payload_len = sizeof(struct udphdr) + 5; - ip_len = sizeof(struct ethhdr) + sizeof(struct ip6hdr) + - ip6_payload_len; + ip_len = sizeof(struct ip6hdr) + ip6_payload_len; fill_ip6hdr ((uint8_t *) ip6, ip6_payload_len, IPTYPE_UDP, get_ipv6_address(), &(fn_ip->server_ip6)); } |