mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 14:59:34 +00:00
net: Read bracketed IPv6 addrs and port numbers
Allow specifying port numbers for http and tftp paths and allow IPv6 addresses to be recognized with brackets around them, which is required to specify a port number. Co-authored-by: Aaron Miller <aaronmiller@fb.com> Signed-off-by: Aaron Miller <aaronmiller@fb.com> Co-authored-by: Peter Jones <pjones@redhat.com> Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Robbie Harwood <rharwood@redhat.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
52061b2cf4
commit
26cfaa8a90
5 files changed
+111
-10
No files matched your search
@@ -295,6 +295,7 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
grub_err_t err;
|
||||
grub_uint8_t *nbd;
|
||||
grub_net_network_level_address_t addr;
|
||||
int port = file->device->net->port;
|
||||
|
||||
data = grub_zalloc (sizeof (*data));
|
||||
if (!data)
|
||||
@@ -361,12 +362,15 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||
if (err)
|
||||
{
|
||||
grub_dprintf ("tftp", "Address resolution failed: %d\n", err);
|
||||
grub_dprintf ("tftp", "file_size is %" PRIuGRUB_UINT64_T ", block_size is %" PRIuGRUB_UINT32_T "\n",
|
||||
data->file_size, data->block_size);
|
||||
grub_free (data);
|
||||
return err;
|
||||
}
|
||||
|
||||
data->sock = grub_net_udp_open (addr,
|
||||
TFTP_SERVER_PORT, tftp_receive,
|
||||
port ? port : TFTP_SERVER_PORT, tftp_receive,
|
||||
file);
|
||||
if (!data->sock)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user