[SLOF] [PATCH 1/6] net-snk: Remove junk at the end of IPv6 TFTP ACK and error packets
Thomas Huth
thuth at redhat.com
Thu Jan 14 10:10:34 AEDT 2016
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 at redhat.com>
---
clients/net-snk/app/netlib/tftp.c | 6 ++----
1 file 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));
}
--
1.8.3.1
More information about the SLOF
mailing list