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>
This commit is contained in:
parent
568fb49625
commit
caf8309249
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue