grub/grub-core/net
Alexey Makhalov 781b3e5efc tftp: Do not use priority queue
There is not need to reassemble the order of blocks. Per RFC 1350,
server must wait for the ACK, before sending next block. Data packets
can be served immediately without putting them to priority queue.

Logic to handle incoming packet is this:
  - if packet block id equal to expected block id, then
    process the packet,
  - if packet block id is less than expected - this is retransmit
    of old packet, then ACK it and drop the packet,
  - if packet block id is more than expected - that shouldn't
    happen, just drop the packet.

It makes the tftp receive path code simpler, smaller and faster.
As a benefit, this change fixes CID# 73624 and CID# 96690, caused
by following while loop:

  while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0)

where tftph pointer is not moving from one iteration to another, causing
to serve same packet again. Luckily, double serving didn't happen due to
data->block++ during the first iteration.

Fixes: CID 73624, CID 96690

Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:48 +02:00
..
drivers ofnet: Fix build regression in grub_ieee1275_parse_bootpath() 2018-11-28 13:48:45 +01:00
arp.c Add Virtual LAN support. 2017-05-03 13:03:50 +02:00
bootp.c calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
dns.c malloc: Use overflow checking primitives where we do complex allocations 2020-07-29 16:55:47 +02:00
ethernet.c Add Virtual LAN support. 2017-05-03 13:03:50 +02:00
http.c misc: Make grub_strtol() "end" pointers have safer const qualifiers 2020-02-28 12:41:29 +01:00
icmp.c arp, icmp: Fix handling in case of oversized or invalid packets. 2015-03-27 12:18:25 +01:00
icmp6.c net: fix ipv6 routing 2016-02-25 22:38:52 +03:00
ip.c net/dhcp: Make grub_net_process_dhcp() take an interface 2019-03-12 20:04:07 +01:00
net.c calloc: Use calloc() at most places 2020-07-29 16:55:47 +02:00
netbuff.c arp, icmp: Fix handling in case of oversized or invalid packets. 2015-03-27 12:18:25 +01:00
tcp.c tcp: fix memory leaks 2016-01-16 20:59:50 +03:00
tftp.c tftp: Do not use priority queue 2020-07-29 16:55:48 +02:00
udp.c * grub-core/disk/ahci.c: Add needed explicit cast. 2013-08-21 21:02:14 +02:00