Fix TFTP timeouts when trying to fetch files larger than 65535 KiB
Resolves: rhbz#1869335 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
This commit is contained in:
parent
db0149e860
commit
cc2f966c55
@ -399,14 +399,14 @@ index 4b7972b8e7e..f24f1fd63f6 100644
|
||||
grub_err_t
|
||||
grub_net_add_ipv4_local (struct grub_net_network_level_interface *inter,
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index 7d90bf66e76..1157524fc50 100644
|
||||
index 7d90bf66e76..a5c5038130a 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -379,19 +379,23 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
+ grub_dprintf("tftp", "resolving address for %s\n", file->device->net->server);
|
||||
+ grub_dprintf ("tftp", "resolving address for %s\n", file->device->net->server);
|
||||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||
if (err)
|
||||
{
|
||||
@ -416,13 +416,13 @@ index 7d90bf66e76..1157524fc50 100644
|
||||
return err;
|
||||
}
|
||||
|
||||
+ grub_dprintf("tftp", "opening connection\n");
|
||||
+ grub_dprintf ("tftp", "opening connection\n");
|
||||
data->sock = grub_net_udp_open (addr,
|
||||
TFTP_SERVER_PORT, tftp_receive,
|
||||
file);
|
||||
if (!data->sock)
|
||||
{
|
||||
+ grub_dprintf("tftp", "connection failed\n");
|
||||
+ grub_dprintf ("tftp", "connection failed\n");
|
||||
destroy_pq (data);
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
|
@ -14,7 +14,7 @@ Signed-off-by: Mark Salter <msalter@redhat.com>
|
||||
1 file changed, 25 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index 1157524fc50..dcd82494309 100644
|
||||
index a5c5038130a..e6d831f1bc9 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -300,6 +300,25 @@ destroy_pq (tftp_data_t data)
|
||||
|
@ -8,7 +8,7 @@ Subject: [PATCH] don't ignore const
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index dcd82494309..f90071353ad 100644
|
||||
index e6d831f1bc9..0c02a00255b 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -307,7 +307,7 @@ static void
|
||||
|
@ -227,7 +227,7 @@ index 6468eb24596..2734f70d22f 100644
|
||||
}
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index f90071353ad..e267af354f4 100644
|
||||
index 0c02a00255b..4920c3a9783 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -333,6 +333,7 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
@ -252,7 +252,7 @@ index f90071353ad..e267af354f4 100644
|
||||
return err;
|
||||
@@ -413,7 +417,7 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
|
||||
grub_dprintf("tftp", "opening connection\n");
|
||||
grub_dprintf ("tftp", "opening connection\n");
|
||||
data->sock = grub_net_udp_open (addr,
|
||||
- TFTP_SERVER_PORT, tftp_receive,
|
||||
+ port ? port : TFTP_SERVER_PORT, tftp_receive,
|
||||
|
@ -35,7 +35,7 @@ Upstream-commit-id: 8316694c4f7
|
||||
1 file changed, 50 insertions(+), 112 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index e267af354f4..c2df3d7f6ab 100644
|
||||
index 4920c3a9783..22badd74316 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -25,7 +25,6 @@
|
||||
@ -233,7 +233,7 @@ index e267af354f4..c2df3d7f6ab 100644
|
||||
- return grub_errno;
|
||||
- }
|
||||
-
|
||||
grub_dprintf("tftp", "resolving address for %s\n", file->device->net->server);
|
||||
grub_dprintf ("tftp", "resolving address for %s\n", file->device->net->server);
|
||||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||
if (err)
|
||||
@@ -410,7 +353,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
@ -247,7 +247,7 @@ index e267af354f4..c2df3d7f6ab 100644
|
||||
@@ -422,7 +364,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
if (!data->sock)
|
||||
{
|
||||
grub_dprintf("tftp", "connection failed\n");
|
||||
grub_dprintf ("tftp", "connection failed\n");
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
|
49
0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch
Normal file
49
0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Javier Martinez Canillas <javierm@redhat.com>
|
||||
Date: Thu, 20 Aug 2020 13:19:00 +0200
|
||||
Subject: [PATCH] tftp: increase blocksize from 1024 to 2048 octets
|
||||
|
||||
The RFC2348 [0] defines how the TFTP Blocksize Option should be negotiated
|
||||
between the client and the server. GRUB just hardcodes this to 1024, which
|
||||
limits the maximum file size to be fetched to 65535 KiB, since the block
|
||||
number is stored in a 16-bit field.
|
||||
|
||||
This limit is a problem when attempting to fetch large files (i.e: initrd
|
||||
images) because the block number will overflow, and GRUB will never ack a
|
||||
packet. This causes a timeout when trying to download the file over TFTP.
|
||||
|
||||
Since the TFTP support in GRUB is used primarily to fetch the kernel and
|
||||
initrd images, let's bump the blocksize to 2048 which would allow to get
|
||||
files twice as large than the current limit.
|
||||
|
||||
The TFTP support should be improved to define the blocksize dynamically
|
||||
instead of hardcoding it, but until that happens is better to use a value
|
||||
that at least allows to fetch a kernel and initrd image with the size that
|
||||
are present in the install media that is used for network booting.
|
||||
|
||||
[0]: https://tools.ietf.org/html/rfc2348
|
||||
|
||||
Resolves: rhbz#1869335
|
||||
|
||||
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
||||
---
|
||||
grub-core/net/tftp.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index 22badd74316..816050bca43 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -322,9 +322,9 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
rrqlen += grub_strlen ("blksize") + 1;
|
||||
rrq += grub_strlen ("blksize") + 1;
|
||||
|
||||
- grub_strcpy (rrq, "1024");
|
||||
- rrqlen += grub_strlen ("1024") + 1;
|
||||
- rrq += grub_strlen ("1024") + 1;
|
||||
+ grub_strcpy (rrq, "2048");
|
||||
+ rrqlen += grub_strlen ("2048") + 1;
|
||||
+ rrq += grub_strlen ("2048") + 1;
|
||||
|
||||
grub_strcpy (rrq, "tsize");
|
||||
rrqlen += grub_strlen ("tsize") + 1;
|
@ -265,3 +265,4 @@ Patch0264: 0264-Fix-const-char-pointers-in-grub-core-net-efi-pxe.c.patch
|
||||
Patch0265: 0265-Fix-const-char-pointers-in-grub-core-net-url.c.patch
|
||||
Patch0266: 0266-Add-systemd-integration-scripts-to-make-systemctl-re.patch
|
||||
Patch0267: 0267-systemd-integration.sh-Also-set-old-menu_show_once-g.patch
|
||||
Patch0268: 0268-tftp-increase-blocksize-from-1024-to-2048-octets.patch
|
||||
|
@ -14,7 +14,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.04
|
||||
Release: 28%{?dist}
|
||||
Release: 29%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
@ -516,6 +516,10 @@ rm -r /boot/grub2.tmp/ || :
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Aug 21 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.04-29
|
||||
- Fix TFTP timeouts when trying to fetch files larger than 65535 KiB
|
||||
Resolves: rhbz#1869335
|
||||
|
||||
* Wed Aug 12 2020 Javier Martinez Canillas <javierm@redhat.com> - 2.04-28
|
||||
- Add support for "systemctl reboot --boot-loader-menu=xx" (hdegoede)
|
||||
Related: rhbz#1857389
|
||||
|
Loading…
Reference in New Issue
Block a user