Using the http module to download config files, produces memory errors,
after the config file is downloaded.
The error was traced to the tcp stack in grub-core/net/tcp.c. The wrong
netbuff pointer was being freed in the clean up loop.
Changing the code to free the correct netbuff pointer removes the runtime
error.
Closes 42765.
Many routers have long router advertisment interval configured by
default. The Neighbor Discovery protocol (RFC4861) has defined default
MaxRtrAdvInterval value as 600 seconds and
MinRtrAdvInterval as 0.33*MaxRtrAdvInterval. This makes
net_ipv6_autoconf fails more often than not as currently it passively
listens the RA message to perfom address autoconfiguration.
This patch tries to send router solicitation to overcome the problem of
long RA interval.
v2:
use cpu_to_be macro for network byte order conversion
add missing error handling
The structure size used in grub_netbuff_pull to get the pointer to
option header is apparently wrong, which leads to subsequent range check
failed and therefore not responding to any neighbor solicit message in my
testing.
It enables net boot even when there is no bootp/dhcp server.
* grub-core/net/drivers/ieee1275/ofnet.c: Add grub_ieee1275_parse_bootpath and
call it at grub_ieee1275_net_config_real.
* grub-core/kern/ieee1275/init.c: Add bootpath to grub_ieee1275_net_config.
* include/grub/ieee1275/ieee1275.h: Likewise.
In net/net.c there is a while (1) that only exits if there is a stop
condition and more then 10 packages or if there is no package received.
If GRUB is idle and enter in this loop, the only condition to leave is
if it doesn't have incoming packages. In a network with heavy traffic
this never happens.
Adding multiple questions on a single DNS query is not supportted by
most DNS servers. This patch issues two separate DNS queries
sequentially for ipv4 and then for ipv6.
Fixes: https://savannah.gnu.org/bugs/?39710
* grub-core/net/bootp.c (parse_dhcp_vendor): Add DNS option.
* grub-core/net/dns.c (grub_dns_qtype_id): New enum.
* (grub_net_dns_lookup): Now using separated dns packages.
* (grub_cmd_nslookup): Add error condition.
* (grub_cmd_list_dns): Print DNS option.
* (grub_cmd_add_dns): Add four parameters: --only-ipv4,
* --only-ipv6, --prefer-ipv4, and --prefer-ipv6.
* include/grub/net.h (grub_dns_option_t): New enum.
* (grub_net_network_level_address): option added.
Also-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
strncpy.
* grub-core/fs/jfs.c (grub_jfs_lookup_symlink): Likewise.
* grub-core/kern/misc.c (grub_strncpy): Move from here ...
* include/grub/misc.h (grub_strncpy): ... to here. Make inline.
* grub-core/net/net.c (grub_net_addr_to_str): Use COMPILE_TIME_ASSERT
+ strcpy rather than strncpy.
* Makefile.util.def (grub-mount): Add LIBGEOM to ldadd.
* grub-core/net/drivers/emu/emunet.c: Only include Linux-specific
headers on Linux.
(GRUB_MOD_INIT): Return immediately on non-Linux platforms; this
implementation is currently Linux-specific.
* util/getroot.c (exec_pipe): Define only on Linux or when either
libzfs or libnvpair is unavailable.
(find_root_devices_from_poolname): Remove unused path variable.
* grub-core/net/http.c (parse_line): Handle response 206.
(http_receive): Stall if too many packets are in the queue.
(http_establish): Fix range header.
(http_seek): Fix double free.
(http_close): Likewise.
(http_packets_pulled): New function.
(grub_http_protocol): Set http_seek
* grub-core/net/tcp.c (grub_net_tcp_socket): New field `i_stall'.
(ack_real): Set window depending on i_stall.
(grub_net_send_tcp_packet): Likewise.
(grub_net_tcp_stall): New function.
(grub_net_tcp_unstall): Likewise.
* include/grub/net/tcp.h (grub_net_tcp_stall): New proto.
(grub_net_tcp_unstall): Likewise.