I wonder what exactly I was going to achieve.
Krzysztof Halasa
khc at pm.waw.pl
Sat May 5 17:52:53 EDT 2012
DHCP and friends not waiting if there is nothing to wait for?
Signed-off-by: Krzysztof Hałasa <khc at 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)
More information about the barebox
mailing list