Commit graph

186 commits

Author SHA1 Message Date
Vladimir Serbinenko
cf8d6bbd9e * grub-core/net/tftp.c: Retransmit ack when rereceiving old packet.
Try to handle more than 0xFFFF packets.
2013-10-27 19:15:37 +01:00
Vladimir Serbinenko
40f290606d * grub-core/net/dns.c (hash): Use unsigned arithmetic. 2013-10-25 20:26:27 +02:00
Paulo Flabiano Smorigo
84a0e9699f Add progress module to display load progress of files.
* grub-core/lib/progress.c: New file.
	* grub-core/Makefile.core.def (progress): New module.
	* grub-core/kern/file.c (grub_file_open): File name added.
	* (grub_file_read): Progress hook added.
	* grub-core/fs/cbfs.c (grub_cbfs_read): Likewise.
	* grub-core/fs/cpio_common.c (grub_cpio_read): Likewise.
	* grub-core/net/net.c (grub_net_fs_read_real): Likewise.
	* include/grub/file.h (struct grub_file): Add progress module
	* members.
	* include/grub/term.h (struct grub_term_output): Likewise.
	* grub-core/osdep/unix/emuconsole.c (grub_console_term_output):
	Terminal velocity added.
	* grub-core/osdep/windows/emuconsole.c (grub_console_term_output):
	* Likewise.
	* grub-core/term/arc/console.c (grub_console_term_output): Likewise.
	* grub-core/term/efi/console.c (grub_console_term_output): Likewise.
	* grub-core/term/gfxterm.c (grub_video_term): Likewise.
	* grub-core/term/i386/coreboot/cbmemc.c (grub_cbmemc_term_output):
	* Likewise.
	* grub-core/term/i386/pc/console.c (grub_console_term_output):
	* Likewise.
	* grub-core/term/i386/pc/vga_text.c (grub_vga_text_term): Likewise.
	* grub-core/term/ieee1275/console.c (grub_console_term_output):
	* Likewise.
	* grub-core/term/morse.c (grub_audio_term_output): Likewise.
	* grub-core/term/serial.c (grub_serial_term_output): Likewise.
	* grub-core/term/spkmodem.c (grub_spkmodem_term_output): Likewise.
	* grub-core/term/uboot/console.c (uboot_console_term_output):
	* Likewise.
2013-10-22 16:42:20 -02:00
Vladimir 'phcoder' Serbinenko
28153eb87a * grub-core/net/arp.c: Remove variable length arrays.
* grub-core/net/bootp.c: Likewise.
	* grub-core/net/dns.c: Likewise.
	* grub-core/net/icmp6.c: Likewise.
	* grub-core/net/net.c: Likewise.
2013-10-20 17:40:21 +02:00
Vladimir 'phcoder' Serbinenko
70671037c8 Split emunet into platform-dependent and GRUB-binding parts. Keep
platform-dependent part in kernel for easy access to OS functions.
2013-10-15 11:55:20 +02:00
Vladimir 'phcoder' Serbinenko
aabe433afe * grub-core/net/drivers/emu/emunet.c: Move to ..
* grub-core/osdep/linux/emunet.c: ..here.
2013-10-08 18:42:46 +02:00
Vladimir 'phcoder' Serbinenko
54ea2f4401 * grub-core/disk/ahci.c: Add needed explicit cast.
* grub-core/lib/backtrace.c: Likewise.
	* grub-core/net/ip.c: Likewise.
	* grub-core/net/tcp.c: Likewise.
	* grub-core/net/udp.c: Likewise.
2013-08-21 21:02:14 +02:00
Avik Sil
369508b3cb * grub-core/net/tftp.c: Send tftp ack packet before closing the socket. 2013-08-14 20:32:42 -03:00
Avik Sil
412ce9165c * grub-core/net/drivers/ieee1275/ofnet.c: Get proper mac address when using qemu. 2013-08-14 18:03:01 -03:00
Vladimir 'phcoder' Serbinenko
ae27e4d323 Merge mainline into arm 2013-07-16 18:43:43 +02:00
Andrey Borzenkov
7a87d69fcf * grub-core/net/bootp.c: Export net_* variables.
* grub-core/net/net.c: Likewise.
2013-07-14 22:59:00 +04:00
Paulo Flabiano Smorigo
a9c0b699c0 * grub-core/net/bootp.c (grub_cmd_bootp): Check if there is any card
present.
	* include/grub/err.h (grub_err_t): New enum value GRUB_ERR_NET_NO_CARD.
