mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* I wonder what exactly I was going to achieve.
@ 2012-05-05 21:52 Krzysztof Halasa
  0 siblings, 0 replies; only message in thread
From: Krzysztof Halasa @ 2012-05-05 21:52 UTC (permalink / raw)
  To: barebox

DHCP and friends not waiting if there is nothing to wait for?

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>

diff --git a/net/net.c b/net/net.c
index c803c48..d16807a 100644
--- a/net/net.c
+++ b/net/net.c
@@ -219,6 +219,7 @@ static int arp_request(IPaddr_t dest, unsigned char *ether)
 	static char *arp_packet;
 	struct ethernet *et;
 	unsigned retries = 0;
+	int err;
 
 	if (!arp_packet) {
 		arp_packet = net_alloc_packet();
@@ -262,7 +263,10 @@ static int arp_request(IPaddr_t dest, unsigned char *ether)
 
 	arp_ether = ether;
 
-	eth_send(arp_packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
+	err = eth_send(arp_packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
+	if (err < 0)
+		return err;
+
 	arp_start = get_time_ns();
 
 	while (arp_wait_ip) {
@@ -272,7 +276,9 @@ static int arp_request(IPaddr_t dest, unsigned char *ether)
 		if (is_timeout(arp_start, 3 * SECOND)) {
 			printf("T ");
 			arp_start = get_time_ns();
-			eth_send(arp_packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
+			err = eth_send(arp_packet, ETHER_HDR_SIZE + ARP_HDR_SIZE);
+			if (err < 0)
+				return err;
 			retries++;
 		}
 
@@ -454,9 +460,7 @@ static int net_ip_send(struct net_connection *con, int len)
 	con->ip->check = 0;
 	con->ip->check = ~net_checksum((unsigned char *)con->ip, sizeof(struct iphdr));
 
-	eth_send(con->packet, ETHER_HDR_SIZE + sizeof(struct iphdr) + len);
-
-	return 0;
+	return eth_send(con->packet, ETHER_HDR_SIZE + sizeof(struct iphdr) + len);
 }
 
 int net_udp_send(struct net_connection *con, int len)

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-05 21:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-05 21:52 I wonder what exactly I was going to achieve Krzysztof Halasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox