Commit Graph

27 Commits

Author SHA1 Message Date
Andrei Borzenkov d4561cd080 tcp: fix memory leaks
Found by: Coverity scan.
CID: 96639, 96647
2016-01-16 20:59:50 +03:00
Josef Bacik fb47807918 tcp: ack when we get an OOO/lost packet
While adding tcp window scaling support I was finding that I'd get some packet
loss or reordering when transferring from large distances and grub would just
timeout.  This is because we weren't ack'ing when we got our OOO packet, so the
sender didn't know it needed to retransmit anything, so eventually it would fill
the window and stop transmitting, and we'd time out.  Fix this by ACK'ing when
we don't find our next sequence numbered packet.  With this fix I no longer time
out.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
2015-12-07 20:52:27 +03:00
Ignat Korchagin 43c8310244 tcp: Fix uninited mac address when accepting connection. 2015-10-29 16:30:28 +01:00
Curtis Larsen 06eadf5ebf fix double free in grub_net_recv_tcp_packet
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.
2014-12-07 11:28:57 +03:00
Vladimir Serbinenko 7e47e27bd8 Add gcc_struct to all packed structures when compiling with mingw.
Just "packed" doesn't always pack the way we expect.
2013-12-15 14:14:30 +01: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
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 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 d61386e21d Improve string. Gettextize. 2012-02-12 15:25:25 +01:00
Vladimir 'phcoder' Serbinenko 9c4b5c13e6 Improve gettext support. Stylistic fixes and error handling fixes while
on it.
2012-02-08 19:26:01 +01:00
Vladimir 'phcoder' Serbinenko 87edb8940a Replace single-linked with double-linked lists. It results in more
compact and more efficient code.

	* grub-core/kern/list.c (grub_list_push): Moved from here ...
	* include/grub/list.h (grub_list_push): ... to here. Set prev.
	(grub_list_remove): Moved from here ...
	* include/grub/list.h (grub_list_remove): ... here. Use and set prev.
	(grub_prio_list_insert): Set prev.
	* include/grub/list.h (grub_list): Add prev. All users updated.
2012-01-24 13:31:12 +01:00
Vladimir 'phcoder' Serbinenko 34feab6f21 Remerge net branch 2011-12-15 20:53:29 +01:00
Yves Blusseau 93f87ec28d * grub-core/net/tcp.c (grub_net_ip_transport_checksum): Silence spurious
warning.
2011-10-30 10:50:26 +01:00
Vladimir 'phcoder' Serbinenko 0cb9503b70 support routed pings 2011-10-13 20:53:22 +02:00
Vladimir 'phcoder' Serbinenko bd40efbf0b several net bugfixes and improvements and fix some memory leaks 2011-10-13 18:31:53 +02:00
Vladimir 'phcoder' Serbinenko da1b289afc IPv6. Apparently working. At least I could retrieve a file with http6 2011-10-13 01:22:56 +02:00
Vladimir 'phcoder' Serbinenko a53cf6534d some more ipv6 code 2011-10-12 10:20:55 +02:00
Vladimir 'phcoder' Serbinenko 9aad3cd91d IPv6 support. Several fixes and unifications 2011-10-05 22:15:30 +02:00
Vladimir 'phcoder' Serbinenko 96bd62413f Don't set RST in response to empty packets 2011-10-05 17:50:52 +02:00
Vladimir 'phcoder' Serbinenko 4f71e077b9 HTTP seek support. Various bugfixes. 2011-10-05 17:39:13 +02:00
Vladimir 'phcoder' Serbinenko 80e722366d First attempt at http 2011-07-23 03:49:02 +02:00
Vladimir 'phcoder' Serbinenko 440694e3d3 Fix TCP retransmission 2011-07-23 03:48:10 +02:00
Vladimir 'phcoder' Serbinenko c410299b05 TCP listening support 2011-07-10 23:37:28 +02:00
Vladimir 'phcoder' Serbinenko f4e6e2909b TCP fragmentation 2011-07-10 11:26:34 +02:00
Vladimir 'phcoder' Serbinenko bfca152e5a Fix a memory leak 2011-07-10 09:53:29 +02:00
Vladimir 'phcoder' Serbinenko 3a2e860334 TCP improvements 2011-07-10 09:52:08 +02:00
Vladimir 'phcoder' Serbinenko 3a7af37260 basic tcp implementation 2011-07-10 08:46:48 +02:00