2013-05-11 11:25:29 +02:00
Vladimir 'phcoder' Serbinenko
8e71d87482 merge mainline into arm 2013-05-11 10:24:24 +02:00
Vladimir 'phcoder' Serbinenko
0ef7478b5b * grub-core/net/net.c (grub_net_open_real): Autoload network modules. 2013-05-10 14:17:10 +02:00
Vladimir 'phcoder' Serbinenko
2aa072d76a New variables 'net_default_*' to determine MAC/IP of default interface. 2013-05-07 12:05:36 +02:00
Leif Lindholm
b385e0723b Leif's API fixes 2013-05-03 15:07:39 +02:00
Vladimir 'phcoder' Serbinenko
fe22b071dc Fix memory leaks in ofnet.
Reported by: Francesco Lavra.
2013-04-13 20:12:11 +02:00
Vladimir 'phcoder' Serbinenko
fa8058da9e Fix few memory leaks. Reported by Francesco Lavra 2013-04-13 20:07:37 +02:00
Vladimir 'phcoder' Serbinenko
92c8f58d97 * grub-core/net/http.c: Fix bad free. 2013-04-12 20:17:53 +02:00
Vladimir 'phcoder' Serbinenko
b7d17a492f * grub-core/net/drivers/ieee1275/ofnet.c: Don't attempt to send more
than buffer size.
2013-04-12 19:25:16 +02:00
Vladimir 'phcoder' Serbinenko
c86c39abef Add uboot net 2013-04-12 16:55:38 +02:00
Vladimir 'phcoder' Serbinenko
2f1071d57e Resend a packet if we got the wrong buffer in status. 2013-03-17 13:33:16 +01:00
Vladimir 'phcoder' Serbinenko
6e4146c41e Move to more hookless approach in IEEE1275 devices handling. 2013-03-02 23:51:19 +01:00
Colin Watson
fc524edf65 Remove nested functions from filesystem directory iterators.
* include/grub/fs.h (grub_fs_dir_hook_t): New type.
(struct grub_fs.dir): Add hook_data argument.

Update all implementations and callers.
2013-01-21 01:33:46 +00:00
Colin Watson
6c0314d638 Fix typos for "developer" and "development". 2013-01-20 13:24:47 +00:00
Paulo Flabiano Smorigo
48ff08895d * grub-core/net/bootp.c (parse_dhcp_vendor): Fix double increment. 2012-11-28 14:14:20 +01:00
Colin Watson
39525c22be * grub-core/loader/i386/linux.c (allocate_pages): Fix spelling of
preferred_address.
(grub_cmd_linux): Likewise.
* grub-core/net/icmp6.c (struct prefix_option): Fix spelling of
preferred_lifetime.  Update all users.
2012-10-05 13:09:19 +01:00
Colin Watson
794c8c3375 Fix grub-emu build on FreeBSD.
* 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.
2012-09-22 21:19:58 +01:00
Vladimir 'phcoder' Serbinenko
a706f4cc6b * grub-core/net/tftp.c (ack): Fix endianness problem.
(tftp_receive): Likewise.
	Reported by: Michael Davidsaver.
2012-07-02 11:22:50 +02:00
Vladimir 'phcoder' Serbinenko
982f1909cf Implement flow control for http.
* 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.
2012-06-22 22:09:31 +02:00
Vladimir 'phcoder' Serbinenko
bd407d6e5e * grub-core/net/tftp.c: Decrease stall to 50 packets. 2012-06-22 22:04:16 +02:00
Vladimir 'phcoder' Serbinenko
c7564b8e13 * grub-core/net/net.c (grub_net_fs_open): Free resources on failed open. 2012-06-22 22:02:47 +02:00
Vladimir 'phcoder' Serbinenko
b27069e06d Implement flow control for tftp.
* grub-core/net/net.c (receive_packets): Decrease the stop to 10
	packets but stop only if stop condition is satisfied.
	(grub_net_fs_read_real): Call packets_pulled after real read. Use
	`stall' instead of `eof' as stop condition.
	* grub-core/net/http.c (parse_line): Set `stall' on EOF.
	(http_err): Likewise.
	* grub-core/net/tftp.c (ack): Replace the first argument with data
	instead of socket.
	(tftp_receive): Stall if too many packets are in wait queue.
	(tftp_packets_pulled): New function.
	(grub_tftp_protocol): Set packets_pulled.
	* include/grub/net.h (grub_net_packets): New field count.
	(grub_net_put_packet): Increment count.
	(grub_net_remove_packet): Likewise.
	(grub_net_app_protocol): New field `packets_pulled'.
	(grub_net): New field `stall'.
2012-06-22 14:17:46 +02:00
Vladimir 'phcoder' Serbinenko
6b9cfac683 * grub-core/net/net.c (receive_packets): Stop after 100 packets to let
sync part to handle them.
2012-06-22 12:42:31 +02:00
Vladimir 'phcoder' Serbinenko
f35abd8190 * grub-core/kern/main.c (grub_set_prefix_and_root): Fix memory leak.
* grub-core/net/drivers/ieee1275/ofnet.c
	(grub_ieee1275_net_config_real): Likewise.
2012-06-22 11:51:48 +02:00
Vladimir 'phcoder' Serbinenko
0e7ec82034 * grub-core/net/bootp.c (grub_net_configure_by_dhcp_ack): Don't create
the direct route for server/gateway.
2012-06-21 22:20:57 +02:00
Vladimir 'phcoder' Serbinenko
9d611a318d * grub-core/net/bootp.c (grub_net_configure_by_dhcp_ack): Prefer
IP address to server name since we may not hame the DNS.
2012-06-21 22:15:10 +02:00
Vladimir 'phcoder' Serbinenko
418f45abd1 * grub-core/net/dns.c (grub_cmd_nslookup): Init addresses to 0 to avoid
freeing random buffer on failure.
	* grub-core/net/net.c (grub_net_resolve_address): Likewise.
2012-06-21 22:11:47 +02:00
Vladimir 'phcoder' Serbinenko
44a0efc180 * grub-core/net/bootp.c (grub_cmd_bootp): Fix packet allocation size. 2012-06-21 22:08:33 +02:00
Vladimir 'phcoder' Serbinenko
531e2241a6 * grub-core/net/drivers/emu/emunet.c (get_card_packet): Allocate the
reserved bytes.
	* grub-core/net/drivers/i386/pc/pxe.c (grub_pxe_recv): Likewise.
	* grub-core/net/drivers/ieee1275/ofnet.c (get_card_packet): Likewise.
	Handle malloc error correctly.
2012-06-21 22:05:41 +02:00
Vladimir 'phcoder' Serbinenko
9b55efe09a * grub-core/net/dns.c (grub_cmd_nslookup): Use configured DNS servers if
none is explicitly specified.
2012-06-21 00:14:51 +02:00
Vladimir 'phcoder' Serbinenko
9eb832c365 * grub-core/net/dns.c (grub_net_add_dns_server): Don't erase old servers
while reallocating.
2012-06-20 23:51:56 +02:00
Vladimir 'phcoder' Serbinenko
d6b7c7c986 Respect netmask from bootp/dhcp.
* grub-core/net/bootp.c (parse_dhcp_vendor): Parse mask.
	(grub_net_configure_by_dhcp_ack): Use mask and grub_net_add_ipv4_local.
	* grub-core/net/net.c (grub_net_add_addr): Split creating local route
	into ...
	(grub_net_add_ipv4_local): ... this.
	(grub_cmd_addaddr): Use grub_net_add_ipv4_local.
	* include/grub/net.h (GRUB_NET_BOOTP_NETMASK): New enum value.
	(grub_net_add_ipv4_local): New proto.
2012-06-20 23:46:50 +02:00
Vladimir 'phcoder' Serbinenko
e169a1805f * grub-core/net/drivers/ieee1275/ofnet.c (search_net_devices): Decrease
poll rate.
2012-06-19 15:44:51 +02:00
Vladimir 'phcoder' Serbinenko
0494408e7e * include/grub/net.h (grub_net_card): New member txbufsize.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): New enum values
	GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX and
	GRUB_IEEE1275_FLAG_VIRT_TO_REAL_BROKEN.
	* grub-core/net/drivers/efi/efinet.c (grub_efinet_findcards): Use
	txbufsize.
	* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options): Use
	compatible property to check for macs. Set
	GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX and
	GRUB_IEEE1275_FLAG_VIRT_TO_REAL_BROKEN on macs.
	* grub-core/net/drivers/ieee1275/ofnet.c (card_open): Don't add suffix
	if GRUB_IEEE1275_FLAG_NO_OFNET_SUFFIX is set.
	(send_card_buffer): Use txbuf.
	(grub_ofnet_findcards): Allocate txbuf. Simplify code flow and move
	nested function out of the parent while on it.
2012-06-19 11:34:52 +02:00
Vladimir 'phcoder' Serbinenko
cc35fe8f31 * grub-core/net/drivers/ieee1275/ofnet.c (get_card_packet): Fix packet
presence check.
	(grub_ieee1275_net_config_real): Fix config pointer.
2012-06-19 11:25:37 +02:00
Vladimir 'phcoder' Serbinenko
96f7e60eae Stop polling as soon as we have the packet we were waiting for.
* include/grub/net.h (grub_net_poll_cards): New argument stop_condition.
	All users updated.
	* grub-core/net/arp.c (have_pending): New var.
	(pending_req): Likewise.
	(grub_net_arp_send_request): Fill pending_req and use have_pending as
	stop indicator.
	(grub_net_arp_receive): Set have_pending.
	* grub-core/net/dns.c (recv_data): New field stop.
	(recv_hook): Set stop.
	(grub_net_dns_lookup): Init stop and use as stop condition.
	* grub-core/net/http.c (http_establish): Use headers_recv as stop
	condition.
	* grub-core/net/net.c (grub_net_poll_cards): New argument
	stop_condition. Stop when it goes true.
	* grub-core/net/tcp.c (grub_net_tcp_open): Use `established' as stop
	indicator.
	* grub-core/net/tftp.c (tftp_open): Use `have_oack' as stop indicator.
2012-06-09 11:06:55 +02:00
Vladimir 'phcoder' Serbinenko
3e74723951 Keep TX and RX buffers on EFI rather than always allocate new ones.
* include/grub/net.h (grub_net_card_driver): Allow driver to modify
	card. All users updated.
	(grub_net_card): New members txbuf, rcvbuf, rcvbufsize and txbusy.
	* grub-core/net/drivers/efi/efinet.c (send_card_buffer): Reuse buffer.
	(get_card_packet): Likewise.
	(grub_efinet_findcards): Init new fields.
2012-06-09 11:00:18 +02:00
Bean
5efb817d64 * grub-core/net/ip.c (reassemble): Make asm_buffer into asm_netbuff.
All users updated.
	(free_rsm): Free header as well.
	(free_old_fragments): Fix memory leak.
	* grub-core/net/netbuff.c (grub_netbuff_free): Make return void.
	* grub-core/net/tftp.c (tftp_receive): Fix memory leak.
	(destroy_pq): Likewise.
	* include/grub/net/netbuff.h (grub_netbuff_free): Make return void.
2012-05-08 16:03:02 +02:00
Vladimir 'phcoder' Serbinenko
1739b1fef8 * grub-core/net/bootp.c (set_env_limn_ro): Replace reserved ':' with
'_' in variable names.
	* grub-core/net/net.c (grub_net_network_level_interface_register):
	Likewise.
2012-05-08 14:07:49 +02:00