diff options
Diffstat (limited to 'net/net.c')
-rw-r--r-- | net/net.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -22,9 +22,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <common.h> #include <clock.h> @@ -219,6 +216,7 @@ static int arp_request(IPaddr_t dest, unsigned char *ether) static char *arp_packet; struct ethernet *et; unsigned retries = 0; + int ret; if (!arp_packet) { arp_packet = net_alloc_packet(); @@ -262,7 +260,9 @@ static int arp_request(IPaddr_t dest, unsigned char *ether) arp_ether = ether; - eth_send(arp_packet, ETHER_HDR_SIZE + ARP_HDR_SIZE); + ret = eth_send(arp_packet, ETHER_HDR_SIZE + ARP_HDR_SIZE); + if (ret) + return ret; arp_start = get_time_ns(); while (arp_wait_ip) { @@ -272,7 +272,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); + ret = eth_send(arp_packet, ETHER_HDR_SIZE + ARP_HDR_SIZE); + if (ret) + return ret; retries++; } @@ -454,9 +456,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) @@ -480,6 +480,7 @@ static int net_answer_arp(unsigned char *pkt, int len) struct arprequest *arp = (struct arprequest *)(pkt + ETHER_HDR_SIZE); struct ethernet *et = (struct ethernet *)pkt; unsigned char *packet; + int ret; debug("%s\n", __func__); @@ -497,10 +498,10 @@ static int net_answer_arp(unsigned char *pkt, int len) if (!packet) return 0; memcpy(packet, pkt, ETHER_HDR_SIZE + ARP_HDR_SIZE); - eth_send(packet, ETHER_HDR_SIZE + ARP_HDR_SIZE); + ret = eth_send(packet, ETHER_HDR_SIZE + ARP_HDR_SIZE); free(packet); - return 0; + return ret; } static void net_bad_packet(unsigned char *pkt, int len) |