mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: barebox@lists.infradead.org
Subject: I wonder what exactly I was going to achieve.
Date: Sat, 05 May 2012 23:52:53 +0200	[thread overview]
Message-ID: <m3y5p6l2h6.fsf@intrepid.localdomain> (raw)

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

                 reply	other threads:[~2012-05-05 21:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3y5p6l2h6.fsf@intrepid.localdomain \
    --to=khc@pm.waw.pl \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox